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

Unified Diff: sync/notifier/ack_tracker.h

Issue 11607003: Add a Clock and TickClock interface for mocking out time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix warnings Created 7 years, 10 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
« no previous file with comments | « media/base/pipeline_unittest.cc ('k') | sync/notifier/ack_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/ack_tracker.h
diff --git a/sync/notifier/ack_tracker.h b/sync/notifier/ack_tracker.h
index 08fcad9a43be5f52e042b95dcd5c76c02317c358..a21a914daa9ac69d00ae619b7ffec73ab760713e 100644
--- a/sync/notifier/ack_tracker.h
+++ b/sync/notifier/ack_tracker.h
@@ -17,6 +17,10 @@
#include "sync/base/sync_export.h"
#include "sync/notifier/invalidation_util.h"
+namespace base {
+class TickClock;
+} // namespace base
+
namespace syncer {
// A simple class that tracks sets of object IDs that have not yet been
@@ -34,11 +38,10 @@ class SYNC_EXPORT_PRIVATE AckTracker {
virtual void OnTimeout(const ObjectIdSet& ids) = 0;
};
- typedef base::Callback<base::TimeTicks()> NowCallback;
typedef base::Callback<scoped_ptr<net::BackoffEntry>(
const net::BackoffEntry::Policy* const)> CreateBackoffEntryCallback;
- explicit AckTracker(Delegate* delegate);
+ AckTracker(base::TickClock* tick_clock, Delegate* delegate);
~AckTracker();
// Equivalent to calling Ack() on all currently registered object IDs.
@@ -53,7 +56,6 @@ class SYNC_EXPORT_PRIVATE AckTracker {
void Ack(const ObjectIdSet& ids);
// Testing methods.
- void SetNowCallbackForTest(const NowCallback& now_callback);
void SetCreateBackoffEntryCallbackForTest(
const CreateBackoffEntryCallback& create_backoff_entry_callback);
// Returns true iff there are no timeouts scheduled to occur before |now|.
@@ -83,9 +85,10 @@ class SYNC_EXPORT_PRIVATE AckTracker {
const net::BackoffEntry::Policy* const policy);
// Used for testing purposes.
- NowCallback now_callback_;
CreateBackoffEntryCallback create_backoff_entry_callback_;
+ base::TickClock* const tick_clock_;
+
Delegate* const delegate_;
base::OneShotTimer<AckTracker> timer_;
« no previous file with comments | « media/base/pipeline_unittest.cc ('k') | sync/notifier/ack_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698