• Colin Blundell's avatar
    Have FakeProfileOAuth2TokenService cancel requests · ab9952d0
    Colin Blundell authored
    I just discovered that FakeProfileOAuth2TokenService never cancels
    access token requests:
    - OAuth2TokenService::FetchOAuth2Token() is virtual and overridden by
      FakePO2TS. This is the method that creates pending fetchers for
      access token requests. FakePO2TS' override results in O2TS not
      creating any pending fetchers for access token requests.
    - OAuth2TokenService::CancelRequests{ForAccount}(), however, are *not*
      virtual. O2TS simply looks in its set of pending fetchers to cancel
      the relevant ones.
    
    The combination of these facts means that requests are not cancelled
    in response to CancelRequests{ForAccount}() when FakePO2TS is used.
    This in turn means that production flows are not accurately reflected,
    and blocks creating a unittest for a just-discovered production bug
    (that itself would perhaps have not landed if this situation was not
    as it is).
    
    This CL remedies the problem by having FakePO2TS override the
    now-virtual methods for cancelling access token requests to respond
    appropriately. It also updates a few unittests that had previously
    (either intentionally or unintentionally) worked around the lack of
    cancellation by cancelling requests manually after token revocation.
    
    Change-Id: Id935831294849a191e6034f3fe1360bea1dddc9e
    Reviewed-on: https://chromium-review.googlesource.com/1154925
    Commit-Queue: Colin Blundell <blundell@chromium.org>
    Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#579352}
    ab9952d0
oauth2_token_service.h 17 KB