| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_packets.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 expected_send_window += kDefaultTCPMSS; | 236 expected_send_window += kDefaultTCPMSS; |
| 237 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 237 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 238 | 238 |
| 239 // Now RTO and ensure slow start gets reset. | 239 // Now RTO and ensure slow start gets reset. |
| 240 EXPECT_TRUE(sender_->hybrid_slow_start().started()); | 240 EXPECT_TRUE(sender_->hybrid_slow_start().started()); |
| 241 sender_->OnRetransmissionTimeout(true); | 241 sender_->OnRetransmissionTimeout(true); |
| 242 EXPECT_FALSE(sender_->hybrid_slow_start().started()); | 242 EXPECT_FALSE(sender_->hybrid_slow_start().started()); |
| 243 } | 243 } |
| 244 | 244 |
| 245 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossWithLargeReduction) { | 245 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossWithLargeReduction) { |
| 246 FLAGS_quic_sslr_limit_reduction = true; | |
| 247 QuicConfig config; | 246 QuicConfig config; |
| 248 QuicTagVector options; | 247 QuicTagVector options; |
| 249 options.push_back(kSSLR); | 248 options.push_back(kSSLR); |
| 250 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 249 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 251 sender_->SetFromConfig(config, Perspective::IS_SERVER); | 250 sender_->SetFromConfig(config, Perspective::IS_SERVER); |
| 252 | 251 |
| 253 sender_->SetNumEmulatedConnections(1); | 252 sender_->SetNumEmulatedConnections(1); |
| 254 const int kNumberOfAcks = (kDefaultWindowTCP / (2 * kDefaultTCPMSS)) - 1; | 253 const int kNumberOfAcks = (kDefaultWindowTCP / (2 * kDefaultTCPMSS)) - 1; |
| 255 for (int i = 0; i < kNumberOfAcks; ++i) { | 254 for (int i = 0; i < kNumberOfAcks; ++i) { |
| 256 // Send our full send window. | 255 // Send our full send window. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 330 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 332 | 331 |
| 333 // Lose 10 packets in recovery and verify that congestion window is reduced | 332 // Lose 10 packets in recovery and verify that congestion window is reduced |
| 334 // by 5 packets. | 333 // by 5 packets. |
| 335 LoseNPackets(10, kDefaultTCPMSS / 2); | 334 LoseNPackets(10, kDefaultTCPMSS / 2); |
| 336 expected_send_window -= 5 * kDefaultTCPMSS; | 335 expected_send_window -= 5 * kDefaultTCPMSS; |
| 337 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 336 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 338 } | 337 } |
| 339 | 338 |
| 340 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossWithMaxHalfReduction) { | 339 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossWithMaxHalfReduction) { |
| 341 FLAGS_quic_sslr_limit_reduction = true; | |
| 342 QuicConfig config; | 340 QuicConfig config; |
| 343 QuicTagVector options; | 341 QuicTagVector options; |
| 344 options.push_back(kSSLR); | 342 options.push_back(kSSLR); |
| 345 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 343 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 346 sender_->SetFromConfig(config, Perspective::IS_SERVER); | 344 sender_->SetFromConfig(config, Perspective::IS_SERVER); |
| 347 | 345 |
| 348 sender_->SetNumEmulatedConnections(1); | 346 sender_->SetNumEmulatedConnections(1); |
| 349 const int kNumberOfAcks = kInitialCongestionWindowPackets / 2; | 347 const int kNumberOfAcks = kInitialCongestionWindowPackets / 2; |
| 350 for (int i = 0; i < kNumberOfAcks; ++i) { | 348 for (int i = 0; i < kNumberOfAcks; ++i) { |
| 351 // Send our full send window. | 349 // Send our full send window. |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 acked_packets.push_back(std::make_pair(i, 1350)); | 1039 acked_packets.push_back(std::make_pair(i, 1350)); |
| 1042 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), | 1040 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), |
| 1043 acked_packets, missing_packets); | 1041 acked_packets, missing_packets); |
| 1044 } | 1042 } |
| 1045 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, | 1043 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, |
| 1046 sender->GetCongestionWindow() / kDefaultTCPMSS); | 1044 sender->GetCongestionWindow() / kDefaultTCPMSS); |
| 1047 } | 1045 } |
| 1048 | 1046 |
| 1049 } // namespace test | 1047 } // namespace test |
| 1050 } // namespace net | 1048 } // namespace net |
| OLD | NEW |