OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_ | 5 #ifndef JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_ |
6 #define JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_ | 6 #define JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "jingle/notifier/listener/push_client.h" | 13 #include "jingle/notifier/listener/push_client.h" |
| 14 #include "jingle/notifier/listener/push_client_observer.h" |
14 | 15 |
15 namespace notifier { | 16 namespace notifier { |
16 | 17 |
17 // PushClient implementation that can be used for testing. | 18 // PushClient implementation that can be used for testing. |
18 class FakePushClient : public PushClient { | 19 class FakePushClient : public PushClient { |
19 public: | 20 public: |
20 FakePushClient(); | 21 FakePushClient(); |
21 virtual ~FakePushClient(); | 22 virtual ~FakePushClient(); |
22 | 23 |
23 // PushClient implementation. | 24 // PushClient implementation. |
24 virtual void AddObserver(PushClientObserver* observer) OVERRIDE; | 25 virtual void AddObserver(PushClientObserver* observer) OVERRIDE; |
25 virtual void RemoveObserver(PushClientObserver* observer) OVERRIDE; | 26 virtual void RemoveObserver(PushClientObserver* observer) OVERRIDE; |
26 virtual void UpdateSubscriptions( | 27 virtual void UpdateSubscriptions( |
27 const SubscriptionList& subscriptions) OVERRIDE; | 28 const SubscriptionList& subscriptions) OVERRIDE; |
28 virtual void UpdateCredentials( | 29 virtual void UpdateCredentials( |
29 const std::string& email, const std::string& token) OVERRIDE; | 30 const std::string& email, const std::string& token) OVERRIDE; |
30 virtual void SendNotification(const Notification& notification) OVERRIDE; | 31 virtual void SendNotification(const Notification& notification) OVERRIDE; |
31 | 32 |
32 // Triggers OnNotificationStateChange on all observers. | 33 // Triggers OnNotificationsEnabled on all observers. |
33 void SimulateNotificationStateChange(bool notifications_enabled); | 34 void EnableNotifications(); |
| 35 |
| 36 // Triggers OnNotificationsDisabled on all observers. |
| 37 void DisableNotifications(NotificationsDisabledReason reason); |
34 | 38 |
35 // Triggers OnIncomingNotification on all observers. | 39 // Triggers OnIncomingNotification on all observers. |
36 void SimulateIncomingNotification(const Notification& notification); | 40 void SimulateIncomingNotification(const Notification& notification); |
37 | 41 |
38 const SubscriptionList& subscriptions() const; | 42 const SubscriptionList& subscriptions() const; |
39 const std::string& email() const; | 43 const std::string& email() const; |
40 const std::string& token() const; | 44 const std::string& token() const; |
41 const std::vector<Notification>& sent_notifications() const; | 45 const std::vector<Notification>& sent_notifications() const; |
42 | 46 |
43 private: | 47 private: |
44 ObserverList<PushClientObserver> observers_; | 48 ObserverList<PushClientObserver> observers_; |
45 SubscriptionList subscriptions_; | 49 SubscriptionList subscriptions_; |
46 std::string email_; | 50 std::string email_; |
47 std::string token_; | 51 std::string token_; |
48 std::vector<Notification> sent_notifications_; | 52 std::vector<Notification> sent_notifications_; |
49 | 53 |
50 DISALLOW_COPY_AND_ASSIGN(FakePushClient); | 54 DISALLOW_COPY_AND_ASSIGN(FakePushClient); |
51 }; | 55 }; |
52 | 56 |
53 } // namespace notifier | 57 } // namespace notifier |
54 | 58 |
55 #endif // JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_ | 59 #endif // JINGLE_NOTIFIER_LISTENER_FAKE_PUSH_CLIENT_H_ |
OLD | NEW |