Commit 2a54cee2 authored by Anastasiia N's avatar Anastasiia N Committed by Commit Bot

Make methods in AccountsMutatorImpl NOTREACHED on Chrome OS

On Chrome OS we should not change accounts using AccountsMutatorImpl.
All methods except UpdateAccountInfo should be NOTREACHED.

Bug: 1068240
Change-Id: Ib25550b82e8b81d7b58c0995a6809e148c4e3b33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2317351
Commit-Queue: Anastasiia N <anastasiian@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792415}
parent 80ff36e2
...@@ -836,9 +836,8 @@ IN_PROC_BROWSER_TEST_P(ArcAuthServiceTest, AccountRemovalsArePropagated) { ...@@ -836,9 +836,8 @@ IN_PROC_BROWSER_TEST_P(ArcAuthServiceTest, AccountRemovalsArePropagated) {
// be sent. // be sent.
EnableRemovalOfExtendedAccountInfo(); EnableRemovalOfExtendedAccountInfo();
identity_manager->GetAccountsMutator()->RemoveAccount( signin::RemoveRefreshTokenForAccount(identity_manager,
maybe_account_info.value().account_id, maybe_account_info.value().account_id);
signin_metrics::SourceForRefreshTokenOperation::kUnknown);
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, auth_instance().num_account_removed_calls()); EXPECT_EQ(1, auth_instance().num_account_removed_calls());
......
...@@ -329,9 +329,7 @@ TEST_F(AdvancedProtectionStatusManagerTest, AccountRemoval) { ...@@ -329,9 +329,7 @@ TEST_F(AdvancedProtectionStatusManagerTest, AccountRemoval) {
// This call is necessary to ensure that the account removal is fully // This call is necessary to ensure that the account removal is fully
// processed in this testing context. // processed in this testing context.
identity_test_env_.EnableRemovalOfExtendedAccountInfo(); identity_test_env_.EnableRemovalOfExtendedAccountInfo();
identity_test_env_.identity_manager()->GetAccountsMutator()->RemoveAccount( identity_test_env_.RemoveRefreshTokenForAccount(account_id);
account_id,
signin_metrics::SourceForRefreshTokenOperation::kUserMenu_RemoveAccount);
EXPECT_FALSE(aps_manager.IsUnderAdvancedProtection()); EXPECT_FALSE(aps_manager.IsUnderAdvancedProtection());
EXPECT_TRUE( EXPECT_TRUE(
pref_service_.HasPrefPath(prefs::kAdvancedProtectionLastRefreshInUs)); pref_service_.HasPrefPath(prefs::kAdvancedProtectionLastRefreshInUs));
......
...@@ -42,6 +42,9 @@ CoreAccountId AccountsMutatorImpl::AddOrUpdateAccount( ...@@ -42,6 +42,9 @@ CoreAccountId AccountsMutatorImpl::AddOrUpdateAccount(
const std::string& refresh_token, const std::string& refresh_token,
bool is_under_advanced_protection, bool is_under_advanced_protection,
signin_metrics::SourceForRefreshTokenOperation source) { signin_metrics::SourceForRefreshTokenOperation source) {
#if defined(OS_CHROMEOS)
NOTREACHED();
#endif
CoreAccountId account_id = CoreAccountId account_id =
account_tracker_service_->SeedAccountInfo(gaia_id, email); account_tracker_service_->SeedAccountInfo(gaia_id, email);
account_tracker_service_->SetIsAdvancedProtectionAccount( account_tracker_service_->SetIsAdvancedProtectionAccount(
...@@ -75,16 +78,25 @@ void AccountsMutatorImpl::UpdateAccountInfo( ...@@ -75,16 +78,25 @@ void AccountsMutatorImpl::UpdateAccountInfo(
void AccountsMutatorImpl::RemoveAccount( void AccountsMutatorImpl::RemoveAccount(
const CoreAccountId& account_id, const CoreAccountId& account_id,
signin_metrics::SourceForRefreshTokenOperation source) { signin_metrics::SourceForRefreshTokenOperation source) {
#if defined(OS_CHROMEOS)
NOTREACHED();
#endif
token_service_->RevokeCredentials(account_id, source); token_service_->RevokeCredentials(account_id, source);
} }
void AccountsMutatorImpl::RemoveAllAccounts( void AccountsMutatorImpl::RemoveAllAccounts(
signin_metrics::SourceForRefreshTokenOperation source) { signin_metrics::SourceForRefreshTokenOperation source) {
#if defined(OS_CHROMEOS)
NOTREACHED();
#endif
token_service_->RevokeAllCredentials(source); token_service_->RevokeAllCredentials(source);
} }
void AccountsMutatorImpl::InvalidateRefreshTokenForPrimaryAccount( void AccountsMutatorImpl::InvalidateRefreshTokenForPrimaryAccount(
signin_metrics::SourceForRefreshTokenOperation source) { signin_metrics::SourceForRefreshTokenOperation source) {
#if defined(OS_CHROMEOS)
NOTREACHED();
#endif
DCHECK(primary_account_manager_->IsAuthenticated()); DCHECK(primary_account_manager_->IsAuthenticated());
CoreAccountInfo primary_account_info = CoreAccountInfo primary_account_info =
primary_account_manager_->GetAuthenticatedAccountInfo(); primary_account_manager_->GetAuthenticatedAccountInfo();
......
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