mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1474247 - Test cases for animations tracked by the pending animation tracker for Animation::SetEffect, Animation::Cancel() and . r=birtles
MozReview-Commit-ID: 4XzAoylcwpS --HG-- extra : rebase_source : b800a4d1c2ca831f2f244050a0faaf071043dfc9
This commit is contained in:
parent
f5027435f0
commit
4466a3936f
@ -46,6 +46,7 @@ skip-if = (toolkit == 'android' && debug) || (os == 'win' && bits == 64) # Bug 1
|
||||
[mozilla/test_document_timeline_origin_time_range.html]
|
||||
[mozilla/test_hide_and_show.html]
|
||||
[mozilla/test_moz_prefixed_properties.html]
|
||||
[mozilla/test_pending_animation_tracker.html]
|
||||
[mozilla/test_restyles.html]
|
||||
[mozilla/test_restyling_xhr_doc.html]
|
||||
[mozilla/test_set_easing.html]
|
||||
|
@ -0,0 +1,78 @@
|
||||
<!doctype html>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<title>Test animations in PendingAnimationTracker</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
test(t => {
|
||||
const target = addDiv(t);
|
||||
const anim = target.animate(null, 100 * MS_PER_SEC);
|
||||
assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should be tracked by tracker');
|
||||
|
||||
anim.effect = null;
|
||||
|
||||
assert_false(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should NOT be tracked by the tracker');
|
||||
}, 'Setting null effect removes the animation from the tracker');
|
||||
|
||||
test(t => {
|
||||
const target = addDiv(t);
|
||||
const anim = target.animate(null, 100 * MS_PER_SEC);
|
||||
assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should be tracked by tracker');
|
||||
|
||||
const newEffect = new KeyframeEffect(target, null);
|
||||
anim.effect = newEffect;
|
||||
|
||||
assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should be still tracked by tracker');
|
||||
}, 'Setting another effect keeps the pending animation in the tracker');
|
||||
|
||||
test(t => {
|
||||
const target = addDiv(t);
|
||||
const anim = target.animate(null, 100 * MS_PER_SEC);
|
||||
assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should be tracked by tracker');
|
||||
|
||||
anim.cancel();
|
||||
|
||||
assert_false(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should NOT be tracked by the tracker');
|
||||
}, 'Calling cancel() removes the animation from the tracker');
|
||||
|
||||
promise_test(async t => {
|
||||
// Before proceeding this test, make sure following code is _NOT_ processed
|
||||
// between paint and refresh driver's tick. Otherwise, waitForNextFrame below
|
||||
// doesn't ensure that a paint process happens which means that there is
|
||||
// no chance to call TriggerPendingAnimationsOnNextTick to discard the
|
||||
// animation from the pending animation tracker.
|
||||
await waitForNextFrame();
|
||||
|
||||
const target = addDiv(t);
|
||||
const anim = target.animate(null, 100 * MS_PER_SEC);
|
||||
|
||||
assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should be tracked by tracker');
|
||||
|
||||
target.remove();
|
||||
|
||||
assert_true(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation is still being tracked by the tracker');
|
||||
|
||||
await waitForNextFrame();
|
||||
assert_false(SpecialPowers.DOMWindowUtils.isAnimationInPendingTracker(anim),
|
||||
'The animation should NOT be tracked by the tracker in the ' +
|
||||
'next frame');
|
||||
}, 'Removing target element from the document removes the animation from ' +
|
||||
'the tracker in the next tick');
|
||||
|
||||
</script>
|
||||
</body>
|
Loading…
Reference in New Issue
Block a user