Fix CaptivePortalBrowserTest's WaitForJobs() function.

It wasn't actually waiting for |num_jobs| when NavigationLoaderOnUI
is enabled. When that feature is enabled, the function is called
directly from the UI thread, and if |ongoing_mock_requests_|
doesn't have size |num_jobs| it would return without waiting.

This was discovered by
https://chromium-review.googlesource.com/c/chromium/src/+/1688592
which will introduce a thread hop in order to perform service worker
interception before doing an outgoing network request, so WaitForJobs()
will be called before a request is added to ongoing_mock_requests_.

Bug: 824858, 978556
Change-Id: I7264f1a4f04e517694417affcd5a8d20d0f4b9b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1689979
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676347}
1 file changed