Bug 1282312 - Part 3: Add test for disabling of async animations with rendering observers. r=hiro
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 29 Jul 2016 17:59:02 +1200
changeset 332322 09874746f3e0ef2a2566e6ae5916456fed84841a
parent 332321 dbe1b11f09d39468cfae379f2f18acc32479e63c
child 332323 a467d989a3b9e1809f42985cdd23bc4ea93db9ad
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1282312
milestone50.0a1
Bug 1282312 - Part 3: Add test for disabling of async animations with rendering observers. r=hiro
dom/animation/test/chrome/test_animation_performance_warning.html
--- a/dom/animation/test/chrome/test_animation_performance_warning.html
+++ b/dom/animation/test/chrome/test_animation_performance_warning.html
@@ -233,17 +233,18 @@ var gAnimationWithGeometricKeyframeTests
           runningOnCompositor: false,
           warning: 'CompositorAnimationWarningTransformWithGeometricProperties'
         }
       ]
     }
   },
 ];
 
-var gPerformanceWarningTests = [
+// Performance warning tests that set and clear a style property.
+var gPerformanceWarningTestsStyle = [
   {
     desc: 'preserve-3d transform',
     frames: {
       transform: ['translate(0px)', 'translate(100px)']
     },
     style: 'transform-style: preserve-3d',
     expected: [
       {
@@ -302,16 +303,35 @@ var gPerformanceWarningTests = [
         property: 'transform',
         runningOnCompositor: false,
         warning: 'CompositorAnimationWarningTransformBackfaceVisibilityHidden'
       }
     ]
   },
 ];
 
+// Performance warning tests that set and clear the id property
+var gPerformanceWarningTestsId= [
+  {
+    desc: 'moz-element referencing a transform',
+    frames: {
+      transform: ['translate(0px)', 'translate(100px)']
+    },
+    id: 'transformed',
+    createelement: 'width:100px; height:100px; background: -moz-element(#transformed)',
+    expected: [
+      {
+        property: 'transform',
+        runningOnCompositor: false,
+        warning: 'CompositorAnimationWarningHasRenderingObserver'
+      }
+    ]
+  },
+];
+
 var gMultipleAsyncAnimationsTests = [
   {
     desc: 'opacity and transform with preserve-3d',
     style: 'transform-style: preserve-3d',
     animations: [
       {
         frames: {
           transform: ['translate(0px)', 'translate(100px)']
@@ -632,17 +652,17 @@ function start() {
         // Finally, the transform animation is running on compositor.
         assert_animation_property_state_equals(
           animation.effect.getProperties(),
           subtest.expected.withoutGeometric);
       });
     }, 'An animation has: ' + subtest.desc);
   });
 
-  gPerformanceWarningTests.forEach(function(subtest) {
+  gPerformanceWarningTestsStyle.forEach(function(subtest) {
     promise_test(function(t) {
       var animation = addDivAndAnimate(t,
                                        { class: 'compositable' },
                                        subtest.frames, 100 * MS_PER_SEC);
       return animation.ready.then(function() {
         assert_property_state_on_compositor(
           animation.effect.getProperties(),
           subtest.expected);
@@ -657,16 +677,45 @@ function start() {
       }).then(function() {
         assert_property_state_on_compositor(
           animation.effect.getProperties(),
           subtest.expected);
       });
     }, subtest.desc);
   });
 
+  gPerformanceWarningTestsId.forEach(function(subtest) {
+    promise_test(function(t) {
+      if (subtest.createelement) {
+        addDiv(t, { style: subtest.createelement });
+      }
+
+      var animation = addDivAndAnimate(t,
+                                       { class: 'compositable' },
+                                       subtest.frames, 100 * MS_PER_SEC);
+      return animation.ready.then(function() {
+        assert_property_state_on_compositor(
+          animation.effect.getProperties(),
+          subtest.expected);
+        animation.effect.target.id = subtest.id;
+        return waitForFrame();
+      }).then(function() {
+        assert_animation_property_state_equals(
+          animation.effect.getProperties(),
+          subtest.expected);
+        animation.effect.target.id = '';
+        return waitForFrame();
+      }).then(function() {
+        assert_property_state_on_compositor(
+          animation.effect.getProperties(),
+          subtest.expected);
+      });
+    }, subtest.desc);
+  });
+
   gMultipleAsyncAnimationsTests.forEach(function(subtest) {
     promise_test(function(t) {
       var div = addDiv(t, { class: 'compositable' });
       var animations = subtest.animations.map(function(anim) {
         var animation = div.animate(anim.frames, 100 * MS_PER_SEC);
 
         // Bind expected values to animation object.
         animation.expected = anim.expected;