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(
void AccountConsistencyService::OnPrimaryAccountCleared(
const CoreAccountInfo& previous_account_info) {
// There is not need to remove CHROME_CONNECTED cookies on |GoogleSignedOut|
// events as these cookies will be removed by the GaiaCookieManagerServer
// right before fetching the Gaia logout request.
RemoveAllChromeConnectedCookies(base::OnceClosure());
}
void AccountConsistencyService::OnAccountsInCookieUpdated(
......
......@@ -218,10 +218,9 @@ class AccountConsistencyServiceTest : public PlatformTest {
WaitUntilAllCookieRequestsAreApplied();
}
void SignOutAndSimulateGaiaCookieManagerServiceLogout() {
void SignOut() {
signin::ClearPrimaryAccount(identity_test_env_->identity_manager(),
signin::ClearPrimaryAccountPolicy::DEFAULT);
SimulateGaiaCookieManagerServiceLogout();
WaitUntilAllCookieRequestsAreApplied();
}
......@@ -286,7 +285,7 @@ class AccountConsistencyServiceTest : public PlatformTest {
// Simulate the action of the action GaiaCookieManagerService to cleanup
// the cookies once the sign-out is done.
void SimulateGaiaCookieManagerServiceLogout() {
void RemoveAllChromeConnectedCookies() {
base::RunLoop run_loop;
account_consistency_service_->RemoveAllChromeConnectedCookies(
run_loop.QuitClosure());
......@@ -372,7 +371,7 @@ TEST_F(AccountConsistencyServiceTest, SignInSignOut) {
CheckDomainHasChromeConnectedCookie(kYoutubeDomain);
CheckDomainHasChromeConnectedCookie(kCountryGoogleDomain);
SignOutAndSimulateGaiaCookieManagerServiceLogout();
SignOut();
CheckNoChromeConnectedCookies();
}
......@@ -380,7 +379,7 @@ TEST_F(AccountConsistencyServiceTest, SignInSignOut) {
TEST_F(AccountConsistencyServiceTest, SignOutWithoutDomains) {
CheckNoChromeConnectedCookies();
SignOutAndSimulateGaiaCookieManagerServiceLogout();
SignOut();
CheckNoChromeConnectedCookies();
}
......@@ -623,7 +622,7 @@ TEST_F(AccountConsistencyServiceTest, DomainsWithCookieLoadedFromPrefs) {
CheckDomainHasChromeConnectedCookie(kGoogleDomain);
CheckDomainHasChromeConnectedCookie(kYoutubeDomain);
SignOutAndSimulateGaiaCookieManagerServiceLogout();
SignOut();
CheckNoChromeConnectedCookies();
}
......@@ -772,7 +771,7 @@ TEST_F(AccountConsistencyServiceTest, DeleteChromeConnectedCookiesAfterSet) {
account_consistency_service_->SetChromeConnectedCookieWithUrls(
{GURL("https://google.ca"), GURL("https://google.fr"),
GURL("https://google.de")});
SimulateGaiaCookieManagerServiceLogout();
RemoveAllChromeConnectedCookies();
WaitUntilAllCookieRequestsAreApplied();
CheckNoChromeConnectedCookies();
......@@ -790,7 +789,7 @@ TEST_F(AccountConsistencyServiceTest, SetChromeConnectedCookiesAfterDelete) {
account_consistency_service_->SetChromeConnectedCookieWithUrls(
{GURL("https://google.ca"), GURL("https://google.fr"),
GURL("https://google.de")});
SimulateGaiaCookieManagerServiceLogout();
RemoveAllChromeConnectedCookies();
account_consistency_service_->SetChromeConnectedCookieWithUrls(
{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