tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_proton_moreTools_panel.js (1575B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 ChromeUtils.defineLazyGetter(this, "DevToolsStartup", () => {
      7  return Cc["@mozilla.org/devtools/startup-clh;1"].getService(
      8    Ci.nsICommandLineHandler
      9  ).wrappedJSObject;
     10 });
     11 
     12 // Test activating the developer button shows the More Tools panel.
     13 add_task(async function testDevToolsPanelInToolbar() {
     14  // We need to force DevToolsStartup to rebuild the developer tool toggle so that
     15  // proton prefs are applied to the new browser window for this test.
     16  DevToolsStartup.developerToggleCreated = false;
     17  CustomizableUI.destroyWidget("developer-button");
     18 
     19  const win = await BrowserTestUtils.openNewBrowserWindow();
     20 
     21  CustomizableUI.addWidgetToArea(
     22    "developer-button",
     23    CustomizableUI.AREA_NAVBAR
     24  );
     25 
     26  // Test the developer tools panel is showing.
     27  let button = document.getElementById("developer-button");
     28  let devToolsView = PanelMultiView.getViewNode(
     29    document,
     30    "PanelUI-developer-tools"
     31  );
     32  let devToolsShownPromise = BrowserTestUtils.waitForEvent(
     33    devToolsView,
     34    "ViewShown"
     35  );
     36 
     37  EventUtils.synthesizeMouseAtCenter(button, {});
     38  await devToolsShownPromise;
     39  ok(true, "Dev Tools view is showing");
     40  is(
     41    devToolsView.children.length,
     42    1,
     43    "Dev tools subview is the only child of panel"
     44  );
     45  is(
     46    devToolsView.children[0].id,
     47    "PanelUI-developer-tools-view",
     48    "Dev tools child has correct id"
     49  );
     50 
     51  // Cleanup
     52  await BrowserTestUtils.closeWindow(win);
     53  CustomizableUI.reset();
     54 });