tor-browser

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

browser_aboutdebugging_runtime_remote_runtime_buttons.js (1660B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const USB_RUNTIME_ID = "1337id";
      7 const USB_DEVICE_NAME = "Fancy Phone";
      8 const USB_APP_NAME = "Lorem ipsum";
      9 
     10 /**
     11 * Test that remote runtimes show action buttons that are hidden for 'This Firefox'.
     12 */
     13 add_task(async function () {
     14  // enable USB devices mocks
     15  const mocks = new Mocks();
     16  mocks.createUSBRuntime(USB_RUNTIME_ID, {
     17    deviceName: USB_DEVICE_NAME,
     18    name: USB_APP_NAME,
     19  });
     20 
     21  const { document, tab, window } = await openAboutDebugging();
     22  await selectThisFirefoxPage(document, window.AboutDebugging.store);
     23 
     24  info("Checking This Firefox");
     25  ok(
     26    !document.querySelector(".qa-connection-prompt-toggle-button"),
     27    "This Firefox does not contain the connection prompt button"
     28  );
     29  ok(
     30    !document.querySelector(".qa-profile-runtime-button"),
     31    "This Firefox does not contain the profile runtime button"
     32  );
     33  ok(
     34    !document.querySelector(".qa-runtime-info__action"),
     35    "This Firefox does not contain the disconnect button"
     36  );
     37 
     38  info("Checking a USB runtime");
     39  mocks.emitUSBUpdate();
     40  await connectToRuntime(USB_DEVICE_NAME, document);
     41  await waitForRuntimePage(USB_APP_NAME, document);
     42  ok(
     43    !!document.querySelector(".qa-connection-prompt-toggle-button"),
     44    "Runtime contains the connection prompt button"
     45  );
     46  ok(
     47    !!document.querySelector(".qa-profile-runtime-button"),
     48    "Remote runtime contains the profile runtime button"
     49  );
     50  ok(
     51    !!document.querySelector(".qa-runtime-info__action"),
     52    "Runtime contains the disconnect button"
     53  );
     54 
     55  await removeTab(tab);
     56 });