| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/congestion_control/tcp_cubic_sender_bytes.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender_bytes.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 expected_send_window += kDefaultTCPMSS; | 225 expected_send_window += kDefaultTCPMSS; |
| 226 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 226 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 227 | 227 |
| 228 // Now RTO and ensure slow start gets reset. | 228 // Now RTO and ensure slow start gets reset. |
| 229 EXPECT_TRUE(sender_->hybrid_slow_start().started()); | 229 EXPECT_TRUE(sender_->hybrid_slow_start().started()); |
| 230 sender_->OnRetransmissionTimeout(true); | 230 sender_->OnRetransmissionTimeout(true); |
| 231 EXPECT_FALSE(sender_->hybrid_slow_start().started()); | 231 EXPECT_FALSE(sender_->hybrid_slow_start().started()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLossWithLargeReduction) { | 234 TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLossWithLargeReduction) { |
| 235 FLAGS_quic_sslr_limit_reduction = true; | |
| 236 QuicConfig config; | 235 QuicConfig config; |
| 237 QuicTagVector options; | 236 QuicTagVector options; |
| 238 options.push_back(kSSLR); | 237 options.push_back(kSSLR); |
| 239 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 238 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 240 sender_->SetFromConfig(config, Perspective::IS_SERVER); | 239 sender_->SetFromConfig(config, Perspective::IS_SERVER); |
| 241 | 240 |
| 242 sender_->SetNumEmulatedConnections(1); | 241 sender_->SetNumEmulatedConnections(1); |
| 243 const int kNumberOfAcks = (kDefaultWindowTCP / (2 * kDefaultTCPMSS)) - 1; | 242 const int kNumberOfAcks = (kDefaultWindowTCP / (2 * kDefaultTCPMSS)) - 1; |
| 244 for (int i = 0; i < kNumberOfAcks; ++i) { | 243 for (int i = 0; i < kNumberOfAcks; ++i) { |
| 245 // Send our full send window. | 244 // Send our full send window. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 319 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 321 | 320 |
| 322 // Lose 10 packets in recovery and verify that congestion window is reduced | 321 // Lose 10 packets in recovery and verify that congestion window is reduced |
| 323 // by 5 packets. | 322 // by 5 packets. |
| 324 LoseNPackets(10, kDefaultTCPMSS / 2); | 323 LoseNPackets(10, kDefaultTCPMSS / 2); |
| 325 expected_send_window -= 5 * kDefaultTCPMSS; | 324 expected_send_window -= 5 * kDefaultTCPMSS; |
| 326 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 325 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 327 } | 326 } |
| 328 | 327 |
| 329 TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLossWithMaxHalfReduction) { | 328 TEST_F(TcpCubicSenderBytesTest, SlowStartPacketLossWithMaxHalfReduction) { |
| 330 FLAGS_quic_sslr_limit_reduction = true; | |
| 331 QuicConfig config; | 329 QuicConfig config; |
| 332 QuicTagVector options; | 330 QuicTagVector options; |
| 333 options.push_back(kSSLR); | 331 options.push_back(kSSLR); |
| 334 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 332 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 335 sender_->SetFromConfig(config, Perspective::IS_SERVER); | 333 sender_->SetFromConfig(config, Perspective::IS_SERVER); |
| 336 | 334 |
| 337 sender_->SetNumEmulatedConnections(1); | 335 sender_->SetNumEmulatedConnections(1); |
| 338 const int kNumberOfAcks = kInitialCongestionWindowPackets / 2; | 336 const int kNumberOfAcks = kInitialCongestionWindowPackets / 2; |
| 339 for (int i = 0; i < kNumberOfAcks; ++i) { | 337 for (int i = 0; i < kNumberOfAcks; ++i) { |
| 340 // Send our full send window. | 338 // Send our full send window. |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 acked_packets.push_back(std::make_pair(i, 1350)); | 887 acked_packets.push_back(std::make_pair(i, 1350)); |
| 890 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), | 888 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), |
| 891 acked_packets, missing_packets); | 889 acked_packets, missing_packets); |
| 892 } | 890 } |
| 893 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, | 891 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, |
| 894 sender->GetCongestionWindow() / kDefaultTCPMSS); | 892 sender->GetCongestionWindow() / kDefaultTCPMSS); |
| 895 } | 893 } |
| 896 | 894 |
| 897 } // namespace test | 895 } // namespace test |
| 898 } // namespace net | 896 } // namespace net |
| OLD | NEW |