Commit 69508417 authored by James Cook's avatar James Cook Committed by Commit Bot

Fix UserImageManagerTest when SplitSettingsSync is enabled

UserImageManagerTest.SaveUserImageFromProfileImage was using
signin::SetRefreshTokenForPrimaryAccount(), which assumes there is a
"sync consented" primary account.

SplitSettingsSync does not set a sync-consented account until the
user goes through the sync consent screen. This test doesn't care
about sync consent, so change it to use SetRefreshTokenForAccount().

This avoids a DCHECK failure when SplitSettingsSync is enabled.

Bug: 1060289
Change-Id: I7c2b262707ea04c7a23f374680bcffa1eb876104
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218804
Commit-Queue: James Cook <jamescook@chromium.org>
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@{#772461}
parent 5ddded6e
......@@ -62,6 +62,7 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/consent_level.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/user_manager/scoped_user_manager.h"
#include "components/user_manager/user.h"
......@@ -258,9 +259,11 @@ class UserImageManagerTestBase : public LoginManagerTest,
void UpdatePrimaryAccountInfo(Profile* profile) {
auto* identity_manager = IdentityManagerFactory::GetForProfile(profile);
signin::SetRefreshTokenForPrimaryAccount(identity_manager,
kRandomTokenStrForTesting);
CoreAccountInfo core_info = identity_manager->GetPrimaryAccountInfo();
// Sync consent level doesn't matter here.
CoreAccountInfo core_info = identity_manager->GetPrimaryAccountInfo(
signin::ConsentLevel::kNotRequired);
signin::SetRefreshTokenForAccount(identity_manager, core_info.account_id,
kRandomTokenStrForTesting);
AccountInfo account_info;
account_info.email = core_info.email;
account_info.gaia = core_info.gaia;
......
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