Index: net/quic/quic_connection_test.cc |
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc |
index 969fcf2f55bfa0fd7349ca2e86a4943c89d5243f..0a184eddac162b93061dcf23fd35139f4dac4492 100644 |
--- a/net/quic/quic_connection_test.cc |
+++ b/net/quic/quic_connection_test.cc |
@@ -3331,6 +3331,40 @@ TEST_P(QuicConnectionTest, TimeoutAfterReceiveNotSendWhenUnacked) { |
EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); |
} |
+TEST_P(QuicConnectionTest, TimeoutAfter5RTOs) { |
+ FLAGS_quic_enable_rto_timeout = true; |
+ QuicSentPacketManagerPeer::SetMaxTailLossProbes(manager_, 2); |
+ EXPECT_TRUE(connection_.connected()); |
+ EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
+ QuicConfig config; |
+ QuicTagVector connection_options; |
+ connection_options.push_back(k5RTO); |
+ config.SetConnectionOptionsToSend(connection_options); |
+ connection_.SetFromConfig(config); |
+ |
+ // Send stream data. |
+ SendStreamDataToPeer(kClientDataStreamId1, "foo", 0, kFin, nullptr); |
+ |
+ EXPECT_CALL(visitor_, OnPathDegrading()); |
+ // Fire the retransmission alarm 6 times, twice for TLP and 4 times for RTO. |
+ for (int i = 0; i < 6; ++i) { |
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
+ connection_.GetRetransmissionAlarm()->Fire(); |
+ EXPECT_TRUE(connection_.GetTimeoutAlarm()->IsSet()); |
+ EXPECT_TRUE(connection_.connected()); |
+ } |
+ |
+ EXPECT_EQ(2u, connection_.sent_packet_manager().consecutive_tlp_count()); |
+ EXPECT_EQ(4u, connection_.sent_packet_manager().consecutive_rto_count()); |
+ // This time, we should time out. |
+ EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_TOO_MANY_RTOS, |
+ ConnectionCloseSource::FROM_SELF)); |
+ EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
+ connection_.GetRetransmissionAlarm()->Fire(); |
+ EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); |
+ EXPECT_FALSE(connection_.connected()); |
+} |
+ |
TEST_P(QuicConnectionTest, SendScheduler) { |
// Test that if we send a packet without delay, it is not queued. |
QuicPacket* packet = |