Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: third_party/WebKit/LayoutTests/virtual/threaded/fast/compositorworker/worklet-animation-creation.html

Issue 2869183002: Initial implementation of WorkletAnimation (Closed)
Patch Set: Add more DCHECKs Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698