OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "net/quic/congestion_control/inter_arrival_state_machine.h" | 8 #include "net/quic/congestion_control/inter_arrival_state_machine.h" |
9 #include "net/quic/test_tools/mock_clock.h" | 9 #include "net/quic/test_tools/mock_clock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 namespace test { | 13 namespace test { |
14 | 14 |
15 class InterArrivalStateMachineTest : public ::testing::Test { | 15 class InterArrivalStateMachineTest : public ::testing::Test { |
16 protected: | 16 protected: |
17 InterArrivalStateMachineTest() { | 17 InterArrivalStateMachineTest() { |
18 } | 18 } |
19 | 19 |
20 void SetUp() { | 20 virtual void SetUp() { |
21 state_machine_.reset(new InterArrivalStateMachine(&clock_)); | 21 state_machine_.reset(new InterArrivalStateMachine(&clock_)); |
22 } | 22 } |
23 | 23 |
24 MockClock clock_; | 24 MockClock clock_; |
25 scoped_ptr<InterArrivalStateMachine> state_machine_; | 25 scoped_ptr<InterArrivalStateMachine> state_machine_; |
26 }; | 26 }; |
27 | 27 |
28 TEST_F(InterArrivalStateMachineTest, SimplePacketLoss) { | 28 TEST_F(InterArrivalStateMachineTest, SimplePacketLoss) { |
29 QuicTime::Delta rtt = QuicTime::Delta::FromMilliseconds(100); | 29 QuicTime::Delta rtt = QuicTime::Delta::FromMilliseconds(100); |
30 state_machine_->set_rtt(rtt); | 30 state_machine_->set_rtt(rtt); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Make sure we stay in state competing TCP flow(s). | 117 // Make sure we stay in state competing TCP flow(s). |
118 clock_.AdvanceTime(rtt); | 118 clock_.AdvanceTime(rtt); |
119 state_machine_->PacketLossEvent(); | 119 state_machine_->PacketLossEvent(); |
120 state_machine_->DecreaseBitrateDecision(); | 120 state_machine_->DecreaseBitrateDecision(); |
121 EXPECT_EQ(kInterArrivalStateCompetingTcpFLow, | 121 EXPECT_EQ(kInterArrivalStateCompetingTcpFLow, |
122 state_machine_->GetInterArrivalState()); | 122 state_machine_->GetInterArrivalState()); |
123 } | 123 } |
124 | 124 |
125 } // namespace test | 125 } // namespace test |
126 } // namespace net | 126 } // namespace net |
OLD | NEW |