Add MOCK_TIME mode to ScopedTaskEnvironment :)

Taking advantage of the new kBoundToThread mode on
TestMockTimeTaskRunner.

This change also required tweaking the
ScopedTaskEnvironment::RunUntilIdle() logic as RunLoop().Run() on
TestMockTimeTaskRunner results in advancing time when there's no
request to quit-when-idle which is undesired here. New logic gets rid
of need for |on_queue_empty_closure_| and I think is simpler overall.
As of patch set 20, this new RunUntilIdle() logic also avoids using
TaskScheduler::FlushForTesting() as that can result in hangs should a
TaskScheduler task synchronously block on the main thread.

R=fdoray@chromium.org
TBR=gab@chromium.org (IWYU fixes)

Bug: 708584
Change-Id: I76ba55ec64d398151420379d3fcdcd5186fbceb8
Reviewed-on: https://chromium-review.googlesource.com/638550
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Fran├žois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518433}
8 files changed