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/tcp_cubic_sender.h" | 9 #include "net/quic/congestion_control/tcp_cubic_sender.h" |
10 #include "net/quic/congestion_control/tcp_receiver.h" | 10 #include "net/quic/congestion_control/tcp_receiver.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 AckNPackets(2); | 491 AckNPackets(2); |
492 } | 492 } |
493 | 493 |
494 QuicByteCount expected_send_window = | 494 QuicByteCount expected_send_window = |
495 kMaxCongestionWindowTCP * kDefaultTCPMSS; | 495 kMaxCongestionWindowTCP * kDefaultTCPMSS; |
496 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 496 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
497 } | 497 } |
498 | 498 |
499 TEST_F(TcpCubicSenderTest, TcpCubicMaxCongestionWindow) { | 499 TEST_F(TcpCubicSenderTest, TcpCubicMaxCongestionWindow) { |
500 const QuicTcpCongestionWindow kMaxCongestionWindowTCP = 50; | 500 const QuicTcpCongestionWindow kMaxCongestionWindowTCP = 50; |
501 const int kNumberOfAcks = 1000; | 501 // Set to 10000 to compensate for small cubic alpha. |
| 502 const int kNumberOfAcks = 10000; |
| 503 |
502 sender_.reset( | 504 sender_.reset( |
503 new TcpCubicSenderPeer(&clock_, false, kMaxCongestionWindowTCP)); | 505 new TcpCubicSenderPeer(&clock_, false, kMaxCongestionWindowTCP)); |
504 | 506 |
505 QuicCongestionFeedbackFrame feedback; | 507 QuicCongestionFeedbackFrame feedback; |
506 // At startup make sure we can send. | 508 // At startup make sure we can send. |
507 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), | 509 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), |
508 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA, NOT_HANDSHAKE).IsZero()); | 510 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA, NOT_HANDSHAKE).IsZero()); |
509 // Get default QuicCongestionFeedbackFrame from receiver. | 511 // Get default QuicCongestionFeedbackFrame from receiver. |
510 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback)); | 512 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback)); |
511 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now(), | 513 sender_->OnIncomingQuicCongestionFeedbackFrame(feedback, clock_.Now(), |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 config.set_server_initial_congestion_window(2 * congestion_window, | 571 config.set_server_initial_congestion_window(2 * congestion_window, |
570 2 * congestion_window); | 572 2 * congestion_window); |
571 EXPECT_EQ(2 * congestion_window, config.server_initial_congestion_window()); | 573 EXPECT_EQ(2 * congestion_window, config.server_initial_congestion_window()); |
572 | 574 |
573 sender_->SetFromConfig(config, true); | 575 sender_->SetFromConfig(config, true); |
574 EXPECT_EQ(2 * congestion_window, sender_->congestion_window()); | 576 EXPECT_EQ(2 * congestion_window, sender_->congestion_window()); |
575 } | 577 } |
576 | 578 |
577 } // namespace test | 579 } // namespace test |
578 } // namespace net | 580 } // namespace net |
OLD | NEW |