| 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 (kDefaultTCPMSS * 2 * kNumberOfAcks); | 663 (kDefaultTCPMSS * 2 * kNumberOfAcks); |
| 664 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 664 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 665 | 665 |
| 666 LoseNPackets(1); | 666 LoseNPackets(1); |
| 667 | 667 |
| 668 // We should now have fallen out of slow start, and window should be cut in | 668 // We should now have fallen out of slow start, and window should be cut in |
| 669 // half by Reno. New cwnd should be 10. | 669 // half by Reno. New cwnd should be 10. |
| 670 expected_send_window /= 2; | 670 expected_send_window /= 2; |
| 671 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 671 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 672 | 672 |
| 673 // No congestion window growth should occur in recovery phase, i.e., | 673 // No congestion window growth should occur in recovery phase, i.e., until the |
| 674 // until the currently outstanding 20 packets are acked. | 674 // currently outstanding 20 packets are acked. |
| 675 for (int i = 0; i < 10; ++i) { | 675 for (int i = 0; i < 10; ++i) { |
| 676 // Send our full send window. | 676 // Send our full send window. |
| 677 SendAvailableSendWindow(); | 677 SendAvailableSendWindow(); |
| 678 EXPECT_TRUE(sender_->InRecovery()); | 678 EXPECT_TRUE(sender_->InRecovery()); |
| 679 AckNPackets(2); | 679 AckNPackets(2); |
| 680 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 680 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 681 } | 681 } |
| 682 EXPECT_FALSE(sender_->InRecovery()); | 682 EXPECT_FALSE(sender_->InRecovery()); |
| 683 | 683 |
| 684 // Out of recovery now. Congestion window should not grow during RTT. | 684 // Out of recovery now. Congestion window should not grow during RTT. |
| 685 for (int i = 0; i < 4; ++i) { | 685 for (int i = 0; i < 4; ++i) { |
| 686 // Send our full send window. | 686 // Send our full send window. |
| 687 SendAvailableSendWindow(); | 687 SendAvailableSendWindow(); |
| 688 AckNPackets(2); | 688 AckNPackets(2); |
| 689 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 689 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 690 } | 690 } |
| 691 | 691 |
| 692 // Next ack should cause congestion window to grow by 1MSS. | 692 // Next ack should cause congestion window to grow by 1MSS. |
| 693 AckNPackets(2); | 693 AckNPackets(2); |
| 694 expected_send_window += kDefaultTCPMSS; | 694 expected_send_window += kDefaultTCPMSS; |
| 695 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); | 695 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); |
| 696 } | 696 } |
| 697 | 697 |
| 698 } // namespace test | 698 } // namespace test |
| 699 } // namespace net | 699 } // namespace net |
| OLD | NEW |