Commit 9b5bb7b3 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Remove the CHROME_CONNECTED cookie when the user signs out of Chrome.

Before using the cookie jar APIs to add and remove CHROME_CONNECTED
cookie, |IOSChromeSigninClient| used to call the
AccountConsistencyService::RemoveAllChromeConnectedCookies to delete
these cookies. This was removed as part of CL
https://chromium-review.googlesource.com/c/chromium/src/+/2421669.

This CL fixes the AccountConsistencyService service to actually remove
the CHROME_CONNECTED cookie when the user signs out of Chrome as this is
no longer called by IOSChromeSigninClient.

Bug: 1148200
Change-Id: I336a420d42f9cb2e653441be61c3adc14e5be095
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532001
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Auto-Submit: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarNohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826726}
parent 5a7f5fe4
...@@ -547,9 +547,7 @@ void AccountConsistencyService::OnPrimaryAccountSet( ...@@ -547,9 +547,7 @@ void AccountConsistencyService::OnPrimaryAccountSet(
void AccountConsistencyService::OnPrimaryAccountCleared( void AccountConsistencyService::OnPrimaryAccountCleared(
const CoreAccountInfo& previous_account_info) { const CoreAccountInfo& previous_account_info) {
// There is not need to remove CHROME_CONNECTED cookies on |GoogleSignedOut| RemoveAllChromeConnectedCookies(base::OnceClosure());
// events as these cookies will be removed by the GaiaCookieManagerServer
// right before fetching the Gaia logout request.
} }
void AccountConsistencyService::OnAccountsInCookieUpdated( void AccountConsistencyService::OnAccountsInCookieUpdated(
......
...@@ -218,10 +218,9 @@ class AccountConsistencyServiceTest : public PlatformTest { ...@@ -218,10 +218,9 @@ class AccountConsistencyServiceTest : public PlatformTest {
WaitUntilAllCookieRequestsAreApplied(); WaitUntilAllCookieRequestsAreApplied();
} }
void SignOutAndSimulateGaiaCookieManagerServiceLogout() { void SignOut() {
signin::ClearPrimaryAccount(identity_test_env_->identity_manager(), signin::ClearPrimaryAccount(identity_test_env_->identity_manager(),
signin::ClearPrimaryAccountPolicy::DEFAULT); signin::ClearPrimaryAccountPolicy::DEFAULT);
SimulateGaiaCookieManagerServiceLogout();
WaitUntilAllCookieRequestsAreApplied(); WaitUntilAllCookieRequestsAreApplied();
} }
...@@ -286,7 +285,7 @@ class AccountConsistencyServiceTest : public PlatformTest { ...@@ -286,7 +285,7 @@ class AccountConsistencyServiceTest : public PlatformTest {
// Simulate the action of the action GaiaCookieManagerService to cleanup // Simulate the action of the action GaiaCookieManagerService to cleanup
// the cookies once the sign-out is done. // the cookies once the sign-out is done.
void SimulateGaiaCookieManagerServiceLogout() { void RemoveAllChromeConnectedCookies() {
base::RunLoop run_loop; base::RunLoop run_loop;
account_consistency_service_->RemoveAllChromeConnectedCookies( account_consistency_service_->RemoveAllChromeConnectedCookies(
run_loop.QuitClosure()); run_loop.QuitClosure());
...@@ -372,7 +371,7 @@ TEST_F(AccountConsistencyServiceTest, SignInSignOut) { ...@@ -372,7 +371,7 @@ TEST_F(AccountConsistencyServiceTest, SignInSignOut) {
CheckDomainHasChromeConnectedCookie(kYoutubeDomain); CheckDomainHasChromeConnectedCookie(kYoutubeDomain);
CheckDomainHasChromeConnectedCookie(kCountryGoogleDomain); CheckDomainHasChromeConnectedCookie(kCountryGoogleDomain);
SignOutAndSimulateGaiaCookieManagerServiceLogout(); SignOut();
CheckNoChromeConnectedCookies(); CheckNoChromeConnectedCookies();
} }
...@@ -380,7 +379,7 @@ TEST_F(AccountConsistencyServiceTest, SignInSignOut) { ...@@ -380,7 +379,7 @@ TEST_F(AccountConsistencyServiceTest, SignInSignOut) {
TEST_F(AccountConsistencyServiceTest, SignOutWithoutDomains) { TEST_F(AccountConsistencyServiceTest, SignOutWithoutDomains) {
CheckNoChromeConnectedCookies(); CheckNoChromeConnectedCookies();
SignOutAndSimulateGaiaCookieManagerServiceLogout(); SignOut();
CheckNoChromeConnectedCookies(); CheckNoChromeConnectedCookies();
} }
...@@ -623,7 +622,7 @@ TEST_F(AccountConsistencyServiceTest, DomainsWithCookieLoadedFromPrefs) { ...@@ -623,7 +622,7 @@ TEST_F(AccountConsistencyServiceTest, DomainsWithCookieLoadedFromPrefs) {
CheckDomainHasChromeConnectedCookie(kGoogleDomain); CheckDomainHasChromeConnectedCookie(kGoogleDomain);
CheckDomainHasChromeConnectedCookie(kYoutubeDomain); CheckDomainHasChromeConnectedCookie(kYoutubeDomain);
SignOutAndSimulateGaiaCookieManagerServiceLogout(); SignOut();
CheckNoChromeConnectedCookies(); CheckNoChromeConnectedCookies();
} }
...@@ -772,7 +771,7 @@ TEST_F(AccountConsistencyServiceTest, DeleteChromeConnectedCookiesAfterSet) { ...@@ -772,7 +771,7 @@ TEST_F(AccountConsistencyServiceTest, DeleteChromeConnectedCookiesAfterSet) {
account_consistency_service_->SetChromeConnectedCookieWithUrls( account_consistency_service_->SetChromeConnectedCookieWithUrls(
{GURL("https://google.ca"), GURL("https://google.fr"), {GURL("https://google.ca"), GURL("https://google.fr"),
GURL("https://google.de")}); GURL("https://google.de")});
SimulateGaiaCookieManagerServiceLogout(); RemoveAllChromeConnectedCookies();
WaitUntilAllCookieRequestsAreApplied(); WaitUntilAllCookieRequestsAreApplied();
CheckNoChromeConnectedCookies(); CheckNoChromeConnectedCookies();
...@@ -790,7 +789,7 @@ TEST_F(AccountConsistencyServiceTest, SetChromeConnectedCookiesAfterDelete) { ...@@ -790,7 +789,7 @@ TEST_F(AccountConsistencyServiceTest, SetChromeConnectedCookiesAfterDelete) {
account_consistency_service_->SetChromeConnectedCookieWithUrls( account_consistency_service_->SetChromeConnectedCookieWithUrls(
{GURL("https://google.ca"), GURL("https://google.fr"), {GURL("https://google.ca"), GURL("https://google.fr"),
GURL("https://google.de")}); GURL("https://google.de")});
SimulateGaiaCookieManagerServiceLogout(); RemoveAllChromeConnectedCookies();
account_consistency_service_->SetChromeConnectedCookieWithUrls( account_consistency_service_->SetChromeConnectedCookieWithUrls(
{GURL("https://google.ca")}); {GURL("https://google.ca")});
......
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