Bug 1442150 - Wait for one more frame if the animation starts at the current timeline time in the first test case. r?birtles
MozReview-Commit-ID: DVOiauPDqhM
--- a/dom/animation/test/chrome/test_running_on_compositor.html
+++ b/dom/animation/test/chrome/test_running_on_compositor.html
@@ -63,16 +63,27 @@ function assert_animation_is_not_running
}
promise_test(async t => {
// FIXME: When we implement Element.animate, use that here instead of CSS
// so that we remove any dependency on the CSS mapping.
var div = addDiv(t, { style: 'animation: anim 100s' });
var animation = div.getAnimations()[0];
+ // If the animation starts at the current timeline time, we need to wait for
+ // one more frame to avoid receiving the fake timer-based MozAfterPaint event.
+ // FIXME: Bug 1419226: Drop this 'animation.ready' and 'waitForFrame'. Once
+ // MozAfterPaint is fired reliably, we just need to wait for a MozAfterPaint
+ // here.
+ await animation.ready;
+
+ if (animationStartsRightNow(animation)) {
+ await waitForFrame();
+ }
+
await waitForPaints();
assert_animation_is_running_on_compositor(animation,
'Animation reports that it is running on the compositor'
+ ' during playback');
div.style.animationPlayState = 'paused';