| 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);
|
|
|