Commit b02792b9 authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

Remove FakeSigninManager::SignIn()

As part of the effort to eliminate this class, this CL eliminates its
last public API. We port the callers to either use identity_test_utils.h
or directly use SigninManager::OnExternalSigninCompleted() as
appropriate given the context of the test.

Bug: 796544
Change-Id: I3f32b3fbb2285925a65d35d0041750281cfc67c5
Reviewed-on: https://chromium-review.googlesource.com/c/1486531Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635466}
parent 18d4d20b
...@@ -39,14 +39,6 @@ FakeSigninManager::FakeSigninManager( ...@@ -39,14 +39,6 @@ FakeSigninManager::FakeSigninManager(
FakeSigninManager::~FakeSigninManager() {} FakeSigninManager::~FakeSigninManager() {}
void FakeSigninManager::SignIn(const std::string& gaia_id,
const std::string& username) {
std::string account_id =
account_tracker_service()->SeedAccountInfo(gaia_id, username);
token_service()->UpdateCredentials(account_id, "test_refresh_token");
OnExternalSigninCompleted(username);
}
void FakeSigninManager::OnSignoutDecisionReached( void FakeSigninManager::OnSignoutDecisionReached(
signin_metrics::ProfileSignout signout_source_metric, signin_metrics::ProfileSignout signout_source_metric,
signin_metrics::SignoutDelete signout_delete_metric, signin_metrics::SignoutDelete signout_delete_metric,
......
...@@ -34,8 +34,6 @@ class FakeSigninManager : public SigninManager { ...@@ -34,8 +34,6 @@ class FakeSigninManager : public SigninManager {
~FakeSigninManager() override; ~FakeSigninManager() override;
void SignIn(const std::string& gaia_id, const std::string& username);
protected: protected:
void OnSignoutDecisionReached( void OnSignoutDecisionReached(
signin_metrics::ProfileSignout signout_source_metric, signin_metrics::ProfileSignout signout_source_metric,
......
...@@ -227,7 +227,8 @@ class AccountConsistencyServiceTest : public PlatformTest { ...@@ -227,7 +227,8 @@ class AccountConsistencyServiceTest : public PlatformTest {
} }
void SignIn() { void SignIn() {
signin_manager_->SignIn("12345", "user@gmail.com"); identity::MakePrimaryAccountAvailable(
identity_test_env_->identity_manager(), "user@gmail.com");
EXPECT_EQ(0, web_view_load_expection_count_); EXPECT_EQ(0, web_view_load_expection_count_);
} }
......
...@@ -432,8 +432,8 @@ TEST_F(IdentityManagerImplTest, ...@@ -432,8 +432,8 @@ TEST_F(IdentityManagerImplTest,
// the primary account is now considered available). Note that it is necessary // the primary account is now considered available). Note that it is necessary
// to call SignIn() here to ensure that GoogleSigninSucceeded() is fired by // to call SignIn() here to ensure that GoogleSigninSucceeded() is fired by
// the fake signin manager. // the fake signin manager.
static_cast<FakeSigninManager*>(signin_manager()) SigninManager::FromSigninManagerBase(signin_manager())
->SignIn(kTestGaiaId, kTestEmail); ->OnExternalSigninCompleted(kTestEmail);
run_loop.Run(); run_loop.Run();
......
...@@ -501,12 +501,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAtStartup) { ...@@ -501,12 +501,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAtStartup) {
TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSignin) { TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSignin) {
ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT); ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT);
base::RunLoop run_loop; SetPrimaryAccount(identity_manager(), kTestEmail);
identity_manager_observer()->SetOnPrimaryAccountSetCallback(
run_loop.QuitClosure());
signin_manager()->SignIn(kTestGaiaId, kTestEmail);
run_loop.Run();
CoreAccountInfo primary_account_from_set_callback = CoreAccountInfo primary_account_from_set_callback =
identity_manager_observer()->PrimaryAccountFromSetCallback(); identity_manager_observer()->PrimaryAccountFromSetCallback();
...@@ -529,11 +524,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSigninAndSignout) { ...@@ -529,11 +524,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSigninAndSignout) {
ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT); ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT);
// First ensure that the user is signed in from the POV of the // First ensure that the user is signed in from the POV of the
// IdentityManager. // IdentityManager.
base::RunLoop run_loop; SetPrimaryAccount(identity_manager(), kTestEmail);
identity_manager_observer()->SetOnPrimaryAccountSetCallback(
run_loop.QuitClosure());
signin_manager()->SignIn(kTestGaiaId, kTestEmail);
run_loop.Run();
// Sign the user out and check that the IdentityManager responds // Sign the user out and check that the IdentityManager responds
// appropriately. // appropriately.
...@@ -560,11 +551,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSigninAndAccountRemoval) { ...@@ -560,11 +551,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSigninAndAccountRemoval) {
ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT); ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT);
// First ensure that the user is signed in from the POV of the // First ensure that the user is signed in from the POV of the
// IdentityManager. // IdentityManager.
base::RunLoop run_loop; SetPrimaryAccount(identity_manager(), kTestEmail);
identity_manager_observer()->SetOnPrimaryAccountSetCallback(
run_loop.QuitClosure());
signin_manager()->SignIn(kTestGaiaId, kTestEmail);
run_loop.Run();
// Remove the account from the AccountTrackerService and check that // Remove the account from the AccountTrackerService and check that
// the returned AccountInfo won't have a valid ID anymore, even if // the returned AccountInfo won't have a valid ID anymore, even if
...@@ -1462,7 +1449,8 @@ TEST_F( ...@@ -1462,7 +1449,8 @@ TEST_F(
RecreateIdentityManager(); RecreateIdentityManager();
signin_manager_observer.set_identity_manager(identity_manager()); signin_manager_observer.set_identity_manager(identity_manager());
signin_manager()->SignIn(kTestGaiaId, kTestEmail); signin_manager()->OnExternalSigninCompleted(kTestEmail);
run_loop.Run(); run_loop.Run();
CoreAccountInfo primary_account_from_signin_callback = CoreAccountInfo primary_account_from_signin_callback =
......
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