forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make TestMockTimeTaskRunner a RunLoop::Delegate.
Introducing TestMockTimeTaskRunner::Type::kBound which will make that TestMockTimeTaskRunner takeover the thread it's created on (a la MessageLoop), enabling RunLoop and Thread/SequencedTaskRunnerHandle. Also introduces RunLoop::ScopedDisallowRunningForTesting to enforce mutual exclusion TestMockTimeTaskRunner::ScopedContext (used to toggle context to another task runner on the main thread) and RunLoop::Run() (meant to run the current thread's associated task runner). Mixing the two would result in running the incorrect task runner. While I don't think this is a use case worth supporting, experience with //base APIs has taught me that if there's a way to use it wrong, someone will, and it's much easier to prevent than to heal; hence this check. (there should already be no RunLoop usage during TaskRunnerHandle overrides per RunLoop not being previously supported by TestMockTimeTaskRunner and this check ensures it stays that way :)) EDIT: Well except that HeartbeatSenderTest had found a way to use it the deprecated way, but it's a nice fit for using a kBound TestMockTimeTaskRunner so all good :). Had to drop support for virtual TestMockTimeTaskRunner::IsElapsingStopped() which in turn forced removal of custom task runner in remote_commands_service_unittest.cc whose use case is now supported by the new API :). This enables follow-ups to: 1) Add mock time to base::test::ScopedTaskEnvironment :) https://docs.google.com/document/d/1QabRo8c7D9LsYY3cEcaPQbOCLo8Tu-6VLykYXyl3Pkk/edit 2) Fixing a race in base::Timer which requires RunLoop from TestMockTimeTaskRunner to get rid of the two remaining problematic use cases (see bug blocked by 703346). Bug: 703346 Change-Id: I062b77b669853a36c30813e44dd984d01fcefbe2 TBR=pastarmovj@chromium.org (for components/policy test side-effects) Change-Id: I062b77b669853a36c30813e44dd984d01fcefbe2 Reviewed-on: https://chromium-review.googlesource.com/614788 Reviewed-by: Gabriel Charette <gab@chromium.org> Reviewed-by: Dirk Pranke <dpranke@chromium.org> Reviewed-by: Scott Nichols <nicholss@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Gabriel Charette <gab@chromium.org> Cr-Commit-Position: refs/heads/master@{#496111}
- Loading branch information
Gabriel Charette
authored and
Commit Bot
committed
Aug 21, 2017
1 parent
1b2e991
commit a449750
Showing
12 changed files
with
445 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.