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/core/quic_protocol.h" | 5 #include "net/quic/core/quic_protocol.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/quic/core/quic_flags.h" | 10 #include "net/quic/core/quic_flags.h" |
11 #include "net/quic/core/quic_utils.h" | 11 #include "net/quic/core/quic_utils.h" |
12 #include "net/quic/test_tools/quic_test_utils.h" | 12 #include "net/quic/test_tools/quic_test_utils.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 namespace test { | 16 namespace test { |
17 namespace { | 17 namespace { |
18 | 18 |
19 TEST(QuicProtocolTest, AdjustErrorForVersion) { | |
20 ASSERT_EQ(15, QUIC_STREAM_LAST_ERROR) | |
21 << "Any additions to QuicRstStreamErrorCode require an addition to " | |
22 << "AdjustErrorForVersion and this associated test."; | |
23 | |
24 // If we ever add different RST codes, we should have a test akin to the | |
25 // following. | |
26 // EXPECT_EQ(QUIC_RST_ACKNOWLEDGEMENT, AdjustErrorForVersion( | |
27 // QUIC_RST_ACKNOWLEDGEMENT, | |
28 // QUIC_VERSION_28)); | |
29 } | |
30 | |
31 TEST(QuicProtocolTest, MakeQuicTag) { | 19 TEST(QuicProtocolTest, MakeQuicTag) { |
32 QuicTag tag = MakeQuicTag('A', 'B', 'C', 'D'); | 20 QuicTag tag = MakeQuicTag('A', 'B', 'C', 'D'); |
33 char bytes[4]; | 21 char bytes[4]; |
34 memcpy(bytes, &tag, 4); | 22 memcpy(bytes, &tag, 4); |
35 EXPECT_EQ('A', bytes[0]); | 23 EXPECT_EQ('A', bytes[0]); |
36 EXPECT_EQ('B', bytes[1]); | 24 EXPECT_EQ('B', bytes[1]); |
37 EXPECT_EQ('C', bytes[2]); | 25 EXPECT_EQ('C', bytes[2]); |
38 EXPECT_EQ('D', bytes[3]); | 26 EXPECT_EQ('D', bytes[3]); |
39 } | 27 } |
40 | 28 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 EXPECT_EQ(2u, queue.NumIntervals()); | 508 EXPECT_EQ(2u, queue.NumIntervals()); |
521 EXPECT_TRUE(queue.Contains(10)); | 509 EXPECT_TRUE(queue.Contains(10)); |
522 EXPECT_TRUE(queue.Contains(11)); | 510 EXPECT_TRUE(queue.Contains(11)); |
523 EXPECT_TRUE(queue.Contains(20)); | 511 EXPECT_TRUE(queue.Contains(20)); |
524 EXPECT_TRUE(queue.Contains(21)); | 512 EXPECT_TRUE(queue.Contains(21)); |
525 } | 513 } |
526 | 514 |
527 } // namespace | 515 } // namespace |
528 } // namespace test | 516 } // namespace test |
529 } // namespace net | 517 } // namespace net |
OLD | NEW |