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

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: Created 8 years 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: sync/notifier/ack_tracker.h
diff --git a/sync/notifier/ack_tracker.h b/sync/notifier/ack_tracker.h
index 1609ac9715b0076fcc97b061eafe1e646daac3d3..f74035bfbccc3e0eca61102a187585bdbb2d72c3 100644
--- a/sync/notifier/ack_tracker.h
+++ b/sync/notifier/ack_tracker.h
@@ -16,6 +16,10 @@
#include "net/base/backoff_entry.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
@@ -33,11 +37,10 @@ class 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.
@@ -52,7 +55,6 @@ class 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|.
@@ -82,9 +84,10 @@ class 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_;

Powered by Google App Engine
This is Rietveld 408576698