зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
607cd13827
Коммит
649709818f
|
@ -51,6 +51,11 @@ function assert_animation_is_running_on_compositor(animation, desc) {
|
||||||
desc + ' at ' + animation.currentTime + 'ms');
|
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) {
|
promise_test(function(t) {
|
||||||
// FIXME: When we implement Element.animate, use that here instead of CSS
|
// FIXME: When we implement Element.animate, use that here instead of CSS
|
||||||
// so that we remove any dependency on the CSS mapping.
|
// so that we remove any dependency on the CSS mapping.
|
||||||
|
@ -66,7 +71,7 @@ promise_test(function(t) {
|
||||||
|
|
||||||
return animation.ready;
|
return animation.ready;
|
||||||
}).then(function() {
|
}).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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' when paused');
|
+ ' when paused');
|
||||||
});
|
});
|
||||||
|
@ -77,7 +82,7 @@ promise_test(function(t) {
|
||||||
var animation = div.getAnimations()[0];
|
var animation = div.getAnimations()[0];
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' for animation of "background"');
|
+ ' for animation of "background"');
|
||||||
});
|
});
|
||||||
|
@ -104,7 +109,7 @@ promise_test(function(t) {
|
||||||
animation.pause();
|
animation.pause();
|
||||||
return animation.ready;
|
return animation.ready;
|
||||||
}).then(function() {
|
}).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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' when animation.pause() is called');
|
+ ' when animation.pause() is called');
|
||||||
});
|
});
|
||||||
|
@ -116,13 +121,13 @@ promise_test(function(t) {
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
return animation.ready.then(function() {
|
||||||
animation.finish();
|
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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' immediately after animation.finish() is called');
|
+ ' immediately after animation.finish() is called');
|
||||||
// Check that we don't set the flag back again on the next tick.
|
// Check that we don't set the flag back again on the next tick.
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' on the next tick after animation.finish() is called');
|
+ ' on the next tick after animation.finish() is called');
|
||||||
});
|
});
|
||||||
|
@ -134,13 +139,13 @@ promise_test(function(t) {
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
return animation.ready.then(function() {
|
||||||
animation.currentTime = 100 * MS_PER_SEC;
|
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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' immediately after manually seeking the animation to the end');
|
+ ' immediately after manually seeking the animation to the end');
|
||||||
// Check that we don't set the flag back again on the next tick.
|
// Check that we don't set the flag back again on the next tick.
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' on the next tick after manually seeking the animation to the end');
|
+ ' 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() {
|
return animation.ready.then(function() {
|
||||||
animation.cancel();
|
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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' immediately after animation.cancel() is called');
|
+ ' immediately after animation.cancel() is called');
|
||||||
// Check that we don't set the flag back again on the next tick.
|
// Check that we don't set the flag back again on the next tick.
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' on the next tick after animation.cancel() is called');
|
+ ' on the next tick after animation.cancel() is called');
|
||||||
});
|
});
|
||||||
|
@ -170,7 +175,7 @@ promise_test(function(t) {
|
||||||
var animation = div.getAnimations()[0];
|
var animation = div.getAnimations()[0];
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' while in the delay phase');
|
+ ' while in the delay phase');
|
||||||
});
|
});
|
||||||
|
@ -313,7 +318,7 @@ promise_test(function(t) {
|
||||||
animation.currentTime = 150 * MS_PER_SEC;
|
animation.currentTime = 150 * MS_PER_SEC;
|
||||||
animation.effect.timing.duration = 100 * 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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' when the animation is set a shorter duration than current time');
|
+ ' 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;
|
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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' when finished');
|
+ ' when finished');
|
||||||
|
|
||||||
|
@ -363,7 +368,7 @@ promise_test(function(t) {
|
||||||
animation.currentTime = 110 * MS_PER_SEC;
|
animation.currentTime = 110 * MS_PER_SEC;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' when currentTime is during endDelay');
|
+ ' when currentTime is during endDelay');
|
||||||
});
|
});
|
||||||
|
@ -382,7 +387,7 @@ promise_test(function(t) {
|
||||||
animation.effect.timing.endDelay = -200 * MS_PER_SEC;
|
animation.effect.timing.endDelay = -200 * MS_PER_SEC;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' when endTime is negative value');
|
+ ' when endTime is negative value');
|
||||||
});
|
});
|
||||||
|
@ -407,7 +412,7 @@ promise_test(function(t) {
|
||||||
animation.currentTime = 60 * MS_PER_SEC;
|
animation.currentTime = 60 * MS_PER_SEC;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).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'
|
'Animation reports that it is NOT running on the compositor'
|
||||||
+ ' when currentTime is after endTime');
|
+ ' when currentTime is after endTime');
|
||||||
});
|
});
|
||||||
|
@ -424,7 +429,7 @@ promise_test(function(t) {
|
||||||
var div = addDiv(t);
|
var div = addDiv(t);
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
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 ' +
|
'Animation with null target reports that it is not running ' +
|
||||||
'on the compositor');
|
'on the compositor');
|
||||||
|
|
||||||
|
@ -446,7 +451,7 @@ promise_test(function(t) {
|
||||||
'Animation reports that it is running on the compositor');
|
'Animation reports that it is running on the compositor');
|
||||||
|
|
||||||
animation.effect.target = null;
|
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 ' +
|
'Animation reports that it is NOT running on the ' +
|
||||||
'compositor after setting null target');
|
'compositor after setting null target');
|
||||||
});
|
});
|
||||||
|
@ -461,7 +466,7 @@ promise_test(function(t) {
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
return animation.ready.then(function() {
|
||||||
// Will be fixed in bug 1223658.
|
// 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 ' +
|
'Animation with fill:backwards in delay phase reports ' +
|
||||||
'that it is NOT running on the compositor');
|
'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);
|
var animation = div.animate({ color: ['red', 'black'] }, 100 * MS_PER_SEC);
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
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 ' +
|
'Color animation reports that it is not running on the ' +
|
||||||
'compositor');
|
'compositor');
|
||||||
|
|
||||||
|
@ -530,7 +535,7 @@ promise_test(function(t) {
|
||||||
100 * MS_PER_SEC);
|
100 * MS_PER_SEC);
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
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 ' +
|
'Color animation reports that it is not running on the ' +
|
||||||
'compositor');
|
'compositor');
|
||||||
|
|
||||||
|
@ -551,7 +556,7 @@ promise_test(function(t) {
|
||||||
var animation = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
|
var animation = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
|
||||||
|
|
||||||
return animation.ready.then(function() {
|
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 ' +
|
'Opacity animation on an element which has 100% opacity style with ' +
|
||||||
'!important flag reports that it is not running on the compositor');
|
'!important flag reports that it is not running on the compositor');
|
||||||
// Clear important flag from the opacity style on the target element.
|
// 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,
|
assert_animation_is_running_on_compositor(secondAnimation,
|
||||||
'The second opacity animation on an element reports that ' +
|
'The second opacity animation on an element reports that ' +
|
||||||
'it is running on the compositor');
|
'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 ' +
|
'The first opacity animation on the same element reports ' +
|
||||||
'that it is NOT running on the compositor');
|
'that it is NOT running on the compositor');
|
||||||
|
|
||||||
|
@ -607,7 +612,7 @@ promise_test(function(t) {
|
||||||
assert_animation_is_running_on_compositor(secondAnimation,
|
assert_animation_is_running_on_compositor(secondAnimation,
|
||||||
'The second opacity animation on an element reports that ' +
|
'The second opacity animation on an element reports that ' +
|
||||||
'it is running on the compositor');
|
'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 ' +
|
'The first opacity animation on the same element reports ' +
|
||||||
'that it is NOT running on the compositor');
|
'that it is NOT running on the compositor');
|
||||||
|
|
||||||
|
@ -648,7 +653,7 @@ promise_test(function(t) {
|
||||||
'Animation continues to run on the compositor after ' +
|
'Animation continues to run on the compositor after ' +
|
||||||
'being applied to a different element with a ' +
|
'being applied to a different element with a ' +
|
||||||
'lower-priority animation');
|
'lower-priority animation');
|
||||||
assert_equals(animation.isRunningOnCompositor, false,
|
assert_animation_is_not_running_on_compositor(animation,
|
||||||
'Animation stops running on the compositor after ' +
|
'Animation stops running on the compositor after ' +
|
||||||
'a higher-priority animation originally applied to ' +
|
'a higher-priority animation originally applied to ' +
|
||||||
'a different element is applied to the same element');
|
'a different element is applied to the same element');
|
||||||
|
@ -671,13 +676,13 @@ promise_test(function(t) {
|
||||||
animation.effect.target = null;
|
animation.effect.target = null;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
assert_equals(animation.isRunningOnCompositor, false,
|
assert_animation_is_not_running_on_compositor(animation,
|
||||||
'Animation is no longer running on the compositor after ' +
|
'Animation is no longer running on the compositor after ' +
|
||||||
'removing from the element');
|
'removing from the element');
|
||||||
animation.effect.target = importantOpacityElement;
|
animation.effect.target = importantOpacityElement;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
assert_equals(animation.isRunningOnCompositor, false,
|
assert_animation_is_not_running_on_compositor(animation,
|
||||||
'Animation is NOT running on the compositor even after ' +
|
'Animation is NOT running on the compositor even after ' +
|
||||||
'being applied to a different element which has an ' +
|
'being applied to a different element which has an ' +
|
||||||
'!important opacity declaration');
|
'!important opacity declaration');
|
||||||
|
@ -704,13 +709,13 @@ promise_test(function(t) {
|
||||||
lowerAnimation.effect.target = null;
|
lowerAnimation.effect.target = null;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
assert_equals(lowerAnimation.isRunningOnCompositor, false,
|
assert_animation_is_not_running_on_compositor(lowerAnimation,
|
||||||
'Animation is no longer running on the compositor after ' +
|
'Animation is no longer running on the compositor after ' +
|
||||||
'being removed from the element');
|
'being removed from the element');
|
||||||
lowerAnimation.effect.target = another;
|
lowerAnimation.effect.target = another;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
assert_equals(lowerAnimation.isRunningOnCompositor, false,
|
assert_animation_is_not_running_on_compositor(lowerAnimation,
|
||||||
'A lower-priority animation does NOT begin running ' +
|
'A lower-priority animation does NOT begin running ' +
|
||||||
'on the compositor after being applied to an element ' +
|
'on the compositor after being applied to an element ' +
|
||||||
'which has a higher-priority animation');
|
'which has a higher-priority animation');
|
||||||
|
@ -741,13 +746,13 @@ promise_test(function(t) {
|
||||||
higherAnimation.effect.target = null;
|
higherAnimation.effect.target = null;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
assert_equals(higherAnimation.isRunningOnCompositor, false,
|
assert_animation_is_not_running_on_compositor(higherAnimation,
|
||||||
'Animation is no longer running on the compositor after ' +
|
'Animation is no longer running on the compositor after ' +
|
||||||
'being removed from the element');
|
'being removed from the element');
|
||||||
higherAnimation.effect.target = div;
|
higherAnimation.effect.target = div;
|
||||||
return waitForFrame();
|
return waitForFrame();
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
assert_equals(lowerAnimation.isRunningOnCompositor, false,
|
assert_animation_is_not_running_on_compositor(lowerAnimation,
|
||||||
'Animation stops running on the compositor after ' +
|
'Animation stops running on the compositor after ' +
|
||||||
'a higher-priority animation applied to the same element');
|
'a higher-priority animation applied to the same element');
|
||||||
assert_animation_is_running_on_compositor(higherAnimation,
|
assert_animation_is_running_on_compositor(higherAnimation,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче