n-closerequest-n.html (1187B)
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="/common/top-layer.js"></script> 10 <script src="../resources/helpers.js"></script> 11 12 <body> 13 <script> 14 const type = location.search.substring(1); 15 promise_test(async t => { 16 const events = []; 17 18 createRecordingCloseWatcher(t, events, "watcher1", type); 19 20 await sendCloseRequest(); 21 await waitForPotentialCloseEvent(); 22 assert_array_equals(events, ["watcher1 cancel[cancelable=false]", "watcher1 close"]); 23 24 createRecordingCloseWatcher(t, events, "watcher2", type); 25 26 await sendCloseRequest(); 27 await waitForPotentialCloseEvent(); 28 assert_array_equals(events, ["watcher1 cancel[cancelable=false]", "watcher1 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]); 29 }, "Create a close watcher without user activation; send a close request; create a close watcher without user activation"); 30 </script>