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 #include "jingle/notifier/listener/fake_push_client.h" | 5 #include "jingle/notifier/listener/fake_push_client.h" |
6 | 6 |
7 #include "jingle/notifier/listener/push_client_observer.h" | 7 #include "jingle/notifier/listener/push_client_observer.h" |
8 | 8 |
9 namespace notifier { | 9 namespace notifier { |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 void FakePushClient::UpdateCredentials( | 28 void FakePushClient::UpdateCredentials( |
29 const std::string& email, const std::string& token) { | 29 const std::string& email, const std::string& token) { |
30 email_ = email; | 30 email_ = email; |
31 token_ = token; | 31 token_ = token; |
32 } | 32 } |
33 | 33 |
34 void FakePushClient::SendNotification(const Notification& notification) { | 34 void FakePushClient::SendNotification(const Notification& notification) { |
35 sent_notifications_.push_back(notification); | 35 sent_notifications_.push_back(notification); |
36 } | 36 } |
37 | 37 |
38 void FakePushClient::SimulateNotificationStateChange( | 38 void FakePushClient::EnableNotifications() { |
39 bool notifications_enabled) { | |
40 FOR_EACH_OBSERVER(PushClientObserver, observers_, | 39 FOR_EACH_OBSERVER(PushClientObserver, observers_, |
41 OnNotificationStateChange(notifications_enabled)); | 40 OnNotificationsEnabled()); |
| 41 } |
| 42 |
| 43 void FakePushClient::DisableNotifications( |
| 44 NotificationsDisabledReason reason) { |
| 45 FOR_EACH_OBSERVER(PushClientObserver, observers_, |
| 46 OnNotificationsDisabled(reason)); |
42 } | 47 } |
43 | 48 |
44 void FakePushClient::SimulateIncomingNotification( | 49 void FakePushClient::SimulateIncomingNotification( |
45 const Notification& notification) { | 50 const Notification& notification) { |
46 FOR_EACH_OBSERVER(PushClientObserver, observers_, | 51 FOR_EACH_OBSERVER(PushClientObserver, observers_, |
47 OnIncomingNotification(notification)); | 52 OnIncomingNotification(notification)); |
48 } | 53 } |
49 | 54 |
50 const SubscriptionList& FakePushClient::subscriptions() const { | 55 const SubscriptionList& FakePushClient::subscriptions() const { |
51 return subscriptions_; | 56 return subscriptions_; |
52 } | 57 } |
53 | 58 |
54 const std::string& FakePushClient::email() const { | 59 const std::string& FakePushClient::email() const { |
55 return email_; | 60 return email_; |
56 } | 61 } |
57 | 62 |
58 const std::string& FakePushClient::token() const { | 63 const std::string& FakePushClient::token() const { |
59 return token_; | 64 return token_; |
60 } | 65 } |
61 | 66 |
62 const std::vector<Notification>& FakePushClient::sent_notifications() const { | 67 const std::vector<Notification>& FakePushClient::sent_notifications() const { |
63 return sent_notifications_; | 68 return sent_notifications_; |
64 } | 69 } |
65 | 70 |
66 } // namespace notifier | 71 } // namespace notifier |
67 | 72 |
OLD | NEW |