| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Document#exitFullscreen() vs. Element#requestFullscreen()</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="../trusted-event.js"></script> |
| 6 <div id="log"></div> |
| 7 <div id="target"></div> |
| 8 <script> |
| 9 // Adapted from https://github.com/w3c/web-platform-tests/pull/4250 |
| 10 // TODO(foolip): Remove this test when the above is imported and passing. |
| 11 async_test(t => { |
| 12 const target = document.getElementById("target"); |
| 13 trusted_request(target); |
| 14 |
| 15 document.onfullscreenchange = t.step_func(() => { |
| 16 document.onfullscreenchange = t.unreached_func("fullscreenchange event"); |
| 17 // We are now in fullscreen, so exiting requires a resize but requesting |
| 18 // does not. |
| 19 trusted_event(t.step_func(() => { |
| 20 // Request fullscreen on the current fullscreen element, to ensure there |
| 21 // is no short circuiting and that both requests fail. Note that the order |
| 22 // of the two fullscreenerror events relative to the fullscreenchange |
| 23 // event isn't tested, as it depends on whether the resize happens before |
| 24 // the next animation frame or not. |
| 25 |
| 26 let fullscreenchanges = 0; |
| 27 document.onfullscreenchange = t.step_func((event) => { |
| 28 fullscreenchanges++; |
| 29 if (fullscreenchanges == 3) { |
| 30 assert_equals(document.fullscreenElement, null); |
| 31 t.done(); |
| 32 } |
| 33 }); |
| 34 document.onfullscreenerror = t.unreached_func("fullscreenerror event"); |
| 35 |
| 36 assert_equals(document.fullscreenElement, target); |
| 37 target.requestFullscreen(); |
| 38 document.exitFullscreen(); |
| 39 target.requestFullscreen(); |
| 40 }), target); |
| 41 }); |
| 42 }); |
| 43 </script> |
| OLD | NEW |