tor-browser

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

browser_tab_not_selected.js (1487B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Verify RDM opens for the correct tab, even if it is not the currently
      7 // selected tab.
      8 
      9 const TEST_URL = "http://example.com/";
     10 
     11 addRDMTask(
     12  null,
     13  async function () {
     14    info("Open two tabs");
     15    const tab1 = await addTab(TEST_URL);
     16    const tab2 = await addTab(TEST_URL);
     17 
     18    is(gBrowser.selectedTab, tab2, "The selected tab is tab2");
     19 
     20    info("Open RDM for the non-selected tab");
     21    const { ui } = await openRDM(tab1);
     22 
     23    ok(!ResponsiveUIManager.isActiveForTab(tab2), "RDM is not opened on tab2");
     24 
     25    // Not mandatory for the test to pass, but it is helpful to see the RDM tab
     26    // for Try failure screenshots.
     27    info("Select the first tab");
     28    gBrowser.selectedTab = tab1;
     29 
     30    info("Try to update the DPI");
     31 
     32    // The click on the device pixel ratio select is intermittently flagged as
     33    // not accessible. See Bug 1849028 for a11y issues in DevTools tests.
     34    AccessibilityUtils.setEnv({
     35      focusableRule: false,
     36    });
     37 
     38    await selectDevicePixelRatio(ui, 2);
     39    const dppx = await waitForDevicePixelRatio(ui, 2, {
     40      waitForTargetConfiguration: true,
     41    });
     42    is(dppx, 2, "Content has expected devicePixelRatio");
     43 
     44    AccessibilityUtils.resetEnv();
     45 
     46    const clientClosed = waitForClientClose(ui);
     47    await removeTab(tab2);
     48    await removeTab(tab1);
     49    await clientClosed;
     50  },
     51  { onlyPrefAndTask: true }
     52 );