Index: net/quic/congestion_control/tcp_loss_algorithm_test.cc |
diff --git a/net/quic/congestion_control/tcp_loss_algorithm_test.cc b/net/quic/congestion_control/tcp_loss_algorithm_test.cc |
index 8c6a74f9f228aac0aabf01b0ef839f5b6ca615ad..2540bc72d7196967f4d52f1f2cf1eb3e6ad3ac2e 100644 |
--- a/net/quic/congestion_control/tcp_loss_algorithm_test.cc |
+++ b/net/quic/congestion_control/tcp_loss_algorithm_test.cc |
@@ -129,21 +129,34 @@ TEST_F(TcpLossAlgorithmTest, EarlyRetransmitAllPackets) { |
const size_t kNumSentPackets = 5; |
for (size_t i = 1; i <= kNumSentPackets; ++i) { |
SendDataPacket(i); |
+ // Advance the time 1/4 RTT between 3 and 4. |
+ if (i == 3) { |
+ clock_.AdvanceTime(srtt_.Multiply(0.25)); |
+ } |
} |
- // Early retransmit when the final packet gets acked and the first 4 are |
- // nacked multiple times via FACK. |
+ |
+ // Early retransmit when the final packet gets acked and 1.25 RTTs have |
+ // elapsed since the packets were sent. |
unacked_packets_.SetNotPending(kNumSentPackets); |
+ // This simulates a single ack following multiple missing packets with FACK. |
for (size_t i = 1; i < kNumSentPackets; ++i) { |
unacked_packets_.NackPacket(i, kNumSentPackets - i); |
} |
QuicPacketSequenceNumber lost[] = { 1, 2 }; |
VerifyLosses(kNumSentPackets, lost, arraysize(lost)); |
- EXPECT_EQ(clock_.Now().Add(srtt_.Multiply(1.25)), |
+ // The time has already advanced 1/4 an RTT, so ensure the timeout is set |
+ // 1.25 RTTs after the earliest pending packet(3), not the last(4). |
+ EXPECT_EQ(clock_.Now().Add(srtt_), |
loss_algorithm_.GetLossTimeout()); |
- clock_.AdvanceTime(srtt_.Multiply(1.25)); |
- QuicPacketSequenceNumber lost2[] = { 1, 2, 3, 4 }; |
+ clock_.AdvanceTime(srtt_); |
+ QuicPacketSequenceNumber lost2[] = { 1, 2, 3 }; |
VerifyLosses(kNumSentPackets, lost2, arraysize(lost2)); |
+ EXPECT_EQ(clock_.Now().Add(srtt_.Multiply(0.25)), |
+ loss_algorithm_.GetLossTimeout()); |
+ clock_.AdvanceTime(srtt_.Multiply(0.25)); |
+ QuicPacketSequenceNumber lost3[] = { 1, 2, 3, 4 }; |
+ VerifyLosses(kNumSentPackets, lost3, arraysize(lost3)); |
EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); |
} |