Bug 1442150 - Wait for one more frame if the animation starts at the current timeline time in the first test case. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 06 Mar 2018 10:55:05 +0900
changeset 763481 d65c5de431cfc729096882500eeec2526ff6209e
parent 763476 f8ef2eb237f9890d1b910b0b1556822a867215c9
child 763482 241824ad6c358180b1aac9b4532205e083311e1b
push id101467
push userhikezoe@mozilla.com
push dateTue, 06 Mar 2018 02:02:08 +0000
reviewersbirtles
bugs1442150
milestone60.0a1
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
dom/animation/test/chrome/test_running_on_compositor.html
--- 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';