Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h |
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h |
index 105ac2a237c419f9ce66d44ce1ed100949b09fc8..8d2cf29f5e3596405e44e40894f95012ca50d3d4 100644 |
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h |
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h |
@@ -11,6 +11,8 @@ |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/single_thread_task_runner.h" |
+#include "base/time/clock.h" |
+#include "base/time/tick_clock.h" |
#include "base/time/time.h" |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h" |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h" |
@@ -114,15 +116,15 @@ class TestDataReductionProxyConfigServiceClient |
private: |
// A clock which returns a fixed value in both base::Time and base::TimeTicks. |
- class TestTickClock { |
+ class TestTickClock : public base::Clock, public base::TickClock { |
public: |
TestTickClock(const base::Time& initial_time); |
- // Returns the current base::TimeTicks |
- base::TimeTicks NowTicks() const; |
+ // base::TickClock implementation. |
+ base::TimeTicks NowTicks() override; |
- // Returns the current base::Time |
- base::Time Now() const; |
+ // base::Clock implementation. |
+ base::Time Now() override; |
// Sets the current time. |
void SetTime(const base::Time& time); |
@@ -131,23 +133,8 @@ class TestDataReductionProxyConfigServiceClient |
base::Time time_; |
}; |
- // A net::BackoffEntry which uses an injected base::TickClock to control |
- // the backoff expiration time. |
- class TestBackoffEntry : public net::BackoffEntry { |
- public: |
- TestBackoffEntry(const BackoffEntry::Policy* const policy, |
- const TestTickClock* tick_clock); |
- |
- protected: |
- // Override of net::BackoffEntry. |
- base::TimeTicks ImplGetTimeNow() const override; |
- |
- private: |
- const TestTickClock* tick_clock_; |
- }; |
- |
- TestTickClock tick_clock_; |
- TestBackoffEntry test_backoff_entry_; |
+ mutable TestTickClock tick_clock_; |
mmenke
2015/04/10 15:50:43
Why does this have to be mutable?
johnme
2015/04/10 16:23:36
It was because base::Clock::Now is non-const, henc
mmenke
2015/04/10 16:26:37
I'd go ahead and make DataReductionProxyConfigServ
|
+ net::BackoffEntry test_backoff_entry_; |
}; |
// Test version of |DataReductionProxyService|, which permits mocking of various |