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

Unified Diff: chrome/browser/sync/test/integration/profile_sync_service_harness.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: rebased Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/profile_sync_service_harness.cc
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 2f4450be96bf91ee381c37b78d160fe66be7cc11..e739a36ad5d58d61a561ffbfb9a64ffaa2061b54 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.";
}

Powered by Google App Engine
This is Rietveld 408576698