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/quic/quic_protocol.h" | 5 #include "net/quic/quic_protocol.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 namespace test { | 11 namespace test { |
12 namespace { | 12 namespace { |
13 | 13 |
14 TEST(QuicProtocolTest, AdjustErrorForVersion) { | 14 TEST(QuicProtocolTest, AdjustErrorForVersion) { |
15 ASSERT_EQ(8, QUIC_STREAM_LAST_ERROR) | 15 ASSERT_EQ(8, QUIC_STREAM_LAST_ERROR) |
16 << "Any additions to QuicRstStreamErrorCode require an addition to " | 16 << "Any additions to QuicRstStreamErrorCode require an addition to " |
17 << "AdjustErrorForVersion and this associated test."; | 17 << "AdjustErrorForVersion and this associated test."; |
18 | 18 |
19 EXPECT_EQ(QUIC_RST_FLOW_CONTROL_ACCOUNTING, AdjustErrorForVersion( | 19 // If we ever add different RST codes, we should have a test akin to the |
20 QUIC_RST_FLOW_CONTROL_ACCOUNTING, | 20 // following. |
21 QUIC_VERSION_18)); | 21 // EXPECT_EQ(QUIC_RST_FLOW_CONTROL_ACCOUNTING, AdjustErrorForVersion( |
| 22 // QUIC_RST_FLOW_CONTROL_ACCOUNTING, |
| 23 // QUIC_VERSION_18)); |
22 } | 24 } |
23 | 25 |
24 TEST(QuicProtocolTest, MakeQuicTag) { | 26 TEST(QuicProtocolTest, MakeQuicTag) { |
25 QuicTag tag = MakeQuicTag('A', 'B', 'C', 'D'); | 27 QuicTag tag = MakeQuicTag('A', 'B', 'C', 'D'); |
26 char bytes[4]; | 28 char bytes[4]; |
27 memcpy(bytes, &tag, 4); | 29 memcpy(bytes, &tag, 4); |
28 EXPECT_EQ('A', bytes[0]); | 30 EXPECT_EQ('A', bytes[0]); |
29 EXPECT_EQ('B', bytes[1]); | 31 EXPECT_EQ('B', bytes[1]); |
30 EXPECT_EQ('C', bytes[2]); | 32 EXPECT_EQ('C', bytes[2]); |
31 EXPECT_EQ('D', bytes[3]); | 33 EXPECT_EQ('D', bytes[3]); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Make sure that all supported versions are present in QuicVersionToString. | 161 // Make sure that all supported versions are present in QuicVersionToString. |
160 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { | 162 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { |
161 QuicVersion version = kSupportedQuicVersions[i]; | 163 QuicVersion version = kSupportedQuicVersions[i]; |
162 EXPECT_NE("QUIC_VERSION_UNSUPPORTED", QuicVersionToString(version)); | 164 EXPECT_NE("QUIC_VERSION_UNSUPPORTED", QuicVersionToString(version)); |
163 } | 165 } |
164 } | 166 } |
165 | 167 |
166 } // namespace | 168 } // namespace |
167 } // namespace test | 169 } // namespace test |
168 } // namespace net | 170 } // namespace net |
OLD | NEW |