Commit ac2d27b0 authored by atwilson@chromium.org's avatar atwilson@chromium.org

No longer trigger signin errors on connection_failed for sync.

If ProfileSyncService gets a transient network error trying to contact the
backend, we no longer treat this as a fatal signin error.

Also, we no longer display a "wait for the backend to startup" spinner in cases
where we know the spinner will immediately be dismissed, to avoid a gnarly
infinite loop in the UI code.

BUG=244769

Review URL: https://chromiumcodereview.appspot.com/16173006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203968 0039d316-1c4b-4281-b951-d872f2087c98
parent eb81c80b
...@@ -171,9 +171,14 @@ bool SigninTracker::AreServicesSignedIn(Profile* profile) { ...@@ -171,9 +171,14 @@ bool SigninTracker::AreServicesSignedIn(Profile* profile) {
return true; return true;
ProfileSyncService* service = ProfileSyncService* service =
ProfileSyncServiceFactory::GetForProfile(profile); ProfileSyncServiceFactory::GetForProfile(profile);
// Check the sync service state - we ignore CONNECTION_FAILED errors here
// because they are transient and do not signify a failure of the signin
// process.
return (service->IsSyncEnabledAndLoggedIn() && return (service->IsSyncEnabledAndLoggedIn() &&
service->IsSyncTokenAvailable() && service->IsSyncTokenAvailable() &&
service->GetAuthError().state() == GoogleServiceAuthError::NONE && (service->GetAuthError().state() == GoogleServiceAuthError::NONE ||
service->GetAuthError().state() ==
GoogleServiceAuthError::CONNECTION_FAILED) &&
!service->HasUnrecoverableError()); !service->HasUnrecoverableError());
} }
......
...@@ -363,10 +363,21 @@ TEST_F(SigninTrackerTest, SigninFailedGoogleServiceAuthError) { ...@@ -363,10 +363,21 @@ TEST_F(SigninTrackerTest, SigninFailedGoogleServiceAuthError) {
TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) { TEST_F(SigninTrackerTest, SigninFailedWhenInitializing) {
tracker_.reset(); tracker_.reset();
// SigninFailed() should be called. // SigninFailed() should be called because we are not signed in.
GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED); GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED);
EXPECT_CALL(observer_, SigninFailed(error)); EXPECT_CALL(observer_, SigninFailed(error));
tracker_.reset(new SigninTracker(profile_.get(), &observer_, tracker_.reset(new SigninTracker(profile_.get(), &observer_,
SigninTracker::SERVICES_INITIALIZING)); SigninTracker::SERVICES_INITIALIZING));
tracker_->OnStateChanged(); tracker_->OnStateChanged();
} }
TEST_F(SigninTrackerTest, ConnectionErrorWhenInitializing) {
// SigninFailed() should not be called for a CONNECTION_FAILED error.
GoogleServiceAuthError error(GoogleServiceAuthError::CONNECTION_FAILED);
ExpectSignedInSyncService(mock_pss_, mock_token_service_, error);
mock_signin_manager_->SetAuthenticatedUsername("username@gmail.com");
EXPECT_CALL(observer_, SigninFailed(_)).Times(0);
tracker_.reset(new SigninTracker(profile_.get(), &observer_,
SigninTracker::SERVICES_INITIALIZING));
tracker_->OnStateChanged();
}
...@@ -440,7 +440,15 @@ void SyncSetupHandler::DisplayConfigureSync(bool show_advanced, ...@@ -440,7 +440,15 @@ void SyncSetupHandler::DisplayConfigureSync(bool show_advanced,
#endif #endif
service->UnsuppressAndStart(); service->UnsuppressAndStart();
DisplaySpinner();
// See if it's even possible to bring up the sync backend - if not
// (unrecoverable error?), don't bother displaying a spinner that will be
// immediately closed because this leads to some ugly infinite UI loop (see
// http://crbug.com/244769).
if (SigninTracker::GetSigninState(GetProfile(), NULL) !=
SigninTracker::WAITING_FOR_GAIA_VALIDATION) {
DisplaySpinner();
}
// To listen to the token available notifications, start SigninTracker. // To listen to the token available notifications, start SigninTracker.
signin_tracker_.reset( signin_tracker_.reset(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment