Fix failed quic_connection_test while canary flags get flipped.
PiperOrigin-RevId: 393234459
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 871e5e8..28a87ea 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -1765,6 +1765,9 @@
QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false);
EXPECT_EQ(Perspective::IS_SERVER, connection_.perspective());
connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
+ // Discard INITIAL key.
+ connection_.RemoveEncrypter(ENCRYPTION_INITIAL);
+ connection_.NeuterUnencryptedPackets();
// Prevent packets from being coalesced.
EXPECT_CALL(visitor_, GetHandshakeState())
.WillRepeatedly(Return(HANDSHAKE_CONFIRMED));
@@ -1978,6 +1981,9 @@
QuicConnectionPeer::SetAddressValidated(&connection_);
}
connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
+ // Discard INITIAL key.
+ connection_.RemoveEncrypter(ENCRYPTION_INITIAL);
+ connection_.NeuterUnencryptedPackets();
EXPECT_CALL(visitor_, GetHandshakeState())
.WillRepeatedly(Return(HANDSHAKE_CONFIRMED));
@@ -2108,6 +2114,9 @@
EXPECT_CALL(visitor_, OnServerConnectionIdIssued(_))
.WillOnce(Invoke([&](const QuicConnectionId& cid) { new_cid = cid; }));
EXPECT_CALL(visitor_, SendNewConnectionId(_));
+ // Discard INITIAL key.
+ connection_.RemoveEncrypter(ENCRYPTION_INITIAL);
+ connection_.NeuterUnencryptedPackets();
connection_.OnHandshakeComplete();
EXPECT_CALL(visitor_, GetHandshakeState())
.WillRepeatedly(Return(HANDSHAKE_CONFIRMED));
@@ -2154,6 +2163,9 @@
SetClientConnectionId(TestConnectionId(1));
connection_.CreateConnectionIdManager();
connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
+ // Discard INITIAL key.
+ connection_.RemoveEncrypter(ENCRYPTION_INITIAL);
+ connection_.NeuterUnencryptedPackets();
// Prevent packets from being coalesced.
EXPECT_CALL(visitor_, GetHandshakeState())
.WillRepeatedly(Return(HANDSHAKE_CONFIRMED));
@@ -14189,6 +14201,8 @@
// Verify the anti-amplification limit is lifted by sending a packet larger
// than the anti-amplification limit.
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
+ EXPECT_CALL(*send_algorithm_, PacingRate(_))
+ .WillRepeatedly(Return(QuicBandwidth::Zero()));
connection_.SendCryptoDataWithString(std::string(1200, 'a'), 0);
EXPECT_EQ(1u, connection_.GetStats().num_validated_peer_migration);
}
@@ -15102,6 +15116,9 @@
QuicConnectionPeer::SetAddressValidated(&connection_);
}
connection_.SetDefaultEncryptionLevel(ENCRYPTION_FORWARD_SECURE);
+ // Discard INITIAL key.
+ connection_.RemoveEncrypter(ENCRYPTION_INITIAL);
+ connection_.NeuterUnencryptedPackets();
EXPECT_CALL(visitor_, GetHandshakeState())
.WillRepeatedly(Return(HANDSHAKE_CONFIRMED));