summaryrefslogtreecommitdiffstats
path: root/devtools/client/responsive/test/browser/browser_tab_not_selected.js
blob: ac36f788f746e5faa238e8fb109bfc6c3af4a1ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Verify RDM opens for the correct tab, even if it is not the currently
// selected tab.

const TEST_URL = "http://example.com/";

addRDMTask(
  null,
  async function () {
    info("Open two tabs");
    const tab1 = await addTab(TEST_URL);
    const tab2 = await addTab(TEST_URL);

    is(gBrowser.selectedTab, tab2, "The selected tab is tab2");

    info("Open RDM for the non-selected tab");
    const { ui } = await openRDM(tab1);

    ok(!ResponsiveUIManager.isActiveForTab(tab2), "RDM is not opened on tab2");

    // Not mandatory for the test to pass, but it is helpful to see the RDM tab
    // for Try failure screenshots.
    info("Select the first tab");
    gBrowser.selectedTab = tab1;

    info("Try to update the DPI");
    await selectDevicePixelRatio(ui, 2);
    const dppx = await waitForDevicePixelRatio(ui, 2, {
      waitForTargetConfiguration: true,
    });
    is(dppx, 2, "Content has expected devicePixelRatio");

    const clientClosed = waitForClientClose(ui);
    await removeTab(tab2);
    await removeTab(tab1);
    await clientClosed;
  },
  { onlyPrefAndTask: true }
);