tor-browser

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

browser_aboutdebugging_select_network_runtime.js (1704B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const NETWORK_RUNTIME_HOST = "localhost:6080";
      7 const NETWORK_RUNTIME_APP_NAME = "TestNetworkApp";
      8 const NETWORK_RUNTIME_CHANNEL = "SomeChannel";
      9 const NETWORK_RUNTIME_VERSION = "12.3";
     10 
     11 // Test that network runtimes can be selected.
     12 add_task(async function () {
     13  const mocks = new Mocks();
     14 
     15  const { document, tab, window } = await openAboutDebugging();
     16  await selectThisFirefoxPage(document, window.AboutDebugging.store);
     17 
     18  info("Prepare Network client mock");
     19  const networkClient = mocks.createNetworkRuntime(NETWORK_RUNTIME_HOST, {
     20    name: NETWORK_RUNTIME_APP_NAME,
     21  });
     22  networkClient.getDeviceDescription = () => {
     23    return {
     24      name: NETWORK_RUNTIME_APP_NAME,
     25      channel: NETWORK_RUNTIME_CHANNEL,
     26      version: NETWORK_RUNTIME_VERSION,
     27    };
     28  };
     29 
     30  info("Test addons in runtime page for Network client");
     31  await connectToRuntime(NETWORK_RUNTIME_HOST, document);
     32  await waitForRuntimePage(NETWORK_RUNTIME_APP_NAME, document);
     33 
     34  info("Check that the network runtime mock is properly displayed");
     35  const thisFirefoxRuntimeInfo = document.querySelector(".qa-runtime-name");
     36  ok(
     37    thisFirefoxRuntimeInfo,
     38    "Runtime info for this-firefox runtime is displayed"
     39  );
     40  const runtimeInfoText = thisFirefoxRuntimeInfo.textContent;
     41 
     42  ok(
     43    runtimeInfoText.includes(NETWORK_RUNTIME_APP_NAME),
     44    "network runtime info shows the correct runtime name: " + runtimeInfoText
     45  );
     46  ok(
     47    runtimeInfoText.includes(NETWORK_RUNTIME_VERSION),
     48    "network runtime info shows the correct version number: " + runtimeInfoText
     49  );
     50 
     51  await removeTab(tab);
     52 });