OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <title>Document#exitFullscreen() called twice</title> | |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
5 <script src="../trusted-click.js"></script> | |
6 <div id="log"></div> | |
7 <script> | |
8 // Adapted from https://github.com/w3c/web-platform-tests/pull/4250 | |
9 // TODO(foolip): Remove this test when the above is imported and passing. | |
10 async_test(t => { | |
11 const div = document.querySelector("div"); | |
12 | |
13 document.onfullscreenchange = t.step_func(() => { | |
14 // We are now in fullscreen. | |
15 assert_equals(document.fullscreenElement, div); | |
16 | |
17 document.onfullscreenchange = t.step_func(() => { | |
18 assert_equals(document.fullscreenElement, null); | |
19 // Done, but ensure that there's only one fullscreenchange event. | |
20 document.onfullscreenchange = t.unreached_func("second fullscreenchange ev
ent"); | |
21 setTimeout(t.step_func_done(), 0); | |
22 }); | |
23 | |
24 // Exit fullscreen twice. | |
25 document.exitFullscreen(); | |
26 assert_equals(document.fullscreenElement, null, "fullscreenElement after fir
st exitFullscreen()"); | |
27 document.exitFullscreen(); | |
28 assert_equals(document.fullscreenElement, null, "fullscreenElement after sec
ond exitFullscreen()"); | |
29 }); | |
30 document.onfullscreenerror = t.unreached_func("fullscreenerror event"); | |
31 | |
32 trusted_request(div); | |
33 }); | |
34 </script> | |
OLD | NEW |