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(
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(
signin_metrics::ProfileSignout signout_source_metric,
signin_metrics::SignoutDelete signout_delete_metric,
......
......@@ -34,8 +34,6 @@ class FakeSigninManager : public SigninManager {
~FakeSigninManager() override;
void SignIn(const std::string& gaia_id, const std::string& username);
protected:
void OnSignoutDecisionReached(
signin_metrics::ProfileSignout signout_source_metric,
......
......@@ -227,7 +227,8 @@ class AccountConsistencyServiceTest : public PlatformTest {
}
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_);
}
......
......@@ -432,8 +432,8 @@ TEST_F(IdentityManagerImplTest,
// the primary account is now considered available). Note that it is necessary
// to call SignIn() here to ensure that GoogleSigninSucceeded() is fired by
// the fake signin manager.
static_cast<FakeSigninManager*>(signin_manager())
->SignIn(kTestGaiaId, kTestEmail);
SigninManager::FromSigninManagerBase(signin_manager())
->OnExternalSigninCompleted(kTestEmail);
run_loop.Run();
......
......@@ -501,12 +501,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAtStartup) {
TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSignin) {
ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT);
base::RunLoop run_loop;
identity_manager_observer()->SetOnPrimaryAccountSetCallback(
run_loop.QuitClosure());
signin_manager()->SignIn(kTestGaiaId, kTestEmail);
run_loop.Run();
SetPrimaryAccount(identity_manager(), kTestEmail);
CoreAccountInfo primary_account_from_set_callback =
identity_manager_observer()->PrimaryAccountFromSetCallback();
......@@ -529,11 +524,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSigninAndSignout) {
ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT);
// First ensure that the user is signed in from the POV of the
// IdentityManager.
base::RunLoop run_loop;
identity_manager_observer()->SetOnPrimaryAccountSetCallback(
run_loop.QuitClosure());
signin_manager()->SignIn(kTestGaiaId, kTestEmail);
run_loop.Run();
SetPrimaryAccount(identity_manager(), kTestEmail);
// Sign the user out and check that the IdentityManager responds
// appropriately.
......@@ -560,11 +551,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSigninAndAccountRemoval) {
ClearPrimaryAccount(identity_manager(), ClearPrimaryAccountPolicy::DEFAULT);
// First ensure that the user is signed in from the POV of the
// IdentityManager.
base::RunLoop run_loop;
identity_manager_observer()->SetOnPrimaryAccountSetCallback(
run_loop.QuitClosure());
signin_manager()->SignIn(kTestGaiaId, kTestEmail);
run_loop.Run();
SetPrimaryAccount(identity_manager(), kTestEmail);
// Remove the account from the AccountTrackerService and check that
// the returned AccountInfo won't have a valid ID anymore, even if
......@@ -1462,7 +1449,8 @@ TEST_F(
RecreateIdentityManager();
signin_manager_observer.set_identity_manager(identity_manager());
signin_manager()->SignIn(kTestGaiaId, kTestEmail);
signin_manager()->OnExternalSigninCompleted(kTestEmail);
run_loop.Run();
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