Bug 1244635 - Part4 Add duration tests in layout/style/test r?hiro draft
authorRyo Motozawa <motozawa@mozilla-japan.org>
Tue, 01 Mar 2016 18:52:16 +0900
changeset 335739 1f68c98fa2f15b37d762d6c2a990621a6db3b22b
parent 335738 8167979ef7e279d01337fe2d85e04d530956d3c1
child 515201 4405172a27248cef6ba4241ef4cf89209e901265
push id11859
push userbmo:motoryo1@gmail.com
push dateTue, 01 Mar 2016 09:53:53 +0000
reviewershiro
bugs1244635
milestone47.0a1
Bug 1244635 - Part4 Add duration tests in layout/style/test r?hiro MozReview-Commit-ID: 1LVOD3Qc4Yq
layout/style/test/file_animations_effect_timing_enddelay.html
layout/style/test/mochitest.ini
layout/style/test/test_animations_effect_timing_enddelay.html
new file mode 100644
--- /dev/null
+++ b/layout/style/test/file_animations_effect_timing_enddelay.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <script type="application/javascript"
+    src="/tests/SimpleTest/paint_listener.js"></script>
+  <script type="application/javascript" src="animation_utils.js"></script>
+  <style type="text/css">
+    @keyframes anim {
+      0% { transform: translate(0px) }
+      100% { transform: translate(100px) }
+    }
+    .target {
+      /* The animation target needs geometry in order to qualify for OMTA */
+      width: 100px;
+      height: 100px;
+      background-color: white;
+    }
+  </style>
+  <script>
+    var ok = opener.ok.bind(opener);
+    var is = opener.is.bind(opener);
+    var todo = opener.todo.bind(opener);
+    function finish() {
+      var o = opener;
+      self.close();
+      o.SimpleTest.finish();
+    }
+  </script>
+</head>
+<body>
+<div id="display"></div>
+<script type="application/javascript">
+"use strict";
+
+runOMTATest(function() {
+  runAllAsyncAnimTests().then(function() {
+    finish();
+  });
+}, finish, opener.SpecialPowers);
+
+addAsyncAnimTest(function *() {
+  var [ div ] = new_div("");
+  div.style.transform = 'translate(0px)';
+  var animation = div.animate(
+    [ { transform: 'translate(0px)' }, { transform: 'translate(100px)' } ],
+    { duration: 1000, fill: 'none' });
+  yield waitForPaints();
+
+  advance_clock(100);
+  omta_is(div, "transform", { tx: 10 }, RunningOn.Compositor,
+          "Animation is running on compositor");
+  animation.effect.timing.endDelay = 1000;
+
+  yield waitForPaints();
+  omta_is(div, "transform", { tx: 10 }, RunningOn.Compositor,
+          "Animation remains on compositor");
+
+  advance_clock(1000);
+  yield waitForPaints();
+  omta_is(div, "transform", { tx: 0 }, RunningOn.Mainthread,
+          "Animation is updated on compositor");
+
+  done_div();
+});
+
+addAsyncAnimTest(function *() {
+  var [ div ] = new_div("");
+  div.style.transform = 'translate(0px)';
+  var animation = div.animate(
+    [ { transform: 'translate(0px)' }, { transform: 'translate(100px)' } ],
+    { duration: 1000, fill: 'forwards' });
+  yield waitForPaints();
+
+  animation.effect.timing.endDelay = 1000;
+  advance_clock(1500);
+  omta_is(div, "transform", { tx: 100 }, RunningOn.Compositor,
+          "Animation is updated on compositor backwards");
+
+  done_div();
+});
+
+
+</script>
+</body>
+</html>
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -39,16 +39,18 @@ generated-files = css_properties.js
 [test_all_shorthand.html]
 [test_animations.html]
 skip-if = toolkit == 'android'
 [test_animations_async_tests.html]
 support-files = ../../reftests/fonts/Ahem.ttf file_animations_async_tests.html
 [test_animations_dynamic_changes.html]
 [test_animations_effect_timing_duration.html]
 support-files = file_animations_effect_timing_duration.html
+[test_animations_effect_timing_enddelay.html]
+support-files = file_animations_effect_timing_enddelay.html
 [test_animations_event_order.html]
 [test_animations_omta.html]
 [test_animations_omta_start.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # bug 1041017
 [test_animations_pausing.html]
 support-files = file_animations_pausing.html
 [test_animations_playbackrate.html]
 support-files = file_animations_playbackrate.html
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_animations_effect_timing_enddelay.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for animation.effect.timing.endDelay on compositor</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<div id="display"></div>
+<pre id="test">
+<script type="application/javascript">
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+SpecialPowers.pushPrefEnv(
+  { "set": [[ "dom.animations-api.core.enabled", true]] },
+  function() {
+    window.open("file_animations_effect_timing_enddelay.html");
+  });
+</script>
+</pre>
+</body>
+</html>