Chromium Code Reviews| Index: net/quic/quic_chromium_alarm_factory_test.cc |
| diff --git a/net/quic/quic_chromium_alarm_factory_test.cc b/net/quic/quic_chromium_alarm_factory_test.cc |
| index 5d4df0e7bfad4e4de9d2c978913da7896f6b542f..4ef931efabe9801d096e3aeb4621f795448dd6f5 100644 |
| --- a/net/quic/quic_chromium_alarm_factory_test.cc |
| +++ b/net/quic/quic_chromium_alarm_factory_test.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "net/quic/quic_chromium_connection_helper.h" |
| +#include "net/quic/quic_chromium_alarm_factory.h" |
|
Ryan Hamilton
2016/04/20 18:44:58
Is this supposed to be part of this CL?
|
| #include "net/quic/test_tools/mock_clock.h" |
| #include "net/quic/test_tools/mock_random.h" |
| @@ -26,18 +26,18 @@ class TestDelegate : public QuicAlarm::Delegate { |
| bool fired_; |
| }; |
| -class QuicChromiumConnectionHelperTest : public ::testing::Test { |
| +class QuicChromiumAlarmFactoryTest : public ::testing::Test { |
| protected: |
| - QuicChromiumConnectionHelperTest() |
| + QuicChromiumAlarmFactoryTest() |
| : runner_(new TestTaskRunner(&clock_)), |
| - alarm_factory_(runner_.get(), &clock_, ) {} |
| + alarm_factory_(runner_.get(), &clock_) {} |
| scoped_refptr<TestTaskRunner> runner_; |
| QuicChromiumAlarmFactory alarm_factory_; |
| MockClock clock_; |
| }; |
| -TEST_F(QuicChromiumConnectionHelperTest, CreateAlarm) { |
| +TEST_F(QuicChromiumAlarmFactoryTest, CreateAlarm) { |
| TestDelegate* delegate = new TestDelegate(); |
| std::unique_ptr<QuicAlarm> alarm(alarm_factory_.CreateAlarm(delegate)); |
| @@ -54,7 +54,7 @@ TEST_F(QuicChromiumConnectionHelperTest, CreateAlarm) { |
| EXPECT_TRUE(delegate->fired()); |
| } |
| -TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndCancel) { |
| +TEST_F(QuicChromiumAlarmFactoryTest, CreateAlarmAndCancel) { |
| TestDelegate* delegate = new TestDelegate(); |
| std::unique_ptr<QuicAlarm> alarm(alarm_factory_.CreateAlarm(delegate)); |
| @@ -72,7 +72,7 @@ TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndCancel) { |
| EXPECT_FALSE(delegate->fired()); |
| } |
| -TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndReset) { |
| +TEST_F(QuicChromiumAlarmFactoryTest, CreateAlarmAndReset) { |
| TestDelegate* delegate = new TestDelegate(); |
| std::unique_ptr<QuicAlarm> alarm(alarm_factory_.CreateAlarm(delegate)); |
| @@ -99,7 +99,7 @@ TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndReset) { |
| EXPECT_TRUE(delegate->fired()); |
| } |
| -TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndResetEarlier) { |
| +TEST_F(QuicChromiumAlarmFactoryTest, CreateAlarmAndResetEarlier) { |
| TestDelegate* delegate = new TestDelegate(); |
| std::unique_ptr<QuicAlarm> alarm(alarm_factory_.CreateAlarm(delegate)); |
| @@ -128,15 +128,15 @@ TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndResetEarlier) { |
| EXPECT_FALSE(delegate->fired()); |
| } |
| -TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndUpdate) { |
| +TEST_F(QuicChromiumAlarmFactoryTest, CreateAlarmAndUpdate) { |
| TestDelegate* delegate = new TestDelegate(); |
| std::unique_ptr<QuicAlarm> alarm(alarm_factory_.CreateAlarm(delegate)); |
| - QuicTime start = clock_->Now(); |
| + QuicTime start = clock_.Now(); |
| QuicTime::Delta delta = QuicTime::Delta::FromMicroseconds(1); |
| - alarm->Set(clock_->Now().Add(delta)); |
| + alarm->Set(clock_.Now().Add(delta)); |
| QuicTime::Delta new_delta = QuicTime::Delta::FromMicroseconds(3); |
| - alarm->Update(clock_->Now().Add(new_delta), |
| + alarm->Update(clock_.Now().Add(new_delta), |
| QuicTime::Delta::FromMicroseconds(1)); |
| // The alarm task should still be posted. |
| @@ -145,11 +145,11 @@ TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndUpdate) { |
| runner_->GetPostedTasks()[0].delay); |
| runner_->RunNextTask(); |
| - EXPECT_EQ(QuicTime::Zero().Add(delta), clock_->Now()); |
| + EXPECT_EQ(QuicTime::Zero().Add(delta), clock_.Now()); |
| EXPECT_FALSE(delegate->fired()); |
| // Move the alarm forward 1us and ensure it doesn't move forward. |
| - alarm->Update(clock_->Now().Add(new_delta), |
| + alarm->Update(clock_.Now().Add(new_delta), |
| QuicTime::Delta::FromMicroseconds(2)); |
| ASSERT_EQ(1u, runner_->GetPostedTasks().size()); |
| @@ -157,12 +157,12 @@ TEST_F(QuicChromiumConnectionHelperTest, CreateAlarmAndUpdate) { |
| new_delta.Subtract(delta).ToMicroseconds()), |
| runner_->GetPostedTasks()[0].delay); |
| runner_->RunNextTask(); |
| - EXPECT_EQ(start.Add(new_delta), clock_->Now()); |
| + EXPECT_EQ(start.Add(new_delta), clock_.Now()); |
| EXPECT_TRUE(delegate->fired()); |
| // Set the alarm via an update call. |
| new_delta = QuicTime::Delta::FromMicroseconds(5); |
| - alarm->Update(clock_->Now().Add(new_delta), |
| + alarm->Update(clock_.Now().Add(new_delta), |
| QuicTime::Delta::FromMicroseconds(1)); |
| EXPECT_TRUE(alarm->IsSet()); |