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

Unified Diff: net/quic/congestion_control/tcp_loss_algorithm_test.cc

Issue 188153003: Test only change to QUIC TCPLossAlgorithmTest to ensure the early (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698