Bug 1096776 part 1 - Add animation mochitest for examine timeline is null. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Mon, 23 May 2016 08:19:01 +0900
changeset 369363 6c48276d59f0bc1fb2c6e2b312549b41dde5f0a2
parent 369317 16663eb3dcfa759f25b5e27b101bc79270c156f2
child 369364 9a016cab3ee6606d8c62e6266d86360208683e3c
push id18840
push usermantaroh@gmail.com
push dateSun, 22 May 2016 23:29:40 +0000
reviewersbirtles
bugs1096776
milestone49.0a1
Bug 1096776 part 1 - Add animation mochitest for examine timeline is null. r?birtles MozReview-Commit-ID: 3QFFW0qZdyO
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/web-animations/interfaces/Animation/reverse.html.ini
testing/web-platform/meta/web-animations/timing-model/animations/current-time.html.ini
testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
testing/web-platform/tests/web-animations/timing-model/animations/current-time.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -35934,52 +35934,52 @@
       {
         "path": "webdriver/navigation.py",
         "url": "/webdriver/navigation.py"
       }
     ]
   },
   "local_changes": {
     "deleted": [
+      "web-animations/animation/onfinish.html",
+      "web-animations/animation-effect-timing/getComputedStyle.html",
+      "web-animations/animation-model/animation-types/not-animatable.html",
+      "web-animations/animation/ready.html",
+      "web-animations/keyframe-effect/setFrames.html",
+      "web-animations/animation-model/keyframes/effect-value-context.html",
+      "web-animations/keyframe-effect/getComputedTiming.html",
+      "web-animations/keyframe-effect/effect-easing.html",
+      "web-animations/animation/pause.html",
+      "web-animations/animation-effect-timing/delay.html",
+      "web-animations/animation-effect-timing/direction.html",
+      "web-animations/animation-effect-timing/duration.html",
       "web-animations/animatable/animate.html",
-      "web-animations/keyframe-effect/getComputedTiming.html",
+      "web-animations/document/getAnimations.html",
+      "web-animations/animation/id.html",
       "web-animations/animation/cancel.html",
       "web-animations/animation/reverse.html",
-      "web-animations/animation-model/animation-types/not-animatable.html",
-      "web-animations/animation/playbackRate.html",
-      "web-animations/keyframe-effect/keyframe-handling.html",
-      "web-animations/animation/finish.html",
+      "web-animations/keyframe-effect/setTarget.html",
+      "web-animations/animation-effect-timing/getAnimations.html",
+      "web-animations/animation/playState.html",
+      "web-animations/animation/constructor.html",
+      "web-animations/animation/play.html",
+      "web-animations/animation-effect-timing/iterationStart.html",
       "web-animations/animation/startTime.html",
       "web-animations/animation-timeline/document-timeline.html",
-      "web-animations/animation-model/keyframes/effect-value-context.html",
-      "web-animations/animation-effect-timing/delay.html",
-      "web-animations/animation-effect-timing/fill.html",
-      "web-animations/animation-effect-timing/getComputedStyle.html",
+      "web-animations/animation/finished.html",
       "web-animations/animation-effect-timing/endDelay.html",
-      "web-animations/animation/finished.html",
-      "web-animations/animation-effect-timing/iterationStart.html",
-      "web-animations/animation/id.html",
-      "web-animations/keyframe-effect/setTarget.html",
-      "web-animations/animation/oncancel.html",
-      "web-animations/animation-effect-timing/direction.html",
+      "web-animations/animation-effect-timing/iterations.html",
+      "web-animations/animation-effect-timing/fill.html",
       "web-animations/animation-effect-timing/easing.html",
-      "web-animations/animation-effect-timing/getAnimations.html",
-      "web-animations/animation/play.html",
-      "web-animations/keyframe-effect/setFrames.html",
-      "web-animations/animation-effect-timing/duration.html",
-      "web-animations/animation/ready.html",
-      "web-animations/animation/pause.html",
-      "web-animations/animation/onfinish.html",
-      "web-animations/keyframe-effect/effect-easing.html",
-      "web-animations/animation-effect-timing/iterations.html",
+      "web-animations/animation/oncancel.html",
+      "web-animations/animation/finish.html",
+      "web-animations/keyframe-effect/constructor.html",
       "web-animations/animation-timeline/idlharness.html",
-      "web-animations/animation/playState.html",
-      "web-animations/document/getAnimations.html",
-      "web-animations/animation/constructor.html",
-      "web-animations/keyframe-effect/constructor.html"
+      "web-animations/animation/playbackRate.html",
+      "web-animations/keyframe-effect/keyframe-handling.html"
     ],
     "deleted_reftests": {},
     "items": {
       "testharness": {
         "dom/events/EventListener-incumbent-global-1.sub.html": [
           {
             "path": "dom/events/EventListener-incumbent-global-1.sub.html",
             "url": "/dom/events/EventListener-incumbent-global-1.sub.html"
@@ -36231,16 +36231,22 @@
             "url": "/web-animations/interfaces/KeyframeEffect/setKeyframes.html"
           }
         ],
         "web-animations/interfaces/KeyframeEffect/setTarget.html": [
           {
             "path": "web-animations/interfaces/KeyframeEffect/setTarget.html",
             "url": "/web-animations/interfaces/KeyframeEffect/setTarget.html"
           }
+        ],
+        "web-animations/timing-model/animations/current-time.html": [
+          {
+            "path": "web-animations/timing-model/animations/current-time.html",
+            "url": "/web-animations/timing-model/animations/current-time.html"
+          }
         ]
       }
     },
     "reftest_nodes": {}
   },
   "reftest_nodes": {
     "2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
       {
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/web-animations/interfaces/Animation/reverse.html.ini
@@ -0,0 +1,5 @@
+[reverse.html]
+  type: testharness
+  [Reversing an animation without an active timeline throws an InvalidStateError]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1096776
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/web-animations/timing-model/animations/current-time.html.ini
@@ -0,0 +1,5 @@
+[current-time.html]
+  type: testharness
+  [The current time is unresolved when there is no associated timeline (and no hold time is set)]
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1096776
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/reverse.html
@@ -141,10 +141,19 @@ test(function(t) {
 
   assert_equals(animation.playbackRate, 0,
     'reverse() should preserve playbackRate if the playbackRate == 0');
   assert_equals(animation.currentTime, 50 * MS_PER_SEC,
     'reverse() should not affect the currentTime if the playbackRate == 0');
   t.done();
 }, 'reverse() when playbackRate == 0');
 
+test(function(t) {
+  var div = createDiv(t);
+  var animation =
+   new Animation(new KeyframeEffect(div, null, 100 * MS_PER_SEC));
+
+  assert_throws('InvalidStateError', function() { animation.reverse(); });
+}, 'Reversing an animation without an active timeline throws an ' +
+   'InvalidStateError');
+
 </script>
 </body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/current-time.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>Tests for current time</title>
+<link rel="help" href="https://w3c.github.io/web-animations/#current-time">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../../testcommon.js"></script>
+<body>
+<div id="log"></div>
+<script>
+'use strict';
+
+test(function(t) {
+  var animation =
+    new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
+                  document.timeline);
+
+  animation.play();
+  assert_equals(animation.currentTime, 0,
+    'Current time returns the hold time set when entering the play-pending ' +
+    'state');
+}, 'The current time returns the hold time when set');
+
+promise_test(function(t) {
+  var animation =
+    new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
+                  null);
+
+  return animation.ready.then(function() {
+    assert_equals(animation.currentTime, null);
+  });
+}, 'The current time is unresolved when there is no associated timeline ' +
+   '(and no hold time is set)');
+
+// FIXME: Test that the current time is unresolved when we have an inactive
+// timeline if we find a way of creating an inactive timeline!
+
+test(function(t) {
+  var animation =
+    new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
+                  document.timeline);
+
+  animation.startTime = null;
+  assert_equals(animation.currentTime, null);
+}, 'The current time is unresolved when the start time is unresolved ' +
+   '(and no hold time is set)');
+
+promise_test(function(t) {
+  var animation =
+    new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
+                  document.timeline);
+
+  animation.playbackRate = 2;
+  animation.startTime = document.timeline.currentTime - 25 * MS_PER_SEC;
+
+  var timelineTime = document.timeline.currentTime;
+  var startTime = animation.startTime;
+  var playbackRate = animation.playbackRate;
+  assert_times_equal(animation.currentTime,
+                     (timelineTime - startTime) * playbackRate,
+                     'Animation has a unresolved start time');
+}, 'The current time is calculated from the timeline time, start time and ' +
+   'playback rate');
+</script>
+</body>