IdentityTestEnv: Add API to wait for token requests for given account
The current IdentityTestEnvironment APIs to wait for access token requests and issue responses operate in a shotgun manner: when the next access token request is received, the test API implementation issues a response for *all* pending access token requests. However, unittests that is targeted in an upcoming conversion requires more flexibility: as the production code that it is testing interacts with multiple accounts, the test issues access token requests for multiple accounts, and then sequentially issues responses and checks that a specific flow for each account in question was initiated in response to the specific response. Moreover, one of these unittests issues responses in an order different to the order in which the requests were made. To accommodate porting of these tests, this CL adds the ability to wait for an access token request for a given account and then issue a response only for that account. If while waiting for a request from a specific account a request for a *different* account is seen, the waiting code forwards on the handling of the request for that other account to the next iteration of the runloop; this allows for the case where a test wants to handle requests for multiple accounts in an order different to the order in which those requests were made. We leave in a variant that does not take in the account ID and operates as before, as this is convenient for the common case of tests that don't care about this level of detail (usually because they are testing a production flow that operates on the primary account). Bug: 798699, 809923 Change-Id: I6b1d93efd47b1eba128ac0b62c833736700e5196 Reviewed-on: https://chromium-review.googlesource.com/1149876 Commit-Queue: Colin Blundell <blundell@chromium.org> Reviewed-by:Sylvain Defresne <sdefresne@chromium.org> Cr-Commit-Position: refs/heads/master@{#578647}
Showing
Please register or sign in to comment