1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/third_party/quiche/src/quic/core/quic_version_manager.h"
#include "net/third_party/quiche/src/quic/core/quic_versions.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_arraysize.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
namespace quic {
namespace test {
namespace {
class QuicVersionManagerTest : public QuicTest {};
TEST_F(QuicVersionManagerTest, QuicVersionManager) {
static_assert(QUIC_ARRAYSIZE(kSupportedTransportVersions) == 8u,
"Supported versions out of sync");
SetQuicReloadableFlag(quic_enable_version_99, false);
SetQuicReloadableFlag(quic_enable_version_50, false);
SetQuicReloadableFlag(quic_enable_version_49, false);
SetQuicReloadableFlag(quic_enable_version_48_2, false);
SetQuicReloadableFlag(quic_enable_version_47, false);
SetQuicReloadableFlag(quic_disable_version_39, true);
QuicVersionManager manager(AllSupportedVersions());
EXPECT_EQ(FilterSupportedTransportVersions(AllSupportedTransportVersions()),
manager.GetSupportedTransportVersions());
EXPECT_EQ(QuicTransportVersionVector({QUIC_VERSION_46, QUIC_VERSION_43}),
manager.GetSupportedTransportVersions());
SetQuicReloadableFlag(quic_disable_version_39, false);
EXPECT_EQ(QuicTransportVersionVector(
{QUIC_VERSION_46, QUIC_VERSION_43, QUIC_VERSION_39}),
manager.GetSupportedTransportVersions());
SetQuicReloadableFlag(quic_enable_version_47, true);
EXPECT_EQ(QuicTransportVersionVector({QUIC_VERSION_47, QUIC_VERSION_46,
QUIC_VERSION_43, QUIC_VERSION_39}),
manager.GetSupportedTransportVersions());
SetQuicReloadableFlag(quic_enable_version_48_2, true);
EXPECT_EQ(QuicTransportVersionVector({QUIC_VERSION_48, QUIC_VERSION_47,
QUIC_VERSION_46, QUIC_VERSION_43,
QUIC_VERSION_39}),
manager.GetSupportedTransportVersions());
SetQuicReloadableFlag(quic_enable_version_49, true);
EXPECT_EQ(QuicTransportVersionVector({QUIC_VERSION_49, QUIC_VERSION_48,
QUIC_VERSION_47, QUIC_VERSION_46,
QUIC_VERSION_43, QUIC_VERSION_39}),
manager.GetSupportedTransportVersions());
SetQuicReloadableFlag(quic_enable_version_50, true);
EXPECT_EQ(
QuicTransportVersionVector(
{QUIC_VERSION_50, QUIC_VERSION_49, QUIC_VERSION_48, QUIC_VERSION_47,
QUIC_VERSION_46, QUIC_VERSION_43, QUIC_VERSION_39}),
manager.GetSupportedTransportVersions());
SetQuicReloadableFlag(quic_enable_version_99, true);
EXPECT_EQ(
QuicTransportVersionVector(
{QUIC_VERSION_99, QUIC_VERSION_50, QUIC_VERSION_49, QUIC_VERSION_48,
QUIC_VERSION_47, QUIC_VERSION_46, QUIC_VERSION_43, QUIC_VERSION_39}),
manager.GetSupportedTransportVersions());
SetQuicReloadableFlag(quic_enable_version_99, true);
EXPECT_EQ(
QuicTransportVersionVector(
{QUIC_VERSION_99, QUIC_VERSION_50, QUIC_VERSION_49, QUIC_VERSION_48,
QUIC_VERSION_47, QUIC_VERSION_46, QUIC_VERSION_43, QUIC_VERSION_39}),
manager.GetSupportedTransportVersions());
// Ensure that all versions are now supported.
EXPECT_EQ(FilterSupportedTransportVersions(AllSupportedTransportVersions()),
manager.GetSupportedTransportVersions());
}
} // namespace
} // namespace test
} // namespace quic
|