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 "sync/notifier/non_blocking_invalidation_notifier.h" | 5 #include "sync/notifier/non_blocking_invalidation_notifier.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 }; | 66 }; |
67 | 67 |
68 TEST_F(NonBlockingInvalidationNotifierTest, Basic) { | 68 TEST_F(NonBlockingInvalidationNotifierTest, Basic) { |
69 InSequence dummy; | 69 InSequence dummy; |
70 | 70 |
71 syncable::ModelTypePayloadMap type_payloads; | 71 syncable::ModelTypePayloadMap type_payloads; |
72 type_payloads[syncable::PREFERENCES] = "payload"; | 72 type_payloads[syncable::PREFERENCES] = "payload"; |
73 type_payloads[syncable::BOOKMARKS] = ""; | 73 type_payloads[syncable::BOOKMARKS] = ""; |
74 type_payloads[syncable::AUTOFILL] = ""; | 74 type_payloads[syncable::AUTOFILL] = ""; |
75 | 75 |
76 EXPECT_CALL(mock_observer_, OnNotificationStateChange(true)); | 76 EXPECT_CALL(mock_observer_, OnNotificationsEnabled()); |
77 EXPECT_CALL(mock_observer_, | 77 EXPECT_CALL(mock_observer_, |
78 OnIncomingNotification(type_payloads, | 78 OnIncomingNotification(type_payloads, |
79 REMOTE_NOTIFICATION)); | 79 REMOTE_NOTIFICATION)); |
80 EXPECT_CALL(mock_observer_, OnNotificationStateChange(false)); | 80 EXPECT_CALL(mock_observer_, |
| 81 OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR)); |
| 82 EXPECT_CALL(mock_observer_, |
| 83 OnNotificationsDisabled(NOTIFICATION_CREDENTIALS_REJECTED)); |
81 | 84 |
82 invalidation_notifier_->SetStateDeprecated("fake_state"); | 85 invalidation_notifier_->SetStateDeprecated("fake_state"); |
83 invalidation_notifier_->SetUniqueId("fake_id"); | 86 invalidation_notifier_->SetUniqueId("fake_id"); |
84 invalidation_notifier_->UpdateCredentials("foo@bar.com", "fake_token"); | 87 invalidation_notifier_->UpdateCredentials("foo@bar.com", "fake_token"); |
85 | 88 |
86 invalidation_notifier_->OnNotificationStateChange(true); | 89 invalidation_notifier_->OnNotificationsEnabled(); |
87 invalidation_notifier_->OnIncomingNotification(type_payloads, | 90 invalidation_notifier_->OnIncomingNotification(type_payloads, |
88 REMOTE_NOTIFICATION); | 91 REMOTE_NOTIFICATION); |
89 invalidation_notifier_->OnNotificationStateChange(false); | 92 invalidation_notifier_->OnNotificationsDisabled( |
| 93 TRANSIENT_NOTIFICATION_ERROR); |
| 94 invalidation_notifier_->OnNotificationsDisabled( |
| 95 NOTIFICATION_CREDENTIALS_REJECTED); |
90 | 96 |
91 ui_loop_.RunAllPending(); | 97 ui_loop_.RunAllPending(); |
92 } | 98 } |
93 | 99 |
94 } // namespace | 100 } // namespace |
95 | 101 |
96 } // namespace sync_notifier | 102 } // namespace sync_notifier |
OLD | NEW |