diff --git a/dom/animation/test/chrome/test_animation_observers.html b/dom/animation/test/chrome/test_animation_observers.html index d914c0a3a606..33a690b51c06 100644 --- a/dom/animation/test/chrome/test_animation_observers.html +++ b/dom/animation/test/chrome/test_animation_observers.html @@ -1511,6 +1511,43 @@ addAsyncAnimTest("change_duration_and_currenttime", 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(); diff --git a/dom/animation/test/chrome/test_running_on_compositor.html b/dom/animation/test/chrome/test_running_on_compositor.html index 75edff3641e5..688e24137a29 100644 --- a/dom/animation/test/chrome/test_running_on_compositor.html +++ b/dom/animation/test/chrome/test_running_on_compositor.html @@ -327,6 +327,72 @@ promise_test(function(t) { }, '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'); +