Bug 1527640 [wpt PR 15364] - [Animation Worklet] Upstream web tests (related to animator) to WPT, a=testonly
authorJordan Taylor <jortaylo@microsoft.com>
Tue, 05 Mar 2019 11:10:48 +0000
changeset 464511 e070f2c31803ddd8ae62e38c08fde6d40212c29b
parent 464510 e65ca129a94a2aaf4fcf915942553053b73067f0
child 464512 f51f5b78fab60dda1b95598cbffe08c80182fb2e
push id35717
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:45:26 +0000
treeherdermozilla-central@e0861be8d6c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1527640, 15364, 915352, 1468008, 631489
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1527640 [wpt PR 15364] - [Animation Worklet] Upstream web tests (related to animator) to WPT, a=testonly Automatic update from web-platform-tests [Animation Worklet] Upstream web tests (related to animator) to WPT Test for animator-registration was purposefully left out of this group because it will be a more involved change web_tests/animations/animationworklet/animator-animate.html -> web_tests/external/wpt/animation-worklet/animator-animate.https.html web_tests/animations/animationworklet/animator-with-options.html -> web_tests/external/wpt/animation-worklet/animator-with-options.https.html Bug: 915352 Change-Id: I3ccab26ec2134a2d02df9fc9ae4e42dd997264ea Reviewed-on: https://chromium-review.googlesource.com/c/1468008 Commit-Queue: Jordan Taylor <jortaylo@microsoft.com> Reviewed-by: Yi Gu <yigu@chromium.org> Cr-Commit-Position: refs/heads/master@{#631489} -- wpt-commits: 0e4b1315e61ec051dafad75c73f6258f718d56c6 wpt-pr: 15364
testing/web-platform/tests/animation-worklet/animator-animate.https.html
testing/web-platform/tests/animation-worklet/animator-with-options.https.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/animation-worklet/animator-animate.https.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<title>Basic use of Worklet Animation</title>
+<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/web-animations/testcommon.js"></script>
+<script src="common.js"></script>
+
+<div id="target"></div>
+
+<script>
+  promise_test(async t => {
+    await registerConstantLocalTimeAnimator(500);
+    const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 });
+    const animation = new WorkletAnimation('constant_time', effect);
+    animation.play();
+
+    await waitForAsyncAnimationFrames(1);
+    assert_equals(getComputedStyle(target).opacity, "0.5");
+  }, "Simple worklet animation should output values at specified local time");
+</script>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/animation-worklet/animator-with-options.https.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<title>Worklet Animation with options</title>
+<link rel="help" href="https://drafts.css-houdini.org/css-animationworklet/">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/web-animations/testcommon.js"></script>
+<script src="common.js"></script>
+
+<div id="target"></div>
+
+<script id="animate_with_options" type="text/worklet">
+  registerAnimator("test_animator", class {
+    constructor(options) {
+      this.time_ = options.time;
+    }
+    animate(currentTime, effect) {
+      effect.localTime = this.time_;
+    }
+  });
+</script>
+
+<script>
+  promise_test(async t => {
+    await runInAnimationWorklet(document.getElementById('animate_with_options').textContent);
+    const target = document.getElementById('target');
+    const effect = new KeyframeEffect(target, [{ opacity: 0 }], { duration: 1000 });
+    const options = {'time': 500};
+    const animation = new WorkletAnimation('test_animator', effect, document.timeline, options);
+    animation.play();
+
+    await waitForAsyncAnimationFrames(1);
+    assert_equals(getComputedStyle(target).opacity, "0.5");
+  }, "Animator should be able to use options to update the animation");
+</script>
\ No newline at end of file