Index: net/quic/core/congestion_control/bbr_sender_test.cc |
diff --git a/net/quic/core/congestion_control/bbr_sender_test.cc b/net/quic/core/congestion_control/bbr_sender_test.cc |
index 872b863460548ab1f64fc2589ca14a3460bb4ec3..d5f18394536eab8c74b1fe6e109517a5715e97da 100644 |
--- a/net/quic/core/congestion_control/bbr_sender_test.cc |
+++ b/net/quic/core/congestion_control/bbr_sender_test.cc |
@@ -90,9 +90,14 @@ class BbrSenderTest : public ::testing::Test { |
/*connection_id=*/GetPeerInMemoryConnectionId(43)), |
receiver_multiplexer_("Receiver multiplexer", |
{&receiver_, &competing_receiver_}) { |
+ // These will be changed by the appropriate tests as necessary. |
+ FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = false; |
+ FLAGS_quic_reloadable_flag_quic_bbr_slow_recent_delivery = false; |
+ FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = false; |
// TODO(ianswett): Determine why tests become flaky with CWND based on SRTT. |
FLAGS_quic_reloadable_flag_quic_bbr_base_cwnd_on_srtt = false; |
FLAGS_quic_reloadable_flag_quic_bbr_extra_conservation = true; |
+ FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation = true; |
rtt_stats_ = bbr_sender_.connection()->sent_packet_manager().GetRttStats(); |
sender_ = SetupBbrSender(&bbr_sender_); |
@@ -315,7 +320,7 @@ TEST_F(BbrSenderTest, SimpleTransfer2RTTAggregationBytes) { |
// The margin here is high, because the aggregation greatly increases |
// smoothed rtt. |
EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt()); |
- ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); |
+ ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.12f); |
} |
TEST_F(BbrSenderTest, SimpleTransfer2RTTAggregationKeepSending) { |
@@ -447,8 +452,8 @@ TEST_F(BbrSenderTest, |
EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); |
// The margin here is high, because the aggregation greatly increases |
// smoothed rtt. |
- EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt()); |
- ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); |
+ EXPECT_GE(kTestRtt * 5, rtt_stats_->smoothed_rtt()); |
+ ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.25f); |
} |
// Test the number of losses incurred by the startup phase in a situation when |
@@ -460,7 +465,7 @@ TEST_F(BbrSenderTest, PacketLossOnSmallBufferStartup) { |
float loss_rate = |
static_cast<float>(bbr_sender_.connection()->GetStats().packets_lost) / |
bbr_sender_.connection()->GetStats().packets_sent; |
- EXPECT_LE(loss_rate, 0.27); |
+ EXPECT_LE(loss_rate, 0.31); |
} |
// Ensures the code transitions loss recovery states correctly (NOT_IN_RECOVERY |
@@ -490,12 +495,18 @@ TEST_F(BbrSenderTest, RecoveryStates) { |
ASSERT_EQ(BbrSender::CONSERVATION, |
sender_->ExportDebugState().recovery_state); |
+ const QuicByteCount cwnd_at_recovery_start = sender_->GetCongestionWindow(); |
simulator_result = simulator_.RunUntilOrTimeout( |
- [this]() { |
+ [this, cwnd_at_recovery_start]() { |
+ // Ensure that the CWND never drops due to conservation. |
+ if (sender_->GetCongestionWindow() < cwnd_at_recovery_start) { |
+ return true; |
+ } |
return sender_->ExportDebugState().recovery_state != |
BbrSender::CONSERVATION; |
}, |
timeout); |
+ ASSERT_GE(sender_->GetCongestionWindow(), cwnd_at_recovery_start); |
ASSERT_TRUE(simulator_result); |
ASSERT_EQ(BbrSender::GROWTH, sender_->ExportDebugState().recovery_state); |