Index: components/domain_reliability/util.h |
diff --git a/components/domain_reliability/util.h b/components/domain_reliability/util.h |
index 4256b059cbd0a4e41d76051b3c02f072ca67622a..832e2fc4196351f92567577e2a4017d85d781ce8 100644 |
--- a/components/domain_reliability/util.h |
+++ b/components/domain_reliability/util.h |
@@ -10,11 +10,12 @@ |
#include "base/callback_forward.h" |
#include "base/compiler_specific.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/time/clock.h" |
+#include "base/time/tick_clock.h" |
#include "base/time/time.h" |
#include "base/tracked_objects.h" |
#include "components/domain_reliability/domain_reliability_export.h" |
#include "components/domain_reliability/uploader.h" |
-#include "net/base/backoff_entry.h" |
#include "net/http/http_response_info.h" |
#include "net/url_request/url_request_status.h" |
@@ -51,7 +52,8 @@ void GetUploadResultFromResponseDetails( |
// Mockable wrapper around TimeTicks::Now and Timer. Mock version is in |
// test_util.h. |
// TODO(ttuttle): Rename to Time{Provider,Source,?}. |
-class DOMAIN_RELIABILITY_EXPORT MockableTime { |
+class DOMAIN_RELIABILITY_EXPORT MockableTime : public base::Clock, |
+ public base::TickClock { |
public: |
// Mockable wrapper around (a subset of) base::Timer. |
class DOMAIN_RELIABILITY_EXPORT Timer { |
@@ -68,12 +70,13 @@ class DOMAIN_RELIABILITY_EXPORT MockableTime { |
Timer(); |
}; |
- virtual ~MockableTime(); |
+ ~MockableTime() override; |
+ |
+ // Clock impl; returns base::Time::Now() or a mocked version thereof. |
+ base::Time Now() override = 0; |
+ // TickClock impl; returns base::TimeTicks::Now() or a mocked version thereof. |
+ base::TimeTicks NowTicks() override = 0; |
- // Returns base::Time::Now() or a mocked version thereof. |
- virtual base::Time Now() = 0; |
- // Returns base::TimeTicks::Now() or a mocked version thereof. |
- virtual base::TimeTicks NowTicks() = 0; |
// Returns a new Timer, or a mocked version thereof. |
virtual scoped_ptr<MockableTime::Timer> CreateTimer() = 0; |
@@ -98,21 +101,6 @@ class DOMAIN_RELIABILITY_EXPORT ActualTime : public MockableTime { |
scoped_ptr<MockableTime::Timer> CreateTimer() override; |
}; |
-// A subclass of BackoffEntry that uses a MockableTime to keep track of time. |
-class MockableTimeBackoffEntry : public net::BackoffEntry { |
- public: |
- MockableTimeBackoffEntry(const net::BackoffEntry::Policy* const policy, |
- MockableTime* time); |
- |
- ~MockableTimeBackoffEntry() override; |
- |
- protected: |
- base::TimeTicks ImplGetTimeNow() const override; |
- |
- private: |
- MockableTime* time_; |
-}; |
- |
} // namespace domain_reliability |
#endif // COMPONENTS_DOMAIN_RELIABILITY_UTIL_H_ |