Simplify ConstructMisFramedEncryptedPacket() signature. Both call sites have only one version, so taking a ParsedQuicVersion is a better choice than taking a ParsedQuicVersionVector. This is motivated by the variable |version| being unused in ConstructMisFramedEncryptedPacket(), which causes compilation failure in Envoy, but once I'm at it, it makes sense to make this small improvement. gfe-relnote: n/a, test-only change. PiperOrigin-RevId: 277916457 Change-Id: Ica41b8985510bddbe81dadf9843e0a9620ef3ffe
diff --git a/quic/core/http/quic_spdy_client_session_test.cc b/quic/core/http/quic_spdy_client_session_test.cc index 22e0f52..d5b186c 100644 --- a/quic/core/http/quic_spdy_client_session_test.cc +++ b/quic/core/http/quic_spdy_client_session_test.cc
@@ -533,14 +533,15 @@ // A packet with invalid framing should cause a connection to be closed. TEST_P(QuicSpdyClientSessionTest, InvalidFramedPacketReceived) { - if (GetParam().handshake_protocol == PROTOCOL_TLS1_3) { + const ParsedQuicVersion version = GetParam(); + if (version.handshake_protocol == PROTOCOL_TLS1_3) { // TODO(nharper, b/112643533): Figure out why this test fails when TLS is // enabled and fix it. return; } QuicSocketAddress server_address(TestPeerIPAddress(), kTestPort); QuicSocketAddress client_address(TestPeerIPAddress(), kTestPort); - if (GetParam().KnowsWhichDecrypterToUse()) { + if (version.KnowsWhichDecrypterToUse()) { connection_->InstallDecrypter( ENCRYPTION_FORWARD_SECURE, std::make_unique<NullDecrypter>(Perspective::IS_CLIENT)); @@ -561,10 +562,9 @@ QuicConnectionId source_connection_id = EmptyQuicConnectionId(); QuicFramerPeer::SetLastSerializedServerConnectionId( QuicConnectionPeer::GetFramer(connection_), destination_connection_id); - ParsedQuicVersionVector versions = {GetParam()}; bool version_flag = false; QuicConnectionIdIncluded scid_included = CONNECTION_ID_ABSENT; - if (VersionHasIetfInvariantHeader(GetParam().transport_version)) { + if (VersionHasIetfInvariantHeader(version.transport_version)) { version_flag = true; source_connection_id = destination_connection_id; scid_included = CONNECTION_ID_PRESENT; @@ -572,7 +572,7 @@ std::unique_ptr<QuicEncryptedPacket> packet(ConstructMisFramedEncryptedPacket( destination_connection_id, source_connection_id, version_flag, false, 100, "data", CONNECTION_ID_ABSENT, scid_included, PACKET_4BYTE_PACKET_NUMBER, - &versions, Perspective::IS_SERVER)); + version, Perspective::IS_SERVER)); std::unique_ptr<QuicReceivedPacket> received( ConstructReceivedPacket(*packet, QuicTime::Zero())); EXPECT_CALL(*connection_, CloseConnection(_, _, _)).Times(1);
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc index 7e72b34..38d222b 100644 --- a/quic/core/quic_framer_test.cc +++ b/quic/core/quic_framer_test.cc
@@ -9279,12 +9279,10 @@ } framer_.SetEncrypter(ENCRYPTION_INITIAL, std::make_unique<NullEncrypter>(framer_.perspective())); - ParsedQuicVersionVector versions; - versions.push_back(framer_.version()); std::unique_ptr<QuicEncryptedPacket> packet(ConstructMisFramedEncryptedPacket( TestConnectionId(), EmptyQuicConnectionId(), false, false, kTestQuicStreamId, kTestString, CONNECTION_ID_PRESENT, - CONNECTION_ID_ABSENT, PACKET_4BYTE_PACKET_NUMBER, &versions, + CONNECTION_ID_ABSENT, PACKET_4BYTE_PACKET_NUMBER, framer_.version(), Perspective::IS_CLIENT)); MockFramerVisitor visitor;