[Android] Remove android_commands uses from build/android/.
[chromium-blink-merge.git] / net / spdy / spdy_protocol_test.cc
blob486a7722fda55e82b88134a744e1327c0dd92b1a
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/spdy/spdy_protocol.h"
7 #include <limits>
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "net/spdy/spdy_bitmasks.h"
12 #include "net/spdy/spdy_framer.h"
13 #include "net/test/gtest_util.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 namespace {
18 enum SpdyProtocolTestTypes {
19 SPDY2 = net::SPDY2,
20 SPDY3 = net::SPDY3,
23 } // namespace
25 namespace net {
27 class SpdyProtocolTest
28 : public ::testing::TestWithParam<SpdyProtocolTestTypes> {
29 protected:
30 void SetUp() override {
31 spdy_version_ = static_cast<SpdyMajorVersion>(GetParam());
34 // Version of SPDY protocol to be used.
35 SpdyMajorVersion spdy_version_;
38 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3.
39 INSTANTIATE_TEST_CASE_P(SpdyProtocolTests,
40 SpdyProtocolTest,
41 ::testing::Values(SPDY2, SPDY3));
43 class SpdyProtocolDeathTest : public SpdyProtocolTest {};
45 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3.
46 INSTANTIATE_TEST_CASE_P(SpdyProtocolDeathTests,
47 SpdyProtocolDeathTest,
48 ::testing::Values(SPDY2, SPDY3));
50 TEST_P(SpdyProtocolDeathTest, TestSpdySettingsAndIdOutOfBounds) {
51 scoped_ptr<SettingsFlagsAndId> flags_and_id;
53 EXPECT_DFATAL(flags_and_id.reset(new SettingsFlagsAndId(1, 0xFFFFFFFF)),
54 "SPDY setting ID too large.");
55 // Make sure that we get expected values in opt mode.
56 if (flags_and_id.get() != NULL) {
57 EXPECT_EQ(1, flags_and_id->flags());
58 EXPECT_EQ(static_cast<SpdyPingId>(0xffffff), flags_and_id->id());
62 } // namespace net