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

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

Issue 397513002: Fix a newly introduced bug in QUIC's PacingSender where burst_tokens_ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/congestion_control/pacing_sender.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "net/quic/quic_protocol.h" 9 #include "net/quic/quic_protocol.h"
10 #include "net/quic/test_tools/mock_clock.h" 10 #include "net/quic/test_tools/mock_clock.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 CheckPacketIsSentImmediately(); 230 CheckPacketIsSentImmediately();
231 CheckPacketIsSentImmediately(); 231 CheckPacketIsSentImmediately();
232 CheckPacketIsSentImmediately(); 232 CheckPacketIsSentImmediately();
233 233
234 // The first packet was a "make up", then we sent two packets "into the 234 // The first packet was a "make up", then we sent two packets "into the
235 // future", so the delay should be 2. 235 // future", so the delay should be 2.
236 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); 236 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
237 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5)); 237 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5));
238 CheckPacketIsSentImmediately(); 238 CheckPacketIsSentImmediately();
239 239
240 // Now reduce bytes in flight back to 0 by and ensure another burst of 10 can 240 // Next time TimeUntilSend is called with no bytes in flight, the tokens
241 // be sent. 241 // should be refilled and there should be no delay.
242 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, 0, _, _)); 242 EXPECT_CALL(*mock_sender_,
243 pacing_sender_->OnCongestionEvent(true, 0, empty_map, empty_map); 243 TimeUntilSend(clock_.Now(),
244 0,
245 HAS_RETRANSMITTABLE_DATA)).
246 WillOnce(Return(zero_time_));
247 EXPECT_EQ(zero_time_,
248 pacing_sender_->TimeUntilSend(clock_.Now(),
249 0,
250 HAS_RETRANSMITTABLE_DATA));
244 for (int i = 0 ; i < 10; ++i) { 251 for (int i = 0 ; i < 10; ++i) {
245 CheckPacketIsSentImmediately(); 252 CheckPacketIsSentImmediately();
246 } 253 }
247 254
248 CheckPacketIsSentImmediately(); 255 CheckPacketIsSentImmediately();
249 CheckPacketIsSentImmediately(); 256 CheckPacketIsSentImmediately();
250 CheckPacketIsSentImmediately(); 257 CheckPacketIsSentImmediately();
251 258
252 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); 259 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
253 } 260 }
254 261
255 } // namespace test 262 } // namespace test
256 } // namespace net 263 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/pacing_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698