Chromium's signin code currently allows querying signin state before all information has been loaded from disk at startup (e.g., before all refresh tokens have been loaded). This forces consumers to worry about the edge case of a refresh token not being available simply because it hasn't been loaded yet.
The Identity Service APIs can eliminate this edge case by guaranteeing that they do not respond to consumers until the internal state has stabilized after startup. This CL implements this functionaliy, having IdentityService queue pending IdentityManager connection requests until all refresh tokens have been loaded.
Note that this change requires that consumers of the Identity Service ensure that the PO2TS's tokens are loaded if connecting to the Identity Service in test contexts, as otherwise the connection to the Identity Service will hang. In production, it's guaranteed that the PO2TS will fire OnRefreshTokensLoaded() as part of startup (see the relevant CLs https://codereview.chromium.org/1380103004 and https://codereview.chromium.org/1523743003).
Bug: 740117 Change-Id: Id5c9c1ef7e2975204b3c2c004b7b5a714f6499b9 Reviewed-on: https://chromium-review.googlesource.com/565407 Commit-Queue: Colin Blundell
6430f5d Identity Service: Queue requests until internal state is stable
chrome/browser/chromeos/login/kiosk_browsertest.cc | 12 ++-
.../extensions/api/identity/identity_apitest.cc | 4 +
services/identity/README.md | 11 +++
services/identity/identity_manager_unittest.cc | 103 +++++++++++++++++++++
services/identity/identity_service.cc | 30 +++++-
services/identity/identity_service.h | 22 ++++-
.../public/interfaces/identity_manager.mojom | 6 +-
7 files changed, 181 insertions(+), 7 deletions(-)