Add MOCK_TIME mode to ScopedTaskEnvironment :)

Taking advantage of the new kBoundToThread mode on

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. (IWYU fixes)

Bug: 708584
Change-Id: I76ba55ec64d398151420379d3fcdcd5186fbceb8
Commit-Queue: Gabriel Charette <>
Reviewed-by: Gabriel Charette <>
Reviewed-by: Kyle Horimoto <>
Reviewed-by: Fran├žois Doray <>
Cr-Commit-Position: refs/heads/master@{#518433}
8 files changed