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

Unified Diff: sync/notifier/fake_invalidation_state_tracker.cc

Issue 10827133: [Sync] Rework unit tests for ChromeInvalidationClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head Created 8 years, 4 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 | « sync/notifier/fake_invalidation_state_tracker.h ('k') | sync/notifier/invalidation_notifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/fake_invalidation_state_tracker.cc
diff --git a/sync/notifier/fake_invalidation_state_tracker.cc b/sync/notifier/fake_invalidation_state_tracker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..426166b83b5ea5ad0b2b05b741672005fceadcf2
--- /dev/null
+++ b/sync/notifier/fake_invalidation_state_tracker.cc
@@ -0,0 +1,47 @@
+// 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.
+
+#include "sync/notifier/fake_invalidation_state_tracker.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace syncer {
+
+const int64 FakeInvalidationStateTracker::kMinVersion = kint64min;
+
+FakeInvalidationStateTracker::FakeInvalidationStateTracker() {}
+
+FakeInvalidationStateTracker::~FakeInvalidationStateTracker() {}
+
+InvalidationVersionMap
+FakeInvalidationStateTracker::GetAllMaxVersions() const {
+ return versions_;
+}
+
+void FakeInvalidationStateTracker::SetMaxVersion(
+ const invalidation::ObjectId& id, int64 max_version) {
+ InvalidationVersionMap::const_iterator it = versions_.find(id);
+ if ((it != versions_.end()) && (max_version <= it->second)) {
+ ADD_FAILURE();
+ return;
+ }
+ versions_[id] = max_version;
+}
+
+int64 FakeInvalidationStateTracker::GetMaxVersion(
+ const invalidation::ObjectId& id) const {
+ InvalidationVersionMap::const_iterator it = versions_.find(id);
+ return (it == versions_.end()) ? kMinVersion : it->second;
+}
+
+void FakeInvalidationStateTracker::SetInvalidationState(
+ const std::string& state) {
+ state_ = state;
+}
+
+std::string FakeInvalidationStateTracker::GetInvalidationState() const {
+ return state_;
+}
+
+} // namespace syncer
« no previous file with comments | « sync/notifier/fake_invalidation_state_tracker.h ('k') | sync/notifier/invalidation_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698