Fix IdentityManager::HasPrimaryAccount()
"Signing out" always happens via SigninManager and causes the account to be removed from SigninManager as well as AccountTrackerService. However, the primary account can be removed from AccountTrackerService in circumstances *other than* the user signing out of the primary account; e.g., if the refresh token for the account is revoked from ProfileOAuth2TokenService. In these circumstances, there would still be a primary account (i.e., SigninManagerBase::GetAuthenticatedAccountId() returns a valid account ID), but there would be no AccountInfo for the account (i.e., SigninManagerBase::GetAuthenticatedAccountInfo() returns an empty AccountInfo). IdentityManager::HasPrimaryAccount() currently internally uses SigninManagerBase::GetAuthenticatedAccountInfo(). This will result in it giving an incorrect result in these edge cases. This CL changes it to use SigninManagerBase::IsAuthenticated() and adds a test that fails before the change. Bug: 892553 Change-Id: I227ad6767089b259c0d54e33f5f88f6789f2de9a Reviewed-on: https://chromium-review.googlesource.com/c/1264203Reviewed-by:David Roger <droger@chromium.org> Commit-Queue: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/master@{#597064}
Showing
Please register or sign in to comment