Index: chrome/browser/signin/fake_signin_manager.cc |
diff --git a/chrome/browser/signin/fake_signin_manager.cc b/chrome/browser/signin/fake_signin_manager.cc |
index 8314079fe8a782ece0255bf33191d0bd7b3ca5d0..6cc2902ae03f0233cbf56a2fcb8b1d46d9a44612 100644 |
--- a/chrome/browser/signin/fake_signin_manager.cc |
+++ b/chrome/browser/signin/fake_signin_manager.cc |
@@ -14,10 +14,13 @@ |
#include "chrome/browser/signin/signin_manager_factory.h" |
#include "chrome/browser/ui/global_error/global_error_service.h" |
#include "chrome/browser/ui/global_error/global_error_service_factory.h" |
+#include "chrome/common/pref_names.h" |
+#include "components/signin/core/browser/account_tracker_service.h" |
FakeSigninManagerBase::FakeSigninManagerBase(Profile* profile) |
: SigninManagerBase( |
- ChromeSigninClientFactory::GetInstance()->GetForProfile(profile)) {} |
+ ChromeSigninClientFactory::GetForProfile(profile), |
+ AccountTrackerServiceFactory::GetForProfile(profile)) {} |
FakeSigninManagerBase::~FakeSigninManagerBase() { |
} |
@@ -41,7 +44,7 @@ KeyedService* FakeSigninManagerBase::Build(content::BrowserContext* context) { |
FakeSigninManager::FakeSigninManager(Profile* profile) |
: SigninManager( |
- ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), |
+ ChromeSigninClientFactory::GetForProfile(profile), |
ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
AccountTrackerServiceFactory::GetForProfile(profile), |
GaiaCookieManagerServiceFactory::GetForProfile(profile)) {} |
@@ -51,30 +54,36 @@ FakeSigninManager::~FakeSigninManager() { |
void FakeSigninManager::StartSignInWithRefreshToken( |
const std::string& refresh_token, |
+ const std::string& gaia_id, |
const std::string& username, |
const std::string& password, |
const OAuthTokenFetchedCallback& oauth_fetched_callback) { |
- set_auth_in_progress(username); |
+ set_auth_in_progress( |
+ account_tracker_service()->SeedAccountInfo(gaia_id, username)); |
set_password(password); |
+ username_ = username; |
+ |
if (!oauth_fetched_callback.is_null()) |
oauth_fetched_callback.Run(refresh_token); |
} |
void FakeSigninManager::CompletePendingSignin() { |
- SetAuthenticatedUsername(GetUsernameForAuthInProgress()); |
+ SetAuthenticatedAccountId(GetAccountIdForAuthInProgress()); |
set_auth_in_progress(std::string()); |
FOR_EACH_OBSERVER(SigninManagerBase::Observer, |
observer_list_, |
- GoogleSigninSucceeded(authenticated_username_, |
- authenticated_username_, |
+ GoogleSigninSucceeded(authenticated_account_id_, |
+ username_, |
password_)); |
} |
-void FakeSigninManager::SignIn(const std::string& username, |
+void FakeSigninManager::SignIn(const std::string& gaia_id, |
+ const std::string& username, |
const std::string& password) { |
StartSignInWithRefreshToken( |
- std::string(), username, password, OAuthTokenFetchedCallback()); |
+ std::string(), gaia_id, username, password, |
+ OAuthTokenFetchedCallback()); |
CompletePendingSignin(); |
} |
@@ -92,7 +101,7 @@ void FakeSigninManager::SignOut( |
set_password(std::string()); |
const std::string account_id = GetAuthenticatedAccountId(); |
const std::string username = GetAuthenticatedUsername(); |
- ClearAuthenticatedUsername(); |
+ authenticated_account_id_.clear(); |
FOR_EACH_OBSERVER(SigninManagerBase::Observer, observer_list_, |
GoogleSignedOut(account_id, username)); |