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/util.h" | 5 #include "components/domain_reliability/util.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 | 13 |
14 namespace domain_reliability { | 14 namespace domain_reliability { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 class ActualTimer : public MockableTime::Timer { | 18 class ActualTimer : public MockableTime::Timer { |
19 public: | 19 public: |
20 // Initialize base timer with retain_user_info and is_repeating false. | 20 // Initialize base timer with retain_user_info and is_repeating false. |
21 ActualTimer() : base_timer_(false, false) {} | 21 ActualTimer() : base_timer_(false, false) {} |
22 | 22 |
23 virtual ~ActualTimer() {} | 23 virtual ~ActualTimer() {} |
24 | 24 |
25 // MockableTime::Timer implementation: | 25 // MockableTime::Timer implementation: |
26 virtual void Start(const tracked_objects::Location& posted_from, | 26 virtual void Start(const tracked_objects::Location& posted_from, |
27 base::TimeDelta delay, | 27 base::TimeDelta delay, |
28 const base::Closure& user_task) OVERRIDE { | 28 const base::Closure& user_task) override { |
29 base_timer_.Start(posted_from, delay, user_task); | 29 base_timer_.Start(posted_from, delay, user_task); |
30 } | 30 } |
31 | 31 |
32 virtual void Stop() OVERRIDE { | 32 virtual void Stop() override { |
33 base_timer_.Stop(); | 33 base_timer_.Stop(); |
34 } | 34 } |
35 | 35 |
36 virtual bool IsRunning() OVERRIDE { | 36 virtual bool IsRunning() override { |
37 return base_timer_.IsRunning(); | 37 return base_timer_.IsRunning(); |
38 } | 38 } |
39 | 39 |
40 private: | 40 private: |
41 base::Timer base_timer_; | 41 base::Timer base_timer_; |
42 }; | 42 }; |
43 | 43 |
44 const struct NetErrorMapping { | 44 const struct NetErrorMapping { |
45 int net_error; | 45 int net_error; |
46 const char* beacon_status; | 46 const char* beacon_status; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 ActualTime::~ActualTime() {} | 133 ActualTime::~ActualTime() {} |
134 | 134 |
135 base::Time ActualTime::Now() { return base::Time::Now(); } | 135 base::Time ActualTime::Now() { return base::Time::Now(); } |
136 base::TimeTicks ActualTime::NowTicks() { return base::TimeTicks::Now(); } | 136 base::TimeTicks ActualTime::NowTicks() { return base::TimeTicks::Now(); } |
137 | 137 |
138 scoped_ptr<MockableTime::Timer> ActualTime::CreateTimer() { | 138 scoped_ptr<MockableTime::Timer> ActualTime::CreateTimer() { |
139 return scoped_ptr<MockableTime::Timer>(new ActualTimer()); | 139 return scoped_ptr<MockableTime::Timer>(new ActualTimer()); |
140 } | 140 } |
141 | 141 |
142 } // namespace domain_reliability | 142 } // namespace domain_reliability |
OLD | NEW |