Bug 1168759 - Part 2: Use waitForAllPaints() instead of animation.ready. r?boris
MozReview-Commit-ID: Hekj71Een7s
--- a/dom/animation/test/mozilla/file_deferred_start.html
+++ b/dom/animation/test/mozilla/file_deferred_start.html
@@ -1,11 +1,12 @@
<!doctype html>
<meta charset=utf-8>
<script src="../testcommon.js"></script>
+<script src="/tests/SimpleTest/paint_listener.js"></script>
<style>
@keyframes empty { }
@keyframes animTransform {
from { transform: translate(0px); }
to { transform: translate(100px); }
}
.target {
/* Element needs geometry to be eligible for layerization */
@@ -23,16 +24,22 @@ function waitForDocLoad() {
if (document.readyState === 'complete') {
resolve();
} else {
window.addEventListener('load', resolve);
}
});
}
+function waitForPaints() {
+ return new Promise(function(resolve, reject) {
+ waitForAllPaintsFlushed(resolve);
+ });
+}
+
promise_test(function(t) {
var div = addDiv(t);
var cs = window.getComputedStyle(div);
// Test that empty animations actually start.
//
// Normally we tie the start of animations to when their first frame of
// the animation is rendered. However, for animations that don't actually
@@ -82,17 +89,17 @@ promise_test(function(t) {
}
// Setup animation
var div = addDiv(t);
div.classList.add('target');
div.style.animation = 'animTransform 100s -50s forwards';
var animation = div.getAnimations()[0];
- return animation.ready.then(function() {
+ return waitForPaints(function() {
var transformStr =
SpecialPowers.DOMWindowUtils.getOMTAStyle(div, 'transform');
var matrixComponents =
transformStr.startsWith('matrix(')
? transformStr.substring('matrix('.length, transformStr.length-1)
.split(',')
.map(component => Number(component))