Commit eb436ad4 authored by Anastasiia N's avatar Anastasiia N Committed by Commit Bot

Set the same default token_value on all platforms

Remove "if defined(OS_CHROMEOS)" when setting default token_value in
SetRefreshTokenForAccount in identity_test_utils.

UserPolicySigninServiceTest was calling IssueOAuthToken with
"refresh_token_for_" + gaia_id value because they expect the refresh
token to have this value by default. Fix this test by calling
SetRefreshTokenForAccount with custom token value and using the same
token to issue OAuth token.

Bug: 1115075
Change-Id: I92ca73b25b87131b9fb02dbae8bbea8a5707adb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353333Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Anastasiia N <anastasiian@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798624}
parent b7204c8b
...@@ -39,6 +39,8 @@ class UserPolicySigninServiceTest; ...@@ -39,6 +39,8 @@ class UserPolicySigninServiceTest;
namespace { namespace {
const char kTestEmail[] = "enterprise@example.com"; const char kTestEmail[] = "enterprise@example.com";
const char kTestRefreshToken[] =
"test_refresh_token_for_enterprise@example.com";
// Dummy delegate forwarding all the calls the test fixture. // Dummy delegate forwarding all the calls the test fixture.
// Owned by the DiceTurnOnSyncHelper. // Owned by the DiceTurnOnSyncHelper.
...@@ -210,6 +212,9 @@ class UserPolicySigninServiceTest : public InProcessBrowserTest { ...@@ -210,6 +212,9 @@ class UserPolicySigninServiceTest : public InProcessBrowserTest {
account_info_ = signin::MakeAccountAvailable( account_info_ = signin::MakeAccountAvailable(
IdentityManagerFactory::GetForProfile(profile()), kTestEmail); IdentityManagerFactory::GetForProfile(profile()), kTestEmail);
signin::SetRefreshTokenForAccount(
IdentityManagerFactory::GetForProfile(profile()),
account_info_.account_id, kTestRefreshToken);
SetupFakeGaiaResponses(); SetupFakeGaiaResponses();
} }
...@@ -237,9 +242,8 @@ class UserPolicySigninServiceTest : public InProcessBrowserTest { ...@@ -237,9 +242,8 @@ class UserPolicySigninServiceTest : public InProcessBrowserTest {
access_token_info.audience = access_token_info.audience =
GaiaUrls::GetInstance()->oauth2_chrome_client_id(); GaiaUrls::GetInstance()->oauth2_chrome_client_id();
access_token_info.email = kTestEmail; access_token_info.email = kTestEmail;
fake_gaia_.IssueOAuthToken( fake_gaia_.IssueOAuthToken(base::StringPrintf(kTestRefreshToken),
base::StringPrintf("refresh_token_for_%s", account_info_.gaia.c_str()), access_token_info);
access_token_info);
} }
std::unique_ptr<net::test_server::HttpResponse> HandleUserInfoRequest( std::unique_ptr<net::test_server::HttpResponse> HandleUserInfoRequest(
......
...@@ -304,11 +304,8 @@ void SetRefreshTokenForAccount(IdentityManager* identity_manager, ...@@ -304,11 +304,8 @@ void SetRefreshTokenForAccount(IdentityManager* identity_manager,
identity_manager->GetChromeOSAccountManager(), identity_manager->GetChromeOSAccountManager(),
#endif #endif
identity_manager, account_id, identity_manager, account_id,
// TODO(crbug.com/1115075): set the same token_value on all platforms.
token_value.empty() ? "refresh_token_for_" + account_id.ToString() token_value.empty() ? "refresh_token_for_" + account_id.ToString()
#if defined(OS_CHROMEOS)
+ "_" + base::GenerateGUID() + "_" + base::GenerateGUID()
#endif
: token_value); : token_value);
} }
......
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