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

Unified Diff: chrome/browser/invalidation/fake_invalidation_service.h

Issue 15580002: Make use of InvalidationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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: chrome/browser/invalidation/fake_invalidation_service.h
diff --git a/chrome/browser/invalidation/fake_invalidation_service.h b/chrome/browser/invalidation/fake_invalidation_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..aef4d016dbd62306b7f0af92e6f33c32611b78aa
--- /dev/null
+++ b/chrome/browser/invalidation/fake_invalidation_service.h
@@ -0,0 +1,48 @@
+// 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 CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_
+#define CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_
+
+#include "chrome/browser/invalidation/invalidation_service.h"
+#include "sync/notifier/invalidator_registrar.h"
+
+namespace invalidation {
+
+// An InvalidationService that emits invalidations only when
+// its EmitInvalidationForTest method is called.
+class FakeInvalidationService : public InvalidationService {
+ public:
+ FakeInvalidationService();
+ virtual ~FakeInvalidationService();
+
+ virtual void RegisterInvalidationHandler(
+ syncer::InvalidationHandler* handler) OVERRIDE;
+ virtual void UpdateRegisteredInvalidationIds(
+ syncer::InvalidationHandler* handler,
+ const syncer::ObjectIdSet& ids) OVERRIDE;
+ virtual void UnregisterInvalidationHandler(
+ syncer::InvalidationHandler* handler) OVERRIDE;
+
+ virtual void AcknowledgeInvalidation(
+ const invalidation::ObjectId& id,
+ const syncer::AckHandle& ack_handle) OVERRIDE;
+
+ virtual syncer::InvalidatorState GetInvalidatorState() const OVERRIDE;
+ virtual std::string GetInvalidatorClientId() const OVERRIDE;
+
+ void EmitInvalidationForTest(
+ const invalidation::ObjectId& object_id,
+ const std::string& payload);
+
+ private:
+ std::string client_id_;
+ syncer::InvalidatorRegistrar invalidator_registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeInvalidationService);
+};
+
+} // namespace invalidation
+
+#endif // CHROME_BROWSER_INVALIDATION_FAKE_INVALIDATION_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698