Add an QUIC version reserved for negotiation to help test negotiation
gfe-relnote: n/a, test-only changes
PiperOrigin-RevId: 247473641
Change-Id: If063e6cc1f833f865a400298d8ade5bbe2c6ec42
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 8995d00..87b3e0c 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -7114,16 +7114,13 @@
if (connection_.SupportsMultiplePacketNumberSpaces()) {
return;
}
- if (connection_.transport_version() == QUIC_VERSION_99) {
- return;
- }
- // Start out with some unsupported version.
+ const bool expect_failure =
+ GetQuicReloadableFlag(quic_no_client_conn_ver_negotiation) ||
+ connection_.version().handshake_protocol !=
+ QuicVersionReservedForNegotiation().handshake_protocol;
+ // Start out with an unsupported version.
QuicConnectionPeer::GetFramer(&connection_)
- ->set_version_for_tests(ParsedQuicVersion(
- PROTOCOL_UNSUPPORTED,
- GetParam().version.transport_version == QUIC_VERSION_99
- ? QUIC_VERSION_99
- : QUIC_VERSION_UNSUPPORTED));
+ ->set_version_for_tests(QuicVersionReservedForNegotiation());
// Send a version negotiation packet.
std::unique_ptr<QuicEncryptedPacket> encrypted(
@@ -7132,12 +7129,12 @@
AllSupportedVersions()));
std::unique_ptr<QuicReceivedPacket> received(
ConstructReceivedPacket(*encrypted, QuicTime::Zero()));
- if (GetQuicReloadableFlag(quic_no_client_conn_ver_negotiation)) {
+ if (expect_failure) {
EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_INVALID_VERSION, _,
ConnectionCloseSource::FROM_SELF));
}
connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, *received);
- if (GetQuicReloadableFlag(quic_no_client_conn_ver_negotiation)) {
+ if (expect_failure) {
EXPECT_FALSE(connection_.connected());
return;
}