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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 HAS_RETRANSMITTABLE_DATA)); | 494 HAS_RETRANSMITTABLE_DATA)); |
495 } | 495 } |
496 | 496 |
497 TEST_F(TcpCubicSenderTest, ConfigureMaxInitialWindow) { | 497 TEST_F(TcpCubicSenderTest, ConfigureMaxInitialWindow) { |
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, | 504 sender_->SetFromConfig(config, Perspective::IS_SERVER, |
505 /* is_server= */ true, | |
506 /* using_pacing= */ false); | 505 /* using_pacing= */ false); |
507 EXPECT_EQ(10u, sender_->congestion_window()); | 506 EXPECT_EQ(10u, sender_->congestion_window()); |
508 } | 507 } |
509 | 508 |
510 TEST_F(TcpCubicSenderTest, DisableAckTrainDetectionWithPacing) { | 509 TEST_F(TcpCubicSenderTest, DisableAckTrainDetectionWithPacing) { |
511 EXPECT_TRUE(sender_->hybrid_slow_start().ack_train_detection()); | 510 EXPECT_TRUE(sender_->hybrid_slow_start().ack_train_detection()); |
512 | 511 |
513 QuicConfig config; | 512 QuicConfig config; |
514 sender_->SetFromConfig(config, | 513 sender_->SetFromConfig(config, Perspective::IS_SERVER, |
515 /* is_server= */ true, | |
516 /* using_pacing= */ true); | 514 /* using_pacing= */ true); |
517 EXPECT_FALSE(sender_->hybrid_slow_start().ack_train_detection()); | 515 EXPECT_FALSE(sender_->hybrid_slow_start().ack_train_detection()); |
518 } | 516 } |
519 | 517 |
520 TEST_F(TcpCubicSenderTest, 2ConnectionCongestionAvoidanceAtEndOfRecovery) { | 518 TEST_F(TcpCubicSenderTest, 2ConnectionCongestionAvoidanceAtEndOfRecovery) { |
521 sender_->SetNumEmulatedConnections(2); | 519 sender_->SetNumEmulatedConnections(2); |
522 // Ack 10 packets in 5 acks to raise the CWND to 20. | 520 // Ack 10 packets in 5 acks to raise the CWND to 20. |
523 const int kNumberOfAcks = 5; | 521 const int kNumberOfAcks = 5; |
524 for (int i = 0; i < kNumberOfAcks; ++i) { | 522 for (int i = 0; i < kNumberOfAcks; ++i) { |
525 // Send our full send window. | 523 // Send our full send window. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 | 652 |
655 cached_network_params.set_bandwidth_estimate_bytes_per_second( | 653 cached_network_params.set_bandwidth_estimate_bytes_per_second( |
656 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); | 654 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); |
657 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); | 655 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); |
658 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, | 656 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, |
659 sender_->congestion_window()); | 657 sender_->congestion_window()); |
660 } | 658 } |
661 | 659 |
662 } // namespace test | 660 } // namespace test |
663 } // namespace net | 661 } // namespace net |
OLD | NEW |