tor-browser

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

browser_aboutdebugging_sidebar_usb_runtime.js (1094B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const RUNTIME_ID = "RUNTIME_ID";
      7 const RUNTIME_DEVICE_NAME = "RUNTIME_DEVICE_NAME";
      8 const RUNTIME_SHORT_NAME = "testshort";
      9 
     10 // Test that USB runtimes appear and disappear from the sidebar.
     11 add_task(async function () {
     12  const mocks = new Mocks();
     13 
     14  const { document, tab } = await openAboutDebugging();
     15 
     16  mocks.createUSBRuntime(RUNTIME_ID, {
     17    deviceName: RUNTIME_DEVICE_NAME,
     18    shortName: RUNTIME_SHORT_NAME,
     19  });
     20  mocks.emitUSBUpdate();
     21 
     22  info("Wait until the USB sidebar item appears");
     23  await waitUntil(() => findSidebarItemByText(RUNTIME_DEVICE_NAME, document));
     24  const usbRuntimeSidebarItem = findSidebarItemByText(
     25    RUNTIME_DEVICE_NAME,
     26    document
     27  );
     28  ok(
     29    usbRuntimeSidebarItem.textContent.includes(RUNTIME_SHORT_NAME),
     30    "The short name of the usb runtime is visible"
     31  );
     32 
     33  mocks.removeUSBRuntime(RUNTIME_ID);
     34  mocks.emitUSBUpdate();
     35  await waitUntilUsbDeviceIsUnplugged(RUNTIME_DEVICE_NAME, document);
     36 
     37  await removeTab(tab);
     38 });