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.
Migrate the BattOr agent test to a MockTimeTaskRunner
This is necessary to migrate the BattOr agent to the new Chrome task running API (http://bit.ly/2jhO3J6). The reason for this is somewhat subtle: in the old world, we use a "TestSimpleTaskRunner", which runs delayed tasks in the order in which they're supposed to run but runs them immediately. Therefore, RunUntilIdle() effectively fasts forwards through time. With the new task posting architecture, TestSimpleTaskRunner no longer does this, instead by default running non-delayed tasks. This means that when we wait the 100ms after the last clock sync marker in order to run stop tracing, we're effectively waiting forever instead of what we previously did, which is immediately assume that 100ms had elapsed. In order to get around this, I'm migrating the BattOr agent tests to what they probably should have used in the first place: a TestMockTimeTaskRunner. This task runner allows us to programmatically set the current time, which gives us a lot more control in our unit tests. As part of this, rather than getting our time from TimeTicks::Now(), we add a layer of indirection, a TickClock, that can provide the current TimeTicks of the task runnner clock rather than the real current clock. Bug: 761498 Change-Id: I4f59b0bcd7138f11c7b20e659891cbbb066a6b26 Reviewed-on: https://chromium-review.googlesource.com/658259 Reviewed-by: rnephew <rnephew@chromium.org> Commit-Queue: Charlie Andrews <charliea@chromium.org> Cr-Commit-Position: refs/heads/master@{#500981}
- Loading branch information
Charlie Andrews
authored and
Commit Bot
committed
Sep 11, 2017
1 parent
8fd52f8
commit d3c8379
Showing
3 changed files
with
21 additions
and
12 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