Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h

Issue 1076853003: Refactor net::BackoffEntry to not require subclassing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address pneubeck's review comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d51e3164924063cde230202e10a0d56637afbb85..1c53783f64affb96a1318ad5ae0475543fb8d750 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"
@@ -104,20 +106,20 @@ class TestDataReductionProxyConfigServiceClient
protected:
// Overrides of DataReductionProxyConfigServiceClient
- base::Time Now() const override;
+ base::Time Now() override;
net::BackoffEntry* GetBackoffEntry() override;
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);
@@ -126,23 +128,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_;
+ net::BackoffEntry test_backoff_entry_;
};
// Test version of |DataReductionProxyService|, which permits mocking of various

Powered by Google App Engine
This is Rietveld 408576698