• Gabriel Charette's avatar
    Add MOCK_TIME mode to ScopedTaskEnvironment :) · 5e2df665
    Gabriel Charette authored
    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: default avatarGabriel Charette <gab@chromium.org>
    Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
    Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#518433}
    5e2df665
task_tracker.cc 25.2 KB