OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_version_manager.h" | 5 #include "net/quic/core/quic_version_manager.h" |
6 | 6 |
7 #include "net/quic/core/quic_flags.h" | 7 #include "net/quic/core/quic_flags.h" |
8 #include "net/quic/core/quic_versions.h" | 8 #include "net/quic/core/quic_versions.h" |
9 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 namespace test { | 14 namespace test { |
15 namespace { | 15 namespace { |
16 | 16 |
17 TEST(QuicVersionManagerTest, QuicVersionManager) { | 17 TEST(QuicVersionManagerTest, QuicVersionManager) { |
18 QuicFlagSaver flags; | 18 QuicFlagSaver flags; |
19 FLAGS_quic_enable_version_38 = false; | |
20 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = false; | 19 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = false; |
| 20 FLAGS_quic_reloadable_flag_quic_enable_version_38 = false; |
21 FLAGS_quic_reloadable_flag_quic_enable_version_37 = false; | 21 FLAGS_quic_reloadable_flag_quic_enable_version_37 = false; |
22 FLAGS_quic_reloadable_flag_quic_disable_version_34 = false; | 22 FLAGS_quic_reloadable_flag_quic_disable_version_34 = false; |
23 QuicVersionManager manager(AllSupportedVersions()); | 23 QuicVersionManager manager(AllSupportedVersions()); |
24 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), | 24 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), |
25 manager.GetSupportedVersions()); | 25 manager.GetSupportedVersions()); |
26 | 26 |
27 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true; | 27 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3 = true; |
28 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), | 28 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), |
29 manager.GetSupportedVersions()); | 29 manager.GetSupportedVersions()); |
30 ASSERT_EQ(3u, manager.GetSupportedVersions().size()); | 30 ASSERT_EQ(3u, manager.GetSupportedVersions().size()); |
31 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[0]); | 31 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[0]); |
32 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[1]); | 32 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[1]); |
33 EXPECT_EQ(QUIC_VERSION_34, manager.GetSupportedVersions()[2]); | 33 EXPECT_EQ(QUIC_VERSION_34, manager.GetSupportedVersions()[2]); |
34 | 34 |
35 FLAGS_quic_reloadable_flag_quic_enable_version_37 = true; | 35 FLAGS_quic_reloadable_flag_quic_enable_version_37 = true; |
36 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), | 36 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), |
37 manager.GetSupportedVersions()); | 37 manager.GetSupportedVersions()); |
38 ASSERT_EQ(4u, manager.GetSupportedVersions().size()); | 38 ASSERT_EQ(4u, manager.GetSupportedVersions().size()); |
39 EXPECT_EQ(QUIC_VERSION_37, manager.GetSupportedVersions()[0]); | 39 EXPECT_EQ(QUIC_VERSION_37, manager.GetSupportedVersions()[0]); |
40 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[1]); | 40 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[1]); |
41 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[2]); | 41 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[2]); |
42 EXPECT_EQ(QUIC_VERSION_34, manager.GetSupportedVersions()[3]); | 42 EXPECT_EQ(QUIC_VERSION_34, manager.GetSupportedVersions()[3]); |
43 | 43 |
44 FLAGS_quic_enable_version_38 = true; | 44 FLAGS_quic_reloadable_flag_quic_enable_version_38 = true; |
45 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), | 45 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), |
46 manager.GetSupportedVersions()); | 46 manager.GetSupportedVersions()); |
47 ASSERT_EQ(5u, manager.GetSupportedVersions().size()); | 47 ASSERT_EQ(5u, manager.GetSupportedVersions().size()); |
48 EXPECT_EQ(QUIC_VERSION_38, manager.GetSupportedVersions()[0]); | 48 EXPECT_EQ(QUIC_VERSION_38, manager.GetSupportedVersions()[0]); |
49 EXPECT_EQ(QUIC_VERSION_37, manager.GetSupportedVersions()[1]); | 49 EXPECT_EQ(QUIC_VERSION_37, manager.GetSupportedVersions()[1]); |
50 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[2]); | 50 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[2]); |
51 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[3]); | 51 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[3]); |
52 EXPECT_EQ(QUIC_VERSION_34, manager.GetSupportedVersions()[4]); | 52 EXPECT_EQ(QUIC_VERSION_34, manager.GetSupportedVersions()[4]); |
53 | 53 |
54 FLAGS_quic_reloadable_flag_quic_disable_version_34 = true; | 54 FLAGS_quic_reloadable_flag_quic_disable_version_34 = true; |
55 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), | 55 EXPECT_EQ(FilterSupportedVersions(AllSupportedVersions()), |
56 manager.GetSupportedVersions()); | 56 manager.GetSupportedVersions()); |
57 ASSERT_EQ(4u, manager.GetSupportedVersions().size()); | 57 ASSERT_EQ(4u, manager.GetSupportedVersions().size()); |
58 EXPECT_EQ(QUIC_VERSION_38, manager.GetSupportedVersions()[0]); | 58 EXPECT_EQ(QUIC_VERSION_38, manager.GetSupportedVersions()[0]); |
59 EXPECT_EQ(QUIC_VERSION_37, manager.GetSupportedVersions()[1]); | 59 EXPECT_EQ(QUIC_VERSION_37, manager.GetSupportedVersions()[1]); |
60 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[2]); | 60 EXPECT_EQ(QUIC_VERSION_36, manager.GetSupportedVersions()[2]); |
61 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[3]); | 61 EXPECT_EQ(QUIC_VERSION_35, manager.GetSupportedVersions()[3]); |
62 } | 62 } |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 } // namespace test | 65 } // namespace test |
66 } // namespace net | 66 } // namespace net |
OLD | NEW |