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

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

Issue 1335443002: Landing Recent QUIC changes until 8/26/2015 19:47 UTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « net/quic/congestion_control/pacing_sender.cc ('k') | net/quic/congestion_control/tcp_cubic_sender_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/quic/congestion_control/pacing_sender.cc ('k') | net/quic/congestion_control/tcp_cubic_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698