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

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

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/notifier/listener/fake_push_client.h ('k') | jingle/notifier/listener/fake_push_client_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/notifier/listener/fake_push_client.cc
diff --git a/jingle/notifier/listener/fake_push_client.cc b/jingle/notifier/listener/fake_push_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cfe4a999ab4be1223f2dbdc6e38f64b34fad45f8
--- /dev/null
+++ b/jingle/notifier/listener/fake_push_client.cc
@@ -0,0 +1,67 @@
+// 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 "jingle/notifier/listener/fake_push_client.h"
+
+#include "jingle/notifier/listener/push_client_observer.h"
+
+namespace notifier {
+
+FakePushClient::FakePushClient() {}
+
+FakePushClient::~FakePushClient() {}
+
+void FakePushClient::AddObserver(PushClientObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void FakePushClient::RemoveObserver(PushClientObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+void FakePushClient::UpdateSubscriptions(
+ const SubscriptionList& subscriptions) {
+ subscriptions_ = subscriptions;
+}
+
+void FakePushClient::UpdateCredentials(
+ const std::string& email, const std::string& token) {
+ email_ = email;
+ token_ = token;
+}
+
+void FakePushClient::SendNotification(const Notification& notification) {
+ sent_notifications_.push_back(notification);
+}
+
+void FakePushClient::SimulateNotificationStateChange(
+ bool notifications_enabled) {
+ FOR_EACH_OBSERVER(PushClientObserver, observers_,
+ OnNotificationStateChange(notifications_enabled));
+}
+
+void FakePushClient::SimulateIncomingNotification(
+ const Notification& notification) {
+ FOR_EACH_OBSERVER(PushClientObserver, observers_,
+ OnIncomingNotification(notification));
+}
+
+const SubscriptionList& FakePushClient::subscriptions() const {
+ return subscriptions_;
+}
+
+const std::string& FakePushClient::email() const {
+ return email_;
+}
+
+const std::string& FakePushClient::token() const {
+ return token_;
+}
+
+const std::vector<Notification>& FakePushClient::sent_notifications() const {
+ return sent_notifications_;
+}
+
+} // namespace notifier
+
« no previous file with comments | « jingle/notifier/listener/fake_push_client.h ('k') | jingle/notifier/listener/fake_push_client_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698