Bug 1466031 - Move the reversing test to Web Animations web-platform-tests; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Mon, 04 Jun 2018 10:10:40 +0900
changeset 803424 e5f7015f5ac37e363dd53d0b5e743d5dbdc2b743
parent 803423 3496a3e707044f536e3b46ca70ec2fc88ecef272
child 803425 0a0d0899e79227fd6924cd032b8f5932c397f57b
push id112095
push userbmo:bbirtles@mozilla.com
push dateMon, 04 Jun 2018 01:13:47 +0000
reviewershiro
bugs1466031
milestone62.0a1
Bug 1466031 - Move the reversing test to Web Animations web-platform-tests; r?hiro MozReview-Commit-ID: Ixpci3OKXdx
dom/animation/test/css-animations/test_animation-reverse.html
dom/animation/test/mochitest.ini
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
deleted file mode 100644
--- a/dom/animation/test/css-animations/test_animation-reverse.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!doctype html>
-<meta charset=utf-8>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="../testcommon.js"></script>
-<style>
-@keyframes anim {
-  to { transform: translate(100px) }
-}
-</style>
-<body>
-<div id="log"></div>
-<script>
-'use strict';
-
-test(t => {
-  const div = addDiv(t, { style: 'animation: anim 100s' });
-  const animation = div.getAnimations()[0];
-  div.style.animation = "";
-  flushComputedStyle(div);
-
-  assert_equals(animation.currentTime, null);
-  animation.reverse();
-
-  assert_equals(animation.currentTime, 100 * MS_PER_SEC,
-    'animation.currentTime should be its effect end');
-}, 'reverse() from idle state starts playing the animation');
-
-</script>
-</body>
--- a/dom/animation/test/mochitest.ini
+++ b/dom/animation/test/mochitest.ini
@@ -19,17 +19,16 @@ support-files =
 [css-animations/test_animation-cancel.html]
 [css-animations/test_animation-computed-timing.html]
 [css-animations/test_animation-currenttime.html]
 [css-animations/test_animation-finished.html]
 [css-animations/test_animation-id.html]
 [css-animations/test_animation-pausing.html]
 [css-animations/test_animation-playstate.html]
 [css-animations/test_animation-ready.html]
-[css-animations/test_animation-reverse.html]
 [css-animations/test_animation-starttime.html]
 [css-animations/test_cssanimation-animationname.html]
 [css-animations/test_document-get-animations.html]
 [css-animations/test_effect-target.html]
 [css-animations/test_element-get-animations.html]
 [css-animations/test_event-dispatch.html]
 [css-animations/test_event-order.html]
 [css-animations/test_keyframeeffect-getkeyframes.html]
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -615896,17 +615896,17 @@
    "0ab2fa3a464001272d1af541ea769fa967490c3b",
    "testharness"
   ],
   "web-animations/timing-model/animations/playing-an-animation.html": [
    "f6c36cc2370b08037e5a99009e6def67df84a4a7",
    "testharness"
   ],
   "web-animations/timing-model/animations/reversing-an-animation.html": [
-   "72b89e78ca7dac261af8de370389d89c810b3718",
+   "053cc1287bd6dfc9688b4e1700a15bedc11bd92b",
    "testharness"
   ],
   "web-animations/timing-model/animations/seamlessly-updating-the-playback-rate-of-an-animation.html": [
    "a7e28aa0b40a39b00da257e347cb6ecf8d1d2882",
    "testharness"
   ],
   "web-animations/timing-model/animations/setting-the-current-time-of-an-animation.html": [
    "aa5f258132490ade2dbd9485c85f749cbab293a5",
--- a/testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
@@ -211,16 +211,28 @@ promise_test(async t => {
   assert_equals(animation.currentTime, 50 * MS_PER_SEC,
     'reverse() should not affect the currentTime if the playbackRate == 0');
 }, 'Reversing when when playbackRate == 0 should preserve the current ' +
    'time and playback rate');
 
 test(t => {
   const div = createDiv(t);
   const animation =
+    new Animation(new KeyframeEffect(div, null, 100 * MS_PER_SEC));
+  assert_equals(animation.currentTime, null);
+
+  animation.reverse();
+
+  assert_equals(animation.currentTime, 100 * MS_PER_SEC,
+    'animation.currentTime should be at its effect end');
+}, 'Reversing an idle animation from starts playing the animation');
+
+test(t => {
+  const div = createDiv(t);
+  const animation =
     new Animation(new KeyframeEffect(div, null, 100 * MS_PER_SEC), null);
 
   assert_throws('InvalidStateError', () => { animation.reverse(); });
 }, 'Reversing an animation without an active timeline throws an ' +
    'InvalidStateError');
 
 promise_test(async t => {
   const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);