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

Side by Side Diff: chrome/browser/signin/signin_tracker_unittest.cc

Issue 9956097: suppress user/password dialog when re-enabling sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 8 years, 8 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 "chrome/browser/signin/signin_tracker.h" 5 #include "chrome/browser/signin/signin_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 .WillRepeatedly(Return(true)); 219 .WillRepeatedly(Return(true));
220 EXPECT_CALL(*mock_pss_, AreCredentialsAvailable()).WillRepeatedly( 220 EXPECT_CALL(*mock_pss_, AreCredentialsAvailable()).WillRepeatedly(
221 Return(false)); 221 Return(false));
222 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password"); 222 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password");
223 content::NotificationService::current()->Notify( 223 content::NotificationService::current()->Notify(
224 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, 224 chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL,
225 content::Source<Profile>(profile_.get()), 225 content::Source<Profile>(profile_.get()),
226 content::Details<const GoogleServiceSigninSuccessDetails>(&details)); 226 content::Details<const GoogleServiceSigninSuccessDetails>(&details));
227 } 227 }
228 228
229 #if !defined(OS_CHROMEOS)
Andrew T Wilson (Slow) 2012/04/03 17:45:13 If you make the signin tracker so you can inject t
kochi 2012/04/03 21:55:29 Done. Added TODO.
229 TEST_F(SigninTrackerTest, GaiaSigninAfterSyncStarts) { 230 TEST_F(SigninTrackerTest, GaiaSigninAfterSyncStarts) {
230 // Make sure that we don't get a SigninSuccess() callback until after the 231 // Make sure that we don't get a SigninSuccess() callback until after the
231 // sync service reports that it's signed in. 232 // sync service reports that it's signed in.
232 EXPECT_CALL(observer_, GaiaCredentialsValid()); 233 EXPECT_CALL(observer_, GaiaCredentialsValid());
233 EXPECT_CALL(*mock_pss_, AreCredentialsAvailable()).WillOnce( 234 EXPECT_CALL(*mock_pss_, AreCredentialsAvailable()).WillOnce(
234 Return(false)); 235 Return(false));
235 EXPECT_CALL(*mock_token_service_, HasTokenForService(_)) 236 EXPECT_CALL(*mock_token_service_, HasTokenForService(_))
236 .WillRepeatedly(Return(true)); 237 .WillRepeatedly(Return(true));
237 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password"); 238 GoogleServiceSigninSuccessDetails details("username@gmail.com", "password");
238 content::NotificationService::current()->Notify( 239 content::NotificationService::current()->Notify(
(...skipping 27 matching lines...) Expand all
266 tracker_->OnStateChanged(); 267 tracker_->OnStateChanged();
267 // Now mimic an auth error - this should cause us to fail (not waiting for 268 // Now mimic an auth error - this should cause us to fail (not waiting for
268 // auth, but still have no credentials). 269 // auth, but still have no credentials).
269 GoogleServiceAuthError error( 270 GoogleServiceAuthError error(
270 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); 271 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
271 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); 272 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error));
272 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillOnce(Return(false)); 273 EXPECT_CALL(*mock_pss_, waiting_for_auth()).WillOnce(Return(false));
273 EXPECT_CALL(observer_, SigninFailed(error)); 274 EXPECT_CALL(observer_, SigninFailed(error));
274 tracker_->OnStateChanged(); 275 tracker_->OnStateChanged();
275 } 276 }
276 277 #endif // !OS_CHROMEOS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698