Index: net/quic/congestion_control/pacing_sender_test.cc |
diff --git a/net/quic/congestion_control/pacing_sender_test.cc b/net/quic/congestion_control/pacing_sender_test.cc |
index 25ca2a7c1b8d993f86d3225915058a648d398309..cf069efe8066103f81b19a8a4bfb2256543640b9 100644 |
--- a/net/quic/congestion_control/pacing_sender_test.cc |
+++ b/net/quic/congestion_control/pacing_sender_test.cc |
@@ -46,7 +46,8 @@ class PacingSenderTest : public ::testing::Test { |
} |
void CheckPacketIsSentImmediately(HasRetransmittableData retransmittable_data, |
- QuicByteCount bytes_in_flight) { |
+ QuicByteCount bytes_in_flight, |
+ bool in_recovery) { |
// In order for the packet to be sendable, the underlying sender must |
// permit it to be sent immediately. |
for (int i = 0; i < 2; ++i) { |
@@ -60,6 +61,9 @@ class PacingSenderTest : public ::testing::Test { |
} |
// Actually send the packet. |
+ if (bytes_in_flight == 0) { |
+ EXPECT_CALL(*mock_sender_, InRecovery()).WillOnce(Return(in_recovery)); |
+ } |
EXPECT_CALL(*mock_sender_, |
OnPacketSent(clock_.Now(), bytes_in_flight, packet_number_, |
kMaxPacketSize, retransmittable_data)); |
@@ -69,11 +73,13 @@ class PacingSenderTest : public ::testing::Test { |
} |
void CheckPacketIsSentImmediately() { |
- CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, kBytesInFlight); |
+ CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, kBytesInFlight, |
+ false); |
} |
void CheckAckIsSentImmediately() { |
- CheckPacketIsSentImmediately(NO_RETRANSMITTABLE_DATA, kBytesInFlight); |
+ CheckPacketIsSentImmediately(NO_RETRANSMITTABLE_DATA, kBytesInFlight, |
+ false); |
} |
void CheckPacketIsDelayed(QuicTime::Delta delay) { |
@@ -220,7 +226,7 @@ TEST_F(PacingSenderTest, InitialBurst) { |
// Next time TimeUntilSend is called with no bytes in flight, pacing should |
// allow a packet to be sent, and when it's sent, the tokens are refilled. |
- CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0); |
+ CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, false); |
for (int i = 0; i < kInitialBurstPackets - 1; ++i) { |
CheckPacketIsSentImmediately(); |
} |
@@ -256,7 +262,7 @@ TEST_F(PacingSenderTest, InitialBurstNoRttMeasurement) { |
// Next time TimeUntilSend is called with no bytes in flight, the tokens |
// should be refilled and there should be no delay. |
- CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0); |
+ CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, false); |
// Send 10 packets, and verify that they are not paced. |
for (int i = 0; i < kInitialBurstPackets - 1; ++i) { |
CheckPacketIsSentImmediately(); |
@@ -298,7 +304,7 @@ TEST_F(PacingSenderTest, FastSending) { |
// Next time TimeUntilSend is called with no bytes in flight, the tokens |
// should be refilled and there should be no delay. |
- CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0); |
+ CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, false); |
for (int i = 0; i < kInitialBurstPackets - 1; ++i) { |
CheckPacketIsSentImmediately(); |
} |
@@ -311,5 +317,18 @@ TEST_F(PacingSenderTest, FastSending) { |
CheckPacketIsDelayed(QuicTime::Delta::FromMicroseconds(1500)); |
} |
+TEST_F(PacingSenderTest, NoBurstInRecovery) { |
+ // Configure pacing rate of 1 packet per 1 ms with no burst tokens. |
+ InitPacingRate(0, QuicBandwidth::FromBytesAndTimeDelta( |
+ kMaxPacketSize, QuicTime::Delta::FromMilliseconds(1))); |
+ |
+ UpdateRtt(); |
+ |
+ // Ensure only one packet is sent immediately and the rest are paced. |
+ CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, true); |
+ CheckPacketIsSentImmediately(); |
+ CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); |
+} |
+ |
} // namespace test |
} // namespace net |