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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "net/quic/congestion_control/hybrid_slow_start.h" | 7 #include "net/quic/congestion_control/hybrid_slow_start.h" |
8 #include "net/quic/test_tools/mock_clock.h" | 8 #include "net/quic/test_tools/mock_clock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 namespace test { | 12 namespace test { |
13 | 13 |
14 class HybridSlowStartTest : public ::testing::Test { | 14 class HybridSlowStartTest : public ::testing::Test { |
15 protected: | 15 protected: |
16 HybridSlowStartTest() | 16 HybridSlowStartTest() |
17 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), | 17 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), |
18 rtt_(QuicTime::Delta::FromMilliseconds(60)) { | 18 rtt_(QuicTime::Delta::FromMilliseconds(60)) { |
19 } | 19 } |
20 virtual void SetUp() { | 20 void SetUp() override { slow_start_.reset(new HybridSlowStart(&clock_)); } |
21 slow_start_.reset(new HybridSlowStart(&clock_)); | |
22 } | |
23 const QuicTime::Delta one_ms_; | 21 const QuicTime::Delta one_ms_; |
24 const QuicTime::Delta rtt_; | 22 const QuicTime::Delta rtt_; |
25 MockClock clock_; | 23 MockClock clock_; |
26 scoped_ptr<HybridSlowStart> slow_start_; | 24 scoped_ptr<HybridSlowStart> slow_start_; |
27 }; | 25 }; |
28 | 26 |
29 TEST_F(HybridSlowStartTest, Simple) { | 27 TEST_F(HybridSlowStartTest, Simple) { |
30 QuicPacketSequenceNumber sequence_number = 1; | 28 QuicPacketSequenceNumber sequence_number = 1; |
31 QuicPacketSequenceNumber end_sequence_number = 3; | 29 QuicPacketSequenceNumber end_sequence_number = 3; |
32 slow_start_->StartReceiveRound(end_sequence_number); | 30 slow_start_->StartReceiveRound(end_sequence_number); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 rtt_.Add(QuicTime::Delta::FromMilliseconds(n + 5)), rtt_, 100)); | 96 rtt_.Add(QuicTime::Delta::FromMilliseconds(n + 5)), rtt_, 100)); |
99 } | 97 } |
100 // Expect to trigger since all packets in this burst was above the long term | 98 // Expect to trigger since all packets in this burst was above the long term |
101 // RTT provided. | 99 // RTT provided. |
102 EXPECT_TRUE(slow_start_->ShouldExitSlowStart( | 100 EXPECT_TRUE(slow_start_->ShouldExitSlowStart( |
103 rtt_.Add(QuicTime::Delta::FromMilliseconds(5)), rtt_, 100)); | 101 rtt_.Add(QuicTime::Delta::FromMilliseconds(5)), rtt_, 100)); |
104 } | 102 } |
105 | 103 |
106 } // namespace test | 104 } // namespace test |
107 } // namespace net | 105 } // namespace net |
OLD | NEW |