| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 EXPECT_EQ(FilterSupportedVersions(QuicSupportedVersions()), | 307 EXPECT_EQ(FilterSupportedVersions(QuicSupportedVersions()), |
| 308 manager.GetSupportedVersions()); | 308 manager.GetSupportedVersions()); |
| 309 FLAGS_quic_enable_version_35 = true; | 309 FLAGS_quic_enable_version_35 = true; |
| 310 FLAGS_quic_enable_version_36 = true; | 310 FLAGS_quic_enable_version_36 = true; |
| 311 EXPECT_EQ(FilterSupportedVersions(QuicSupportedVersions()), | 311 EXPECT_EQ(FilterSupportedVersions(QuicSupportedVersions()), |
| 312 manager.GetSupportedVersions()); | 312 manager.GetSupportedVersions()); |
| 313 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[0]); | 313 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[0]); |
| 314 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[1]); | 314 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[1]); |
| 315 } | 315 } |
| 316 | 316 |
| 317 TEST(QuicProtocolTest, LookUpVersionByIndex) { |
| 318 QuicVersionVector all_versions = { |
| 319 QUIC_VERSION_30, QUIC_VERSION_31, QUIC_VERSION_32, QUIC_VERSION_33, |
| 320 QUIC_VERSION_34, QUIC_VERSION_35, QUIC_VERSION_36}; |
| 321 int version_count = all_versions.size(); |
| 322 for (int i = -5; i <= version_count + 1; ++i) { |
| 323 if (i >= 0 && i < version_count) { |
| 324 EXPECT_EQ(all_versions[i], VersionOfIndex(all_versions, i)[0]); |
| 325 } else { |
| 326 EXPECT_EQ(QUIC_VERSION_UNSUPPORTED, VersionOfIndex(all_versions, i)[0]); |
| 327 } |
| 328 } |
| 329 } |
| 330 |
| 317 // Tests that a queue contains the expected data after calls to Add(). | 331 // Tests that a queue contains the expected data after calls to Add(). |
| 318 TEST(PacketNumberQueueTest, AddRange) { | 332 TEST(PacketNumberQueueTest, AddRange) { |
| 319 PacketNumberQueue queue; | 333 PacketNumberQueue queue; |
| 320 queue.Add(1, 51); | 334 queue.Add(1, 51); |
| 321 queue.Add(53); | 335 queue.Add(53); |
| 322 | 336 |
| 323 EXPECT_FALSE(queue.Contains(0)); | 337 EXPECT_FALSE(queue.Contains(0)); |
| 324 for (int i = 1; i < 51; ++i) { | 338 for (int i = 1; i < 51; ++i) { |
| 325 EXPECT_TRUE(queue.Contains(i)); | 339 EXPECT_TRUE(queue.Contains(i)); |
| 326 } | 340 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 EXPECT_EQ(2u, queue.NumIntervals()); | 450 EXPECT_EQ(2u, queue.NumIntervals()); |
| 437 EXPECT_TRUE(queue.Contains(10)); | 451 EXPECT_TRUE(queue.Contains(10)); |
| 438 EXPECT_TRUE(queue.Contains(11)); | 452 EXPECT_TRUE(queue.Contains(11)); |
| 439 EXPECT_TRUE(queue.Contains(20)); | 453 EXPECT_TRUE(queue.Contains(20)); |
| 440 EXPECT_TRUE(queue.Contains(21)); | 454 EXPECT_TRUE(queue.Contains(21)); |
| 441 } | 455 } |
| 442 | 456 |
| 443 } // namespace | 457 } // namespace |
| 444 } // namespace test | 458 } // namespace test |
| 445 } // namespace net | 459 } // namespace net |
| OLD | NEW |