Index: net/quic/congestion_control/tcp_cubic_sender_test.cc |
diff --git a/net/quic/congestion_control/tcp_cubic_sender_test.cc b/net/quic/congestion_control/tcp_cubic_sender_test.cc |
index 82b216e68cd3b692214dce4951e5242b46473d0e..a97ddb6ea37a6d470fe57f9d7d62046bf9d2a820 100644 |
--- a/net/quic/congestion_control/tcp_cubic_sender_test.cc |
+++ b/net/quic/congestion_control/tcp_cubic_sender_test.cc |
@@ -485,6 +485,47 @@ TEST_F(TcpCubicSenderTest, TcpCubicMaxCongestionWindow) { |
EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
} |
+TEST_F(TcpCubicSenderTest, TcpCubicResetEpochOnQuiescence) { |
+ const int kMaxCongestionWindow = 50; |
+ const QuicByteCount kMaxCongestionWindowBytes = |
+ kMaxCongestionWindow * kDefaultTCPMSS; |
+ sender_.reset(new TcpCubicSenderPeer(&clock_, false, kMaxCongestionWindow)); |
+ |
+ int num_sent = SendAvailableSendWindow(); |
+ |
+ // Make sure we fall out of slow start. |
+ QuicByteCount saved_cwnd = sender_->GetCongestionWindow(); |
+ LoseNPackets(1); |
+ EXPECT_GT(saved_cwnd, sender_->GetCongestionWindow()); |
+ |
+ // Ack the rest of the outstanding packets to get out of recovery. |
+ for (int i = 1; i < num_sent; ++i) { |
+ AckNPackets(1); |
+ } |
+ EXPECT_EQ(0u, bytes_in_flight_); |
+ |
+ // Send a new window of data and ack all; cubic growth should occur. |
+ saved_cwnd = sender_->GetCongestionWindow(); |
+ num_sent = SendAvailableSendWindow(); |
+ for (int i = 0; i < num_sent; ++i) { |
+ AckNPackets(1); |
+ } |
+ EXPECT_LT(saved_cwnd, sender_->GetCongestionWindow()); |
+ EXPECT_GT(kMaxCongestionWindowBytes, sender_->GetCongestionWindow()); |
+ EXPECT_EQ(0u, bytes_in_flight_); |
+ |
+ // Quiescent time of 100 seconds |
+ clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(100000)); |
+ |
+ // Send new window of data and ack one packet. Cubic epoch should have |
+ // been reset; ensure cwnd increase is not dramatic. |
+ saved_cwnd = sender_->GetCongestionWindow(); |
+ SendAvailableSendWindow(); |
+ AckNPackets(1); |
+ EXPECT_NEAR(saved_cwnd, sender_->GetCongestionWindow(), kDefaultTCPMSS); |
+ EXPECT_GT(kMaxCongestionWindowBytes, sender_->GetCongestionWindow()); |
+} |
+ |
TEST_F(TcpCubicSenderTest, MultipleLossesInOneWindow) { |
SendAvailableSendWindow(); |
const QuicByteCount initial_window = sender_->GetCongestionWindow(); |