commit | d4723a3dfd0215a72507d10ce0bd0e75f5f76bb6 | [log] [tgz] |
---|---|---|
author | Gabriel Charette <gab@chromium.org> | Fri Nov 24 00:11:18 2017 |
committer | Commit Bot <commit-bot@chromium.org> | Fri Nov 24 00:11:18 2017 |
tree | 76ac18dd43ccdaf274fe9aabfac72b07dc2fc436 | |
parent | cc4e3915b4dd5ac5f3288c605d4815019f381ea6 [diff] |
Reland "Add MOCK_TIME mode to ScopedTaskEnvironment :)" Reland follow-up nits CL along with it this time (https://chromium-review.googlesource.com/c/chromium/src/+/783873) Initial CL made ProfileShortcutManagerTest flaky. Running them locally it turns out they mostly pass but they spew out a whole lot of "ScopedTaskEnvironment::RunUntilIdle() appears to be stuck in infinite loop" warning logs (which were added in this CL). This is because the ongoing tasks that prevent DisallowRunTasks() are slow and the main thread goes into a busy loop trying to DisallowRunTasks(). These tests being already slow, these prints pushed them over the edge (I think). DisallowRunTasks() was tweaked in this reland to not return until either one task completes or a short timeout expires (see code comments for detailed reasoning). This also allows removing the YieldCurrentThread() logic in the original CL as busy-looping is avoided altogether. The LOG statement trying to catch infinite RunUntilIdle() was also removed as it wasn't really the nice place for it (it should a counter in the RunOrSkipTask() override if we want it later). This is a reland of 5e2df665dfce3a3aceb4852d90ad55d31fc36f20 Original change's description: > 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} TEST=Repro'ed https://crbug.com/787683 locally and fixed. TBR=gab@chromium.org (IWYU fixes) Bug: 708584, 787683 Change-Id: I511c159ccbb608aa54394a4f35c40ad14697196b Reviewed-on: https://chromium-review.googlesource.com/788133 Commit-Queue: Gabriel Charette <gab@chromium.org> Reviewed-by: François Doray <fdoray@chromium.org> Reviewed-by: Gabriel Charette <gab@chromium.org> Cr-Commit-Position: refs/heads/master@{#519032}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .