browser/devtools/debugger/test/browser_dbg_addon-panels.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 // Ensure that only panels that are relevant to the addon debugger
michael@0 5 // display in the toolbox
michael@0 6
michael@0 7 const ADDON_URL = EXAMPLE_URL + "addon3.xpi";
michael@0 8
michael@0 9 let gAddon, gClient, gThreadClient, gDebugger, gSources;
michael@0 10 let PREFS = [
michael@0 11 "devtools.canvasdebugger.enabled",
michael@0 12 "devtools.shadereditor.enabled",
michael@0 13 "devtools.profiler.enabled",
michael@0 14 "devtools.netmonitor.enabled"
michael@0 15 ];
michael@0 16 function test() {
michael@0 17 Task.spawn(function () {
michael@0 18 let addon = yield addAddon(ADDON_URL);
michael@0 19 let addonDebugger = yield initAddonDebugger(ADDON_URL);
michael@0 20
michael@0 21 // Store and enable all optional dev tools panels
michael@0 22 let originalPrefs = PREFS.map(pref => {
michael@0 23 let original = Services.prefs.getBoolPref(pref);
michael@0 24 Services.prefs.setBoolPref(pref, true)
michael@0 25 return original;
michael@0 26 });
michael@0 27
michael@0 28 let tabs = addonDebugger.frame.contentDocument.getElementById("toolbox-tabs").children;
michael@0 29 let expectedTabs = ["options", "jsdebugger"];
michael@0 30
michael@0 31 is(tabs.length, 2, "displaying only 2 tabs in addon debugger");
michael@0 32 Array.forEach(tabs, (tab, i) => {
michael@0 33 let toolName = expectedTabs[i];
michael@0 34 is(tab.getAttribute("toolid"), toolName, "displaying " + toolName);
michael@0 35 });
michael@0 36
michael@0 37 yield addonDebugger.destroy();
michael@0 38 yield removeAddon(addon);
michael@0 39
michael@0 40 PREFS.forEach((pref, i) => Services.prefs.setBoolPref(pref, originalPrefs[i]));
michael@0 41
michael@0 42 finish();
michael@0 43 });
michael@0 44 }

mercurial