• Kush Sinha's avatar
    Bugfix: CrOsOAuth2TsDelegate calling FireRefreshTokensLoaded too early · 2c31aa6a
    Kush Sinha authored
    |ChromeOSOAuth2TokenServiceDelegate| loads tokens at startup and calls
    |FireRefreshTokensLoaded| before some token service observers may have
    had a chance to register themselves. This causes them to miss the
    |OnRefreshTokensLoaded| callback.
    
    For now, the solution is to respect the temporal coupling between
    |OAuth2TokenServiceDelegate::LoadCredentials| and
    |OAuth2TokenService::AddObserver|, i.e. |LoadCredentials| is called
    only when all observers have been added. Ideally, it should be an
    observer's responsibility to check whether it has been initialized 'too
    late' and may have missed the |OnRefreshTokensLoaded| notification.
    
    Bug: 820046
    Change-Id: I3ac67798d165afe230fa29e03ec7af75a9a093a9
    Reviewed-on: https://chromium-review.googlesource.com/1069353
    Commit-Queue: Kush Sinha <sinhak@chromium.org>
    Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
    Reviewed-by: default avatarLutz Justen <ljusten@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#561422}
    2c31aa6a
oauth2_token_service_delegate_unittest.cc 11.5 KB