tor-browser

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

browser_net_throttling_menu.js (1227B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Network throttling menu smoke test.
      7 
      8 add_task(async function () {
      9  await pushPref("devtools.cache.disabled", true);
     10 
     11  const { monitor, toolbox } = await initNetMonitor(HTTPS_CUSTOM_GET_URL, {
     12    requestCount: 1,
     13  });
     14  const { document } = monitor.panelWin;
     15 
     16  info("Opening the throttling menu");
     17  const popup = toolbox.doc.querySelector("#network-throttling-menu");
     18  document.getElementById("network-throttling").click();
     19 
     20  info("Waiting for the throttling menu to be displayed");
     21  await BrowserTestUtils.waitForPopupEvent(toolbox.doc, "shown");
     22 
     23  const menuItems = [...popup.querySelectorAll(".menuitem .command")];
     24  for (const menuItem of menuItems) {
     25    info(`Check the title for the menu item ${menuItem.id}.`);
     26    isnot(
     27      menuItem.getAttribute("title"),
     28      "",
     29      "The title is not an empty string"
     30    );
     31    info(`Select the throttling profile with id: ${menuItem.id}.`);
     32    menuItem.click();
     33 
     34    info(`Waiting for the '${menuItem.id}' profile to be applied`);
     35    await monitor.panelWin.api.once(TEST_EVENTS.THROTTLING_CHANGED);
     36  }
     37 
     38  await teardown(monitor);
     39 });