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

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

Issue 530343003: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0828
Patch Set: Created 6 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 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 "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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta( 142 .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta(
143 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2)))); 143 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2))));
144 144
145 // Send a whole pile of packets, and verify that they are not paced. 145 // Send a whole pile of packets, and verify that they are not paced.
146 for (int i = 0 ; i < 1000; ++i) { 146 for (int i = 0 ; i < 1000; ++i) {
147 CheckPacketIsSentImmediately(); 147 CheckPacketIsSentImmediately();
148 } 148 }
149 149
150 // Now update the RTT and verify that packets are actually paced. 150 // Now update the RTT and verify that packets are actually paced.
151 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _)); 151 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _));
152 SendAlgorithmInterface::CongestionMap empty_map; 152 SendAlgorithmInterface::CongestionVector empty_map;
153 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, empty_map); 153 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, empty_map);
154 154
155 CheckPacketIsSentImmediately(); 155 CheckPacketIsSentImmediately();
156 CheckPacketIsSentImmediately(); 156 CheckPacketIsSentImmediately();
157 CheckPacketIsSentImmediately(); 157 CheckPacketIsSentImmediately();
158 158
159 // The first packet was a "make up", then we sent two packets "into the 159 // The first packet was a "make up", then we sent two packets "into the
160 // future", so the delay should be 2. 160 // future", so the delay should be 2.
161 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); 161 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
162 162
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta( 217 .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta(
218 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2)))); 218 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2))));
219 219
220 // Send a whole pile of packets, and verify that they are not paced. 220 // Send a whole pile of packets, and verify that they are not paced.
221 for (int i = 0 ; i < 1000; ++i) { 221 for (int i = 0 ; i < 1000; ++i) {
222 CheckPacketIsSentImmediately(); 222 CheckPacketIsSentImmediately();
223 } 223 }
224 224
225 // Now update the RTT and verify that packets are actually paced. 225 // Now update the RTT and verify that packets are actually paced.
226 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _)); 226 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _));
227 SendAlgorithmInterface::CongestionMap empty_map; 227 SendAlgorithmInterface::CongestionVector empty_map;
228 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, empty_map); 228 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, empty_map);
229 229
230 CheckPacketIsSentImmediately(); 230 CheckPacketIsSentImmediately();
231 CheckPacketIsSentImmediately(); 231 CheckPacketIsSentImmediately();
232 232
233 // The first packet was a "make up", then we sent two packets "into the 233 // The first packet was a "make up", then we sent two packets "into the
234 // future", so the delay should be 2200us. 234 // future", so the delay should be 2200us.
235 CheckPacketIsDelayed(QuicTime::Delta::FromMicroseconds(2200)); 235 CheckPacketIsDelayed(QuicTime::Delta::FromMicroseconds(2200));
236 236
237 // Wake up on time. 237 // Wake up on time.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 EXPECT_CALL(*mock_sender_, InSlowStart()).WillRepeatedly(Return(true)); 285 EXPECT_CALL(*mock_sender_, InSlowStart()).WillRepeatedly(Return(true));
286 286
287 // Configure bandwith of 1 packet per 2 ms, for which the pacing rate 287 // Configure bandwith of 1 packet per 2 ms, for which the pacing rate
288 // will be 1 packet per 1 ms. 288 // will be 1 packet per 1 ms.
289 EXPECT_CALL(*mock_sender_, BandwidthEstimate()) 289 EXPECT_CALL(*mock_sender_, BandwidthEstimate())
290 .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta( 290 .WillRepeatedly(Return(QuicBandwidth::FromBytesAndTimeDelta(
291 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2)))); 291 kMaxPacketSize, QuicTime::Delta::FromMilliseconds(2))));
292 292
293 // Update the RTT and verify that the first 10 packets aren't paced. 293 // Update the RTT and verify that the first 10 packets aren't paced.
294 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _)); 294 EXPECT_CALL(*mock_sender_, OnCongestionEvent(true, kBytesInFlight, _, _));
295 SendAlgorithmInterface::CongestionMap empty_map; 295 SendAlgorithmInterface::CongestionVector empty_map;
296 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, empty_map); 296 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, empty_map, empty_map);
297 297
298 // Send 10 packets, and verify that they are not paced. 298 // Send 10 packets, and verify that they are not paced.
299 for (int i = 0 ; i < 10; ++i) { 299 for (int i = 0 ; i < 10; ++i) {
300 CheckPacketIsSentImmediately(); 300 CheckPacketIsSentImmediately();
301 } 301 }
302 302
303 CheckPacketIsSentImmediately(); 303 CheckPacketIsSentImmediately();
304 CheckPacketIsSentImmediately(); 304 CheckPacketIsSentImmediately();
305 CheckPacketIsSentImmediately(); 305 CheckPacketIsSentImmediately();
(...skipping 21 matching lines...) Expand all
327 327
328 CheckPacketIsSentImmediately(); 328 CheckPacketIsSentImmediately();
329 CheckPacketIsSentImmediately(); 329 CheckPacketIsSentImmediately();
330 CheckPacketIsSentImmediately(); 330 CheckPacketIsSentImmediately();
331 331
332 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); 332 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
333 } 333 }
334 334
335 } // namespace test 335 } // namespace test
336 } // namespace net 336 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/pacing_sender.cc ('k') | net/quic/congestion_control/send_algorithm_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698