Bug 1267018 - Split tests that rely on pref-based changes to Element.prototype into two files; r=heycam, a=test-only
authorBrian Birtles <birtles@gmail.com>
Mon, 02 May 2016 09:28:45 +0900
changeset 332728 b17fa0c2f2e4537942a5d91b543c825f124564fc
parent 332727 623e6b615195618597f0737c4345b3f50aa59b4e
child 332729 f0f7f315c21548d5e5eb69209b8cbfa719079b29
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam, test-only
bugs1267018
milestone48.0a2
Bug 1267018 - Split tests that rely on pref-based changes to Element.prototype into two files; r=heycam, a=test-only MozReview-Commit-ID: KqLCYOknFRX
layout/style/test/file_animations_with_disabled_properties.html
layout/style/test/file_transitions_with_disabled_properties.html
layout/style/test/mochitest.ini
layout/style/test/test_animations_with_disabled_properties.html
layout/style/test/test_transitions_with_disabled_properties.html
new file mode 100644
--- /dev/null
+++ b/layout/style/test/file_animations_with_disabled_properties.html
@@ -0,0 +1,50 @@
+<!doctype html>
+<head>
+  <meta charset=utf-8>
+  <style>
+  @keyframes enabled-and-disabled {
+    from {
+      left: 0px;
+      -webkit-text-fill-color: green;
+    }
+    to {
+      left: 100px;
+      -webkit-text-fill-color: blue;
+    }
+  }
+  </style>
+  <script>
+    var is = opener.is.bind(opener);
+    var ok = opener.ok.bind(opener);
+    function finish() {
+      var o = opener;
+      self.close();
+      o.SimpleTest.finish();
+    }
+  </script>
+</head>
+<body>
+<div id="display"></div>
+<script>
+'use strict';
+
+var display = document.getElementById('display');
+display.style.animation = 'enabled-and-disabled 0.01s';
+
+var animation = display.getAnimations()[0];
+is(animation.effect.getFrames().length, 2,
+   'Got two frames on the generated animation');
+
+ok(animation.effect.getFrames()[0].hasOwnProperty('left'),
+   'Enabled property is set on initial keyframe');
+ok(!animation.effect.getFrames()[0].hasOwnProperty('webkitTextFillColor'),
+   'Disabled property is not set on initial keyframe');
+
+ok(animation.effect.getFrames()[1].hasOwnProperty('left'),
+   'Enabled property is set on final keyframe');
+ok(!animation.effect.getFrames()[1].hasOwnProperty('webkitTextFillColor'),
+   'Disabled property is not set on final keyframe');
+
+finish();
+</script>
+</body>
new file mode 100644
--- /dev/null
+++ b/layout/style/test/file_transitions_with_disabled_properties.html
@@ -0,0 +1,46 @@
+<!doctype html>
+<head>
+  <meta charset=utf-8>
+  <style>
+  #display {
+    transition: all 0.01s;
+  }
+  </style>
+  <script>
+    var ok = opener.ok.bind(opener);
+    function finish() {
+      var o = opener;
+      self.close();
+      o.SimpleTest.finish();
+    }
+  </script>
+</head>
+<body>
+<div id="display"></div>
+<script>
+'use strict';
+
+/*
+ * This tests for transitions generated on the -webkit-text-fill-color property.
+ * This property has an initial value of 'currentcolor' so by triggering a
+ * transition on the 'color' property we also--at least at the point when
+ * this test was written--trigger a transition on the -webkit-text-fill-color
+ * property (that behavior may change in bug 1260543).
+ *
+ * However, before beginning the test we disable -webkit-text-fill-color by
+ * setting layout.css.prefixes.webkit to false. This code tests that we don't
+ * end up triggering a transition on the (disabled) property in that case.
+ */
+
+var display = document.getElementById('display');
+display.style.color = 'green';
+
+var transitionedProperties =
+  display.getAnimations().map(transition => transition.transitionProperty);
+
+ok(!transitionedProperties.includes('-webkit-text-fill-color'),
+   'We should not fire transitions for properties disabled by prefs');
+
+finish();
+</script>
+</body>
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -59,16 +59,17 @@ support-files = file_animations_iteratio
 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
 [test_animations_styles_on_event.html]
 support-files = file_animations_styles_on_event.html
 [test_animations_with_disabled_properties.html]
+support-files = file_animations_with_disabled_properties.html
 [test_any_dynamic.html]
 [test_at_rule_parse_serialize.html]
 [test_attribute_selector_eof_behavior.html]
 [test_background_blend_mode.html]
 [test_box_size_keywords.html]
 [test_bug73586.html]
 [test_bug74880.html]
 [test_bug98997.html]
@@ -268,16 +269,17 @@ skip-if = (toolkit == 'gonk' && debug) |
 skip-if = (android_version == '18' && debug) # bug 1159532
 [test_transitions_bug537151.html]
 [test_transitions_dynamic_changes.html]
 [test_transitions_per_property.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 775227 # b2g(times out, needs more time + various failures) b2g-debug(times out, needs more time + various failures) b2g-desktop(times out, needs more time + various failures)
 [test_transitions_step_functions.html]
 [test_transitions_with_displaynone.html]
 [test_transitions_with_disabled_properties.html]
+support-files = file_transitions_with_disabled_properties.html
 [test_unclosed_parentheses.html]
 [test_unicode_range_loading.html]
 support-files = ../../reftests/fonts/markA.woff ../../reftests/fonts/markB.woff ../../reftests/fonts/markC.woff ../../reftests/fonts/markD.woff
 [test_units_angle.html]
 [test_units_frequency.html]
 [test_units_length.html]
 [test_units_time.html]
 [test_unprefixing_service.html]
--- a/layout/style/test/test_animations_with_disabled_properties.html
+++ b/layout/style/test/test_animations_with_disabled_properties.html
@@ -3,67 +3,32 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1265611
 -->
 <head>
   <title>Test CSS animations ignore disabled properties (Bug 1265611)</title>
   <script type="application/javascript"
     src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <style>
-  @keyframes enabled-and-disabled {
-    from {
-      left: 0px;
-      -webkit-text-fill-color: green;
-    }
-    to {
-      left: 100px;
-      -webkit-text-fill-color: blue;
-    }
-  }
-  </style>
 </head>
 <body>
 <a target="_blank"
    href="https://bugzilla.mozilla.org/show_bug.cgi?id=1265611">Mozilla Bug
    1265611</a>
-<div id="display"></div>
 <pre id="test">
 <script>
 'use strict';
 
 SimpleTest.waitForExplicitFinish();
 
 /*
  * This test relies on the fact that the -webkit-text-fill-color property
  * is disabled by the layout.css.prefixes.webkit pref. If we ever remove that
  * pref we will need to substitute some other pref:property combination.
  */
 SpecialPowers.pushPrefEnv(
   { 'set': [[ 'dom.animations-api.core.enabled', true ],
             [ 'layout.css.prefixes.webkit', false ]] },
-  () => {
-    // Reparse stylesheet with updated prefs
-    document.querySelector('style').textContent += " ";
-
-    var display = document.getElementById('display');
-    display.style.animation = 'enabled-and-disabled 0.01s';
-
-    var animation = display.getAnimations()[0];
-    is(animation.effect.getFrames().length, 2,
-      'Got two frames on the generated animation');
-
-    ok(animation.effect.getFrames()[0].hasOwnProperty('left'),
-      'Enabled property is set on initial keyframe');
-    ok(!animation.effect.getFrames()[0].hasOwnProperty('webkitTextFillColor'),
-      'Disabled property is not set on initial keyframe');
-
-    ok(animation.effect.getFrames()[1].hasOwnProperty('left'),
-      'Enabled property is set on final keyframe');
-    ok(!animation.effect.getFrames()[1].hasOwnProperty('webkitTextFillColor'),
-      'Disabled property is not set on final keyframe');
-
-    SimpleTest.finish();
-  });
+  () => window.open('file_animations_with_disabled_properties.html'));
 </script>
 </pre>
 </body>
 </html>
--- a/layout/style/test/test_transitions_with_disabled_properties.html
+++ b/layout/style/test/test_transitions_with_disabled_properties.html
@@ -4,53 +4,25 @@
 https://bugzilla.mozilla.org/show_bug.cgi?id=1265611
 -->
 <head>
   <meta charset=utf-8>
   <title>Test for bug 1265611</title>
   <script type="application/javascript"
     src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <style>
-  #display {
-    transition: all 0.01s;
-  }
-  </style>
 </head>
 <body>
 <a target="_blank"
   href="https://bugzilla.mozilla.org/show_bug.cgi?id=1265611">Mozilla Bug
   1265611</a>
 
-<div id="display"></div>
 <pre id="test">
 <script>
 SimpleTest.waitForExplicitFinish();
 
-/*
- * This tests for transitions generated on the -webkit-text-fill-color property.
- * This property has an initial value of 'currentcolor' so by triggering a
- * transition on the 'color' property we also--at least at the point when
- * this test was written--trigger a transition on the -webkit-text-fill-color
- * property (that behavior may change in bug 1260543).
- *
- * However, before beginning the test we disable -webkit-text-fill-color by
- * setting layout.css.prefixes.webkit to false. This code tests that we don't
- * end up triggering a transition on the (disabled) property in that case.
- */
 SpecialPowers.pushPrefEnv({'set': [['layout.css.prefixes.webkit', false],
                                    ['dom.animations-api.core.enabled', true]] },
-  () => {
-    var display = document.getElementById('display');
-    display.style.color = 'green';
-
-    var transitionedProperties =
-      display.getAnimations().map(transition => transition.transitionProperty);
-
-    ok(!transitionedProperties.includes('-webkit-text-fill-color'),
-       'We should not fire transitions for properties disabled by prefs');
-    SimpleTest.finish();
-  }
-);
+  () => window.open('file_transitions_with_disabled_properties.html'));
 </script>
 </pre>
 </body>
 </html>