Bug 1474213 - Add a test case checking animation playback events is fired on the timeline of the animation object. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 09 Jul 2018 07:18:30 +0900
changeset 815509 dcca842d8530aed17e627fc4af5df4f0c4199800
parent 815508 273539e248701b9b1ada5a32b93152e512cb365f
push id115520
push userbmo:hikezoe@mozilla.com
push dateSun, 08 Jul 2018 22:24:35 +0000
reviewersbirtles
bugs1474213
milestone63.0a1
Bug 1474213 - Add a test case checking animation playback events is fired on the timeline of the animation object. r?birtles In this test case, the animation object lives in the parent document and the animation timeline is the parent document's one. Whereas the rendered document for the animation is the subframe one. On Gecko, the subframe has no refresh driver since its display style is 'none', which means in this test case if we were using the rendered document timeline, we don't observe animation playback events at all. MozReview-Commit-ID: 2RMlHeQhBMD
dom/animation/test/mochitest.ini
dom/animation/test/mozilla/test_update-and-send-events.html
--- a/dom/animation/test/mochitest.ini
+++ b/dom/animation/test/mochitest.ini
@@ -48,16 +48,17 @@ skip-if = (toolkit == 'android' && debug
 [mozilla/test_moz_prefixed_properties.html]
 [mozilla/test_restyles.html]
 [mozilla/test_restyling_xhr_doc.html]
 [mozilla/test_set_easing.html]
 [mozilla/test_transform_limits.html]
 [mozilla/test_transition_finish_on_compositor.html]
 skip-if = toolkit == 'android'
 [mozilla/test_underlying_discrete_value.html]
+[mozilla/test_update-and-send-events.html]
 [mozilla/test_event_listener_leaks.html]
 [style/test_animation-seeking-with-current-time.html]
 [style/test_animation-seeking-with-start-time.html]
 [style/test_animation-setting-effect.html]
 [style/test_composite.html]
 [style/test_interpolation-from-interpolatematrix-to-none.html]
 [style/test_missing-keyframe.html]
 [style/test_missing-keyframe-on-compositor.html]
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/mozilla/test_update-and-send-events.html
@@ -0,0 +1,43 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Update animations and send events</title>
+<link rel="help" href="https://drafts.csswg.org/web-animations/#update-animations-and-send-events">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../testcommon.js"></script>
+<div id="log"></div>
+<script>
+'use strict';
+
+// This is a variant of update-and-send-events.html in web platform test but
+// for gecko specific.
+
+promise_test(async t => {
+  const iframe = document.createElement('iframe');
+  document.body.appendChild(iframe);
+  t.add_cleanup(() => iframe.remove());
+
+  // Make the iframe timeline null.
+  iframe.style.display = 'none';
+
+  const iframeEventWatcher = new EventWatcher(t, iframe, 'load');
+  await iframeEventWatcher.wait_for('load');
+
+  const div = iframe.contentDocument.createElement('div');
+  iframe.contentDocument.body.appendChild(div);
+
+  const effect = new KeyframeEffect(div, null, 100 * MS_PER_SEC);
+  const animation = new Animation(effect);
+
+  const animationEventWatcher =
+    new EventWatcher(t, animation, [ 'cancel', 'finish' ]);
+
+  animation.currentTime = 0;
+  animation.finish();
+  animation.cancel();
+
+  await animationEventWatcher.wait_for([ 'cancel', 'finish' ]);
+}, 'Fires animation playback events on the timeline that the animation ' +
+   'timeline belongs to');
+
+</script>