Introduce QuicDisableVersion and QuicVersionIsEnabled
These functions are mainly meant for tests, but are accessible from prod code because there are legitimate uses for disabling versions in production. The main goal here is to simplify adding and removing new versions by reducing the amount of code that sets these flags directly. This CL does not change any existing behavior.
No behavior change
PiperOrigin-RevId: 316944337
Change-Id: Ieebd6ae4cc493b49269540c5d0fd7acbe655e5fa
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc
index c478abf..12008c4 100644
--- a/quic/core/quic_dispatcher_test.cc
+++ b/quic/core/quic_dispatcher_test.cc
@@ -1014,17 +1014,11 @@
VerifyVersionNotSupported(QuicVersionReservedForNegotiation());
for (ParsedQuicVersion version : CurrentSupportedVersions()) {
VerifyVersionSupported(version);
+ QuicDisableVersion(version);
+ VerifyVersionNotSupported(version);
+ QuicEnableVersion(version);
+ VerifyVersionSupported(version);
}
-
- // Turn off version Q050.
- SetQuicReloadableFlag(quic_disable_version_q050, true);
- VerifyVersionNotSupported(
- ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, QUIC_VERSION_50));
-
- // Turn on version Q050.
- SetQuicReloadableFlag(quic_disable_version_q050, false);
- VerifyVersionSupported(
- ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, QUIC_VERSION_50));
}
TEST_P(QuicDispatcherTestOneVersion,
@@ -2260,8 +2254,7 @@
// Regression test for b/117874922.
TEST_P(BufferedPacketStoreTest, ProcessBufferedChloWithDifferentVersion) {
// Ensure the preferred version is not supported by the server.
- SetQuicReloadableFlag(quic_enable_version_draft_29, false);
- ASSERT_EQ(AllSupportedVersions()[0], ParsedQuicVersion::Draft29());
+ QuicDisableVersion(AllSupportedVersions().front());
uint64_t last_connection_id = kMaxNumSessionsToCreate + 5;
ParsedQuicVersionVector supported_versions = CurrentSupportedVersions();