Commit 652ff752 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Clean up pass on DiceTurnSyncOnHelper code

This is a follow up CL to [1], that addresses post-land feedback from blundell@.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1387393/6#message-5b6d62524d8612f8d9b11bd7500af41f4f10cc76

BUG=890811,890812

Change-Id: Ie01be10511872dca5b053d20386559d2975e4bff
Reviewed-on: https://chromium-review.googlesource.com/c/1391688Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#619771}
parent 736eadde
......@@ -442,7 +442,6 @@ void DiceTurnSyncOnHelper::OnNewProfileTokensLoaded(Profile* new_profile) {
void DiceTurnSyncOnHelper::SigninAndShowSyncConfirmationUI() {
// Signin.
auto* primary_account_mutator = identity_manager_->GetPrimaryAccountMutator();
DCHECK(primary_account_mutator);
primary_account_mutator->SetPrimaryAccount(account_info_.account_id);
signin_metrics::LogSigninAccessPointCompleted(signin_access_point_,
signin_promo_action_);
......
......@@ -30,8 +30,8 @@ class SyncService;
class SyncSetupInProgressHandle;
}
// Handles details of signing the user in with IdentityManager and turning on
// sync for an account that is already present in the token service.
// Handles details of setting the primary account with IdentityManager and
// turning on sync for an account for which there is already a refresh token.
class DiceTurnSyncOnHelper : public SyncStartupTracker::Observer {
public:
// Behavior when the signin is aborted (by an error or cancelled by the user).
......
......@@ -175,14 +175,6 @@ std::unique_ptr<TestingProfile> BuildTestingProfile(
const base::FilePath& path,
Profile::Delegate* delegate) {
TestingProfile::Builder profile_builder;
TestingProfile::TestingFactories testing_factories =
IdentityTestEnvironmentProfileAdaptor::
GetIdentityTestEnvironmentFactories();
for (auto& testing_factory : testing_factories) {
profile_builder.AddTestingFactory(testing_factory.first,
testing_factory.second);
}
profile_builder.AddTestingFactory(
ChromeSigninClientFactory::GetInstance(),
base::BindRepeating(&signin::BuildTestSigninClient));
......@@ -194,7 +186,8 @@ std::unique_ptr<TestingProfile> BuildTestingProfile(
base::BindRepeating(&FakeUserPolicySigninService::Build));
profile_builder.SetDelegate(delegate);
profile_builder.SetPath(path);
return profile_builder.Build();
return IdentityTestEnvironmentProfileAdaptor::
CreateProfileForIdentityTestEnvironment(profile_builder);
}
} // namespace
......@@ -808,7 +801,7 @@ TEST_F(DiceTurnSyncOnHelperTest,
DiceTurnSyncOnHelper* dice_sync_starter = CreateDiceTurnOnSyncHelper(
DiceTurnSyncOnHelper::SigninAbortedMode::REMOVE_ACCOUNT);
// Check that the account was set in the sign-in manager, but the sync
// Check that the primary account was set with IdentityManager, but the sync
// confirmation dialog was not yet shown.
EXPECT_TRUE(identity_manager()->HasAccountWithRefreshToken(account_id()));
EXPECT_EQ(account_id(), identity_manager()->GetPrimaryAccountId());
......
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