Bug 1083045 - Scratchpad tests shouldn't depend on chrome debugging being disabled by default. r=past
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 15 Oct 2014 09:18:40 +0300
changeset 210425 d4b2df21883db9b0a26df19e25cc71a2e8f026e8
parent 210424 f7c9184589007ffb3011b58b7ace23b6c21e4c26
child 210426 34705a056e396ad84dc9dbdb74e9049354faec1a
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerspast
bugs1083045
milestone36.0a1
Bug 1083045 - Scratchpad tests shouldn't depend on chrome debugging being disabled by default. r=past
browser/devtools/scratchpad/test/browser_scratchpad_edit_ui_updates.js
browser/devtools/scratchpad/test/browser_scratchpad_initialization.js
browser/devtools/scratchpad/test/browser_scratchpad_modeline.js
--- a/browser/devtools/scratchpad/test/browser_scratchpad_edit_ui_updates.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_edit_ui_updates.js
@@ -1,21 +1,23 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 /* Bug 699130 */
 
 "use strict";
 
 let WebConsoleUtils = require("devtools/toolkit/webconsole/utils").Utils;
+let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
 
 function test()
 {
   waitForExplicitFinish();
   gBrowser.selectedTab = gBrowser.addTab();
+  Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, false);
   gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
     gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
     openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,test Edit menu updates Scratchpad - bug 699130";
 }
 
@@ -170,16 +172,17 @@ function runTests()
     closeMenu(hideAfterPaste);
   };
 
   let hideAfterPaste = function() {
     if (pass == 0) {
       pass++;
       testContextMenu();
     } else {
+      Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
       finish();
     }
   };
 
   let testContextMenu = function() {
     info("will test the context menu");
 
     editMenu = null;
--- a/browser/devtools/scratchpad/test/browser_scratchpad_initialization.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_initialization.js
@@ -1,16 +1,19 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
+
 function test()
 {
   waitForExplicitFinish();
 
+  Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, false);
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
     gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
 
     ok(window.Scratchpad, "Scratchpad variable exists");
 
     openScratchpad(runTests);
   }, true);
@@ -39,10 +42,11 @@ function runTests()
      "Error console command is disabled");
 
   let chromeContextCommand = gScratchpadWindow.document.
                             getElementById("sp-cmd-browserContext");
   ok(chromeContextCommand, "Chrome context command element exists");
   is(chromeContextCommand.getAttribute("disabled"), "true",
      "Chrome context command is disabled");
 
+  Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
   finish();
 }
--- a/browser/devtools/scratchpad/test/browser_scratchpad_modeline.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_modeline.js
@@ -15,16 +15,17 @@ let gFile; // Reference to the temporary
 let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
 
 // The temporary file content.
 let gFileContent = "function main() { return 0; }";
 
 function test() {
   waitForExplicitFinish();
 
+  Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, false);
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
     gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
     openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,<p>test file open and save in Scratchpad";
 }