| 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/hybrid_slow_start.h" | 5 #include "net/quic/congestion_control/hybrid_slow_start.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // RTT of 60ms the detection will happen at 67.5 ms. | 52 // RTT of 60ms the detection will happen at 67.5 ms. |
| 53 const int kHybridStartMinSamples = 8; // Number of acks required to trigger. | 53 const int kHybridStartMinSamples = 8; // Number of acks required to trigger. |
| 54 | 54 |
| 55 QuicPacketNumber end_packet_number = 1; | 55 QuicPacketNumber end_packet_number = 1; |
| 56 slow_start_->StartReceiveRound(end_packet_number++); | 56 slow_start_->StartReceiveRound(end_packet_number++); |
| 57 | 57 |
| 58 // Will not trigger since our lowest RTT in our burst is the same as the long | 58 // Will not trigger since our lowest RTT in our burst is the same as the long |
| 59 // term RTT provided. | 59 // term RTT provided. |
| 60 for (int n = 0; n < kHybridStartMinSamples; ++n) { | 60 for (int n = 0; n < kHybridStartMinSamples; ++n) { |
| 61 EXPECT_FALSE(slow_start_->ShouldExitSlowStart( | 61 EXPECT_FALSE(slow_start_->ShouldExitSlowStart( |
| 62 rtt_.Add(QuicTime::Delta::FromMilliseconds(n)), rtt_, 100)); | 62 rtt_ + QuicTime::Delta::FromMilliseconds(n), rtt_, 100)); |
| 63 } | 63 } |
| 64 slow_start_->StartReceiveRound(end_packet_number++); | 64 slow_start_->StartReceiveRound(end_packet_number++); |
| 65 for (int n = 1; n < kHybridStartMinSamples; ++n) { | 65 for (int n = 1; n < kHybridStartMinSamples; ++n) { |
| 66 EXPECT_FALSE(slow_start_->ShouldExitSlowStart( | 66 EXPECT_FALSE(slow_start_->ShouldExitSlowStart( |
| 67 rtt_.Add(QuicTime::Delta::FromMilliseconds(n + 10)), rtt_, 100)); | 67 rtt_ + QuicTime::Delta::FromMilliseconds(n + 10), rtt_, 100)); |
| 68 } | 68 } |
| 69 // Expect to trigger since all packets in this burst was above the long term | 69 // Expect to trigger since all packets in this burst was above the long term |
| 70 // RTT provided. | 70 // RTT provided. |
| 71 EXPECT_TRUE(slow_start_->ShouldExitSlowStart( | 71 EXPECT_TRUE(slow_start_->ShouldExitSlowStart( |
| 72 rtt_.Add(QuicTime::Delta::FromMilliseconds(10)), rtt_, 100)); | 72 rtt_ + QuicTime::Delta::FromMilliseconds(10), rtt_, 100)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace test | 75 } // namespace test |
| 76 } // namespace net | 76 } // namespace net |
| OLD | NEW |