| 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 "net/quic/congestion_control/inter_arrival_bitrate_ramp_up.h" | 7 #include "net/quic/congestion_control/inter_arrival_bitrate_ramp_up.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 InterArrivalBitrateRampUpTest : public ::testing::Test { | 14 class InterArrivalBitrateRampUpTest : public ::testing::Test { |
| 15 protected: | 15 protected: |
| 16 InterArrivalBitrateRampUpTest() | 16 InterArrivalBitrateRampUpTest() |
| 17 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), | 17 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), |
| 18 hundred_ms_(QuicTime::Delta::FromMilliseconds(100)), | 18 hundred_ms_(QuicTime::Delta::FromMilliseconds(100)), |
| 19 bitrate_ramp_up_(&clock_) { | 19 bitrate_ramp_up_(&clock_) { |
| 20 } | 20 } |
| 21 void SetUp() { | 21 virtual void SetUp() { |
| 22 clock_.AdvanceTime(one_ms_); | 22 clock_.AdvanceTime(one_ms_); |
| 23 } | 23 } |
| 24 const QuicTime::Delta one_ms_; | 24 const QuicTime::Delta one_ms_; |
| 25 const QuicTime::Delta hundred_ms_; | 25 const QuicTime::Delta hundred_ms_; |
| 26 MockClock clock_; | 26 MockClock clock_; |
| 27 InterArrivalBitrateRampUp bitrate_ramp_up_; | 27 InterArrivalBitrateRampUp bitrate_ramp_up_; |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 TEST_F(InterArrivalBitrateRampUpTest, GoodEstimates) { | 30 TEST_F(InterArrivalBitrateRampUpTest, GoodEstimates) { |
| 31 QuicBandwidth start_rate = QuicBandwidth::FromKBytesPerSecond(100); | 31 QuicBandwidth start_rate = QuicBandwidth::FromKBytesPerSecond(100); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 EXPECT_GE(channel_estimate, sent_bitrate); | 395 EXPECT_GE(channel_estimate, sent_bitrate); |
| 396 EXPECT_LE(halfway_point, sent_bitrate); | 396 EXPECT_LE(halfway_point, sent_bitrate); |
| 397 } | 397 } |
| 398 clock_.AdvanceTime(hundred_ms_); | 398 clock_.AdvanceTime(hundred_ms_); |
| 399 sent_bitrate = bitrate_ramp_up_.GetNewBitrate(sent_bitrate); | 399 sent_bitrate = bitrate_ramp_up_.GetNewBitrate(sent_bitrate); |
| 400 EXPECT_LE(channel_estimate, sent_bitrate); | 400 EXPECT_LE(channel_estimate, sent_bitrate); |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace test | 403 } // namespace test |
| 404 } // namespace net | 404 } // namespace net |
| OLD | NEW |