Enforce invariants in TokenService implementations |
||
Issue descriptionThe token service has a conceptual invariants that are probably true on desktop (although not really enforced) but false on android. The violations should be fixed and the invariants enforced. The main invariants are: - GetAccounts() should return the list of accounts for which we have refresh tokens. In particular, RefreshTokenIsAvailable() should return true iff the account is in GetAccounts(). - When OnRefreshTokenAvailable() is called, RefreshTokenIsAvailable() should return true. - When OnRefreshTokenRevoked() is called, RefreshTokenIsAvailable() should return false. - GetAccounts() is empty until the tokens are fully loaded.
,
Jan 8
,
Jan 10
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/172680039455beb8321f5e98687b2c0f22fe3fb3 commit 172680039455beb8321f5e98687b2c0f22fe3fb3 Author: Kush Sinha <sinhak@chromium.org> Date: Thu Jan 10 12:53:43 2019 Fix ChromeOSOAuth2TokenServiceDelegate invariants |ChromeOSOAuth2TokenServiceDelegate| violates |OAuth2TokenServiceDelegate|'s invariants wrt the contract between |GetAccounts| and |RefreshTokenIsAvailable| APIs. Please check the attached bug for context. Bug: 919793, 820046 Test: unit_tests --gtest_filter="*CrOSOAuthDelegateTest*" Change-Id: I367bdc65ce3ad1796bd07d18b60d255c1916e4b8 Reviewed-on: https://chromium-review.googlesource.com/c/1400666 Commit-Queue: Kush Sinha <sinhak@chromium.org> Reviewed-by: Mihai Sardarescu <msarda@chromium.org> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Cr-Commit-Position: refs/heads/master@{#621554} [modify] https://crrev.com/172680039455beb8321f5e98687b2c0f22fe3fb3/chrome/browser/chromeos/oauth2_token_service_delegate.cc [modify] https://crrev.com/172680039455beb8321f5e98687b2c0f22fe3fb3/chrome/browser/chromeos/oauth2_token_service_delegate_unittest.cc [modify] https://crrev.com/172680039455beb8321f5e98687b2c0f22fe3fb3/google_apis/gaia/oauth2_token_service.h [modify] https://crrev.com/172680039455beb8321f5e98687b2c0f22fe3fb3/google_apis/gaia/oauth2_token_service_delegate.h |
||
►
Sign in to add a comment |
||
Comment 1 by bugdroid1@chromium.org
, Jan 8