1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/scratchpad/test/browser_scratchpad_chrome_context_pref.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +/* vim: set ts=2 et sw=2 tw=80: */ 1.5 +/* Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.7 +/* Bug 646070 */ 1.8 + 1.9 +let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled"; 1.10 + 1.11 +function test() 1.12 +{ 1.13 + waitForExplicitFinish(); 1.14 + 1.15 + Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true); 1.16 + 1.17 + gBrowser.selectedTab = gBrowser.addTab(); 1.18 + gBrowser.selectedBrowser.addEventListener("load", function onLoad() { 1.19 + gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); 1.20 + 1.21 + ok(window.Scratchpad, "Scratchpad variable exists"); 1.22 + 1.23 + openScratchpad(runTests); 1.24 + }, true); 1.25 + 1.26 + content.location = "data:text/html,Scratchpad test for bug 646070 - chrome context preference"; 1.27 +} 1.28 + 1.29 +function runTests() 1.30 +{ 1.31 + let sp = gScratchpadWindow.Scratchpad; 1.32 + ok(sp, "Scratchpad object exists in new window"); 1.33 + 1.34 + let environmentMenu = gScratchpadWindow.document. 1.35 + getElementById("sp-environment-menu"); 1.36 + ok(environmentMenu, "Environment menu element exists"); 1.37 + ok(!environmentMenu.hasAttribute("hidden"), 1.38 + "Environment menu is visible"); 1.39 + 1.40 + let errorConsoleCommand = gScratchpadWindow.document. 1.41 + getElementById("sp-cmd-errorConsole"); 1.42 + ok(errorConsoleCommand, "Error console command element exists"); 1.43 + ok(!errorConsoleCommand.hasAttribute("disabled"), 1.44 + "Error console command is enabled"); 1.45 + 1.46 + let chromeContextCommand = gScratchpadWindow.document. 1.47 + getElementById("sp-cmd-browserContext"); 1.48 + ok(chromeContextCommand, "Chrome context command element exists"); 1.49 + ok(!chromeContextCommand.hasAttribute("disabled"), 1.50 + "Chrome context command is disabled"); 1.51 + 1.52 + Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED); 1.53 + 1.54 + finish(); 1.55 +}