| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "net/quic/congestion_control/rtt_stats.h" | 9 #include "net/quic/congestion_control/rtt_stats.h" |
| 10 #include "net/quic/congestion_control/tcp_cubic_sender.h" | 10 #include "net/quic/congestion_control/tcp_cubic_sender.h" |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 EXPECT_FALSE(sender_->OnPacketSent(clock_.Now(), bytes_in_flight_, | 487 EXPECT_FALSE(sender_->OnPacketSent(clock_.Now(), bytes_in_flight_, |
| 488 sequence_number_++, kDefaultTCPMSS, | 488 sequence_number_++, kDefaultTCPMSS, |
| 489 NO_RETRANSMITTABLE_DATA)); | 489 NO_RETRANSMITTABLE_DATA)); |
| 490 | 490 |
| 491 // Send a data packet with retransmittable data, and ensure it is tracked. | 491 // Send a data packet with retransmittable data, and ensure it is tracked. |
| 492 EXPECT_TRUE(sender_->OnPacketSent(clock_.Now(), bytes_in_flight_, | 492 EXPECT_TRUE(sender_->OnPacketSent(clock_.Now(), bytes_in_flight_, |
| 493 sequence_number_++, kDefaultTCPMSS, | 493 sequence_number_++, kDefaultTCPMSS, |
| 494 HAS_RETRANSMITTABLE_DATA)); | 494 HAS_RETRANSMITTABLE_DATA)); |
| 495 } | 495 } |
| 496 | 496 |
| 497 TEST_F(TcpCubicSenderTest, ConfigureMaxInitialWindow) { | 497 TEST_F(TcpCubicSenderTest, ConfigureInitialWindow) { |
| 498 QuicConfig config; | 498 QuicConfig config; |
| 499 | 499 |
| 500 // Verify that kCOPT: kIW10 forces the congestion window to the default of 10. | 500 // Verify that kCOPT: kIW10 forces the congestion window to the default of 10. |
| 501 QuicTagVector options; | 501 QuicTagVector options; |
| 502 options.push_back(kIW10); | 502 options.push_back(kIW10); |
| 503 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 503 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 504 sender_->SetFromConfig(config, Perspective::IS_SERVER, | 504 sender_->SetFromConfig(config, Perspective::IS_SERVER, |
| 505 /* using_pacing= */ false); | 505 /* using_pacing= */ false); |
| 506 EXPECT_EQ(10u, sender_->congestion_window()); | 506 EXPECT_EQ(10u, sender_->congestion_window()); |
| 507 } | 507 } |
| 508 | 508 |
| 509 TEST_F(TcpCubicSenderTest, ConfigureMinimumWindow) { |
| 510 QuicConfig config; |
| 511 |
| 512 // Verify that kCOPT: kMIN1 forces the min CWND to 1 packet. |
| 513 QuicTagVector options; |
| 514 options.push_back(kMIN1); |
| 515 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 516 sender_->SetFromConfig(config, Perspective::IS_SERVER, |
| 517 /* using_pacing= */ false); |
| 518 sender_->OnRetransmissionTimeout(true); |
| 519 EXPECT_EQ(1u, sender_->congestion_window()); |
| 520 } |
| 521 |
| 509 TEST_F(TcpCubicSenderTest, DisableAckTrainDetectionWithPacing) { | 522 TEST_F(TcpCubicSenderTest, DisableAckTrainDetectionWithPacing) { |
| 510 EXPECT_TRUE(sender_->hybrid_slow_start().ack_train_detection()); | 523 EXPECT_TRUE(sender_->hybrid_slow_start().ack_train_detection()); |
| 511 | 524 |
| 512 QuicConfig config; | 525 QuicConfig config; |
| 513 sender_->SetFromConfig(config, Perspective::IS_SERVER, | 526 sender_->SetFromConfig(config, Perspective::IS_SERVER, |
| 514 /* using_pacing= */ true); | 527 /* using_pacing= */ true); |
| 515 EXPECT_FALSE(sender_->hybrid_slow_start().ack_train_detection()); | 528 EXPECT_FALSE(sender_->hybrid_slow_start().ack_train_detection()); |
| 516 } | 529 } |
| 517 | 530 |
| 518 TEST_F(TcpCubicSenderTest, 2ConnectionCongestionAvoidanceAtEndOfRecovery) { | 531 TEST_F(TcpCubicSenderTest, 2ConnectionCongestionAvoidanceAtEndOfRecovery) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 | 665 |
| 653 cached_network_params.set_bandwidth_estimate_bytes_per_second( | 666 cached_network_params.set_bandwidth_estimate_bytes_per_second( |
| 654 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); | 667 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); |
| 655 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); | 668 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); |
| 656 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, | 669 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, |
| 657 sender_->congestion_window()); | 670 sender_->congestion_window()); |
| 658 } | 671 } |
| 659 | 672 |
| 660 } // namespace test | 673 } // namespace test |
| 661 } // namespace net | 674 } // namespace net |
| OLD | NEW |