1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_
6 #define JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/observer_list.h"
13 #include "jingle/notifier/listener/push_client.h"
14 #include "jingle/notifier/listener/push_client_observer.h"
18 // PushClient implementation that can be used for testing.
19 class FakePushClient : public PushClient {
22 virtual ~FakePushClient();
24 // PushClient implementation.
25 virtual void AddObserver(PushClientObserver* observer) OVERRIDE;
26 virtual void RemoveObserver(PushClientObserver* observer) OVERRIDE;
27 virtual void UpdateSubscriptions(
28 const SubscriptionList& subscriptions) OVERRIDE;
29 virtual void UpdateCredentials(
30 const std::string& email, const std::string& token) OVERRIDE;
31 virtual void SendNotification(const Notification& notification) OVERRIDE;
32 virtual void SendPing() OVERRIDE;
34 // Triggers OnNotificationsEnabled on all observers.
35 void EnableNotifications();
37 // Triggers OnNotificationsDisabled on all observers.
38 void DisableNotifications(NotificationsDisabledReason reason);
40 // Triggers OnIncomingNotification on all observers.
41 void SimulateIncomingNotification(const Notification& notification);
43 const SubscriptionList& subscriptions() const;
44 const std::string& email() const;
45 const std::string& token() const;
46 const std::vector<Notification>& sent_notifications() const;
47 int sent_pings() const;
50 ObserverList<PushClientObserver> observers_;
51 SubscriptionList subscriptions_;
54 std::vector<Notification> sent_notifications_;
57 DISALLOW_COPY_AND_ASSIGN(FakePushClient);
60 } // namespace notifier
62 #endif // JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_