OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/domain_reliability/dispatcher.h" | 5 #include "components/domain_reliability/dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "components/domain_reliability/test_util.h" | 8 #include "components/domain_reliability/test_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
| 11 namespace domain_reliability { |
| 12 namespace { |
| 13 |
11 using base::TimeDelta; | 14 using base::TimeDelta; |
12 using base::TimeTicks; | 15 using base::TimeTicks; |
13 | 16 |
14 namespace domain_reliability { | |
15 | |
16 class DomainReliabilityDispatcherTest : public testing::Test { | 17 class DomainReliabilityDispatcherTest : public testing::Test { |
17 public: | 18 public: |
18 DomainReliabilityDispatcherTest() : dispatcher_(&time_) {} | 19 DomainReliabilityDispatcherTest() : dispatcher_(&time_) {} |
19 | 20 |
20 protected: | 21 protected: |
21 MockTime time_; | 22 MockTime time_; |
22 DomainReliabilityDispatcher dispatcher_; | 23 DomainReliabilityDispatcher dispatcher_; |
23 }; | 24 }; |
24 | 25 |
25 TEST_F(DomainReliabilityDispatcherTest, Create) { | 26 TEST_F(DomainReliabilityDispatcherTest, Create) { |
(...skipping 25 matching lines...) Expand all Loading... |
51 TimeDelta delay = TimeDelta::FromSeconds(1); | 52 TimeDelta delay = TimeDelta::FromSeconds(1); |
52 TestCallback callback; | 53 TestCallback callback; |
53 | 54 |
54 dispatcher_.ScheduleTask(callback.callback(), 2 * delay, 3 * delay); | 55 dispatcher_.ScheduleTask(callback.callback(), 2 * delay, 3 * delay); |
55 time_.Advance(2 * delay); | 56 time_.Advance(2 * delay); |
56 EXPECT_FALSE(callback.called()); | 57 EXPECT_FALSE(callback.called()); |
57 time_.Advance(delay); | 58 time_.Advance(delay); |
58 EXPECT_TRUE(callback.called()); | 59 EXPECT_TRUE(callback.called()); |
59 } | 60 } |
60 | 61 |
| 62 } // namespace |
61 } // namespace domain_reliability | 63 } // namespace domain_reliability |
OLD | NEW |