summaryrefslogtreecommitdiffstats
path: root/sync/test/callback_counter.h
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 23:21:30 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 23:21:30 +0000
commitc572a3ef5d0af696b3a852f6ceb427e7e3a7e597 (patch)
treeac88e1ac7b53972e0e81ed6fe8d29816aae81be2 /sync/test/callback_counter.h
parentea241b4a6194df1d8643fd1480e2159fcd5993e3 (diff)
downloadchromium_src-c572a3ef5d0af696b3a852f6ceb427e7e3a7e597.zip
chromium_src-c572a3ef5d0af696b3a852f6ceb427e7e3a7e597.tar.gz
chromium_src-c572a3ef5d0af696b3a852f6ceb427e7e3a7e597.tar.bz2
[Sync] Refactor sync configuration logic.
We remove all the pending download/configure state in SBH, in addition to the split transaction nature of configurations themselves. This allows us to have a single SyncScheduler::ScheduleConfiguration command that is both synchronous (assuming it doesn't fail) and can handle CleanupDisabledTypes and GetKey commands. This also now keys which datatypes need downloading by checking the initial sync ended bits directly. This allows us to recover from a new sync db gracefully. BUG=129665,133061,129825 TEST=unit/integration tests Review URL: https://chromiumcodereview.appspot.com/10483015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/test/callback_counter.h')
-rw-r--r--sync/test/callback_counter.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/sync/test/callback_counter.h b/sync/test/callback_counter.h
new file mode 100644
index 0000000..71586ec
--- /dev/null
+++ b/sync/test/callback_counter.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_TEST_CALLBACK_COUNTER_H_
+#define SYNC_TEST_CALLBACK_COUNTER_H_
+#pragma once
+
+namespace browser_sync {
+
+// Helper class to track how many times a callback is triggered.
+class CallbackCounter {
+ public:
+ CallbackCounter() { Reset(); }
+ ~CallbackCounter() {}
+
+ void Reset() { times_called_ = 0; }
+ void Callback() { ++times_called_; }
+ int times_called() const { return times_called_; }
+
+ private:
+ int times_called_;
+
+ DISALLOW_COPY_AND_ASSIGN(CallbackCounter);
+};
+
+} // namespace browser_sync
+
+#endif // SYNC_TEST_CALLBACK_COUNTER_H_