| Index: net/quic/congestion_control/tcp_cubic_sender_bytes_test.cc
|
| diff --git a/net/quic/congestion_control/tcp_cubic_sender_bytes_test.cc b/net/quic/congestion_control/tcp_cubic_sender_bytes_test.cc
|
| index 3bca8cb87f7ba7c28de5e685c6503fa30edf6e45..0e471c0256da8f0c919a42fa0db904b79beafbcd 100644
|
| --- a/net/quic/congestion_control/tcp_cubic_sender_bytes_test.cc
|
| +++ b/net/quic/congestion_control/tcp_cubic_sender_bytes_test.cc
|
| @@ -231,6 +231,7 @@ TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLoss) {
|
| }
|
|
|
| TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLossWithLargeReduction) {
|
| + FLAGS_quic_sslr_limit_reduction = true;
|
| QuicConfig config;
|
| QuicTagVector options;
|
| options.push_back(kSSLR);
|
| @@ -238,7 +239,7 @@ TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLossWithLargeReduction) {
|
| sender_->SetFromConfig(config, Perspective::IS_SERVER);
|
|
|
| sender_->SetNumEmulatedConnections(1);
|
| - const int kNumberOfAcks = 10;
|
| + const int kNumberOfAcks = (kDefaultWindowTCP / (2 * kDefaultTCPMSS)) - 1;
|
| for (int i = 0; i < kNumberOfAcks; ++i) {
|
| // Send our full send window.
|
| SendAvailableSendWindow();
|
| @@ -260,6 +261,11 @@ TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLossWithLargeReduction) {
|
| LoseNPackets(5);
|
| expected_send_window -= 5 * kDefaultTCPMSS;
|
| EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
|
| + // Lose another 10 packets and ensure it reduces below half the peak CWND,
|
| + // because we never acked the full IW.
|
| + LoseNPackets(10);
|
| + expected_send_window -= 10 * kDefaultTCPMSS;
|
| + EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
|
|
|
| size_t packets_in_recovery_window = expected_send_window / kDefaultTCPMSS;
|
|
|
| @@ -319,6 +325,41 @@ TEST_F(TcpCubicSenderBytesTest, SlowStartHalfPacketLossWithLargeReduction) {
|
| EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
|
| }
|
|
|
| +TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLossWithMaxHalfReduction) {
|
| + FLAGS_quic_sslr_limit_reduction = true;
|
| + QuicConfig config;
|
| + QuicTagVector options;
|
| + options.push_back(kSSLR);
|
| + QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
|
| + sender_->SetFromConfig(config, Perspective::IS_SERVER);
|
| +
|
| + sender_->SetNumEmulatedConnections(1);
|
| + const int kNumberOfAcks = kInitialCongestionWindowPackets / 2;
|
| + for (int i = 0; i < kNumberOfAcks; ++i) {
|
| + // Send our full send window.
|
| + SendAvailableSendWindow();
|
| + AckNPackets(2);
|
| + }
|
| + SendAvailableSendWindow();
|
| + QuicByteCount expected_send_window =
|
| + kDefaultWindowTCP + (kDefaultTCPMSS * 2 * kNumberOfAcks);
|
| + EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
|
| +
|
| + // Lose a packet to exit slow start. We should now have fallen out of
|
| + // slow start with a window reduced by 1.
|
| + LoseNPackets(1);
|
| + expected_send_window -= kDefaultTCPMSS;
|
| + EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
|
| +
|
| + // Lose half the outstanding packets in recovery and verify the congestion
|
| + // window is only reduced by a max of half.
|
| + LoseNPackets(kNumberOfAcks * 2);
|
| + expected_send_window -= (kNumberOfAcks * 2 - 1) * kDefaultTCPMSS;
|
| + EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
|
| + LoseNPackets(5);
|
| + EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
|
| +}
|
| +
|
| TEST_F(TcpCubicSenderBytesTest, NoPRRWhenLessThanOnePacketInFlight) {
|
| SendAvailableSendWindow();
|
| LoseNPackets(kInitialCongestionWindowPackets - 1);
|
| @@ -696,17 +737,24 @@ TEST_F(TcpCubicSenderBytesTest, BandwidthResumption) {
|
| EXPECT_EQ(kMaxCongestionWindow * kDefaultTCPMSS,
|
| sender_->GetCongestionWindow());
|
|
|
| - cached_network_params.set_bandwidth_estimate_bytes_per_second(
|
| - (kMinCongestionWindowForBandwidthResumption - 1) * kDefaultTCPMSS);
|
| - sender_->ResumeConnectionState(cached_network_params, false);
|
| - EXPECT_EQ(kMinCongestionWindowForBandwidthResumption * kDefaultTCPMSS,
|
| - sender_->GetCongestionWindow());
|
| + if (FLAGS_quic_no_lower_bw_resumption_limit) {
|
| + // Resume with an illegal value of 0 and verify the server uses 1 instead.
|
| + cached_network_params.set_bandwidth_estimate_bytes_per_second(0);
|
| + sender_->ResumeConnectionState(cached_network_params, false);
|
| + EXPECT_EQ(sender_->min_congestion_window(), sender_->GetCongestionWindow());
|
| + } else {
|
| + cached_network_params.set_bandwidth_estimate_bytes_per_second(
|
| + (kMinCongestionWindowForBandwidthResumption - 1) * kDefaultTCPMSS);
|
| + sender_->ResumeConnectionState(cached_network_params, false);
|
| + EXPECT_EQ(kMinCongestionWindowForBandwidthResumption * kDefaultTCPMSS,
|
| + sender_->GetCongestionWindow());
|
| + }
|
|
|
| // Resume to the max value.
|
| cached_network_params.set_max_bandwidth_estimate_bytes_per_second(
|
| - (kMinCongestionWindowForBandwidthResumption + 10) * kDefaultTCPMSS);
|
| + kMaxCongestionWindow * kDefaultTCPMSS);
|
| sender_->ResumeConnectionState(cached_network_params, true);
|
| - EXPECT_EQ((kMinCongestionWindowForBandwidthResumption + 10) * kDefaultTCPMSS,
|
| + EXPECT_EQ(kMaxCongestionWindow * kDefaultTCPMSS,
|
| sender_->GetCongestionWindow());
|
| }
|
|
|
|
|