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

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

Issue 447083002: Default socket receive buffer to 256K bytes and remove unnecessary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Include_socket_receive_buffer_72334240
Patch Set: Created 6 years, 4 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
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
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/congestion_control/rtt_stats.h" 9 #include "net/quic/congestion_control/rtt_stats.h"
10 #include "net/quic/congestion_control/tcp_cubic_sender.h" 10 #include "net/quic/congestion_control/tcp_cubic_sender.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 MockClock clock_; 124 MockClock clock_;
125 scoped_ptr<TcpCubicSenderPeer> sender_; 125 scoped_ptr<TcpCubicSenderPeer> sender_;
126 scoped_ptr<TcpReceiver> receiver_; 126 scoped_ptr<TcpReceiver> receiver_;
127 QuicPacketSequenceNumber sequence_number_; 127 QuicPacketSequenceNumber sequence_number_;
128 QuicPacketSequenceNumber acked_sequence_number_; 128 QuicPacketSequenceNumber acked_sequence_number_;
129 QuicByteCount bytes_in_flight_; 129 QuicByteCount bytes_in_flight_;
130 TransmissionInfo standard_packet_; 130 TransmissionInfo standard_packet_;
131 }; 131 };
132 132
133 TEST_F(TcpCubicSenderTest, SimpleSender) { 133 TEST_F(TcpCubicSenderTest, SimpleSender) {
134 QuicCongestionFeedbackFrame feedback;
135 // At startup make sure we are at the default. 134 // At startup make sure we are at the default.
136 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); 135 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
137 // At startup make sure we can send. 136 // At startup make sure we can send.
138 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 137 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
139 0, 138 0,
140 HAS_RETRANSMITTABLE_DATA).IsZero()); 139 HAS_RETRANSMITTABLE_DATA).IsZero());
141 // Get default QuicCongestionFeedbackFrame from receiver.
142 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
143 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
144 // Make sure we can send. 140 // Make sure we can send.
145 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 141 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
146 0, 142 0,
147 HAS_RETRANSMITTABLE_DATA).IsZero()); 143 HAS_RETRANSMITTABLE_DATA).IsZero());
148 // And that window is un-affected. 144 // And that window is un-affected.
149 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); 145 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
150 146
151 // Fill the send window with data, then verify that we can't send. 147 // Fill the send window with data, then verify that we can't send.
152 SendAvailableSendWindow(); 148 SendAvailableSendWindow();
153 EXPECT_FALSE(sender_->TimeUntilSend(clock_.Now(), 149 EXPECT_FALSE(sender_->TimeUntilSend(clock_.Now(),
154 sender_->GetCongestionWindow(), 150 sender_->GetCongestionWindow(),
155 HAS_RETRANSMITTABLE_DATA).IsZero()); 151 HAS_RETRANSMITTABLE_DATA).IsZero());
156 } 152 }
157 153
158 TEST_F(TcpCubicSenderTest, ApplicationLimitedSlowStart) { 154 TEST_F(TcpCubicSenderTest, ApplicationLimitedSlowStart) {
159 // Send exactly 10 packets and ensure the CWND ends at 14 packets. 155 // Send exactly 10 packets and ensure the CWND ends at 14 packets.
160 const int kNumberOfAcks = 5; 156 const int kNumberOfAcks = 5;
161 QuicCongestionFeedbackFrame feedback;
162 // At startup make sure we can send. 157 // At startup make sure we can send.
163 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 158 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
164 0, 159 0,
165 HAS_RETRANSMITTABLE_DATA).IsZero()); 160 HAS_RETRANSMITTABLE_DATA).IsZero());
166 // Get default QuicCongestionFeedbackFrame from receiver.
167 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
168 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
169 // Make sure we can send. 161 // Make sure we can send.
170 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 162 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
171 0, 163 0,
172 HAS_RETRANSMITTABLE_DATA).IsZero()); 164 HAS_RETRANSMITTABLE_DATA).IsZero());
173 165
174 SendAvailableSendWindow(); 166 SendAvailableSendWindow();
175 for (int i = 0; i < kNumberOfAcks; ++i) { 167 for (int i = 0; i < kNumberOfAcks; ++i) {
176 AckNPackets(2); 168 AckNPackets(2);
177 } 169 }
178 QuicByteCount bytes_to_send = sender_->SendWindow(); 170 QuicByteCount bytes_to_send = sender_->SendWindow();
179 // It's expected 2 acks will arrive when the bytes_in_flight are greater than 171 // It's expected 2 acks will arrive when the bytes_in_flight are greater than
180 // half the CWND. 172 // half the CWND.
181 EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * 2, 173 EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * 2,
182 bytes_to_send); 174 bytes_to_send);
183 } 175 }
184 176
185 TEST_F(TcpCubicSenderTest, ExponentialSlowStart) { 177 TEST_F(TcpCubicSenderTest, ExponentialSlowStart) {
186 const int kNumberOfAcks = 20; 178 const int kNumberOfAcks = 20;
187 QuicCongestionFeedbackFrame feedback;
188 // At startup make sure we can send. 179 // At startup make sure we can send.
189 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 180 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
190 0, 181 0,
191 HAS_RETRANSMITTABLE_DATA).IsZero()); 182 HAS_RETRANSMITTABLE_DATA).IsZero());
192 // Get default QuicCongestionFeedbackFrame from receiver.
193 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
194 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
195 // Make sure we can send. 183 // Make sure we can send.
196 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 184 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
197 0, 185 0,
198 HAS_RETRANSMITTABLE_DATA).IsZero()); 186 HAS_RETRANSMITTABLE_DATA).IsZero());
199 187
200 for (int i = 0; i < kNumberOfAcks; ++i) { 188 for (int i = 0; i < kNumberOfAcks; ++i) {
201 // Send our full send window. 189 // Send our full send window.
202 SendAvailableSendWindow(); 190 SendAvailableSendWindow();
203 AckNPackets(2); 191 AckNPackets(2);
204 } 192 }
205 QuicByteCount bytes_to_send = sender_->SendWindow(); 193 QuicByteCount bytes_to_send = sender_->SendWindow();
206 EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * kNumberOfAcks, 194 EXPECT_EQ(kDefaultWindowTCP + kDefaultTCPMSS * 2 * kNumberOfAcks,
207 bytes_to_send); 195 bytes_to_send);
208 } 196 }
209 197
210 TEST_F(TcpCubicSenderTest, SlowStartAckTrain) { 198 TEST_F(TcpCubicSenderTest, SlowStartAckTrain) {
211 EXPECT_EQ(kDefaultMaxCongestionWindowTCP * kDefaultTCPMSS, 199 EXPECT_EQ(kDefaultMaxCongestionWindowTCP * kDefaultTCPMSS,
212 sender_->GetSlowStartThreshold()); 200 sender_->GetSlowStartThreshold());
213 201
214 // Make sure that we fall out of slow start when we send ACK train longer 202 // Make sure that we fall out of slow start when we send ACK train longer
215 // than half the RTT, in this test case 30ms, which is more than 30 calls to 203 // than half the RTT, in this test case 30ms, which is more than 30 calls to
216 // Ack2Packets in one round. 204 // Ack2Packets in one round.
217 // Since we start at 10 packet first round will be 5 second round 10 etc 205 // Since we start at 10 packet first round will be 5 second round 10 etc
218 // Hence we should pass 30 at 65 = 5 + 10 + 20 + 30 206 // Hence we should pass 30 at 65 = 5 + 10 + 20 + 30
219 const int kNumberOfAcks = 65; 207 const int kNumberOfAcks = 65;
220 QuicCongestionFeedbackFrame feedback;
221 // Get default QuicCongestionFeedbackFrame from receiver.
222 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
223 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
224
225 for (int i = 0; i < kNumberOfAcks; ++i) { 208 for (int i = 0; i < kNumberOfAcks; ++i) {
226 // Send our full send window. 209 // Send our full send window.
227 SendAvailableSendWindow(); 210 SendAvailableSendWindow();
228 AckNPackets(2); 211 AckNPackets(2);
229 } 212 }
230 QuicByteCount expected_send_window = 213 QuicByteCount expected_send_window =
231 kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks); 214 kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks);
232 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 215 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
233 216
234 // We should now have fallen out of slow start. 217 // We should now have fallen out of slow start.
(...skipping 21 matching lines...) Expand all
256 EXPECT_EQ(expected_send_window / 2 / kDefaultTCPMSS, 239 EXPECT_EQ(expected_send_window / 2 / kDefaultTCPMSS,
257 sender_->slowstart_threshold()); 240 sender_->slowstart_threshold());
258 241
259 // Now revert the RTO and ensure the CWND and slowstart threshold revert. 242 // Now revert the RTO and ensure the CWND and slowstart threshold revert.
260 sender_->RevertRetransmissionTimeout(); 243 sender_->RevertRetransmissionTimeout();
261 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 244 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
262 EXPECT_EQ(140u, sender_->slowstart_threshold()); 245 EXPECT_EQ(140u, sender_->slowstart_threshold());
263 } 246 }
264 247
265 TEST_F(TcpCubicSenderTest, SlowStartPacketLoss) { 248 TEST_F(TcpCubicSenderTest, SlowStartPacketLoss) {
266 // Make sure that we fall out of slow start when we encounter a packet loss.
267 QuicCongestionFeedbackFrame feedback;
268 // Get default QuicCongestionFeedbackFrame from receiver.
269 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
270 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
271
272 const int kNumberOfAcks = 10; 249 const int kNumberOfAcks = 10;
273 for (int i = 0; i < kNumberOfAcks; ++i) { 250 for (int i = 0; i < kNumberOfAcks; ++i) {
274 // Send our full send window. 251 // Send our full send window.
275 SendAvailableSendWindow(); 252 SendAvailableSendWindow();
276 AckNPackets(2); 253 AckNPackets(2);
277 } 254 }
278 SendAvailableSendWindow(); 255 SendAvailableSendWindow();
279 QuicByteCount expected_send_window = kDefaultWindowTCP + 256 QuicByteCount expected_send_window = kDefaultWindowTCP +
280 (kDefaultTCPMSS * 2 * kNumberOfAcks); 257 (kDefaultTCPMSS * 2 * kNumberOfAcks);
281 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 258 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 290 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
314 291
315 // Now RTO and ensure slow start gets reset. 292 // Now RTO and ensure slow start gets reset.
316 EXPECT_TRUE(sender_->hybrid_slow_start().started()); 293 EXPECT_TRUE(sender_->hybrid_slow_start().started());
317 sender_->OnRetransmissionTimeout(true); 294 sender_->OnRetransmissionTimeout(true);
318 EXPECT_FALSE(sender_->hybrid_slow_start().started()); 295 EXPECT_FALSE(sender_->hybrid_slow_start().started());
319 } 296 }
320 297
321 TEST_F(TcpCubicSenderTest, SlowStartPacketLossPRR) { 298 TEST_F(TcpCubicSenderTest, SlowStartPacketLossPRR) {
322 // Test based on the first example in RFC6937. 299 // Test based on the first example in RFC6937.
323 // Make sure that we fall out of slow start when we encounter a packet loss.
324 QuicCongestionFeedbackFrame feedback;
325 // Get default QuicCongestionFeedbackFrame from receiver.
326 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
327 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
328
329 // Ack 10 packets in 5 acks to raise the CWND to 20, as in the example. 300 // Ack 10 packets in 5 acks to raise the CWND to 20, as in the example.
330 const int kNumberOfAcks = 5; 301 const int kNumberOfAcks = 5;
331 for (int i = 0; i < kNumberOfAcks; ++i) { 302 for (int i = 0; i < kNumberOfAcks; ++i) {
332 // Send our full send window. 303 // Send our full send window.
333 SendAvailableSendWindow(); 304 SendAvailableSendWindow();
334 AckNPackets(2); 305 AckNPackets(2);
335 } 306 }
336 SendAvailableSendWindow(); 307 SendAvailableSendWindow();
337 QuicByteCount expected_send_window = kDefaultWindowTCP + 308 QuicByteCount expected_send_window = kDefaultWindowTCP +
338 (kDefaultTCPMSS * 2 * kNumberOfAcks); 309 (kDefaultTCPMSS * 2 * kNumberOfAcks);
(...skipping 30 matching lines...) Expand all
369 340
370 AckNPackets(1); 341 AckNPackets(1);
371 expected_send_window += kDefaultTCPMSS; 342 expected_send_window += kDefaultTCPMSS;
372 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 343 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
373 } 344 }
374 345
375 TEST_F(TcpCubicSenderTest, SlowStartBurstPacketLossPRR) { 346 TEST_F(TcpCubicSenderTest, SlowStartBurstPacketLossPRR) {
376 // Test based on the second example in RFC6937, though we also implement 347 // Test based on the second example in RFC6937, though we also implement
377 // forward acknowledgements, so the first two incoming acks will trigger 348 // forward acknowledgements, so the first two incoming acks will trigger
378 // PRR immediately. 349 // PRR immediately.
379 // Make sure that we fall out of slow start when we encounter a packet loss.
380 QuicCongestionFeedbackFrame feedback;
381 // Get default QuicCongestionFeedbackFrame from receiver.
382 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
383 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
384
385 // Ack 10 packets in 5 acks to raise the CWND to 20, as in the example. 350 // Ack 10 packets in 5 acks to raise the CWND to 20, as in the example.
386 const int kNumberOfAcks = 5; 351 const int kNumberOfAcks = 5;
387 for (int i = 0; i < kNumberOfAcks; ++i) { 352 for (int i = 0; i < kNumberOfAcks; ++i) {
388 // Send our full send window. 353 // Send our full send window.
389 SendAvailableSendWindow(); 354 SendAvailableSendWindow();
390 AckNPackets(2); 355 AckNPackets(2);
391 } 356 }
392 SendAvailableSendWindow(); 357 SendAvailableSendWindow();
393 QuicByteCount expected_send_window = kDefaultWindowTCP + 358 QuicByteCount expected_send_window = kDefaultWindowTCP +
394 (kDefaultTCPMSS * 2 * kNumberOfAcks); 359 (kDefaultTCPMSS * 2 * kNumberOfAcks);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 sender_->rtt_stats_.SmoothedRtt().ToMicroseconds()), 465 sender_->rtt_stats_.SmoothedRtt().ToMicroseconds()),
501 sender_->BandwidthEstimate().ToBytesPerSecond()); 466 sender_->BandwidthEstimate().ToBytesPerSecond());
502 } 467 }
503 468
504 TEST_F(TcpCubicSenderTest, SlowStartMaxSendWindow) { 469 TEST_F(TcpCubicSenderTest, SlowStartMaxSendWindow) {
505 const QuicTcpCongestionWindow kMaxCongestionWindowTCP = 50; 470 const QuicTcpCongestionWindow kMaxCongestionWindowTCP = 50;
506 const int kNumberOfAcks = 100; 471 const int kNumberOfAcks = 100;
507 sender_.reset( 472 sender_.reset(
508 new TcpCubicSenderPeer(&clock_, false, kMaxCongestionWindowTCP)); 473 new TcpCubicSenderPeer(&clock_, false, kMaxCongestionWindowTCP));
509 474
510 QuicCongestionFeedbackFrame feedback;
511 // Get default QuicCongestionFeedbackFrame from receiver.
512 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
513 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
514
515 for (int i = 0; i < kNumberOfAcks; ++i) { 475 for (int i = 0; i < kNumberOfAcks; ++i) {
516 // Send our full send window. 476 // Send our full send window.
517 SendAvailableSendWindow(); 477 SendAvailableSendWindow();
518 AckNPackets(2); 478 AckNPackets(2);
519 } 479 }
520 QuicByteCount expected_send_window = 480 QuicByteCount expected_send_window =
521 kMaxCongestionWindowTCP * kDefaultTCPMSS; 481 kMaxCongestionWindowTCP * kDefaultTCPMSS;
522 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 482 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
523 } 483 }
524 484
525 TEST_F(TcpCubicSenderTest, TcpRenoMaxCongestionWindow) { 485 TEST_F(TcpCubicSenderTest, TcpRenoMaxCongestionWindow) {
526 const QuicTcpCongestionWindow kMaxCongestionWindowTCP = 50; 486 const QuicTcpCongestionWindow kMaxCongestionWindowTCP = 50;
527 const int kNumberOfAcks = 1000; 487 const int kNumberOfAcks = 1000;
528 sender_.reset( 488 sender_.reset(
529 new TcpCubicSenderPeer(&clock_, true, kMaxCongestionWindowTCP)); 489 new TcpCubicSenderPeer(&clock_, true, kMaxCongestionWindowTCP));
530 490
531 QuicCongestionFeedbackFrame feedback;
532 // Get default QuicCongestionFeedbackFrame from receiver.
533 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
534 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
535
536 SendAvailableSendWindow(); 491 SendAvailableSendWindow();
537 AckNPackets(2); 492 AckNPackets(2);
538 // Make sure we fall out of slow start. 493 // Make sure we fall out of slow start.
539 LoseNPackets(1); 494 LoseNPackets(1);
540 495
541 for (int i = 0; i < kNumberOfAcks; ++i) { 496 for (int i = 0; i < kNumberOfAcks; ++i) {
542 // Send our full send window. 497 // Send our full send window.
543 SendAvailableSendWindow(); 498 SendAvailableSendWindow();
544 AckNPackets(2); 499 AckNPackets(2);
545 } 500 }
546 501
547 QuicByteCount expected_send_window = 502 QuicByteCount expected_send_window =
548 kMaxCongestionWindowTCP * kDefaultTCPMSS; 503 kMaxCongestionWindowTCP * kDefaultTCPMSS;
549 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 504 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
550 } 505 }
551 506
552 TEST_F(TcpCubicSenderTest, TcpCubicMaxCongestionWindow) { 507 TEST_F(TcpCubicSenderTest, TcpCubicMaxCongestionWindow) {
553 const QuicTcpCongestionWindow kMaxCongestionWindowTCP = 50; 508 const QuicTcpCongestionWindow kMaxCongestionWindowTCP = 50;
554 // Set to 10000 to compensate for small cubic alpha. 509 // Set to 10000 to compensate for small cubic alpha.
555 const int kNumberOfAcks = 10000; 510 const int kNumberOfAcks = 10000;
556 511
557 sender_.reset( 512 sender_.reset(
558 new TcpCubicSenderPeer(&clock_, false, kMaxCongestionWindowTCP)); 513 new TcpCubicSenderPeer(&clock_, false, kMaxCongestionWindowTCP));
559 514
560 QuicCongestionFeedbackFrame feedback;
561 // Get default QuicCongestionFeedbackFrame from receiver.
562 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
563 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
564
565 SendAvailableSendWindow(); 515 SendAvailableSendWindow();
566 AckNPackets(2); 516 AckNPackets(2);
567 // Make sure we fall out of slow start. 517 // Make sure we fall out of slow start.
568 LoseNPackets(1); 518 LoseNPackets(1);
569 519
570 for (int i = 0; i < kNumberOfAcks; ++i) { 520 for (int i = 0; i < kNumberOfAcks; ++i) {
571 // Send our full send window. 521 // Send our full send window.
572 SendAvailableSendWindow(); 522 SendAvailableSendWindow();
573 AckNPackets(2); 523 AckNPackets(2);
574 } 524 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // Verify that kCOPT: kIW10 forces the congestion window to the 567 // Verify that kCOPT: kIW10 forces the congestion window to the
618 // default of 10 regardless of ReceivedInitialWindow. 568 // default of 10 regardless of ReceivedInitialWindow.
619 QuicTagVector options; 569 QuicTagVector options;
620 options.push_back(kIW10); 570 options.push_back(kIW10);
621 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 571 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
622 sender_->SetFromConfig(config, true); 572 sender_->SetFromConfig(config, true);
623 EXPECT_EQ(congestion_window, sender_->congestion_window()); 573 EXPECT_EQ(congestion_window, sender_->congestion_window());
624 } 574 }
625 575
626 TEST_F(TcpCubicSenderTest, CongestionAvoidanceAtEndOfRecovery) { 576 TEST_F(TcpCubicSenderTest, CongestionAvoidanceAtEndOfRecovery) {
627 // Make sure that we fall out of slow start when we encounter a packet loss.
628 QuicCongestionFeedbackFrame feedback;
629 // Get default QuicCongestionFeedbackFrame from receiver.
630 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
631 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now());
632 // Ack 10 packets in 5 acks to raise the CWND to 20. 577 // Ack 10 packets in 5 acks to raise the CWND to 20.
633 const int kNumberOfAcks = 5; 578 const int kNumberOfAcks = 5;
634 for (int i = 0; i < kNumberOfAcks; ++i) { 579 for (int i = 0; i < kNumberOfAcks; ++i) {
635 // Send our full send window. 580 // Send our full send window.
636 SendAvailableSendWindow(); 581 SendAvailableSendWindow();
637 AckNPackets(2); 582 AckNPackets(2);
638 } 583 }
639 SendAvailableSendWindow(); 584 SendAvailableSendWindow();
640 QuicByteCount expected_send_window = kDefaultWindowTCP + 585 QuicByteCount expected_send_window = kDefaultWindowTCP +
641 (kDefaultTCPMSS * 2 * kNumberOfAcks); 586 (kDefaultTCPMSS * 2 * kNumberOfAcks);
(...skipping 24 matching lines...) Expand all
666 } 611 }
667 612
668 // Next ack should cause congestion window to grow by 1MSS. 613 // Next ack should cause congestion window to grow by 1MSS.
669 AckNPackets(2); 614 AckNPackets(2);
670 expected_send_window += kDefaultTCPMSS; 615 expected_send_window += kDefaultTCPMSS;
671 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 616 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
672 } 617 }
673 618
674 } // namespace test 619 } // namespace test
675 } // namespace net 620 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698