| Index: third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/worklet-animation-creation.html
|
| diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/worklet-animation-creation.html b/third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/worklet-animation-creation.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6fdc1e7fedd3b896020c8476487eb91e6fa1d8b9
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/worklet-animation-creation.html
|
| @@ -0,0 +1,80 @@
|
| +<!DOCTYPE html>
|
| +<style>
|
| +.scroller {
|
| + height: 100px;
|
| + width: 100px;
|
| + overflow: scroll;
|
| +}
|
| +.content {
|
| + height: 500px;
|
| + width: 500px;
|
| +}
|
| +</style>
|
| +
|
| +<div id='element'></div>
|
| +<div class='scroller'>
|
| + <div class='content'></div>
|
| +</div>
|
| +
|
| +<script src='../../../../resources/testharness.js'></script>
|
| +<script src='../../../../resources/testharnessreport.js'></script>
|
| +<script>
|
| +function CreateKeyframeEffect(element) {
|
| + return new KeyframeEffect(
|
| + element,
|
| + [
|
| + { transform: 'translateY(0%)' },
|
| + { transform: 'translateY(100%)' }
|
| + ],
|
| + { duration: 3000, fill: 'forwards' }
|
| + );
|
| +}
|
| +
|
| +test(function() {
|
| + let effect = CreateKeyframeEffect(document.querySelector('#element'));
|
| + let options = { my_param: 'foo', my_other_param: true };
|
| + let workletAnimation = new WorkletAnimation(
|
| + 'my-animation', [ effect ], [ document.timeline ], options);
|
| + assert_equals(workletAnimation.playState, 'idle');
|
| +}, 'Basic WorkletAnimation creation should work');
|
| +
|
| +test(function() {
|
| + let effect = CreateKeyframeEffect(document.querySelector('#element'));
|
| + let scroller = document.querySelector('.scroller');
|
| + let scrollTimeline = new ScrollTimeline(
|
| + { scrollSource: scroller, timeRange: 100, orientation: 'inline' });
|
| + let options = { my_param: 'foo', my_other_param: true };
|
| + let workletAnimation = new WorkletAnimation(
|
| + 'my-animation', [ effect ], [ scrollTimeline ], options);
|
| + assert_equals(workletAnimation.playState, 'idle');
|
| +}, 'ScrollTimeline is a valid timeline for a WorkletAnimation');
|
| +
|
| +test(function() {
|
| + let options = { my_param: 'foo', my_other_param: true };
|
| + let constructorFunc = function() { new WorkletAnimation(
|
| + 'my-animation', [], [ document.timeline ], options); };
|
| + assert_throws('NotSupportedError', constructorFunc);
|
| +}, 'If there are no effects specified, object construction should fail');
|
| +
|
| +test(function() {
|
| + let effect = CreateKeyframeEffect(document.querySelector('#element'));
|
| +
|
| + let otherDoc = document.implementation.createHTMLDocument();
|
| + let otherElement = otherDoc.createElement('div');
|
| + otherDoc.body.appendChild(otherElement);
|
| + let otherEffect = CreateKeyframeEffect(otherElement);
|
| +
|
| + let options = { my_param: 'foo', my_other_param: true };
|
| + let constructorFunc = function() { new WorkletAnimation(
|
| + 'my-animation', [ effect, otherEffect ], [ document.timeline ], options); };
|
| + assert_throws('NotSupportedError', constructorFunc);
|
| +}, 'If the effects are from different documents, object construction should fail');
|
| +
|
| +test(function() {
|
| + let options = { my_param: 'foo', my_other_param: true };
|
| + let effect = CreateKeyframeEffect(document.querySelector('#element'));
|
| + let constructorFunc = function() { new WorkletAnimation(
|
| + 'my-animation', [ effect ], [], options); };
|
| + assert_throws('NotSupportedError', constructorFunc);
|
| +}, 'If there are no timelines specified, object construction should fail');
|
| +</script>
|
|
|