Commit b630e841 authored by Sergio Villar Senin's avatar Sergio Villar Senin Committed by Commit Bot

[s13n] Replace AccountTrackerService in oauth2_browsertest.cc

Migrated to IdentityManager APIs which do the same thing.

Bug: 922749
Change-Id: I75dcae154936211003e65f79d5a07d5698ff6e6d
Reviewed-on: https://chromium-review.googlesource.com/c/1429983Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Sergio Villar <svillar@igalia.com>
Cr-Commit-Position: refs/heads/master@{#625621}
parent 1291b1a2
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/login/wizard_controller.h"
#include "chrome/browser/extensions/chrome_extension_test_notification_observer.h" #include "chrome/browser/extensions/chrome_extension_test_notification_observer.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
...@@ -97,8 +96,9 @@ const char kTestIdTokenAdvancedProtectionDisabled[] = ...@@ -97,8 +96,9 @@ const char kTestIdTokenAdvancedProtectionDisabled[] =
std::string PickAccountId(Profile* profile, std::string PickAccountId(Profile* profile,
const std::string& gaia_id, const std::string& gaia_id,
const std::string& email) { const std::string& email) {
return AccountTrackerService::PickAccountIdForAccount(profile->GetPrefs(), return IdentityManagerFactory::GetInstance()
gaia_id, email); ->GetForProfile(profile)
->LegacyPickAccountIdForAccount(gaia_id, email);
} }
class OAuth2LoginManagerStateWaiter : public OAuth2LoginManager::Observer { class OAuth2LoginManagerStateWaiter : public OAuth2LoginManager::Observer {
...@@ -663,10 +663,12 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, VerifyInAdvancedProtectionAfterOnlineAuth) { ...@@ -663,10 +663,12 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, VerifyInAdvancedProtectionAfterOnlineAuth) {
/*is_under_advanced_protection=*/true); /*is_under_advanced_protection=*/true);
// Verify that AccountInfo is properly updated. // Verify that AccountInfo is properly updated.
AccountTrackerService* account_tracker = auto* identity_manager =
AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile()); IdentityManagerFactory::GetInstance()->GetForProfile(profile());
EXPECT_TRUE( EXPECT_TRUE(
account_tracker->GetAccountInfo(kTestEmail).is_under_advanced_protection); identity_manager
->FindAccountInfoForAccountWithRefreshTokenByAccountId(kTestEmail)
->is_under_advanced_protection);
} }
IN_PROC_BROWSER_TEST_F(OAuth2Test, IN_PROC_BROWSER_TEST_F(OAuth2Test,
...@@ -675,10 +677,12 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, ...@@ -675,10 +677,12 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test,
/*is_under_advanced_protection=*/false); /*is_under_advanced_protection=*/false);
// Verify that AccountInfo is properly updated. // Verify that AccountInfo is properly updated.
AccountTrackerService* account_tracker = auto* identity_manager =
AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile()); IdentityManagerFactory::GetInstance()->GetForProfile(profile());
EXPECT_FALSE( EXPECT_FALSE(
account_tracker->GetAccountInfo(kTestEmail).is_under_advanced_protection); identity_manager
->FindAccountInfoForAccountWithRefreshTokenByAccountId(kTestEmail)
->is_under_advanced_protection);
} }
// Sets up a new user with stored refresh token. // Sets up a new user with stored refresh token.
......
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