From 649709818f91a64bfa18b34c556fd1da0e7ea51e Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Mon, 5 Sep 2016 10:34:08 +0900 Subject: [PATCH] Bug 1254881 - Part 2: Introduce a new assertion to check a given animation is not running on the compositor. r=birtles MozReview-Commit-ID: INmj4eEorIa --HG-- extra : rebase_source : 9c395d6b7ed8c3da0b118fa3226f1b411c50efc8 --- .../chrome/test_running_on_compositor.html | 65 ++++++++++--------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/dom/animation/test/chrome/test_running_on_compositor.html b/dom/animation/test/chrome/test_running_on_compositor.html index ec8fd696aa5c..ac33d7683329 100644 --- a/dom/animation/test/chrome/test_running_on_compositor.html +++ b/dom/animation/test/chrome/test_running_on_compositor.html @@ -51,6 +51,11 @@ function assert_animation_is_running_on_compositor(animation, desc) { desc + ' at ' + animation.currentTime + 'ms'); } +function assert_animation_is_not_running_on_compositor(animation, desc) { + assert_equals(animation.isRunningOnCompositor, false, + desc + ' at ' + animation.currentTime + 'ms'); +} + promise_test(function(t) { // FIXME: When we implement Element.animate, use that here instead of CSS // so that we remove any dependency on the CSS mapping. @@ -66,7 +71,7 @@ promise_test(function(t) { return animation.ready; }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' when paused'); }); @@ -77,7 +82,7 @@ promise_test(function(t) { var animation = div.getAnimations()[0]; return animation.ready.then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' for animation of "background"'); }); @@ -104,7 +109,7 @@ promise_test(function(t) { animation.pause(); return animation.ready; }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' when animation.pause() is called'); }); @@ -116,13 +121,13 @@ promise_test(function(t) { return animation.ready.then(function() { animation.finish(); - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' immediately after animation.finish() is called'); // Check that we don't set the flag back again on the next tick. return waitForFrame(); }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' on the next tick after animation.finish() is called'); }); @@ -134,13 +139,13 @@ promise_test(function(t) { return animation.ready.then(function() { animation.currentTime = 100 * MS_PER_SEC; - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' immediately after manually seeking the animation to the end'); // Check that we don't set the flag back again on the next tick. return waitForFrame(); }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' on the next tick after manually seeking the animation to the end'); }); @@ -153,13 +158,13 @@ promise_test(function(t) { return animation.ready.then(function() { animation.cancel(); - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' immediately after animation.cancel() is called'); // Check that we don't set the flag back again on the next tick. return waitForFrame(); }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' on the next tick after animation.cancel() is called'); }); @@ -170,7 +175,7 @@ promise_test(function(t) { var animation = div.getAnimations()[0]; return animation.ready.then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' while in the delay phase'); }); @@ -313,7 +318,7 @@ promise_test(function(t) { animation.currentTime = 150 * MS_PER_SEC; animation.effect.timing.duration = 100 * MS_PER_SEC; - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' when the animation is set a shorter duration than current time'); }); @@ -331,7 +336,7 @@ promise_test(function(t) { animation.currentTime = 500 * MS_PER_SEC; - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' when finished'); @@ -363,7 +368,7 @@ promise_test(function(t) { animation.currentTime = 110 * MS_PER_SEC; return waitForFrame(); }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' when currentTime is during endDelay'); }); @@ -382,7 +387,7 @@ promise_test(function(t) { animation.effect.timing.endDelay = -200 * MS_PER_SEC; return waitForFrame(); }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' when endTime is negative value'); }); @@ -407,7 +412,7 @@ promise_test(function(t) { animation.currentTime = 60 * MS_PER_SEC; return waitForFrame(); }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the compositor' + ' when currentTime is after endTime'); }); @@ -424,7 +429,7 @@ promise_test(function(t) { var div = addDiv(t); return animation.ready.then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation with null target reports that it is not running ' + 'on the compositor'); @@ -446,7 +451,7 @@ promise_test(function(t) { 'Animation reports that it is running on the compositor'); animation.effect.target = null; - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation reports that it is NOT running on the ' + 'compositor after setting null target'); }); @@ -461,7 +466,7 @@ promise_test(function(t) { return animation.ready.then(function() { // Will be fixed in bug 1223658. - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation with fill:backwards in delay phase reports ' + 'that it is NOT running on the compositor'); @@ -504,7 +509,7 @@ promise_test(function(t) { var animation = div.animate({ color: ['red', 'black'] }, 100 * MS_PER_SEC); return animation.ready.then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Color animation reports that it is not running on the ' + 'compositor'); @@ -530,7 +535,7 @@ promise_test(function(t) { 100 * MS_PER_SEC); return animation.ready.then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Color animation reports that it is not running on the ' + 'compositor'); @@ -551,7 +556,7 @@ promise_test(function(t) { var animation = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC); return animation.ready.then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Opacity animation on an element which has 100% opacity style with ' + '!important flag reports that it is not running on the compositor'); // Clear important flag from the opacity style on the target element. @@ -576,7 +581,7 @@ promise_test(function(t) { assert_animation_is_running_on_compositor(secondAnimation, 'The second opacity animation on an element reports that ' + 'it is running on the compositor'); - assert_equals(firstAnimation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(firstAnimation, 'The first opacity animation on the same element reports ' + 'that it is NOT running on the compositor'); @@ -607,7 +612,7 @@ promise_test(function(t) { assert_animation_is_running_on_compositor(secondAnimation, 'The second opacity animation on an element reports that ' + 'it is running on the compositor'); - assert_equals(firstAnimation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(firstAnimation, 'The first opacity animation on the same element reports ' + 'that it is NOT running on the compositor'); @@ -648,7 +653,7 @@ promise_test(function(t) { 'Animation continues to run on the compositor after ' + 'being applied to a different element with a ' + 'lower-priority animation'); - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation stops running on the compositor after ' + 'a higher-priority animation originally applied to ' + 'a different element is applied to the same element'); @@ -671,13 +676,13 @@ promise_test(function(t) { animation.effect.target = null; return waitForFrame(); }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation is no longer running on the compositor after ' + 'removing from the element'); animation.effect.target = importantOpacityElement; return waitForFrame(); }).then(function() { - assert_equals(animation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(animation, 'Animation is NOT running on the compositor even after ' + 'being applied to a different element which has an ' + '!important opacity declaration'); @@ -704,13 +709,13 @@ promise_test(function(t) { lowerAnimation.effect.target = null; return waitForFrame(); }).then(function() { - assert_equals(lowerAnimation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(lowerAnimation, 'Animation is no longer running on the compositor after ' + 'being removed from the element'); lowerAnimation.effect.target = another; return waitForFrame(); }).then(function() { - assert_equals(lowerAnimation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(lowerAnimation, 'A lower-priority animation does NOT begin running ' + 'on the compositor after being applied to an element ' + 'which has a higher-priority animation'); @@ -741,13 +746,13 @@ promise_test(function(t) { higherAnimation.effect.target = null; return waitForFrame(); }).then(function() { - assert_equals(higherAnimation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(higherAnimation, 'Animation is no longer running on the compositor after ' + 'being removed from the element'); higherAnimation.effect.target = div; return waitForFrame(); }).then(function() { - assert_equals(lowerAnimation.isRunningOnCompositor, false, + assert_animation_is_not_running_on_compositor(lowerAnimation, 'Animation stops running on the compositor after ' + 'a higher-priority animation applied to the same element'); assert_animation_is_running_on_compositor(higherAnimation,