Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Side by Side Diff: jingle/notifier/listener/non_blocking_push_client_unittest.cc

Issue 10545170: [Sync] Propagate XMPP auth errors to SyncNotifierObservers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix deps, win compile error Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/non_blocking_push_client.h" 5 #include "jingle/notifier/listener/non_blocking_push_client.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 EXPECT_TRUE(fake_push_client_->sent_notifications().empty()); 108 EXPECT_TRUE(fake_push_client_->sent_notifications().empty());
109 message_loop_.RunAllPending(); 109 message_loop_.RunAllPending();
110 ASSERT_EQ(1u, fake_push_client_->sent_notifications().size()); 110 ASSERT_EQ(1u, fake_push_client_->sent_notifications().size());
111 EXPECT_TRUE( 111 EXPECT_TRUE(
112 fake_push_client_->sent_notifications()[0].Equals(notification)); 112 fake_push_client_->sent_notifications()[0].Equals(notification));
113 } 113 }
114 114
115 // Make sure notification state changes get propagated back to the 115 // Make sure notification state changes get propagated back to the
116 // parent. 116 // parent.
117 TEST_F(NonBlockingPushClientTest, NotificationStateChange) { 117 TEST_F(NonBlockingPushClientTest, NotificationStateChange) {
118 EXPECT_FALSE(fake_observer_.notifications_enabled()); 118 EXPECT_EQ(DEFAULT_NOTIFICATION_ERROR,
119 fake_push_client_->SimulateNotificationStateChange(true); 119 fake_observer_.last_notifications_disabled_reason());
120 fake_push_client_->EnableNotifications();
120 message_loop_.RunAllPending(); 121 message_loop_.RunAllPending();
121 EXPECT_TRUE(fake_observer_.notifications_enabled()); 122 EXPECT_EQ(NO_NOTIFICATION_ERROR,
122 fake_push_client_->SimulateNotificationStateChange(false); 123 fake_observer_.last_notifications_disabled_reason());
124 fake_push_client_->DisableNotifications(
125 NOTIFICATION_CREDENTIALS_REJECTED);
123 message_loop_.RunAllPending(); 126 message_loop_.RunAllPending();
124 EXPECT_FALSE(fake_observer_.notifications_enabled()); 127 EXPECT_EQ(NOTIFICATION_CREDENTIALS_REJECTED,
128 fake_observer_.last_notifications_disabled_reason());
125 } 129 }
126 130
127 // Make sure incoming notifications get propagated back to the parent. 131 // Make sure incoming notifications get propagated back to the parent.
128 TEST_F(NonBlockingPushClientTest, OnIncomingNotification) { 132 TEST_F(NonBlockingPushClientTest, OnIncomingNotification) {
129 const Notification notification = MakeTestNotification(); 133 const Notification notification = MakeTestNotification();
130 134
131 fake_push_client_->SimulateIncomingNotification(notification); 135 fake_push_client_->SimulateIncomingNotification(notification);
132 message_loop_.RunAllPending(); 136 message_loop_.RunAllPending();
133 EXPECT_TRUE( 137 EXPECT_TRUE(
134 fake_observer_.last_incoming_notification().Equals(notification)); 138 fake_observer_.last_incoming_notification().Equals(notification));
135 } 139 }
136 140
137 } // namespace 141 } // namespace
138 142
139 } // namespace notifier 143 } // namespace notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698