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

Side by Side Diff: sync/notifier/push_client_channel_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 "sync/notifier/push_client_channel.h" 5 #include "sync/notifier/push_client_channel.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 PushClientChannel::EncodeMessageForTest( 144 PushClientChannel::EncodeMessageForTest(
145 kMessage, 145 kMessage,
146 push_client_channel_.GetServiceContextForTest(), 146 push_client_channel_.GetServiceContextForTest(),
147 push_client_channel_.GetSchedulingHashForTest()); 147 push_client_channel_.GetSchedulingHashForTest());
148 ASSERT_EQ(1u, fake_push_client_->sent_notifications().size()); 148 ASSERT_EQ(1u, fake_push_client_->sent_notifications().size());
149 EXPECT_TRUE( 149 EXPECT_TRUE(
150 fake_push_client_->sent_notifications()[0].Equals( 150 fake_push_client_->sent_notifications()[0].Equals(
151 expected_notification)); 151 expected_notification));
152 } 152 }
153 153
154 // Simulate notification state changes on the push client. It should 154 // Simulate push client state changes on the push client. It should
155 // propagate to the channel. 155 // propagate to the channel.
156 TEST_F(PushClientChannelTest, OnNotificationStateChange) { 156 TEST_F(PushClientChannelTest, OnPushClientStateChange) {
157 EXPECT_FALSE(connected_); 157 EXPECT_FALSE(connected_);
158 fake_push_client_->SimulateNotificationStateChange(true); 158 fake_push_client_->EnableNotifications();
159 EXPECT_TRUE(connected_); 159 EXPECT_TRUE(connected_);
160 fake_push_client_->SimulateNotificationStateChange(false); 160 fake_push_client_->DisableNotifications(
161 notifier::TRANSIENT_NOTIFICATION_ERROR);
162 EXPECT_FALSE(connected_);
163 fake_push_client_->EnableNotifications();
164 EXPECT_TRUE(connected_);
165 fake_push_client_->DisableNotifications(
166 notifier::NOTIFICATION_CREDENTIALS_REJECTED);
161 EXPECT_FALSE(connected_); 167 EXPECT_FALSE(connected_);
162 } 168 }
163 169
164 // Simulate an incoming notification. It should be decoded properly 170 // Simulate an incoming notification. It should be decoded properly
165 // by the channel. 171 // by the channel.
166 TEST_F(PushClientChannelTest, OnIncomingNotification) { 172 TEST_F(PushClientChannelTest, OnIncomingNotification) {
167 const notifier::Notification notification = 173 const notifier::Notification notification =
168 PushClientChannel::EncodeMessageForTest( 174 PushClientChannel::EncodeMessageForTest(
169 kMessage, kServiceContext, kSchedulingHash); 175 kMessage, kServiceContext, kSchedulingHash);
170 176
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 fake_push_client_->sent_notifications()[1], 244 fake_push_client_->sent_notifications()[1],
239 &message, &service_context, &scheduling_hash)); 245 &message, &service_context, &scheduling_hash));
240 EXPECT_EQ(kMessage, message); 246 EXPECT_EQ(kMessage, message);
241 EXPECT_EQ(kServiceContext, service_context); 247 EXPECT_EQ(kServiceContext, service_context);
242 EXPECT_EQ(kSchedulingHash, scheduling_hash); 248 EXPECT_EQ(kSchedulingHash, scheduling_hash);
243 } 249 }
244 } 250 }
245 251
246 } // namespace 252 } // namespace
247 } // namespace sync_notifier 253 } // namespace sync_notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698