Remove many uses of QUIC_VERSION_99 in tests

This will allow us to deprecate QUIC_VERSION_99 soon.

gfe-relnote: n/a, test-only
PiperOrigin-RevId: 297933966
Change-Id: I5f161db41d8cb159c8342e61f5ff78f450c7cf4c
diff --git a/quic/core/crypto/quic_crypto_server_config_test.cc b/quic/core/crypto/quic_crypto_server_config_test.cc
index df9b904..8dd1108 100644
--- a/quic/core/crypto/quic_crypto_server_config_test.cc
+++ b/quic/core/crypto/quic_crypto_server_config_test.cc
@@ -16,6 +16,7 @@
 #include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
 #include "net/third_party/quiche/src/quic/core/proto/crypto_server_config_proto.h"
 #include "net/third_party/quiche/src/quic/core/quic_time.h"
+#include "net/third_party/quiche/src/quic/core/quic_versions.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/crypto_test_utils.h"
@@ -482,15 +483,23 @@
   CryptoHandshakeMessage client_hello;
   QuicIpAddress client_ip;
   QuicSocketAddress server_address;
-  QuicTransportVersion version = QUIC_VERSION_99;
+  QuicTransportVersion transport_version = QUIC_VERSION_UNSUPPORTED;
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    if (version.handshake_protocol == PROTOCOL_QUIC_CRYPTO) {
+      transport_version = version.transport_version;
+      break;
+    }
+  }
+  ASSERT_NE(transport_version, QUIC_VERSION_UNSUPPORTED);
   MockClock clock;
   QuicReferenceCountedPointer<QuicSignedServerConfig> signed_config(
       new QuicSignedServerConfig);
   std::unique_ptr<ValidateClientHelloResultCallback> done_cb(
       new ValidateCallback);
   clock.AdvanceTime(QuicTime::Delta::FromSeconds(1100));
-  config_.ValidateClientHello(client_hello, client_ip, server_address, version,
-                              &clock, signed_config, std::move(done_cb));
+  config_.ValidateClientHello(client_hello, client_ip, server_address,
+                              transport_version, &clock, signed_config,
+                              std::move(done_cb));
   test_peer_.CheckConfigs({{"a", false}, {"b", true}});
 }
 
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc
index 39fc5f5..ead192c 100644
--- a/quic/core/http/end_to_end_test.cc
+++ b/quic/core/http/end_to_end_test.cc
@@ -979,8 +979,7 @@
 }
 
 TEST_P(EndToEndTestWithTls, SimpleRequestResponseWithIetfDraftSupport) {
-  if (GetParam().negotiated_version.transport_version != QUIC_VERSION_99 ||
-      GetParam().negotiated_version.handshake_protocol != PROTOCOL_TLS1_3) {
+  if (!GetParam().negotiated_version.HasIetfQuicFrames()) {
     ASSERT_TRUE(Initialize());
     return;
   }
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 5b70813..1d5305b 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -2288,8 +2288,7 @@
 
 INSTANTIATE_TEST_SUITE_P(Tests,
                          QuicSpdyStreamIncrementalConsumptionTest,
-                         ::testing::Values(ParsedQuicVersion{PROTOCOL_TLS1_3,
-                                                             QUIC_VERSION_99}),
+                         ::testing::ValuesIn(AllSupportedVersions()),
                          ::testing::PrintToStringParamName());
 
 // Test that stream bytes are consumed (by calling
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index ec45837..2248909 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -9383,11 +9383,13 @@
 
 static char kTestString[] = "At least 20 characters.";
 static QuicStreamId kTestQuicStreamId = 1;
-static bool ExpectedStreamFrame(const QuicStreamFrame& frame) {
-  return (frame.stream_id == kTestQuicStreamId ||
-          QuicUtils::IsCryptoStreamId(QUIC_VERSION_99, frame.stream_id)) &&
-         !frame.fin && frame.offset == 0 &&
-         std::string(frame.data_buffer, frame.data_length) == kTestString;
+
+MATCHER_P(ExpectedStreamFrame, version, "") {
+  return (arg.stream_id == kTestQuicStreamId ||
+          QuicUtils::IsCryptoStreamId(version.transport_version,
+                                      arg.stream_id)) &&
+         !arg.fin && arg.offset == 0 &&
+         std::string(arg.data_buffer, arg.data_length) == kTestString;
   // FIN is hard-coded false in ConstructEncryptedPacket.
   // Offset 0 is hard-coded in ConstructEncryptedPacket.
 }
@@ -9426,7 +9428,8 @@
   EXPECT_CALL(visitor, OnError(_)).Times(0);
   EXPECT_CALL(visitor, OnStreamFrame(_)).Times(0);
   if (!QuicVersionUsesCryptoFrames(framer_.version().transport_version)) {
-    EXPECT_CALL(visitor, OnStreamFrame(Truly(ExpectedStreamFrame))).Times(1);
+    EXPECT_CALL(visitor, OnStreamFrame(ExpectedStreamFrame(framer_.version())))
+        .Times(1);
   } else {
     EXPECT_CALL(visitor, OnCryptoFrame(_)).Times(1);
   }
diff --git a/quic/core/quic_stream_id_manager_test.cc b/quic/core/quic_stream_id_manager_test.cc
index b523d40..a114295 100644
--- a/quic/core/quic_stream_id_manager_test.cc
+++ b/quic/core/quic_stream_id_manager_test.cc
@@ -9,6 +9,7 @@
 
 #include "net/third_party/quiche/src/quic/core/quic_constants.h"
 #include "net/third_party/quiche/src/quic/core/quic_utils.h"
+#include "net/third_party/quiche/src/quic/core/quic_versions.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_expect_bug.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_stream_id_manager_peer.h"
@@ -33,9 +34,14 @@
 };
 
 struct TestParams {
-  TestParams(Perspective perspective, bool is_unidirectional)
-      : perspective(perspective), is_unidirectional(is_unidirectional) {}
+  TestParams(ParsedQuicVersion version,
+             Perspective perspective,
+             bool is_unidirectional)
+      : version(version),
+        perspective(perspective),
+        is_unidirectional(is_unidirectional) {}
 
+  ParsedQuicVersion version;
   Perspective perspective;
   bool is_unidirectional;
 };
@@ -43,16 +49,22 @@
 // Used by ::testing::PrintToStringParamName().
 std::string PrintToString(const TestParams& p) {
   return quiche::QuicheStrCat(
+      ParsedQuicVersionToString(p.version), "_",
       (p.perspective == Perspective::IS_CLIENT ? "Client" : "Server"),
       (p.is_unidirectional ? "Unidirectional" : "Bidirectional"));
 }
 
 std::vector<TestParams> GetTestParams() {
   std::vector<TestParams> params;
-  for (Perspective perspective :
-       {Perspective::IS_CLIENT, Perspective::IS_SERVER}) {
-    for (bool is_unidirectional : {true, false}) {
-      params.push_back(TestParams(perspective, is_unidirectional));
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    if (!version.HasIetfQuicFrames()) {
+      continue;
+    }
+    for (Perspective perspective :
+         {Perspective::IS_CLIENT, Perspective::IS_SERVER}) {
+      for (bool is_unidirectional : {true, false}) {
+        params.push_back(TestParams(version, perspective, is_unidirectional));
+      }
     }
   }
   return params;
@@ -70,7 +82,9 @@
     DCHECK(VersionHasIetfQuicFrames(transport_version()));
   }
 
-  QuicTransportVersion transport_version() const { return QUIC_VERSION_99; }
+  QuicTransportVersion transport_version() const {
+    return GetParam().version.transport_version;
+  }
 
   // Returns the stream ID for the Nth incoming stream (created by the peer)
   // of the corresponding directionality of this manager.
diff --git a/quic/core/quic_utils_test.cc b/quic/core/quic_utils_test.cc
index 1381b20..5b2186a 100644
--- a/quic/core/quic_utils_test.cc
+++ b/quic/core/quic_utils_test.cc
@@ -250,10 +250,10 @@
   EXPECT_TRUE(QuicUtils::IsConnectionIdValidForVersion(
       QuicUtils::CreateZeroConnectionId(QUIC_VERSION_43), QUIC_VERSION_43));
   EXPECT_TRUE(QuicUtils::IsConnectionIdValidForVersion(
-      QuicUtils::CreateZeroConnectionId(QUIC_VERSION_99), QUIC_VERSION_99));
+      QuicUtils::CreateZeroConnectionId(QUIC_VERSION_50), QUIC_VERSION_50));
   EXPECT_NE(QuicUtils::CreateZeroConnectionId(QUIC_VERSION_43),
             EmptyQuicConnectionId());
-  EXPECT_EQ(QuicUtils::CreateZeroConnectionId(QUIC_VERSION_99),
+  EXPECT_EQ(QuicUtils::CreateZeroConnectionId(QUIC_VERSION_50),
             EmptyQuicConnectionId());
   EXPECT_FALSE(QuicUtils::IsConnectionIdValidForVersion(EmptyQuicConnectionId(),
                                                         QUIC_VERSION_43));
diff --git a/quic/core/tls_handshaker_test.cc b/quic/core/tls_handshaker_test.cc
index 59570b1..7a5f1cb 100644
--- a/quic/core/tls_handshaker_test.cc
+++ b/quic/core/tls_handshaker_test.cc
@@ -328,19 +328,18 @@
   }
 }
 
-class TlsHandshakerTest : public QuicTest {
+class TlsHandshakerTest : public QuicTestWithParam<ParsedQuicVersion> {
  public:
   TlsHandshakerTest()
-      : client_conn_(new MockQuicConnection(
-            &conn_helper_,
-            &alarm_factory_,
-            Perspective::IS_CLIENT,
-            {ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_99)})),
-        server_conn_(new MockQuicConnection(
-            &conn_helper_,
-            &alarm_factory_,
-            Perspective::IS_SERVER,
-            {ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_99)})),
+      : version_(GetParam()),
+        client_conn_(new MockQuicConnection(&conn_helper_,
+                                            &alarm_factory_,
+                                            Perspective::IS_CLIENT,
+                                            {version_})),
+        server_conn_(new MockQuicConnection(&conn_helper_,
+                                            &alarm_factory_,
+                                            Perspective::IS_SERVER,
+                                            {version_})),
         client_session_(client_conn_, /*create_mock_crypto_stream=*/false),
         server_session_(server_conn_, /*create_mock_crypto_stream=*/false) {
     client_stream_ = new TestQuicCryptoClientStream(&client_session_);
@@ -394,6 +393,7 @@
     EXPECT_EQ(0, server_crypto_params.peer_signature_algorithm);
   }
 
+  ParsedQuicVersion version_;
   MockQuicConnectionHelper conn_helper_;
   MockAlarmFactory alarm_factory_;
   MockQuicConnection* client_conn_;
@@ -406,7 +406,22 @@
   TestQuicCryptoServerStream* server_stream_;
 };
 
-TEST_F(TlsHandshakerTest, CryptoHandshake) {
+std::vector<ParsedQuicVersion> AllSupportedTlsVersions() {
+  std::vector<ParsedQuicVersion> tls_versions;
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    if (version.handshake_protocol == PROTOCOL_TLS1_3) {
+      tls_versions.push_back(version);
+    }
+  }
+  return tls_versions;
+}
+
+INSTANTIATE_TEST_SUITE_P(TlsHandshakerTests,
+                         TlsHandshakerTest,
+                         ::testing::ValuesIn(AllSupportedTlsVersions()),
+                         ::testing::PrintToStringParamName());
+
+TEST_P(TlsHandshakerTest, CryptoHandshake) {
   EXPECT_FALSE(client_conn_->IsHandshakeComplete());
   EXPECT_FALSE(server_conn_->IsHandshakeComplete());
 
@@ -419,7 +434,7 @@
   ExpectHandshakeSuccessful();
 }
 
-TEST_F(TlsHandshakerTest, HandshakeWithAsyncProofSource) {
+TEST_P(TlsHandshakerTest, HandshakeWithAsyncProofSource) {
   EXPECT_CALL(*client_conn_, CloseConnection(_, _, _)).Times(0);
   EXPECT_CALL(*server_conn_, CloseConnection(_, _, _)).Times(0);
   // Enable FakeProofSource to capture call to ComputeTlsSignature and run it
@@ -439,7 +454,7 @@
   ExpectHandshakeSuccessful();
 }
 
-TEST_F(TlsHandshakerTest, CancelPendingProofSource) {
+TEST_P(TlsHandshakerTest, CancelPendingProofSource) {
   EXPECT_CALL(*client_conn_, CloseConnection(_, _, _)).Times(0);
   EXPECT_CALL(*server_conn_, CloseConnection(_, _, _)).Times(0);
   // Enable FakeProofSource to capture call to ComputeTlsSignature and run it
@@ -457,7 +472,7 @@
   proof_source->InvokePendingCallback(0);
 }
 
-TEST_F(TlsHandshakerTest, HandshakeWithAsyncProofVerifier) {
+TEST_P(TlsHandshakerTest, HandshakeWithAsyncProofVerifier) {
   EXPECT_CALL(*client_conn_, CloseConnection(_, _, _)).Times(0);
   EXPECT_CALL(*server_conn_, CloseConnection(_, _, _)).Times(0);
   // Enable TestProofVerifier to capture call to VerifyCertChain and run it
@@ -479,7 +494,7 @@
   ExpectHandshakeSuccessful();
 }
 
-TEST_F(TlsHandshakerTest, ClientSendsNoSNI) {
+TEST_P(TlsHandshakerTest, ClientSendsNoSNI) {
   // Create a new client stream (and handshaker) with an empty server hostname.
   client_stream_ =
       new TestQuicCryptoClientStream(&client_session_, QuicServerId("", 443),
@@ -496,7 +511,7 @@
   EXPECT_EQ(server_stream_->crypto_negotiated_params().sni, "");
 }
 
-TEST_F(TlsHandshakerTest, ServerExtractSNI) {
+TEST_P(TlsHandshakerTest, ServerExtractSNI) {
   EXPECT_CALL(*client_conn_, CloseConnection(_, _, _)).Times(0);
   EXPECT_CALL(*server_conn_, CloseConnection(_, _, _)).Times(0);
   EXPECT_CALL(client_stream_->proof_handler(), OnProofVerifyDetailsAvailable);
@@ -507,7 +522,7 @@
   EXPECT_EQ(server_stream_->crypto_negotiated_params().sni, "test.example.com");
 }
 
-TEST_F(TlsHandshakerTest, ClientConnectionClosedOnTlsError) {
+TEST_P(TlsHandshakerTest, ClientConnectionClosedOnTlsError) {
   // Have client send ClientHello.
   client_stream_->CryptoConnect();
   EXPECT_CALL(*client_conn_, CloseConnection(QUIC_HANDSHAKE_FAILED, _, _));
@@ -527,7 +542,7 @@
   EXPECT_FALSE(client_stream_->one_rtt_keys_available());
 }
 
-TEST_F(TlsHandshakerTest, ServerConnectionClosedOnTlsError) {
+TEST_P(TlsHandshakerTest, ServerConnectionClosedOnTlsError) {
   EXPECT_CALL(*server_conn_, CloseConnection(QUIC_HANDSHAKE_FAILED, _, _));
 
   // Send a zero-length ClientHello from client to server.
@@ -545,7 +560,7 @@
   EXPECT_FALSE(server_stream_->one_rtt_keys_available());
 }
 
-TEST_F(TlsHandshakerTest, ClientNotSendingALPN) {
+TEST_P(TlsHandshakerTest, ClientNotSendingALPN) {
   client_stream_->client_handshaker()->AllowEmptyAlpnForTests();
   EXPECT_CALL(client_session_, GetAlpnsToOffer())
       .WillOnce(Return(std::vector<std::string>()));
@@ -563,7 +578,7 @@
   EXPECT_FALSE(server_stream_->encryption_established());
 }
 
-TEST_F(TlsHandshakerTest, ClientSendingBadALPN) {
+TEST_P(TlsHandshakerTest, ClientSendingBadALPN) {
   const std::string kTestBadClientAlpn = "bad-client-alpn";
   EXPECT_CALL(client_session_, GetAlpnsToOffer())
       .WillOnce(Return(std::vector<std::string>({kTestBadClientAlpn})));
@@ -581,7 +596,7 @@
   EXPECT_FALSE(server_stream_->encryption_established());
 }
 
-TEST_F(TlsHandshakerTest, ClientSendingTooManyALPNs) {
+TEST_P(TlsHandshakerTest, ClientSendingTooManyALPNs) {
   std::string long_alpn(250, 'A');
   EXPECT_CALL(client_session_, GetAlpnsToOffer())
       .WillOnce(Return(std::vector<std::string>({
@@ -597,7 +612,7 @@
   EXPECT_QUIC_BUG(client_stream_->CryptoConnect(), "Failed to set ALPN");
 }
 
-TEST_F(TlsHandshakerTest, ServerRequiresCustomALPN) {
+TEST_P(TlsHandshakerTest, ServerRequiresCustomALPN) {
   const std::string kTestAlpn = "An ALPN That Client Did Not Offer";
   EXPECT_CALL(server_session_, SelectAlpn(_))
       .WillOnce(
@@ -618,7 +633,7 @@
   EXPECT_FALSE(server_stream_->encryption_established());
 }
 
-TEST_F(TlsHandshakerTest, CustomALPNNegotiation) {
+TEST_P(TlsHandshakerTest, CustomALPNNegotiation) {
   EXPECT_CALL(*client_conn_, CloseConnection(_, _, _)).Times(0);
   EXPECT_CALL(*server_conn_, CloseConnection(_, _, _)).Times(0);
 
diff --git a/quic/core/uber_quic_stream_id_manager_test.cc b/quic/core/uber_quic_stream_id_manager_test.cc
index c04cffa..b7acc68 100644
--- a/quic/core/uber_quic_stream_id_manager_test.cc
+++ b/quic/core/uber_quic_stream_id_manager_test.cc
@@ -5,6 +5,7 @@
 #include "net/third_party/quiche/src/quic/core/uber_quic_stream_id_manager.h"
 
 #include "net/third_party/quiche/src/quic/core/quic_utils.h"
+#include "net/third_party/quiche/src/quic/core/quic_versions.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_stream_id_manager_peer.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
@@ -16,6 +17,33 @@
 namespace test {
 namespace {
 
+struct TestParams {
+  explicit TestParams(ParsedQuicVersion version, Perspective perspective)
+      : version(version), perspective(perspective) {}
+
+  ParsedQuicVersion version;
+  Perspective perspective;
+};
+
+// Used by ::testing::PrintToStringParamName().
+std::string PrintToString(const TestParams& p) {
+  return quiche::QuicheStrCat(
+      ParsedQuicVersionToString(p.version), "_",
+      (p.perspective == Perspective::IS_CLIENT ? "client" : "server"));
+}
+
+std::vector<TestParams> GetTestParams() {
+  std::vector<TestParams> params;
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    if (!version.HasIetfQuicFrames()) {
+      continue;
+    }
+    params.push_back(TestParams(version, Perspective::IS_CLIENT));
+    params.push_back(TestParams(version, Perspective::IS_SERVER));
+  }
+  return params;
+}
+
 class MockDelegate : public QuicStreamIdManager::DelegateInterface {
  public:
   MOCK_METHOD1(OnCanCreateNewOutgoingStream, void(bool unidirectional));
@@ -27,7 +55,7 @@
                void(QuicStreamCount stream_count, bool unidirectional));
 };
 
-class UberQuicStreamIdManagerTest : public QuicTestWithParam<Perspective> {
+class UberQuicStreamIdManagerTest : public QuicTestWithParam<TestParams> {
  protected:
   UberQuicStreamIdManagerTest()
       : manager_(perspective(),
@@ -63,22 +91,22 @@
   }
 
   QuicStreamId GetNthPeerInitiatedBidirectionalStreamId(int n) {
-    return ((GetParam() == Perspective::IS_SERVER)
+    return ((perspective() == Perspective::IS_SERVER)
                 ? GetNthClientInitiatedBidirectionalId(n)
                 : GetNthServerInitiatedBidirectionalId(n));
   }
   QuicStreamId GetNthPeerInitiatedUnidirectionalStreamId(int n) {
-    return ((GetParam() == Perspective::IS_SERVER)
+    return ((perspective() == Perspective::IS_SERVER)
                 ? GetNthClientInitiatedUnidirectionalId(n)
                 : GetNthServerInitiatedUnidirectionalId(n));
   }
   QuicStreamId GetNthSelfInitiatedBidirectionalStreamId(int n) {
-    return ((GetParam() == Perspective::IS_CLIENT)
+    return ((perspective() == Perspective::IS_CLIENT)
                 ? GetNthClientInitiatedBidirectionalId(n)
                 : GetNthServerInitiatedBidirectionalId(n));
   }
   QuicStreamId GetNthSelfInitiatedUnidirectionalStreamId(int n) {
-    return ((GetParam() == Perspective::IS_CLIENT)
+    return ((perspective() == Perspective::IS_CLIENT)
                 ? GetNthClientInitiatedUnidirectionalId(n)
                 : GetNthServerInitiatedUnidirectionalId(n));
   }
@@ -93,10 +121,12 @@
            ((stream_count - 1) * QuicUtils::StreamIdDelta(transport_version()));
   }
 
-  ParsedQuicVersion version() { return {PROTOCOL_TLS1_3, transport_version()}; }
-  QuicTransportVersion transport_version() { return QUIC_VERSION_99; }
+  ParsedQuicVersion version() { return GetParam().version; }
+  QuicTransportVersion transport_version() {
+    return version().transport_version;
+  }
 
-  Perspective perspective() { return GetParam(); }
+  Perspective perspective() { return GetParam().perspective; }
 
   testing::StrictMock<MockDelegate> delegate_;
   UberQuicStreamIdManager manager_;
@@ -104,8 +134,7 @@
 
 INSTANTIATE_TEST_SUITE_P(Tests,
                          UberQuicStreamIdManagerTest,
-                         ::testing::ValuesIn({Perspective::IS_CLIENT,
-                                              Perspective::IS_SERVER}),
+                         ::testing::ValuesIn(GetTestParams()),
                          ::testing::PrintToStringParamName());
 
 TEST_P(UberQuicStreamIdManagerTest, Initialization) {
diff --git a/quic/masque/masque_utils.cc b/quic/masque/masque_utils.cc
index 6ef88ae..29e254f 100644
--- a/quic/masque/masque_utils.cc
+++ b/quic/masque/masque_utils.cc
@@ -8,7 +8,16 @@
 
 ParsedQuicVersionVector MasqueSupportedVersions() {
   QuicVersionInitializeSupportForIetfDraft();
-  ParsedQuicVersion version(PROTOCOL_TLS1_3, QUIC_VERSION_99);
+  ParsedQuicVersion version = UnsupportedQuicVersion();
+  for (const ParsedQuicVersion& vers : AllSupportedVersions()) {
+    // Find the first version that supports IETF QUIC.
+    if (vers.HasIetfQuicFrames() &&
+        vers.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      version = vers;
+      break;
+    }
+  }
+  CHECK_NE(version.transport_version, QUIC_VERSION_UNSUPPORTED);
   QuicEnableVersion(version);
   return {version};
 }
diff --git a/quic/quic_transport/quic_transport_client_session_test.cc b/quic/quic_transport/quic_transport_client_session_test.cc
index b2f38f5..312b132 100644
--- a/quic/quic_transport/quic_transport_client_session_test.cc
+++ b/quic/quic_transport/quic_transport_client_session_test.cc
@@ -36,7 +36,15 @@
 }
 
 ParsedQuicVersionVector GetVersions() {
-  return {ParsedQuicVersion{PROTOCOL_TLS1_3, QUIC_VERSION_99}};
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    // Find the first version that supports IETF QUIC.
+    if (version.HasIetfQuicFrames() &&
+        version.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      return {version};
+    }
+  }
+  CHECK(false);
+  return {};
 }
 
 std::string DataInStream(QuicStream* stream) {
diff --git a/quic/quic_transport/quic_transport_integration_test.cc b/quic/quic_transport/quic_transport_integration_test.cc
index cdc99a6..2da47fa 100644
--- a/quic/quic_transport/quic_transport_integration_test.cc
+++ b/quic/quic_transport/quic_transport_integration_test.cc
@@ -49,7 +49,15 @@
 }
 
 ParsedQuicVersionVector GetVersions() {
-  return {ParsedQuicVersion{PROTOCOL_TLS1_3, QUIC_VERSION_99}};
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    // Find the first version that supports IETF QUIC.
+    if (version.HasIetfQuicFrames() &&
+        version.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      return {version};
+    }
+  }
+  CHECK(false);
+  return {};
 }
 
 class QuicTransportEndpointBase : public QuicEndpointBase {
diff --git a/quic/quic_transport/quic_transport_server_session_test.cc b/quic/quic_transport/quic_transport_server_session_test.cc
index dfd075e..c8ef5c7 100644
--- a/quic/quic_transport/quic_transport_server_session_test.cc
+++ b/quic/quic_transport/quic_transport_server_session_test.cc
@@ -51,7 +51,15 @@
 }
 
 ParsedQuicVersionVector GetVersions() {
-  return {ParsedQuicVersion{PROTOCOL_TLS1_3, QUIC_VERSION_99}};
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    // Find the first version that supports IETF QUIC.
+    if (version.HasIetfQuicFrames() &&
+        version.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      return {version};
+    }
+  }
+  CHECK(false);
+  return {};
 }
 
 class QuicTransportServerSessionTest : public QuicTest {
diff --git a/quic/quic_transport/quic_transport_stream_test.cc b/quic/quic_transport/quic_transport_stream_test.cc
index 31e01a0..3c92101 100644
--- a/quic/quic_transport/quic_transport_stream_test.cc
+++ b/quic/quic_transport/quic_transport_stream_test.cc
@@ -24,7 +24,15 @@
 using testing::Return;
 
 ParsedQuicVersionVector GetVersions() {
-  return {ParsedQuicVersion{PROTOCOL_TLS1_3, QUIC_VERSION_99}};
+  for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+    // Find the first version that supports IETF QUIC.
+    if (version.HasIetfQuicFrames() &&
+        version.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      return {version};
+    }
+  }
+  CHECK(false);
+  return {};
 }
 
 class MockQuicTransportSessionInterface : public QuicTransportSessionInterface {
diff --git a/quic/tools/quic_client_interop_test_bin.cc b/quic/tools/quic_client_interop_test_bin.cc
index e3abbd1..9745955 100644
--- a/quic/tools/quic_client_interop_test_bin.cc
+++ b/quic/tools/quic_client_interop_test_bin.cc
@@ -95,6 +95,7 @@
   void AttemptRequest(QuicSocketAddress addr,
                       std::string authority,
                       QuicServerId server_id,
+                      ParsedQuicVersion version,
                       bool test_version_negotiation,
                       bool attempt_rebind);
 
@@ -151,9 +152,9 @@
 void QuicClientInteropRunner::AttemptRequest(QuicSocketAddress addr,
                                              std::string authority,
                                              QuicServerId server_id,
+                                             ParsedQuicVersion version,
                                              bool test_version_negotiation,
                                              bool attempt_rebind) {
-  ParsedQuicVersion version(PROTOCOL_TLS1_3, QUIC_VERSION_99);
   ParsedQuicVersionVector versions = {version};
   if (test_version_negotiation) {
     versions.insert(versions.begin(), QuicVersionReservedForNegotiation());
@@ -189,7 +190,7 @@
   }
   if (test_version_negotiation && !connect_result) {
     // Failed to negotiate version, retry without version negotiation.
-    AttemptRequest(addr, authority, server_id,
+    AttemptRequest(addr, authority, server_id, version,
                    /*test_version_negotiation=*/false, attempt_rebind);
     return;
   }
@@ -235,8 +236,8 @@
         client->SendRequestAndWaitForResponse(header_block, "", /*fin=*/true);
         if (!client->connected()) {
           // Rebinding does not work, retry without attempting it.
-          AttemptRequest(addr, authority, server_id, test_version_negotiation,
-                         /*attempt_rebind=*/false);
+          AttemptRequest(addr, authority, server_id, version,
+                         test_version_negotiation, /*attempt_rebind=*/false);
           return;
         }
         InsertFeature(Feature::kRebinding);
@@ -263,7 +264,17 @@
 std::set<Feature> ServerSupport(std::string host, int port) {
   // Enable IETF version support.
   QuicVersionInitializeSupportForIetfDraft();
-  QuicEnableVersion(ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_99));
+  ParsedQuicVersion version = UnsupportedQuicVersion();
+  for (const ParsedQuicVersion& vers : AllSupportedVersions()) {
+    // Find the first version that supports IETF QUIC.
+    if (vers.HasIetfQuicFrames() &&
+        vers.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+      version = vers;
+      break;
+    }
+  }
+  CHECK_NE(version.transport_version, QUIC_VERSION_UNSUPPORTED);
+  QuicEnableVersion(version);
 
   // Build the client, and try to connect.
   QuicSocketAddress addr =
@@ -277,7 +288,7 @@
 
   QuicClientInteropRunner runner;
 
-  runner.AttemptRequest(addr, authority, server_id,
+  runner.AttemptRequest(addr, authority, server_id, version,
                         /*test_version_negotiation=*/true,
                         /*attempt_rebind=*/true);
 
diff --git a/quic/tools/quic_toy_client.cc b/quic/tools/quic_toy_client.cc
index e790b54..8a9532d 100644
--- a/quic/tools/quic_toy_client.cc
+++ b/quic/tools/quic_toy_client.cc
@@ -187,7 +187,16 @@
   std::string quic_version_string = GetQuicFlag(FLAGS_quic_version);
   if (GetQuicFlag(FLAGS_quic_ietf_draft)) {
     quic::QuicVersionInitializeSupportForIetfDraft();
-    versions = {{quic::PROTOCOL_TLS1_3, quic::QUIC_VERSION_99}};
+    versions = {};
+    for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+      // Find the first version that supports IETF QUIC.
+      if (version.HasIetfQuicFrames() &&
+          version.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+        versions = {version};
+        break;
+      }
+    }
+    CHECK_EQ(versions.size(), 1u);
     quic::QuicEnableVersion(versions[0]);
 
   } else if (!quic_version_string.empty()) {
diff --git a/quic/tools/quic_toy_server.cc b/quic/tools/quic_toy_server.cc
index 45c7b1f..a23e7d9 100644
--- a/quic/tools/quic_toy_server.cc
+++ b/quic/tools/quic_toy_server.cc
@@ -62,9 +62,14 @@
   ParsedQuicVersionVector supported_versions;
   if (GetQuicFlag(FLAGS_quic_ietf_draft)) {
     QuicVersionInitializeSupportForIetfDraft();
-    supported_versions = {
-        ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_99),
-        ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_IETF_DRAFT_25)};
+    for (const ParsedQuicVersion& version : AllSupportedVersions()) {
+      // Add all versions that supports IETF QUIC.
+      if (version.HasIetfQuicFrames() &&
+          version.handshake_protocol == quic::PROTOCOL_TLS1_3) {
+        supported_versions.push_back(version);
+        break;
+      }
+    }
   } else {
     supported_versions = AllSupportedVersions();
   }