Bug 1882451 [wpt PR 44825] - Re-do close watcher user activation tests, a=testonly
[gecko.git] / testing / web-platform / tests / close-watcher / user-activation / nyn.html
blobec5153c7674a1efd37e27eacbc15420ced861f13
1 <!doctype html>
2 <meta name=variant content="?dialog">
3 <meta name=variant content="?CloseWatcher">
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="/resources/testdriver.js"></script>
7 <script src="/resources/testdriver-vendor.js"></script>
8 <script src="/resources/testdriver-actions.js"></script>
9 <script src="../resources/helpers.js"></script>
11 <body>
12 <script>
13 const type = location.search.substring(1);
15 promise_test(async t => {
16 const events = [];
18 const watcher1 = createRecordingCloseWatcher(t, events, "watcher1");
19 await createBlessedRecordingCloseWatcher(t, events, "watcher2", type, watcher1);
20 createRecordingCloseWatcher(t, events, "watcher3");
22 await sendCloseRequest();
23 await waitForPotentialCloseEvent();
24 assert_array_equals(events, ["watcher3 close", "watcher2 close"]);
26 await sendCloseRequest();
27 await waitForPotentialCloseEvent();
28 assert_array_equals(events, ["watcher3 close", "watcher2 close", "watcher1 close"]);
29 }, "Create a close watcher without user activation; create a close watcher with user activation; create a close watcher without user activation");
30 </script>