Bug 1357979 - Add dom.animations-api.core.enabled preference to test of smil with transition in order to enable beta/release test. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Mon, 01 May 2017 22:54:11 +0900
changeset 570870 fe44f97208e8ecce46ca51a2440e2902062d9c22
parent 570775 5278e2a35fc8f2be390243db1e62858bf0982055
child 626592 e39a913b0aef7144d881fac6ca0196274d180b62
push id56602
push usermantaroh@gmail.com
push dateMon, 01 May 2017 13:55:04 +0000
reviewersbirtles
bugs1357979
milestone55.0a1
Bug 1357979 - Add dom.animations-api.core.enabled preference to test of smil with transition in order to enable beta/release test. r?birtles MozReview-Commit-ID: EmdxQMgjatu
dom/smil/test/file_smilWithTransition.html
dom/smil/test/mochitest.ini
dom/smil/test/test_smilWithTransition.html
copy from dom/smil/test/test_smilWithTransition.html
copy to dom/smil/test/file_smilWithTransition.html
--- a/dom/smil/test/test_smilWithTransition.html
+++ b/dom/smil/test/file_smilWithTransition.html
@@ -1,32 +1,39 @@
 <!doctype html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1315874
 -->
 <head>
   <meta charset="utf-8">
   <title>Test SMIL does not trigger CSS Transitions (bug 1315874)</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank"
   href="https://bugzilla.mozilla.org/show_bug.cgi?id=1315874">Mozilla Bug
   1315874</a>
 <svg>
   <rect width="100%" height="100%"
         style="fill: red; transition: fill 10s" id="rect">
     <animate attributeName="fill" to="lime" dur="1s" fill="freeze">
   </rect>
 </svg>
-<pre id="test">
 <script  type="text/javascript">
-  SimpleTest.waitForExplicitFinish();
+  // Bring SimpleTest's function from opener.
+  if (opener) {
+    var is = opener.is.bind(opener);
+    var ok = opener.ok.bind(opener);
+    function finish() {
+      var o = opener;
+      self.close();
+      o.SimpleTest.finish();
+    }
+  }
+
   window.addEventListener('load', runTests, false);
 
   var rect = document.getElementById('rect');
   var svg = document.getElementsByTagName('svg')[0];
   is(getComputedStyle(rect).fill, 'rgb(255, 0, 0)',
      'The initial color should be red.');
 
   function runTests() {
@@ -34,17 +41,17 @@ https://bugzilla.mozilla.org/show_bug.cg
       svg.setCurrentTime(1);
       ok(getComputedStyle(rect).fill, 'rgb(0, 255, 0)',
          'The end color should be lime.');
 
       return waitForAnimationFrames(2);
     }).then(function() {
       var anim = document.getAnimations()[0];
       ok(!anim, 'Transition should not be created by restyling for SMIL');
-      SimpleTest.finish();
+      finish();
     });
   }
 
   // Utility methods from testcommon.js
   // For detail, see dom/animation/test/testcommon.js.
 
   function waitForFrame() {
     return new Promise(function(resolve, reject) {
--- a/dom/smil/test/mochitest.ini
+++ b/dom/smil/test/mochitest.ini
@@ -1,16 +1,17 @@
 [DEFAULT]
 support-files =
   db_smilAnimateMotion.js
   db_smilCSSFromBy.js
   db_smilCSSFromTo.js
   db_smilCSSPaced.js
   db_smilCSSPropertyList.js
   db_smilMappedAttrList.js
+  file_smilWithTransition.html
   smilAnimateMotionValueLists.js
   smilExtDoc_helper.svg
   smilTestUtils.js
   smilXHR_helper.svg
 
 [test_smilAccessKey.xhtml]
 [test_smilAnimateMotion.xhtml]
 [test_smilAnimateMotionInvalidValues.xhtml]
--- a/dom/smil/test/test_smilWithTransition.html
+++ b/dom/smil/test/test_smilWithTransition.html
@@ -1,72 +1,18 @@
 <!doctype html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1315874
--->
+<meta charset=utf-8>
 <head>
-  <meta charset="utf-8">
-  <title>Test SMIL does not trigger CSS Transitions (bug 1315874)</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
-<body>
-<a target="_blank"
-  href="https://bugzilla.mozilla.org/show_bug.cgi?id=1315874">Mozilla Bug
-  1315874</a>
-<svg>
-  <rect width="100%" height="100%"
-        style="fill: red; transition: fill 10s" id="rect">
-    <animate attributeName="fill" to="lime" dur="1s" fill="freeze">
-  </rect>
-</svg>
 <pre id="test">
-<script  type="text/javascript">
-  SimpleTest.waitForExplicitFinish();
-  window.addEventListener('load', runTests, false);
-
-  var rect = document.getElementById('rect');
-  var svg = document.getElementsByTagName('svg')[0];
-  is(getComputedStyle(rect).fill, 'rgb(255, 0, 0)',
-     'The initial color should be red.');
-
-  function runTests() {
-    waitForFrame().then(function() {
-      svg.setCurrentTime(1);
-      ok(getComputedStyle(rect).fill, 'rgb(0, 255, 0)',
-         'The end color should be lime.');
+<script>
+'use strict';
 
-      return waitForAnimationFrames(2);
-    }).then(function() {
-      var anim = document.getAnimations()[0];
-      ok(!anim, 'Transition should not be created by restyling for SMIL');
-      SimpleTest.finish();
-    });
-  }
-
-  // Utility methods from testcommon.js
-  // For detail, see dom/animation/test/testcommon.js.
-
-  function waitForFrame() {
-    return new Promise(function(resolve, reject) {
-      requestAnimationFrame(function(time) {
-        resolve();
-      });
-    });
-  }
-
-  function waitForAnimationFrames(frameCount) {
-    return new Promise(function(resolve, reject) {
-      function handleFrame() {
-        if (--frameCount <= 0) {
-          resolve();
-        } else {
-          window.requestAnimationFrame(handleFrame);
-        }
-      }
-      window.requestAnimationFrame(handleFrame);
-    });
-  }
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv(
+  { "set": [["dom.animations-api.core.enabled", true]]},
+  function() {
+    window.open("file_smilWithTransition.html");
+  });
 </script>
-</pre>
-</body>
 </html>