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

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

Issue 16173006: No longer trigger signin errors on connection_failed for sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « chrome/browser/signin/signin_tracker.cc ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 Return(false)); 356 Return(false));
357 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true)); 357 EXPECT_CALL(*mock_pss_, sync_initialized()).WillRepeatedly(Return(true));
358 // Any error should result in SigninFailed() being called. 358 // Any error should result in SigninFailed() being called.
359 EXPECT_CALL(observer_, SigninFailed(error)); 359 EXPECT_CALL(observer_, SigninFailed(error));
360 tracker_.reset(new SigninTracker(profile_.get(), &observer_, 360 tracker_.reset(new SigninTracker(profile_.get(), &observer_,
361 SigninTracker::SERVICES_INITIALIZING)); 361 SigninTracker::SERVICES_INITIALIZING));
362 } 362 }
363 363
364 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { 364 TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) {
365 tracker_.reset(); 365 tracker_.reset();
366 // SigninFailed() should be called. 366 // SigninFailed() should be called because we are not signed in.
367 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); 367 GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED);
368 EXPECT_CALL(observer_, SigninFailed(error)); 368 EXPECT_CALL(observer_, SigninFailed(error));
369 tracker_.reset(new SigninTracker(profile_.get(), &observer_, 369 tracker_.reset(new SigninTracker(profile_.get(), &observer_,
370 SigninTracker::SERVICES_INITIALIZING)); 370 SigninTracker::SERVICES_INITIALIZING));
371 tracker_->OnStateChanged(); 371 tracker_->OnStateChanged();
372 } 372 }
373
374 TEST_F(SigninTrackerTest, ConnectionErrorWhenInitializing) {
375 // SigninFailed() should not be called for a CONNECTION_FAILED error.
376 GoogleServiceAuthError error(GoogleServiceAuthError::CONNECTION_FAILED);
377 ExpectSignedInSyncService(mock_pss_, mock_token_service_, error);
378 mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
379 EXPECT_CALL(observer_, SigninFailed(_)).Times(0);
380 tracker_.reset(new SigninTracker(profile_.get(), &observer_,
381 SigninTracker::SERVICES_INITIALIZING));
382 tracker_->OnStateChanged();
383 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_tracker.cc ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698