Bug 1264101 - Force dom.animations-api.core.enabled pref to true before animation inspector tests. r=pbro
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 15 Apr 2016 12:35:58 +0200
changeset 331322 898a9b29cadbf098059bc7574fe0206989a03766
parent 331321 355e9b83a662dd7e90a73b7c9cd556372c063ae9
child 331323 f5a97eb5c89a2b5133ff8bba915acba6344fa7cc
child 331329 c5b30ad336bd5004f87738fd0c4f48a60f22bbeb
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)
reviewerspbro
bugs1264101
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264101 - Force dom.animations-api.core.enabled pref to true before animation inspector tests. r=pbro WebAnimations API is not enabled by default in all release channels yet. It is behing the pref dom.animations-api.core.enabled. Turn the preference on before any test of the animationinspector, and clear it after the test. MozReview-Commit-ID: K8UXEthLhnH
devtools/client/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js
devtools/client/animationinspector/test/browser_animation_timeline_takes_rate_into_account.js
devtools/client/animationinspector/test/head.js
--- a/devtools/client/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js
+++ b/devtools/client/animationinspector/test/browser_animation_playerWidgets_appear_on_panel_init.js
@@ -5,22 +5,16 @@
 "use strict";
 
 // Test that player widgets are displayed right when the animation panel is
 // initialized, if the selected node (<body> by default) is animated.
 
 const { ANIMATION_TYPES } = require("devtools/server/actors/animation");
 
 add_task(function* () {
-  yield new Promise(resolve => {
-    SpecialPowers.pushPrefEnv({"set": [
-      ["dom.animations-api.core.enabled", true]
-    ]}, resolve);
-  });
-
   yield addTab(URL_ROOT + "doc_multiple_animation_types.html");
 
   let {panel} = yield openAnimationInspector();
   is(panel.animationsTimelineComponent.animations.length, 3,
     "Three animations are handled by the timeline after init");
   assertAnimationsDisplayed(panel, 3,
     "Three animations are displayed after init");
   is(
--- a/devtools/client/animationinspector/test/browser_animation_timeline_takes_rate_into_account.js
+++ b/devtools/client/animationinspector/test/browser_animation_timeline_takes_rate_into_account.js
@@ -7,22 +7,16 @@
 // Check that if an animation has had its playbackRate changed via the DOM, then
 // the timeline UI shows the right delay and duration.
 // Indeed, the header in the timeline UI always shows the unaltered time,
 // because there might be multiple animations displayed at the same time, some
 // of which may have a different rate than others. Those that have had their
 // rate changed have a delay = delay/rate and a duration = duration/rate.
 
 add_task(function* () {
-  yield new Promise(resolve => {
-    SpecialPowers.pushPrefEnv({"set": [
-      ["dom.animations-api.core.enabled", true]
-    ]}, resolve);
-  });
-
   yield addTab(URL_ROOT + "doc_modify_playbackRate.html");
 
   let {panel} = yield openAnimationInspector();
 
   let timelineEl = panel.animationsTimelineComponent.rootWrapperEl;
 
   let timeBlocks = timelineEl.querySelectorAll(".time-block");
   is(timeBlocks.length, 2, "2 animations are displayed");
--- a/devtools/client/animationinspector/test/head.js
+++ b/devtools/client/animationinspector/test/head.js
@@ -26,24 +26,34 @@ registerCleanupFunction(function* () {
 });
 
 // Clean-up all prefs that might have been changed during a test run
 // (safer here because if the test fails, then the pref is never reverted)
 registerCleanupFunction(() => {
   Services.prefs.clearUserPref("devtools.debugger.log");
 });
 
+// WebAnimations API is not enabled by default in all release channels yet, see
+// Bug 1264101.
+function enableWebAnimationsAPI() {
+  return new Promise(resolve => {
+    SpecialPowers.pushPrefEnv({"set": [
+      ["dom.animations-api.core.enabled", true]
+    ]}, resolve);
+  });
+}
+
 /**
  * Add a new test tab in the browser and load the given url.
  * @param {String} url The url to be loaded in the new tab
  * @return a promise that resolves to the tab object when the url is loaded
  */
 var _addTab = addTab;
 addTab = function(url) {
-  return _addTab(url).then(tab => {
+  return enableWebAnimationsAPI().then(() => _addTab(url)).then(tab => {
     let browser = tab.linkedBrowser;
     info("Loading the helper frame script " + FRAME_SCRIPT_URL);
     browser.messageManager.loadFrameScript(FRAME_SCRIPT_URL, false);
     info("Loading the helper frame script " + COMMON_FRAME_SCRIPT_URL);
     browser.messageManager.loadFrameScript(COMMON_FRAME_SCRIPT_URL, false);
     return tab;
   });
 };