| 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" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 TEST(QuicProtocolTest, PathCloseFrameToString) { | 142 TEST(QuicProtocolTest, PathCloseFrameToString) { |
| 143 QuicPathCloseFrame frame; | 143 QuicPathCloseFrame frame; |
| 144 frame.path_id = 1; | 144 frame.path_id = 1; |
| 145 std::ostringstream stream; | 145 std::ostringstream stream; |
| 146 stream << frame; | 146 stream << frame; |
| 147 EXPECT_EQ("{ path_id: 1 }\n", stream.str()); | 147 EXPECT_EQ("{ path_id: 1 }\n", stream.str()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 TEST(QuicProtocolTest, QuicVersionManager) { | |
| 151 QuicFlagSaver flags; | |
| 152 FLAGS_quic_enable_version_36_v3 = false; | |
| 153 QuicVersionManager manager(AllSupportedVersions()); | |
| 154 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), | |
| 155 manager.GetSupportedVersions()); | |
| 156 FLAGS_quic_enable_version_36_v3 = true; | |
| 157 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), | |
| 158 manager.GetSupportedVersions()); | |
| 159 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[0]); | |
| 160 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[1]); | |
| 161 } | |
| 162 | |
| 163 // Tests that a queue contains the expected data after calls to Add(). | 150 // Tests that a queue contains the expected data after calls to Add(). |
| 164 TEST(PacketNumberQueueTest, AddRange) { | 151 TEST(PacketNumberQueueTest, AddRange) { |
| 165 PacketNumberQueue queue; | 152 PacketNumberQueue queue; |
| 166 queue.Add(1, 51); | 153 queue.Add(1, 51); |
| 167 queue.Add(53); | 154 queue.Add(53); |
| 168 | 155 |
| 169 EXPECT_FALSE(queue.Contains(0)); | 156 EXPECT_FALSE(queue.Contains(0)); |
| 170 for (int i = 1; i < 51; ++i) { | 157 for (int i = 1; i < 51; ++i) { |
| 171 EXPECT_TRUE(queue.Contains(i)); | 158 EXPECT_TRUE(queue.Contains(i)); |
| 172 } | 159 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 EXPECT_EQ(2u, queue.NumIntervals()); | 278 EXPECT_EQ(2u, queue.NumIntervals()); |
| 292 EXPECT_TRUE(queue.Contains(10)); | 279 EXPECT_TRUE(queue.Contains(10)); |
| 293 EXPECT_TRUE(queue.Contains(11)); | 280 EXPECT_TRUE(queue.Contains(11)); |
| 294 EXPECT_TRUE(queue.Contains(20)); | 281 EXPECT_TRUE(queue.Contains(20)); |
| 295 EXPECT_TRUE(queue.Contains(21)); | 282 EXPECT_TRUE(queue.Contains(21)); |
| 296 } | 283 } |
| 297 | 284 |
| 298 } // namespace | 285 } // namespace |
| 299 } // namespace test | 286 } // namespace test |
| 300 } // namespace net | 287 } // namespace net |
| OLD | NEW |