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

Unified Diff: jingle/notifier/listener/fake_push_client.h

Issue 10413014: [Sync] Turn notifier::PushClient into an interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 7 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 | « jingle/jingle.gyp ('k') | jingle/notifier/listener/fake_push_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/notifier/listener/fake_push_client.h
diff --git a/jingle/notifier/listener/fake_push_client.h b/jingle/notifier/listener/fake_push_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..61ba72b2d94e9e5a594871e700661fa87cf17a77
--- /dev/null
+++ b/jingle/notifier/listener/fake_push_client.h
@@ -0,0 +1,55 @@
+// 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 JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_
+#define JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/observer_list.h"
+#include "jingle/notifier/listener/push_client.h"
+
+namespace notifier {
+
+// PushClient implementation that can be used for testing.
+class FakePushClient : public PushClient {
+ public:
+ FakePushClient();
+ virtual ~FakePushClient();
+
+ // PushClient implementation.
+ virtual void AddObserver(PushClientObserver* observer) OVERRIDE;
+ virtual void RemoveObserver(PushClientObserver* observer) OVERRIDE;
+ virtual void UpdateSubscriptions(
+ const SubscriptionList& subscriptions) OVERRIDE;
+ virtual void UpdateCredentials(
+ const std::string& email, const std::string& token) OVERRIDE;
+ virtual void SendNotification(const Notification& notification) OVERRIDE;
+
+ // Triggers OnNotificationStateChange on all observers.
+ void SimulateNotificationStateChange(bool notifications_enabled);
+
+ // Triggers OnIncomingNotification on all observers.
+ void SimulateIncomingNotification(const Notification& notification);
+
+ const SubscriptionList& subscriptions() const;
+ const std::string& email() const;
+ const std::string& token() const;
+ const std::vector<Notification>& sent_notifications() const;
+
+ private:
+ ObserverList<PushClientObserver> observers_;
+ SubscriptionList subscriptions_;
+ std::string email_;
+ std::string token_;
+ std::vector<Notification> sent_notifications_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakePushClient);
+};
+
+} // namespace notifier
+
+#endif // JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_
« no previous file with comments | « jingle/jingle.gyp ('k') | jingle/notifier/listener/fake_push_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698