diff options
Diffstat (limited to 'chrome/browser/sync/test/integration/profile_sync_service_harness.cc')
-rw-r--r-- | chrome/browser/sync/test/integration/profile_sync_service_harness.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc index 2f4450b..e739a36a 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc @@ -37,6 +37,10 @@ using syncer::sessions::SyncSessionSnapshot; namespace { +std::string GetGaiaIdForUsername(const std::string& username) { + return "gaia-id-" + username; +} + bool HasAuthError(ProfileSyncService* service) { return service->GetAuthError().state() == GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || @@ -155,6 +159,12 @@ bool ProfileSyncServiceHarness::SetupSync( // until we've finished configuration. service()->SetSetupInProgress(true); + // Authenticate sync client using GAIA credentials. + std::string gaia_id = GetGaiaIdForUsername(username_); + service()->signin()->SetAuthenticatedAccountInfo(gaia_id, username_); + std::string account_id = service()->signin()->GetAuthenticatedAccountId(); + service()->GoogleSigninSucceeded(account_id, username_, password_); + DCHECK(!username_.empty()); if (signin_type_ == SigninType::UI_SIGNIN) { Browser* browser = @@ -166,10 +176,10 @@ bool ProfileSyncServiceHarness::SetupSync( } } else if (signin_type_ == SigninType::FAKE_SIGNIN) { // Authenticate sync client using GAIA credentials. - service()->signin()->SetAuthenticatedUsername(username_); - service()->GoogleSigninSucceeded(username_, username_, password_); + service()->signin()->SetAuthenticatedAccountInfo(gaia_id, username_); + service()->GoogleSigninSucceeded(account_id, username_, password_); ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> - UpdateCredentials(username_, GenerateFakeOAuth2RefreshTokenString()); + UpdateCredentials(account_id, GenerateFakeOAuth2RefreshTokenString()); } else { LOG(ERROR) << "Unsupported profile signin type."; } |