Commit 1aa22c07 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

[s13n] Replace direct AccountTrackerService use from PeopleHandlerDice unittests

CL is a follow up of blundell's comment in [1].

Basically, it replaces the direct calls to AccountTrackerService::SeedAccountInfo
(and the sibling IdentityTestEnv::SetRefreshTokenForAccount calls),
with an existing IdentityTestEnv equivalent method: MakeAccountAvailable.

[1] https://crrev.com/c/1311093/2/chrome/browser/ui/webui/settings/people_handler_unittest.cc#1039

BUG=890810

Change-Id: I15753453a61e435d59ed3c1a879f89b9cb027dcf
Reviewed-on: https://chromium-review.googlesource.com/c/1324049Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#606122}
parent d3c8cb31
......@@ -15,7 +15,6 @@
#include "base/stl_util.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/browser/signin/scoped_account_consistency.h"
#include "chrome/browser/signin/signin_error_controller_factory.h"
......@@ -33,7 +32,6 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/fake_auth_status_provider.h"
#include "components/sync/base/sync_prefs.h"
#include "components/sync_preferences/pref_service_syncable.h"
......@@ -1043,19 +1041,13 @@ TEST_P(PeopleHandlerDiceUnifiedConsentTest, StoredAccountsList) {
IdentityTestEnvironmentProfileAdaptor::
CreateProfileForIdentityTestEnvironment();
AccountTrackerService* account_tracker =
AccountTrackerServiceFactory::GetForProfile(profile.get());
std::string account_1 =
account_tracker->SeedAccountInfo("1234", "a@gmail.com");
std::string account_2 =
account_tracker->SeedAccountInfo("5678", "b@gmail.com");
auto identity_test_env_adaptor =
std::make_unique<IdentityTestEnvironmentProfileAdaptor>(profile.get());
auto* identity_test_env = identity_test_env_adaptor->identity_test_env();
identity_test_env->SetRefreshTokenForAccount(account_1);
identity_test_env->SetRefreshTokenForAccount(account_2);
identity_test_env->SetPrimaryAccount("a@gmail.com");
auto account_1 = identity_test_env->MakeAccountAvailable("a@gmail.com");
auto account_2 = identity_test_env->MakeAccountAvailable("b@gmail.com");
identity_test_env->SetPrimaryAccount(account_1.email);
PeopleHandler handler(profile.get());
std::unique_ptr<base::ListValue> accounts_list =
......
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