| Index: net/quic/quic_connection_test.cc
|
| diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
|
| index c51e5bc143d25a4cb8c4e8d5aac62f299528e841..69c8661ddae76eba617f0ad9790f567c7f9ee7da 100644
|
| --- a/net/quic/quic_connection_test.cc
|
| +++ b/net/quic/quic_connection_test.cc
|
| @@ -2416,19 +2416,23 @@ TEST_P(QuicConnectionTest, RetransmitPacketsWithInitialEncryption) {
|
| }
|
|
|
| TEST_P(QuicConnectionTest, BufferNonDecryptablePackets) {
|
| + // SetFromConfig is always called after construction from InitializeSession.
|
| + EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
|
| + QuicConfig config;
|
| + config.SetDefaults();
|
| + connection_.SetFromConfig(config);
|
| EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| use_tagging_decrypter();
|
|
|
| const uint8 tag = 0x07;
|
| framer_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag));
|
|
|
| - // Process an encrypted packet which can not yet be decrypted
|
| - // which should result in the packet being buffered.
|
| + // Process an encrypted packet which can not yet be decrypted which should
|
| + // result in the packet being buffered.
|
| ProcessDataPacketAtLevel(1, 0, kEntropyFlag, ENCRYPTION_INITIAL);
|
|
|
| - // Transition to the new encryption state and process another
|
| - // encrypted packet which should result in the original packet being
|
| - // processed.
|
| + // Transition to the new encryption state and process another encrypted packet
|
| + // which should result in the original packet being processed.
|
| connection_.SetDecrypter(new StrictTaggingDecrypter(tag),
|
| ENCRYPTION_INITIAL);
|
| connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
|
| @@ -2436,12 +2440,45 @@ TEST_P(QuicConnectionTest, BufferNonDecryptablePackets) {
|
| EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(2);
|
| ProcessDataPacketAtLevel(2, 0, kEntropyFlag, ENCRYPTION_INITIAL);
|
|
|
| - // Finally, process a third packet and note that we do not
|
| - // reprocess the buffered packet.
|
| + // Finally, process a third packet and note that we do not reprocess the
|
| + // buffered packet.
|
| EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(1);
|
| ProcessDataPacketAtLevel(3, 0, kEntropyFlag, ENCRYPTION_INITIAL);
|
| }
|
|
|
| +TEST_P(QuicConnectionTest, Buffer100NonDecryptablePackets) {
|
| + // SetFromConfig is always called after construction from InitializeSession.
|
| + EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
|
| + QuicConfig config;
|
| + config.SetDefaults();
|
| + config.set_max_undecryptable_packets(100);
|
| + connection_.SetFromConfig(config);
|
| + EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
|
| + use_tagging_decrypter();
|
| +
|
| + const uint8 tag = 0x07;
|
| + framer_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag));
|
| +
|
| + // Process an encrypted packet which can not yet be decrypted which should
|
| + // result in the packet being buffered.
|
| + for (QuicPacketSequenceNumber i = 1; i <= 100; ++i) {
|
| + ProcessDataPacketAtLevel(i, 0, kEntropyFlag, ENCRYPTION_INITIAL);
|
| + }
|
| +
|
| + // Transition to the new encryption state and process another encrypted packet
|
| + // which should result in the original packets being processed.
|
| + connection_.SetDecrypter(new StrictTaggingDecrypter(tag), ENCRYPTION_INITIAL);
|
| + connection_.SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
|
| + connection_.SetEncrypter(ENCRYPTION_INITIAL, new TaggingEncrypter(tag));
|
| + EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(101);
|
| + ProcessDataPacketAtLevel(101, 0, kEntropyFlag, ENCRYPTION_INITIAL);
|
| +
|
| + // Finally, process a third packet and note that we do not reprocess the
|
| + // buffered packet.
|
| + EXPECT_CALL(visitor_, OnStreamFrames(_)).Times(1);
|
| + ProcessDataPacketAtLevel(102, 0, kEntropyFlag, ENCRYPTION_INITIAL);
|
| +}
|
| +
|
| TEST_P(QuicConnectionTest, TestRetransmitOrder) {
|
| QuicByteCount first_packet_size;
|
| EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).WillOnce(
|
|
|