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 ~FakePushClient() override;
24 // PushClient implementation.
25 void AddObserver(PushClientObserver* observer) override;
26 void RemoveObserver(PushClientObserver* observer) override;
27 void UpdateSubscriptions(const SubscriptionList& subscriptions) override;
28 void UpdateCredentials(const std::string& email,
29 const std::string& token) override;
30 void SendNotification(const Notification& notification) override;
31 void SendPing() override;
33 // Triggers OnNotificationsEnabled on all observers.
34 void EnableNotifications();
36 // Triggers OnNotificationsDisabled on all observers.
37 void DisableNotifications(NotificationsDisabledReason reason);
39 // Triggers OnIncomingNotification on all observers.
40 void SimulateIncomingNotification(const Notification& notification);
42 const SubscriptionList& subscriptions() const;
43 const std::string& email() const;
44 const std::string& token() const;
45 const std::vector<Notification>& sent_notifications() const;
46 int sent_pings() const;
49 ObserverList<PushClientObserver> observers_;
50 SubscriptionList subscriptions_;
53 std::vector<Notification> sent_notifications_;
56 DISALLOW_COPY_AND_ASSIGN(FakePushClient);
59 } // namespace notifier
61 #endif // JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_