Update CompositorTestSuite mocking of Time
LayerWithRealCompositorTest.ReportMetrics was racy due to the fact that LayerAnimationElement and SchedulerStateMachine's timing and task queues cannot be mocked out. This left the test vulnerable to differences in timing on bots. The test had a certain expectation of the order of events, which is not actually a guarantee. An animation's frame could be generated before it entered its wait loop. Similarly a animation could be delayed in executing for so long that not enough frames were generated to actually create a report. This updates the test to mock out time, so that it can reliably control the order of events. The test has also been moved to LayerAnimatorTest.ReportMetrics. LayerWithRealCompositorTest utilizes a TestCompositorHost in order to control the Compositor throughout the tests. This was done by having CompositorTestSuite always create a ScopedTaskEnvironment. Unfortunately this causes a thread race with base::TimeTicks::Now, as this thread starts enqueuing work before an individual test can mock out time. This change also updates CompositorTestSuite to not create the ScopedTaskEnvironment. Instead each test suite which desires to mock out the time of task runners, must explicitly create one. Thus allowing tests which need not a full Compositor thread, can instead be able to mock time separately. TBR=sadrul@chromium.org TEST=LayerWithRealCompositorTest.ReportMetrics LayerAnimatorTest.ReportMetrics Bug: 709080 Change-Id: Ia12cdcdf2b6c67c8abc21399eae66cdb1d0d1eb1 Reviewed-on: https://chromium-review.googlesource.com/1157234 Commit-Queue: Jonathan Ross <jonross@chromium.org> Reviewed-by:Robert Flack <flackr@chromium.org> Cr-Commit-Position: refs/heads/master@{#587940}
Showing
Please register or sign in to comment