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

Unified Diff: net/quic/quic_connection_test.cc

Issue 682413002: Close the QUIC connection if too many sent or received packets are (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Remove_QUIC_VERSION_21_78604601
Patch Set: 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_flags.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 fddf22a32127c84de4f2434fcc69822ea528caea..4f1e97a13496fc1c424015944173dd4d06335ffe 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -1314,6 +1314,49 @@ TEST_P(QuicConnectionTest, LeastUnackedLower) {
ProcessStopWaitingPacket(&frame3);
}
+TEST_P(QuicConnectionTest, TooManySentPackets) {
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+
+ for (int i = 0; i < 1100; ++i) {
+ SendStreamDataToPeer(1, "foo", 3 * i, !kFin, nullptr);
+ }
+
+ // Ack packet 1, which leaves more than the limit outstanding.
+ EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
+ if (FLAGS_quic_too_many_outstanding_packets) {
+ EXPECT_CALL(visitor_,
+ OnConnectionClosed(QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS,
+ false));
+ EXPECT_CALL(visitor_, OnCanWrite()).Times(0);
+ } else {
+ EXPECT_CALL(visitor_, OnCanWrite()).Times(1);
+ }
+ // Nack every packet except the last one, leaving a huge gap.
+ QuicAckFrame frame1 = InitAckFrame(1100);
+ for (QuicPacketSequenceNumber i = 1; i < 1100; ++i) {
+ NackPacket(i, &frame1);
+ }
+ ProcessAckPacket(&frame1);
+}
+
+TEST_P(QuicConnectionTest, TooManyReceivedPackets) {
+ EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
+
+ if (FLAGS_quic_too_many_outstanding_packets) {
+ EXPECT_CALL(visitor_,
+ OnConnectionClosed(QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS,
+ false));
+ }
+
+ // Miss every other packet for 1000 packets.
+ for (QuicPacketSequenceNumber i = 1; i < 1000; ++i) {
+ ProcessPacket(i * 2);
+ if (!connection_.connected()) {
+ break;
+ }
+ }
+}
+
TEST_P(QuicConnectionTest, LargestObservedLower) {
EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698