| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 // Send another packet. | 633 // Send another packet. |
| 634 bbr_sender_.AddBytesToTransfer(1000); | 634 bbr_sender_.AddBytesToTransfer(1000); |
| 635 simulator_result = simulator_.RunUntilOrTimeout( | 635 simulator_result = simulator_.RunUntilOrTimeout( |
| 636 [this]() { return receiver_.bytes_received() == 2000; }, timeout); | 636 [this]() { return receiver_.bytes_received() == 2000; }, timeout); |
| 637 ASSERT_TRUE(simulator_result); | 637 ASSERT_TRUE(simulator_result); |
| 638 EXPECT_GE(sender_->PacingRate(0), initial_rate); | 638 EXPECT_GE(sender_->PacingRate(0), initial_rate); |
| 639 } | 639 } |
| 640 | 640 |
| 641 // Test exiting STARTUP earlier due to the 1RTT connection option. | 641 // Test exiting STARTUP earlier due to the 1RTT connection option. |
| 642 TEST_F(BbrSenderTest, SimpleTransfer1RTTStartup) { | 642 TEST_F(BbrSenderTest, SimpleTransfer1RTTStartup) { |
| 643 FLAGS_quic_reloadable_flag_quic_allow_2_rtt_bbr_startup = true; | |
| 644 CreateDefaultSetup(); | 643 CreateDefaultSetup(); |
| 645 | 644 |
| 646 QuicConfig config; | 645 QuicConfig config; |
| 647 QuicTagVector options; | 646 QuicTagVector options; |
| 648 options.push_back(k1RTT); | 647 options.push_back(k1RTT); |
| 649 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 648 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 650 sender_->SetFromConfig(config, Perspective::IS_SERVER); | 649 sender_->SetFromConfig(config, Perspective::IS_SERVER); |
| 651 EXPECT_EQ(1u, sender_->num_startup_rtts()); | 650 EXPECT_EQ(1u, sender_->num_startup_rtts()); |
| 652 | 651 |
| 653 // Run until the full bandwidth is reached and check how many rounds it was. | 652 // Run until the full bandwidth is reached and check how many rounds it was. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 666 ASSERT_TRUE(simulator_result); | 665 ASSERT_TRUE(simulator_result); |
| 667 EXPECT_EQ(BbrSender::DRAIN, sender_->ExportDebugState().mode); | 666 EXPECT_EQ(BbrSender::DRAIN, sender_->ExportDebugState().mode); |
| 668 EXPECT_EQ(1u, sender_->ExportDebugState().round_trip_count - max_bw_round); | 667 EXPECT_EQ(1u, sender_->ExportDebugState().round_trip_count - max_bw_round); |
| 669 EXPECT_EQ(1u, sender_->ExportDebugState().rounds_without_bandwidth_gain); | 668 EXPECT_EQ(1u, sender_->ExportDebugState().rounds_without_bandwidth_gain); |
| 670 EXPECT_EQ(0u, bbr_sender_.connection()->GetStats().packets_lost); | 669 EXPECT_EQ(0u, bbr_sender_.connection()->GetStats().packets_lost); |
| 671 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); | 670 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); |
| 672 } | 671 } |
| 673 | 672 |
| 674 // Test exiting STARTUP earlier due to the 2RTT connection option. | 673 // Test exiting STARTUP earlier due to the 2RTT connection option. |
| 675 TEST_F(BbrSenderTest, SimpleTransfer2RTTStartup) { | 674 TEST_F(BbrSenderTest, SimpleTransfer2RTTStartup) { |
| 676 FLAGS_quic_reloadable_flag_quic_allow_2_rtt_bbr_startup = true; | |
| 677 // Adding TSO CWND causes packet loss before exiting startup. | 675 // Adding TSO CWND causes packet loss before exiting startup. |
| 678 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = false; | 676 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = false; |
| 679 CreateDefaultSetup(); | 677 CreateDefaultSetup(); |
| 680 | 678 |
| 681 QuicConfig config; | 679 QuicConfig config; |
| 682 QuicTagVector options; | 680 QuicTagVector options; |
| 683 options.push_back(k2RTT); | 681 options.push_back(k2RTT); |
| 684 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 682 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 685 sender_->SetFromConfig(config, Perspective::IS_SERVER); | 683 sender_->SetFromConfig(config, Perspective::IS_SERVER); |
| 686 EXPECT_EQ(2u, sender_->num_startup_rtts()); | 684 EXPECT_EQ(2u, sender_->num_startup_rtts()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 sender_->ResumeConnectionState(params, false); | 743 sender_->ResumeConnectionState(params, false); |
| 746 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); | 744 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); |
| 747 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); | 745 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); |
| 748 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); | 746 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); |
| 749 | 747 |
| 750 DriveOutOfStartup(); | 748 DriveOutOfStartup(); |
| 751 } | 749 } |
| 752 | 750 |
| 753 } // namespace test | 751 } // namespace test |
| 754 } // namespace net | 752 } // namespace net |
| OLD | NEW |