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

Unified Diff: net/quic/core/congestion_control/general_loss_algorithm_test.cc

Issue 2403193003: Landing Recent QUIC changes until 9:41 AM, Oct 10, 2016 UTC-7 (Closed)
Patch Set: git cl format Created 4 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
Index: net/quic/core/congestion_control/general_loss_algorithm_test.cc
diff --git a/net/quic/core/congestion_control/general_loss_algorithm_test.cc b/net/quic/core/congestion_control/general_loss_algorithm_test.cc
index 107674dbdadf8f6ddefac3720d14e8bf64d5096f..0a0725ef82e16f9a04fdfb3626823f6186100d3f 100644
--- a/net/quic/core/congestion_control/general_loss_algorithm_test.cc
+++ b/net/quic/core/congestion_control/general_loss_algorithm_test.cc
@@ -232,6 +232,73 @@ TEST_F(GeneralLossAlgorithmTest, AlwaysLosePacketSent1RTTEarlier) {
VerifyLosses(2, lost, arraysize(lost));
}
+// NoFack loss detection tests.
+TEST_F(GeneralLossAlgorithmTest, LazyFackNackRetransmit1Packet) {
+ loss_algorithm_.SetLossDetectionType(kLazyFack);
+ const size_t kNumSentPackets = 5;
+ // Transmit 5 packets.
+ for (size_t i = 1; i <= kNumSentPackets; ++i) {
+ SendDataPacket(i);
+ }
+ // No loss on one ack.
+ unacked_packets_.RemoveFromInFlight(2);
+ VerifyLosses(2, nullptr, 0);
+ // No loss on two acks.
+ unacked_packets_.RemoveFromInFlight(3);
+ VerifyLosses(3, nullptr, 0);
+ // Loss on three acks.
+ unacked_packets_.RemoveFromInFlight(4);
+ QuicPacketNumber lost[] = {1};
+ VerifyLosses(4, lost, arraysize(lost));
+ EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout());
+}
+
+// A stretch ack is an ack that covers more than 1 packet of previously
+// unacknowledged data.
+TEST_F(GeneralLossAlgorithmTest,
+ LazyFackNoNackRetransmit1PacketWith1StretchAck) {
+ loss_algorithm_.SetLossDetectionType(kLazyFack);
+ const size_t kNumSentPackets = 10;
+ // Transmit 10 packets.
+ for (size_t i = 1; i <= kNumSentPackets; ++i) {
+ SendDataPacket(i);
+ }
+
+ // Nack the first packet 3 times in a single StretchAck.
+ unacked_packets_.RemoveFromInFlight(2);
+ unacked_packets_.RemoveFromInFlight(3);
+ unacked_packets_.RemoveFromInFlight(4);
+ VerifyLosses(4, nullptr, 0);
+ // The timer isn't set because we expect more acks.
+ EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout());
+ // Process another ack and then packet 1 will be lost.
+ unacked_packets_.RemoveFromInFlight(5);
+ QuicPacketNumber lost[] = {1};
+ VerifyLosses(5, lost, arraysize(lost));
+ EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout());
+}
+
+// Ack a packet 3 packets ahead does not cause a retransmit.
+TEST_F(GeneralLossAlgorithmTest, LazyFackNackRetransmit1PacketSingleAck) {
+ loss_algorithm_.SetLossDetectionType(kLazyFack);
+ const size_t kNumSentPackets = 10;
+ // Transmit 10 packets.
+ for (size_t i = 1; i <= kNumSentPackets; ++i) {
+ SendDataPacket(i);
+ }
+
+ // Nack the first packet 3 times in an AckFrame with three missing packets.
+ unacked_packets_.RemoveFromInFlight(4);
+ VerifyLosses(4, nullptr, 0);
+ // The timer isn't set because we expect more acks.
+ EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout());
+ // Process another ack and then packet 1 and 2 will be lost.
+ unacked_packets_.RemoveFromInFlight(5);
+ QuicPacketNumber lost[] = {1, 2};
+ VerifyLosses(5, lost, arraysize(lost));
+ EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout());
+}
+
// Time-based loss detection tests.
TEST_F(GeneralLossAlgorithmTest, NoLossFor500Nacks) {
loss_algorithm_.SetLossDetectionType(kTime);
« no previous file with comments | « net/quic/core/congestion_control/general_loss_algorithm.cc ('k') | net/quic/core/congestion_control/rtt_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698