blob: 066a3b5d8edd1000ed39ec146cbd485679f7b598 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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
3// found in the LICENSE file.
4
5#include "net/third_party/quiche/src/quic/core/congestion_control/pacing_sender.h"
6
7#include <memory>
8
9#include "net/third_party/quiche/src/quic/core/quic_packets.h"
10#include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
11#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
12#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
13#include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h"
14#include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
15#include "net/third_party/quiche/src/quic/test_tools/mock_clock.h"
16#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
17
18using testing::_;
19using testing::AtMost;
20using testing::IsEmpty;
21using testing::Return;
22using testing::StrictMock;
23
24namespace quic {
25namespace test {
26
27const QuicByteCount kBytesInFlight = 1024;
28const int kInitialBurstPackets = 10;
29
30class PacingSenderTest : public QuicTest {
31 protected:
32 PacingSenderTest()
33 : zero_time_(QuicTime::Delta::Zero()),
34 infinite_time_(QuicTime::Delta::Infinite()),
35 packet_number_(1),
36 mock_sender_(new StrictMock<MockSendAlgorithm>()),
37 pacing_sender_(new PacingSender) {
38 pacing_sender_->set_sender(mock_sender_.get());
39 // Pick arbitrary time.
40 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(9));
41 }
42
43 ~PacingSenderTest() override {}
44
45 void InitPacingRate(QuicPacketCount burst_size, QuicBandwidth bandwidth) {
46 mock_sender_ = QuicMakeUnique<StrictMock<MockSendAlgorithm>>();
47 pacing_sender_ = QuicMakeUnique<PacingSender>();
48 pacing_sender_->set_sender(mock_sender_.get());
49 EXPECT_CALL(*mock_sender_, PacingRate(_)).WillRepeatedly(Return(bandwidth));
wub04a83592019-04-05 06:30:59 -070050 EXPECT_CALL(*mock_sender_, BandwidthEstimate())
51 .WillRepeatedly(Return(bandwidth));
QUICHE teama6ef0a62019-03-07 20:34:33 -050052 if (burst_size == 0) {
53 EXPECT_CALL(*mock_sender_, OnCongestionEvent(_, _, _, _, _));
54 LostPacketVector lost_packets;
dschinazi66dea072019-04-09 11:41:06 -070055 lost_packets.push_back(
56 LostPacket(QuicPacketNumber(1), kMaxOutgoingPacketSize));
QUICHE teama6ef0a62019-03-07 20:34:33 -050057 AckedPacketVector empty;
58 pacing_sender_->OnCongestionEvent(true, 1234, clock_.Now(), empty,
59 lost_packets);
60 } else if (burst_size != kInitialBurstPackets) {
61 QUIC_LOG(FATAL) << "Unsupported burst_size " << burst_size
62 << " specificied, only 0 and " << kInitialBurstPackets
63 << " are supported.";
64 }
65 }
66
67 void CheckPacketIsSentImmediately(HasRetransmittableData retransmittable_data,
68 QuicByteCount bytes_in_flight,
69 bool in_recovery,
70 bool cwnd_limited,
71 QuicPacketCount cwnd) {
72 // In order for the packet to be sendable, the underlying sender must
73 // permit it to be sent immediately.
74 for (int i = 0; i < 2; ++i) {
75 EXPECT_CALL(*mock_sender_, CanSend(bytes_in_flight))
76 .WillOnce(Return(true));
77 // Verify that the packet can be sent immediately.
78 EXPECT_EQ(zero_time_,
79 pacing_sender_->TimeUntilSend(clock_.Now(), bytes_in_flight));
80 }
81
82 // Actually send the packet.
83 if (bytes_in_flight == 0) {
84 EXPECT_CALL(*mock_sender_, InRecovery()).WillOnce(Return(in_recovery));
85 }
86 EXPECT_CALL(*mock_sender_,
87 OnPacketSent(clock_.Now(), bytes_in_flight, packet_number_,
dschinazi66dea072019-04-09 11:41:06 -070088 kMaxOutgoingPacketSize, retransmittable_data));
QUICHE teama6ef0a62019-03-07 20:34:33 -050089 EXPECT_CALL(*mock_sender_, GetCongestionWindow())
90 .Times(AtMost(1))
91 .WillRepeatedly(Return(cwnd * kDefaultTCPMSS));
dschinazi66dea072019-04-09 11:41:06 -070092 EXPECT_CALL(*mock_sender_,
93 CanSend(bytes_in_flight + kMaxOutgoingPacketSize))
QUICHE teama6ef0a62019-03-07 20:34:33 -050094 .Times(AtMost(1))
95 .WillRepeatedly(Return(!cwnd_limited));
96 pacing_sender_->OnPacketSent(clock_.Now(), bytes_in_flight,
dschinazi66dea072019-04-09 11:41:06 -070097 packet_number_++, kMaxOutgoingPacketSize,
QUICHE teama6ef0a62019-03-07 20:34:33 -050098 retransmittable_data);
99 }
100
101 void CheckPacketIsSentImmediately() {
102 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, kBytesInFlight,
103 false, false, 10);
104 }
105
106 void CheckPacketIsDelayed(QuicTime::Delta delay) {
107 // In order for the packet to be sendable, the underlying sender must
108 // permit it to be sent immediately.
109 for (int i = 0; i < 2; ++i) {
110 EXPECT_CALL(*mock_sender_, CanSend(kBytesInFlight))
111 .WillOnce(Return(true));
112 // Verify that the packet is delayed.
113 EXPECT_EQ(delay.ToMicroseconds(),
114 pacing_sender_->TimeUntilSend(clock_.Now(), kBytesInFlight)
115 .ToMicroseconds());
116 }
117 }
118
119 void UpdateRtt() {
120 EXPECT_CALL(*mock_sender_,
121 OnCongestionEvent(true, kBytesInFlight, _, _, _));
122 AckedPacketVector empty_acked;
123 LostPacketVector empty_lost;
124 pacing_sender_->OnCongestionEvent(true, kBytesInFlight, clock_.Now(),
125 empty_acked, empty_lost);
126 }
127
128 void OnApplicationLimited() { pacing_sender_->OnApplicationLimited(); }
129
130 const QuicTime::Delta zero_time_;
131 const QuicTime::Delta infinite_time_;
132 MockClock clock_;
133 QuicPacketNumber packet_number_;
134 std::unique_ptr<StrictMock<MockSendAlgorithm>> mock_sender_;
135 std::unique_ptr<PacingSender> pacing_sender_;
136};
137
138TEST_F(PacingSenderTest, NoSend) {
139 for (int i = 0; i < 2; ++i) {
140 EXPECT_CALL(*mock_sender_, CanSend(kBytesInFlight)).WillOnce(Return(false));
141 EXPECT_EQ(infinite_time_,
142 pacing_sender_->TimeUntilSend(clock_.Now(), kBytesInFlight));
143 }
144}
145
146TEST_F(PacingSenderTest, SendNow) {
147 for (int i = 0; i < 2; ++i) {
148 EXPECT_CALL(*mock_sender_, CanSend(kBytesInFlight)).WillOnce(Return(true));
149 EXPECT_EQ(zero_time_,
150 pacing_sender_->TimeUntilSend(clock_.Now(), kBytesInFlight));
151 }
152}
153
154TEST_F(PacingSenderTest, VariousSending) {
155 // Configure pacing rate of 1 packet per 1 ms, no initial burst.
dschinazi66dea072019-04-09 11:41:06 -0700156 InitPacingRate(
157 0, QuicBandwidth::FromBytesAndTimeDelta(
158 kMaxOutgoingPacketSize, QuicTime::Delta::FromMilliseconds(1)));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500159
160 // Now update the RTT and verify that packets are actually paced.
161 UpdateRtt();
162
163 CheckPacketIsSentImmediately();
164 CheckPacketIsSentImmediately();
165
166 // The first packet was a "make up", then we sent two packets "into the
167 // future", so the delay should be 2.
168 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
169
170 // Wake up on time.
171 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(2));
172 CheckPacketIsSentImmediately();
173 CheckPacketIsSentImmediately();
174 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
175
176 // Wake up late.
177 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(4));
178 CheckPacketIsSentImmediately();
179 CheckPacketIsSentImmediately();
180 CheckPacketIsSentImmediately();
181 CheckPacketIsSentImmediately();
182 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
183
184 // Wake up really late.
185 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(8));
186 CheckPacketIsSentImmediately();
187 CheckPacketIsSentImmediately();
188 CheckPacketIsSentImmediately();
189 CheckPacketIsSentImmediately();
190 CheckPacketIsSentImmediately();
191 CheckPacketIsSentImmediately();
192 CheckPacketIsSentImmediately();
193 CheckPacketIsSentImmediately();
194 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
195
196 // Wake up really late again, but application pause partway through.
197 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(8));
198 CheckPacketIsSentImmediately();
199 CheckPacketIsSentImmediately();
200 OnApplicationLimited();
201 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(100));
202 CheckPacketIsSentImmediately();
203 CheckPacketIsSentImmediately();
204 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
205 // Wake up early, but after enough time has passed to permit a send.
206 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1));
207 CheckPacketIsSentImmediately();
208}
209
210TEST_F(PacingSenderTest, InitialBurst) {
211 // Configure pacing rate of 1 packet per 1 ms.
dschinazi66dea072019-04-09 11:41:06 -0700212 InitPacingRate(
213 10, QuicBandwidth::FromBytesAndTimeDelta(
214 kMaxOutgoingPacketSize, QuicTime::Delta::FromMilliseconds(1)));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500215
216 // Update the RTT and verify that the first 10 packets aren't paced.
217 UpdateRtt();
218
219 // Send 10 packets, and verify that they are not paced.
220 for (int i = 0; i < kInitialBurstPackets; ++i) {
221 CheckPacketIsSentImmediately();
222 }
223
224 // The first packet was a "make up", then we sent two packets "into the
225 // future", so the delay should be 2ms.
226 CheckPacketIsSentImmediately();
227 CheckPacketIsSentImmediately();
228 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
229
230 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5));
231 CheckPacketIsSentImmediately();
232
233 // Next time TimeUntilSend is called with no bytes in flight, pacing should
234 // allow a packet to be sent, and when it's sent, the tokens are refilled.
235 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, false, false, 10);
236 for (int i = 0; i < kInitialBurstPackets - 1; ++i) {
237 CheckPacketIsSentImmediately();
238 }
239
240 // The first packet was a "make up", then we sent two packets "into the
241 // future", so the delay should be 2ms.
242 CheckPacketIsSentImmediately();
243 CheckPacketIsSentImmediately();
244 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
245}
246
247TEST_F(PacingSenderTest, InitialBurstNoRttMeasurement) {
248 // Configure pacing rate of 1 packet per 1 ms.
dschinazi66dea072019-04-09 11:41:06 -0700249 InitPacingRate(
250 10, QuicBandwidth::FromBytesAndTimeDelta(
251 kMaxOutgoingPacketSize, QuicTime::Delta::FromMilliseconds(1)));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500252
253 // Send 10 packets, and verify that they are not paced.
254 for (int i = 0; i < kInitialBurstPackets; ++i) {
255 CheckPacketIsSentImmediately();
256 }
257
258 // The first packet was a "make up", then we sent two packets "into the
259 // future", so the delay should be 2ms.
260 CheckPacketIsSentImmediately();
261 CheckPacketIsSentImmediately();
262 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
263
264 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5));
265 CheckPacketIsSentImmediately();
266
267 // Next time TimeUntilSend is called with no bytes in flight, the tokens
268 // should be refilled and there should be no delay.
269 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, false, false, 10);
270 // Send 10 packets, and verify that they are not paced.
271 for (int i = 0; i < kInitialBurstPackets - 1; ++i) {
272 CheckPacketIsSentImmediately();
273 }
274
275 // The first packet was a "make up", then we sent two packets "into the
276 // future", so the delay should be 2ms.
277 CheckPacketIsSentImmediately();
278 CheckPacketIsSentImmediately();
279 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
280}
281
282TEST_F(PacingSenderTest, FastSending) {
wub0a564aa2019-07-02 14:59:39 -0700283 SetQuicReloadableFlag(quic_change_default_lumpy_pacing_size_to_two, true);
284 // Ensure the pacing sender paces, even when the inter-packet spacing(0.5ms)
285 // is less than the pacing granularity(1ms).
dschinazi66dea072019-04-09 11:41:06 -0700286 InitPacingRate(10, QuicBandwidth::FromBytesAndTimeDelta(
287 2 * kMaxOutgoingPacketSize,
288 QuicTime::Delta::FromMilliseconds(1)));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500289 // Update the RTT and verify that the first 10 packets aren't paced.
290 UpdateRtt();
291
292 // Send 10 packets, and verify that they are not paced.
293 for (int i = 0; i < kInitialBurstPackets; ++i) {
294 CheckPacketIsSentImmediately();
295 }
296
wub0a564aa2019-07-02 14:59:39 -0700297 CheckPacketIsSentImmediately(); // Make up
298 CheckPacketIsSentImmediately(); // Lumpy token
299 CheckPacketIsSentImmediately(); // "In the future" but within granularity.
300 CheckPacketIsSentImmediately(); // Lumpy token
301 CheckPacketIsDelayed(QuicTime::Delta::FromMicroseconds(2000));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500302
303 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5));
304 CheckPacketIsSentImmediately();
305
306 // Next time TimeUntilSend is called with no bytes in flight, the tokens
307 // should be refilled and there should be no delay.
308 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, false, false, 10);
309 for (int i = 0; i < kInitialBurstPackets - 1; ++i) {
310 CheckPacketIsSentImmediately();
311 }
312
313 // The first packet was a "make up", then we sent two packets "into the
314 // future", so the delay should be 1.5ms.
wub0a564aa2019-07-02 14:59:39 -0700315 CheckPacketIsSentImmediately(); // Make up
316 CheckPacketIsSentImmediately(); // Lumpy token
317 CheckPacketIsSentImmediately(); // "In the future" but within granularity.
318 CheckPacketIsSentImmediately(); // Lumpy token
319 CheckPacketIsDelayed(QuicTime::Delta::FromMicroseconds(2000));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500320}
321
322TEST_F(PacingSenderTest, NoBurstEnteringRecovery) {
323 // Configure pacing rate of 1 packet per 1 ms with no burst tokens.
dschinazi66dea072019-04-09 11:41:06 -0700324 InitPacingRate(
325 0, QuicBandwidth::FromBytesAndTimeDelta(
326 kMaxOutgoingPacketSize, QuicTime::Delta::FromMilliseconds(1)));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500327 // Sending a packet will set burst tokens.
328 CheckPacketIsSentImmediately();
329
330 // Losing a packet will set clear burst tokens.
331 LostPacketVector lost_packets;
dschinazi66dea072019-04-09 11:41:06 -0700332 lost_packets.push_back(
333 LostPacket(QuicPacketNumber(1), kMaxOutgoingPacketSize));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500334 AckedPacketVector empty_acked;
335 EXPECT_CALL(*mock_sender_,
dschinazi66dea072019-04-09 11:41:06 -0700336 OnCongestionEvent(true, kMaxOutgoingPacketSize, _, IsEmpty(), _));
337 pacing_sender_->OnCongestionEvent(true, kMaxOutgoingPacketSize, clock_.Now(),
QUICHE teama6ef0a62019-03-07 20:34:33 -0500338 empty_acked, lost_packets);
339 // One packet is sent immediately, because of 1ms pacing granularity.
340 CheckPacketIsSentImmediately();
341 // Ensure packets are immediately paced.
342 EXPECT_CALL(*mock_sender_, CanSend(kDefaultTCPMSS)).WillOnce(Return(true));
343 // Verify the next packet is paced and delayed 2ms due to granularity.
344 EXPECT_EQ(QuicTime::Delta::FromMilliseconds(2),
345 pacing_sender_->TimeUntilSend(clock_.Now(), kDefaultTCPMSS));
346 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
347}
348
349TEST_F(PacingSenderTest, NoBurstInRecovery) {
350 // Configure pacing rate of 1 packet per 1 ms with no burst tokens.
dschinazi66dea072019-04-09 11:41:06 -0700351 InitPacingRate(
352 0, QuicBandwidth::FromBytesAndTimeDelta(
353 kMaxOutgoingPacketSize, QuicTime::Delta::FromMilliseconds(1)));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500354
355 UpdateRtt();
356
357 // Ensure only one packet is sent immediately and the rest are paced.
358 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, true, false, 10);
359 CheckPacketIsSentImmediately();
360 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
361}
362
363TEST_F(PacingSenderTest, CwndLimited) {
364 // Configure pacing rate of 1 packet per 1 ms, no initial burst.
dschinazi66dea072019-04-09 11:41:06 -0700365 InitPacingRate(
366 0, QuicBandwidth::FromBytesAndTimeDelta(
367 kMaxOutgoingPacketSize, QuicTime::Delta::FromMilliseconds(1)));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500368
369 UpdateRtt();
370
371 CheckPacketIsSentImmediately();
372 CheckPacketIsSentImmediately();
373 // Packet 3 will be delayed 2ms.
374 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
375
376 // Wake up on time.
377 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(2));
378 // After sending packet 3, cwnd is limited.
379 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, kBytesInFlight, false,
380 true, 10);
381
382 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(100));
383 // Verify pacing sender stops making up for lost time after sending packet 3.
384 // Packet 6 will be delayed 2ms.
385 CheckPacketIsSentImmediately();
386 CheckPacketIsSentImmediately();
387 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
388}
389
390TEST_F(PacingSenderTest, LumpyPacingWithInitialBurstToken) {
391 // Set lumpy size to be 3, and cwnd faction to 0.5
wub49855982019-05-01 14:16:26 -0700392 SetQuicFlag(FLAGS_quic_lumpy_pacing_size, 3);
393 SetQuicFlag(FLAGS_quic_lumpy_pacing_cwnd_fraction, 0.5f);
QUICHE teama6ef0a62019-03-07 20:34:33 -0500394 // Configure pacing rate of 1 packet per 1 ms.
dschinazi66dea072019-04-09 11:41:06 -0700395 InitPacingRate(
396 10, QuicBandwidth::FromBytesAndTimeDelta(
397 kMaxOutgoingPacketSize, QuicTime::Delta::FromMilliseconds(1)));
QUICHE teama6ef0a62019-03-07 20:34:33 -0500398 UpdateRtt();
399
400 // Send 10 packets, and verify that they are not paced.
401 for (int i = 0; i < kInitialBurstPackets; ++i) {
402 CheckPacketIsSentImmediately();
403 }
404
405 CheckPacketIsSentImmediately();
406 CheckPacketIsSentImmediately();
407 CheckPacketIsSentImmediately();
408 // Packet 14 will be delayed 3ms.
409 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(3));
410
411 // Wake up on time.
412 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(3));
413 CheckPacketIsSentImmediately();
414 CheckPacketIsSentImmediately();
415 CheckPacketIsSentImmediately();
416 // Packet 17 will be delayed 3ms.
417 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(3));
418
419 // Application throttles sending.
420 OnApplicationLimited();
421 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(100));
422 CheckPacketIsSentImmediately();
423 CheckPacketIsSentImmediately();
424 CheckPacketIsSentImmediately();
425 // Packet 20 will be delayed 3ms.
426 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(3));
427
428 // Wake up on time.
429 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(3));
430 CheckPacketIsSentImmediately();
431 // After sending packet 21, cwnd is limited.
432 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, kBytesInFlight, false,
433 true, 10);
434
435 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(100));
436 // Suppose cwnd size is 5, so that lumpy size becomes 2.
437 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, kBytesInFlight, false,
438 false, 5);
439 CheckPacketIsSentImmediately();
440 // Packet 24 will be delayed 2ms.
441 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
442}
443
wub04a83592019-04-05 06:30:59 -0700444TEST_F(PacingSenderTest, NoLumpyPacingForLowBandwidthFlows) {
445 // Set lumpy size to be 3, and cwnd faction to 0.5
wub49855982019-05-01 14:16:26 -0700446 SetQuicFlag(FLAGS_quic_lumpy_pacing_size, 3);
447 SetQuicFlag(FLAGS_quic_lumpy_pacing_cwnd_fraction, 0.5f);
wub04a83592019-04-05 06:30:59 -0700448
449 // Configure pacing rate of 1 packet per 100 ms.
450 QuicTime::Delta inter_packet_delay = QuicTime::Delta::FromMilliseconds(100);
dschinazi66dea072019-04-09 11:41:06 -0700451 InitPacingRate(kInitialBurstPackets,
452 QuicBandwidth::FromBytesAndTimeDelta(kMaxOutgoingPacketSize,
453 inter_packet_delay));
wub04a83592019-04-05 06:30:59 -0700454 UpdateRtt();
455
456 // Send kInitialBurstPackets packets, and verify that they are not paced.
457 for (int i = 0; i < kInitialBurstPackets; ++i) {
458 CheckPacketIsSentImmediately();
459 }
460
461 // The first packet after burst token exhausted is also sent immediately,
462 // because ideal_next_packet_send_time has not been set yet.
463 CheckPacketIsSentImmediately();
464
465 for (int i = 0; i < 200; ++i) {
466 CheckPacketIsDelayed(inter_packet_delay);
467 }
468}
469
QUICHE teama6ef0a62019-03-07 20:34:33 -0500470} // namespace test
471} // namespace quic