summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/browser_minimize.js
blob: 694808f516863e145e8e36c46e4fa77a3c46743a (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

add_task(async function() {
  registerCleanupFunction(function() {
    window.restore();
  });
  function waitForActive() {
    return gBrowser.selectedTab.linkedBrowser.docShellIsActive;
  }
  function waitForInactive() {
    return !gBrowser.selectedTab.linkedBrowser.docShellIsActive;
  }
  await TestUtils.waitForCondition(waitForActive);
  is(
    gBrowser.selectedTab.linkedBrowser.docShellIsActive,
    true,
    "Docshell should be active"
  );
  window.minimize();
  await TestUtils.waitForCondition(waitForInactive);
  is(
    gBrowser.selectedTab.linkedBrowser.docShellIsActive,
    false,
    "Docshell should be Inactive"
  );
  window.restore();
  await TestUtils.waitForCondition(waitForActive);
  is(
    gBrowser.selectedTab.linkedBrowser.docShellIsActive,
    true,
    "Docshell should be active again"
  );
});