Bug 1884032 [wpt PR 44942] - [css-color] add missing colorscheme-aware tests, a=testonly
[gecko.git] / widget / tests / test_alwaysontop_focus.xhtml
blobb9cc3ee33cef8fc8265f7091a31d53ee238a7fa8
1 <!DOCTYPE HTML>
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta charset="utf-8" />
5 <title>Test that alwaysontop windows do not pull focus when opened.</title>
6 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
8 <script><![CDATA[
9 add_task(async function testAlwaysOnTop() {
10 let topWin = window.docShell.rootTreeItem.domWindow;
11 await SimpleTest.promiseFocus(topWin);
12 is(Services.focus.activeWindow, topWin, "Top level window is focused");
14 let newWin = Services.ww.openWindow(
15 null,
16 "about:blank",
17 null,
18 "chrome,alwaysontop,width=300,height=300",
19 null
21 await new Promise(resolve => {
22 newWin.addEventListener("load", resolve, { once: true });
23 });
25 // Wait one tick of the event loop to give the window a chance to focus.
26 await new Promise(resolve => { SimpleTest.executeSoon(resolve); });
28 is(Services.focus.activeWindow, topWin, "Top level window is still focused");
29 newWin.close();
30 });
31 ]]></script>
32 </head>
33 <body>
34 <p id="display"></p>
35 <div id="content" style="display: none"></div>
36 <pre id="test"></pre>
37 </body>
38 </html>