Bug 1244635 - Part2 Add enddelay tests in dom/animation/test/chrome r=hiro
MozReview-Commit-ID: Kylwd6UJcXH
--- a/dom/animation/test/chrome/test_animation_observers.html
+++ b/dom/animation/test/chrome/test_animation_observers.html
@@ -1506,16 +1506,53 @@ addAsyncAnimTest("change_duration_and_cu
anim.effect.timing.duration = "auto";
yield await_frame();
assert_records([], "records after assigning same value \"auto\"");
anim.cancel();
yield await_frame();
});
+addAsyncAnimTest("change_enddelay_and_currenttime",
+ { observe: div, subtree: true }, function*() {
+ var anim = div.animate({ opacity: [ 0, 1 ] }, { duration: 100000 });
+ yield await_frame();
+ assert_records([{ added: [anim], changed: [], removed: [] }],
+ "records after animation is added");
+
+ anim.effect.timing.endDelay = 10000;
+ yield await_frame();
+ assert_records([{ added: [], changed: [anim], removed: [] }],
+ "records after endDelay is changed");
+
+ anim.effect.timing.endDelay = 10000;
+ yield await_frame();
+ assert_records([], "records after assigning same value");
+
+ anim.currentTime = 109000;
+ yield await_frame();
+ assert_records([{ added: [], changed: [], removed: [anim] }],
+ "records after currentTime during endDelay");
+
+ anim.effect.timing.endDelay = -110000;
+ yield await_frame();
+ assert_records([], "records after assigning negative value");
+
+ anim.cancel();
+ yield await_frame();
+});
+
+addAsyncAnimTest("change_enddelay_and_currenttime",
+ { observe: div, subtree: true }, function*() {
+ var anim = div.animate({ opacity: [ 0, 1 ] },
+ { duration: 100, endDelay: -100 });
+ yield await_frame();
+ assert_records([], "records after animation is added");
+});
+
// Run the tests.
SimpleTest.requestLongerTimeout(2);
SimpleTest.waitForExplicitFinish();
runAllAsyncTests().then(function() {
SimpleTest.finish();
}, function(aError) {
ok(false, "Something failed: " + aError);
--- a/dom/animation/test/chrome/test_running_on_compositor.html
+++ b/dom/animation/test/chrome/test_running_on_compositor.html
@@ -322,11 +322,77 @@ promise_test(function(t) {
})).then(t.step_func(function() {
assert_equals(animation.isRunningOnCompositor, omtaEnabled,
'Animation reports that it is running on the compositor'
+ ' when restarted');
}));
}, 'animation is added to compositor' +
' when timing.duration is made longer than the current time');
+promise_test(function(t) {
+ var div = addDiv(t);
+ var animation = div.animate({ opacity: [ 0, 1 ] }, 10000);
+
+ return animation.ready.then(t.step_func(function() {
+ assert_equals(animation.isRunningOnCompositor, omtaEnabled,
+ 'Animation reports that it is running on the compositor');
+
+ animation.effect.timing.endDelay = 10000;
+
+ assert_equals(animation.isRunningOnCompositor, omtaEnabled,
+ 'Animation reports that it is running on the compositor'
+ + ' when endDelay is changed');
+
+ animation.currentTime = 11000;
+ return waitForFrame();
+ })).then(t.step_func(function() {
+ assert_equals(animation.isRunningOnCompositor, false,
+ 'Animation reports that it is NOT running on the compositor'
+ + ' when currentTime is during endDelay');
+ }));
+}, 'animation is removed from compositor' +
+ ' when current time is made longer than the duration even during endDelay');
+
+promise_test(function(t) {
+ var div = addDiv(t);
+ var animation = div.animate({ opacity: [ 0, 1 ] }, 10000);
+
+ return animation.ready.then(t.step_func(function() {
+ assert_equals(animation.isRunningOnCompositor, omtaEnabled,
+ 'Animation reports that it is running on the compositor');
+
+ animation.effect.timing.endDelay = -20000;
+ return waitForFrame();
+ })).then(t.step_func(function() {
+ assert_equals(animation.isRunningOnCompositor, false,
+ 'Animation reports that it is NOT running on the compositor'
+ + ' when endTime is negative value');
+ }));
+}, 'animation is removed from compositor' +
+ ' when endTime is negative value');
+
+promise_test(function(t) {
+ var div = addDiv(t);
+ var animation = div.animate({ opacity: [ 0, 1 ] }, 10000);
+
+ return animation.ready.then(t.step_func(function() {
+ assert_equals(animation.isRunningOnCompositor, omtaEnabled,
+ 'Animation reports that it is running on the compositor');
+
+ animation.effect.timing.endDelay = -5000;
+ return waitForFrame();
+ })).then(t.step_func(function() {
+ assert_equals(animation.isRunningOnCompositor, omtaEnabled,
+ 'Animation reports that it is running on the compositor'
+ + ' when endTime is positive and endDelay is negative');
+ animation.currentTime = 6000;
+ return waitForFrame();
+ })).then(t.step_func(function() {
+ assert_equals(animation.isRunningOnCompositor, false,
+ 'Animation reports that it is NOT running on the compositor'
+ + ' when currentTime is after endTime');
+ }));
+}, 'animation is NOT running on compositor' +
+ 'when endTime is positive and endDelay is negative');
+
</script>
</script>
</body>