Bug 1112480 part 1 - Adjust tests to accommodate changed animation start behavior; r=jwatt
authorBrian Birtles <birtles@gmail.com>
Fri, 09 Jan 2015 07:57:58 +0900
changeset 222842 15f5148fe5892f1267f298ea6a09d8a6f64dc647
parent 222841 7877a00d7025405b31b2f0df73e8a1067bda5923
child 222843 dfba5219541ff18c96f1b43e52f4d54bd4bc707d
push id10731
push usercbook@mozilla.com
push dateFri, 09 Jan 2015 14:51:37 +0000
treeherderfx-team@e6756043d930 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1112480
milestone37.0a1
Bug 1112480 part 1 - Adjust tests to accommodate changed animation start behavior; r=jwatt In this patch series we adjust the behavior of animation starting so that the animation does not actually start until the following refresh driver tick. This requires some tweaks to tests to ensure they continue to pass.
dom/animation/test/mozilla/test_deferred_start.html
layout/style/test/test_animations_async_tests.html
--- a/dom/animation/test/mozilla/test_deferred_start.html
+++ b/dom/animation/test/mozilla/test_deferred_start.html
@@ -55,28 +55,31 @@ async_test(function(t) {
     var player = div.getAnimationPlayers()[0];
 
     player.ready.then(function() {
       promiseCallbackDone = true;
     }).catch(function() {
       assert_unreached('ready promise was rejected');
     });
 
-  }).then(waitForFrame).then(t.step_func(function() {
+  // We need to wait for up to two frames since the animation may not start
+  // until the beginning of the next refresh driver tick and it won't queue
+  // the ready Promise callback until that point.
+  }).then(waitForFrame).then(waitForFrame).then(t.step_func(function() {
     assert_true(promiseCallbackDone,
                 'ready promise callback was called before the next'
                 + ' requestAnimationFrame callback');
     t.done();
   }));
 }, 'AnimationPlayer.ready is resolved for an empty animation');
 
 // Test that compositor animations with delays get synced correctly
 //
 // NOTE: It is important that we DON'T use
-// SpecialWindows.DOMWindowUtils.advanceTimeAndRefresh here since that takes
+// SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh here since that takes
 // us through a different code path.
 async_test(function(t) {
   // This test only applies to compositor animations
   const OMTAPrefKey = 'layers.offmainthreadcomposition.async-animations';
   var omtaEnabled = SpecialPowers.DOMWindowUtils.layerManagerRemote &&
                     SpecialPowers.getBoolPref(OMTAPrefKey);
   if (!omtaEnabled) {
     t.done();
--- a/layout/style/test/test_animations_async_tests.html
+++ b/layout/style/test/test_animations_async_tests.html
@@ -22,20 +22,21 @@
   }
 
   /*
    * Bug 1086937 - Animations continue correctly across load of
    * downloadable font.
    */
   function test1() {
     var animdiv = document.createElement("div");
+    // Take control of the refresh driver right from the start
+    advance_clock(0);
     animdiv.style.animation = "slide-left 100s linear"; // 10px per second
     gDisplay.appendChild(animdiv);
     var cs = getComputedStyle(animdiv, "");
-    advance_clock(0);
     is(cs.marginLeft, "-1000px", "initial value of animation (force flush)");
     advance_clock(1000);
     is(cs.marginLeft, "-990px", "value of animation before font load");
 
     var font = new FontFace("DownloadedAhem", "url(Ahem.ttf)");
     document.fonts.add(font);
 
     var fontdiv = document.createElement("div");