Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(822)

Unified Diff: net/quic/quic_connection_test.cc

Issue 647923002: Allow the number of undecryptable QUIC packets buffered before the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@merge_76636673
Patch Set: set max_undecryptable_packets_ to 100 Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698