Bug 1253476 - Add tests that removing is triggered at the right time; r=boris

Differential Revision: https://phabricator.services.mozilla.com/D30323

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brian Birtles 2019-05-20 05:22:16 +00:00
parent 5b145a6de4
commit 8ceb39cc5f
6 changed files with 1082 additions and 1 deletions

View File

@ -14,6 +14,7 @@ support-files =
chrome/file_animate_xrays.html
mozilla/xhr_doc.html
mozilla/file_deferred_start.html
mozilla/file_disable_animations_api_autoremove.html
mozilla/file_disable_animations_api_compositing.html
mozilla/file_disable_animations_api_get_animations.html
mozilla/file_disable_animations_api_implicit_keyframes.html
@ -32,6 +33,7 @@ skip-if = (verify && !debug && (os == 'mac'))
[mozilla/test_cubic_bezier_limits.html]
[mozilla/test_deferred_start.html]
skip-if = (toolkit == 'android' && debug) || (os == 'win' && bits == 64) # Bug 1363957
[mozilla/test_disable_animations_api_autoremove.html]
[mozilla/test_disable_animations_api_compositing.html]
[mozilla/test_disable_animations_api_get_animations.html]
[mozilla/test_disable_animations_api_implicit_keyframes.html]

View File

@ -0,0 +1,37 @@
<!doctype html>
<meta charset=utf-8>
<script src="../testcommon.js"></script>
<body>
<script>
'use strict';
promise_test(async t => {
const div = addDiv(t);
const animA = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' });
const animB = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' });
// This should be assert_not_own_property but our local copy of testharness.js
// is old.
assert_equals(
animA.replaceState,
undefined,
'Should not have a replaceState member'
);
animA.addEventListener(
'remove',
t.step_func(() => {
assert_unreached('Should not fire a remove event');
})
);
// Allow a chance for the remove event to be fired
await animA.finished;
await waitForNextFrame();
}, 'Remove events should not be fired if the pref is not set');
done();
</script>
</body>

View File

@ -0,0 +1,15 @@
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
'use strict';
setup({ explicit_done: true });
SpecialPowers.pushPrefEnv(
{ set: [['dom.animations-api.autoremove.enabled', false]] },
function() {
window.open('file_disable_animations_api_autoremove.html');
}
);
</script>

View File

@ -1 +1 @@
prefs: [dom.animations-api.compositing.enabled:true, dom.animations-api.core.enabled:true, dom.animations-api.getAnimations.enabled:true, dom.animations-api.implicit-keyframes.enabled:true, dom.animations-api.timelines.enabled:true, layout.css.step-position-jump.enabled:true]
prefs: [dom.animations-api.autoremove.enabled:true, dom.animations-api.compositing.enabled:true, dom.animations-api.core.enabled:true, dom.animations-api.getAnimations.enabled:true, dom.animations-api.implicit-keyframes.enabled:true, dom.animations-api.timelines.enabled:true, layout.css.step-position-jump.enabled:true]

View File

@ -160,6 +160,7 @@ const tests = {
}),
playState: UsePropertyTest(animation => animation.playState),
pending: UsePropertyTest(animation => animation.pending),
replaceState: UsePropertyTest(animation => animation.replaceState),
ready: UsePropertyTest(animation => animation.ready),
finished: UsePropertyTest(animation => {
// Get the finished Promise
@ -172,6 +173,13 @@ const tests = {
// Set the onfinish menber
animation.onfinish = () => {};
}),
onremove: UsePropertyTest(animation => {
// Get the onremove member
animation.onremove;
// Set the onremove menber
animation.onremove = () => {};
}),
oncancel: UsePropertyTest(animation => {
// Get the oncancel member
animation.oncancel;