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

Side by Side Diff: net/quic/congestion_control/pacing_sender_test.cc

Issue 2002103002: Implement a QUIC No PRR connection option, NPRR. Protected by FLAGS_quic_allow_no_prr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122422703
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/congestion_control/pacing_sender.h" 5 #include "net/quic/congestion_control/pacing_sender.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/quic/quic_protocol.h" 10 #include "net/quic/quic_protocol.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 292
293 // The first packet was a "make up", then we sent two packets "into the 293 // The first packet was a "make up", then we sent two packets "into the
294 // future", so the delay should be 1.5ms. 294 // future", so the delay should be 1.5ms.
295 CheckPacketIsSentImmediately(); 295 CheckPacketIsSentImmediately();
296 CheckPacketIsSentImmediately(); 296 CheckPacketIsSentImmediately();
297 CheckPacketIsSentImmediately(); 297 CheckPacketIsSentImmediately();
298 CheckPacketIsDelayed(QuicTime::Delta::FromMicroseconds(1500)); 298 CheckPacketIsDelayed(QuicTime::Delta::FromMicroseconds(1500));
299 } 299 }
300 300
301 TEST_F(PacingSenderTest, NoBurstEnteringRecovery) {
302 ValueRestore<bool> old_flag(&FLAGS_quic_allow_noprr, true);
303 // Configure pacing rate of 1 packet per 1 ms with no burst tokens.
304 InitPacingRate(0, QuicBandwidth::FromBytesAndTimeDelta(
305 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(1)));
306 // Sending a packet will set burst tokens.
307 CheckPacketIsSentImmediately();
308
309 // Losing a packet will set clear burst tokens.
310 SendAlgorithmInterface::CongestionVector lost_packets;
311 lost_packets.push_back(std::make_pair(1, kMaxPacketSize));
312 SendAlgorithmInterface::CongestionVector empty;
313 EXPECT_CALL(*mock_sender_,
314 OnCongestionEvent(true, kMaxPacketSize, empty, lost_packets));
315 pacing_sender_->OnCongestionEvent(true, kMaxPacketSize, empty, lost_packets);
316 // One packet is sent immediately, because of 1ms pacing granularity.
317 CheckPacketIsSentImmediately();
318 // Ensure packets are immediately paced.
319 EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), kDefaultTCPMSS))
320 .WillOnce(Return(zero_time_));
321 // Verify the next packet is paced and delayed 2ms due to granularity.
322 EXPECT_EQ(QuicTime::Delta::FromMilliseconds(2),
323 pacing_sender_->TimeUntilSend(clock_.Now(), kDefaultTCPMSS));
324 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
325 }
326
301 TEST_F(PacingSenderTest, NoBurstInRecovery) { 327 TEST_F(PacingSenderTest, NoBurstInRecovery) {
302 // Configure pacing rate of 1 packet per 1 ms with no burst tokens. 328 // Configure pacing rate of 1 packet per 1 ms with no burst tokens.
303 InitPacingRate(0, QuicBandwidth::FromBytesAndTimeDelta( 329 InitPacingRate(0, QuicBandwidth::FromBytesAndTimeDelta(
304 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(1))); 330 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(1)));
305 331
306 UpdateRtt(); 332 UpdateRtt();
307 333
308 // Ensure only one packet is sent immediately and the rest are paced. 334 // Ensure only one packet is sent immediately and the rest are paced.
309 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, true); 335 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, true);
310 CheckPacketIsSentImmediately(); 336 CheckPacketIsSentImmediately();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 EXPECT_CALL(*mock_sender_, GetSlowStartThreshold()).WillOnce(Return(kBytes)); 399 EXPECT_CALL(*mock_sender_, GetSlowStartThreshold()).WillOnce(Return(kBytes));
374 EXPECT_EQ(kBytes, pacing_sender_->GetSlowStartThreshold()); 400 EXPECT_EQ(kBytes, pacing_sender_->GetSlowStartThreshold());
375 401
376 EXPECT_CALL(*mock_sender_, GetCongestionControlType()) 402 EXPECT_CALL(*mock_sender_, GetCongestionControlType())
377 .WillOnce(Return(kReno)); 403 .WillOnce(Return(kReno));
378 EXPECT_EQ(kReno, pacing_sender_->GetCongestionControlType()); 404 EXPECT_EQ(kReno, pacing_sender_->GetCongestionControlType());
379 } 405 }
380 406
381 } // namespace test 407 } // namespace test
382 } // namespace net 408 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/pacing_sender.cc ('k') | net/quic/congestion_control/tcp_cubic_sender_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698