Add a TestURLLoaderFactory::SimulateResponseForPendingRequest variant that takes a PendingRequest

It turns out that in order to migrate some specific unit tests more smoothly
from URLFetcher to SimpleURLLoader, it is useful to have a method where
indexing of the pending requests list is preserved after a given pending request is handled.

For instance some tests do this:

  request_load_1();
  request_load_2();
  request_load_3();
  (..)
  request_load_n();

  response_request_3();
  response_request_2();
  response_request_n();
  (..)
  response_request_1();

  // do stuff

  request_load_n+1()
  request_load_n+2()
  request_load_n+3()

  response_request_n+2()
  response_request_n+3()
  response_request_n+1()

In the above scenario, it is handy to be able to simulate responses at the original order
requests were made. This CL adds an API that fills this gap.

In practice, this is a preparation for https://crrev.com/c/1114998/.

BUG=773295

Cq-Include-Trybots: luci.chromium.try:linux_mojo
Change-Id: Id9059f3d8f091eabfb21948f074599c180f44128
Reviewed-on: https://chromium-review.googlesource.com/1123236
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574927}
3 files changed