OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/spdy_protocol.h" | 5 #include "net/spdy/spdy_protocol.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "net/spdy/spdy_bitmasks.h" | 11 #include "net/spdy/spdy_bitmasks.h" |
12 #include "net/spdy/spdy_framer.h" | 12 #include "net/spdy/spdy_framer.h" |
13 #include "net/test/gtest_util.h" | 13 #include "net/test/gtest_util.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 enum SpdyProtocolTestTypes { | 18 enum SpdyProtocolTestTypes { |
19 SPDY2 = 2, | 19 SPDY2 = net::SPDY2, |
20 SPDY3 = 3, | 20 SPDY3 = net::SPDY3, |
21 }; | 21 }; |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 namespace net { | 25 namespace net { |
26 | 26 |
27 class SpdyProtocolTest | 27 class SpdyProtocolTest |
28 : public ::testing::TestWithParam<SpdyProtocolTestTypes> { | 28 : public ::testing::TestWithParam<SpdyProtocolTestTypes> { |
29 protected: | 29 protected: |
30 virtual void SetUp() { | 30 virtual void SetUp() { |
31 spdy_version_ = GetParam(); | 31 spdy_version_ = static_cast<SpdyMajorVersion>(GetParam()); |
32 } | 32 } |
33 | 33 |
34 // Version of SPDY protocol to be used. | 34 // Version of SPDY protocol to be used. |
35 int spdy_version_; | 35 SpdyMajorVersion spdy_version_; |
36 }; | 36 }; |
37 | 37 |
38 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3. | 38 // All tests are run with two different SPDY versions: SPDY/2 and SPDY/3. |
39 INSTANTIATE_TEST_CASE_P(SpdyProtocolTests, | 39 INSTANTIATE_TEST_CASE_P(SpdyProtocolTests, |
40 SpdyProtocolTest, | 40 SpdyProtocolTest, |
41 ::testing::Values(SPDY2, SPDY3)); | 41 ::testing::Values(SPDY2, SPDY3)); |
42 | 42 |
43 // Test our protocol constants | 43 // Test our protocol constants |
44 TEST_P(SpdyProtocolTest, ProtocolConstants) { | 44 TEST_P(SpdyProtocolTest, ProtocolConstants) { |
45 EXPECT_EQ(1, SYN_STREAM); | 45 EXPECT_EQ(1, SYN_STREAM); |
(...skipping 26 matching lines...) Expand all Loading... |
72 EXPECT_DFATAL(flags_and_id.reset(new SettingsFlagsAndId(1, ~0)), | 72 EXPECT_DFATAL(flags_and_id.reset(new SettingsFlagsAndId(1, ~0)), |
73 "SPDY setting ID too large."); | 73 "SPDY setting ID too large."); |
74 // Make sure that we get expected values in opt mode. | 74 // Make sure that we get expected values in opt mode. |
75 if (flags_and_id.get() != NULL) { | 75 if (flags_and_id.get() != NULL) { |
76 EXPECT_EQ(1, flags_and_id->flags()); | 76 EXPECT_EQ(1, flags_and_id->flags()); |
77 EXPECT_EQ(static_cast<SpdyPingId>(0xffffff), flags_and_id->id()); | 77 EXPECT_EQ(static_cast<SpdyPingId>(0xffffff), flags_and_id->id()); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 } // namespace net | 81 } // namespace net |
OLD | NEW |