OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/core/congestion_control/bbr_sender.h" | 5 #include "net/quic/core/congestion_control/bbr_sender.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // The margin here is high, because the aggregation greatly increases | 341 // The margin here is high, because the aggregation greatly increases |
342 // smoothed rtt. | 342 // smoothed rtt. |
343 EXPECT_GE(kTestRtt * 4.5, rtt_stats_->smoothed_rtt()); | 343 EXPECT_GE(kTestRtt * 4.5, rtt_stats_->smoothed_rtt()); |
344 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); | 344 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); |
345 } | 345 } |
346 | 346 |
347 // Test a simple long data transfer with 2 rtts of aggregation. | 347 // Test a simple long data transfer with 2 rtts of aggregation. |
348 TEST_F(BbrSenderTest, SimpleTransferAckDecimation) { | 348 TEST_F(BbrSenderTest, SimpleTransferAckDecimation) { |
349 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = true; | 349 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = true; |
350 // Decrease the CWND gain so extra CWND is required with stretch acks. | 350 // Decrease the CWND gain so extra CWND is required with stretch acks. |
351 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); | 351 SetQuicFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); |
352 sender_ = new BbrSender( | 352 sender_ = new BbrSender( |
353 rtt_stats_, | 353 rtt_stats_, |
354 QuicSentPacketManagerPeer::GetUnackedPacketMap( | 354 QuicSentPacketManagerPeer::GetUnackedPacketMap( |
355 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())), | 355 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())), |
356 kInitialCongestionWindowPackets, kDefaultMaxCongestionWindowPackets, | 356 kInitialCongestionWindowPackets, kDefaultMaxCongestionWindowPackets, |
357 &random_); | 357 &random_); |
358 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), sender_); | 358 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), sender_); |
359 // Enable Ack Decimation on the receiver. | 359 // Enable Ack Decimation on the receiver. |
360 QuicConnectionPeer::SetAckMode(receiver_.connection(), | 360 QuicConnectionPeer::SetAckMode(receiver_.connection(), |
361 QuicConnection::AckMode::ACK_DECIMATION); | 361 QuicConnection::AckMode::ACK_DECIMATION); |
(...skipping 16 matching lines...) Expand all Loading... |
378 // smoothed rtt. | 378 // smoothed rtt. |
379 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt()); | 379 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt()); |
380 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); | 380 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); |
381 } | 381 } |
382 | 382 |
383 TEST_F(BbrSenderTest, SimpleTransferAckDecimationKeepSending) { | 383 TEST_F(BbrSenderTest, SimpleTransferAckDecimationKeepSending) { |
384 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = false; | 384 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = false; |
385 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = true; | 385 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = true; |
386 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = true; | 386 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = true; |
387 // Decrease the CWND gain so extra CWND is required with stretch acks. | 387 // Decrease the CWND gain so extra CWND is required with stretch acks. |
388 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); | 388 SetQuicFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); |
389 sender_ = new BbrSender( | 389 sender_ = new BbrSender( |
390 rtt_stats_, | 390 rtt_stats_, |
391 QuicSentPacketManagerPeer::GetUnackedPacketMap( | 391 QuicSentPacketManagerPeer::GetUnackedPacketMap( |
392 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())), | 392 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())), |
393 kInitialCongestionWindowPackets, kDefaultMaxCongestionWindowPackets, | 393 kInitialCongestionWindowPackets, kDefaultMaxCongestionWindowPackets, |
394 &random_); | 394 &random_); |
395 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), sender_); | 395 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), sender_); |
396 // Enable Ack Decimation on the receiver. | 396 // Enable Ack Decimation on the receiver. |
397 QuicConnectionPeer::SetAckMode(receiver_.connection(), | 397 QuicConnectionPeer::SetAckMode(receiver_.connection(), |
398 QuicConnection::AckMode::ACK_DECIMATION); | 398 QuicConnection::AckMode::ACK_DECIMATION); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 sender_->ResumeConnectionState(params, false); | 761 sender_->ResumeConnectionState(params, false); |
762 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); | 762 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); |
763 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); | 763 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); |
764 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); | 764 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); |
765 | 765 |
766 DriveOutOfStartup(); | 766 DriveOutOfStartup(); |
767 } | 767 } |
768 | 768 |
769 } // namespace test | 769 } // namespace test |
770 } // namespace net | 770 } // namespace net |
OLD | NEW |