Commit 1b641521 authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Convert AccountManager classes to unconsented primary account

SplitSettingsSync will allow the user to opt-out of browser sync.
However, IdentityAccessor::GetPrimaryAccountInfo() assumes the user has
consented to browser sync. The usage in AccountManager code isn't
related to browser sync consent.

Switch to using the "unconsented" primary account. On Chrome OS this
account always exists for the logged-in user account, whether or not
the user consented to browser sync.

See go/cros-sync-mock and go/cros-primary-account for details.

  on enrolled device, see screen/v3dTEPoVGyg

Bug: 1042400
Test: updated existing browser_test
Test: Account manager WebUI shows correct domain for primary account
Change-Id: Ied51c6aec99b34436a8c308a1ab0d2a569e00a9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2031642
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Auto-Submit: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737914}
parent 09f8e0f0
......@@ -60,7 +60,8 @@ class AccountManagerPolicyControllerTest
auto* identity_test_env =
identity_test_environment_adaptor_->identity_test_env();
const AccountInfo primary_account_info =
identity_test_env->MakePrimaryAccountAvailable(kFakePrimaryUsername);
identity_test_env->MakeUnconsentedPrimaryAccountAvailable(
kFakePrimaryUsername);
auto user_manager = std::make_unique<chromeos::FakeChromeUserManager>();
primary_account_id_ = AccountId::FromUserEmailGaiaId(
primary_account_info.email, primary_account_info.gaia);
......@@ -169,7 +170,7 @@ IN_PROC_BROWSER_TEST_P(
->GetUserByProfile(profile())
->GetAccountId()
.GetGaiaId(),
identity_manager()->GetPrimaryAccountInfo().gaia);
identity_manager()->GetUnconsentedPrimaryAccountInfo().gaia);
EXPECT_EQ(ProfileHelper::Get()
->GetUserByProfile(profile())
->GetAccountId()
......@@ -204,7 +205,7 @@ IN_PROC_BROWSER_TEST_P(
->GetUserByProfile(profile())
->GetAccountId()
.GetGaiaId(),
identity_manager()->GetPrimaryAccountInfo().gaia);
identity_manager()->GetUnconsentedPrimaryAccountInfo().gaia);
EXPECT_EQ(ProfileHelper::Get()
->GetUserByProfile(profile())
->GetAccountId()
......
......@@ -273,7 +273,7 @@ void AccountManagerUIHandler::OnGetAccounts(
GetEnterpriseDomainFromUsername(user->GetDisplayEmail()));
} else if (profile_->GetProfilePolicyConnector()->IsManaged()) {
device_account.SetOrganization(GetEnterpriseDomainFromUsername(
identity_manager_->GetPrimaryAccountInfo().email));
identity_manager_->GetUnconsentedPrimaryAccountInfo().email));
}
// Device account must show up at the top.
......
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