| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Element#requestFullscreen() on two elements in different iframes</title> | 2 <title>Element#requestFullscreen() on two elements in different iframes</title> |
| 3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="../trusted-click.js"></script> | 5 <script src="../trusted-click.js"></script> |
| 6 <div id="log"></div> | 6 <div id="log"></div> |
| 7 <iframe id="a" allowfullscreen></iframe> | 7 <iframe id="a" allowfullscreen></iframe> |
| 8 <iframe id="b" allowfullscreen></iframe> | 8 <iframe id="b" allowfullscreen></iframe> |
| 9 <script> | 9 <script> |
| 10 // Adapted from https://github.com/w3c/web-platform-tests/pull/4250 | 10 // Adapted from https://github.com/w3c/web-platform-tests/pull/4250 |
| 11 // TODO(foolip): Remove this test when the above is imported and passing. | 11 // TODO(foolip): Remove this test when the above is imported and passing. |
| 12 async_test(t => { | 12 async_test(t => { |
| 13 // Request fullscreen on the body elements of both iframes, but in reverse | 13 // Request fullscreen on the body elements of both iframes, but in reverse |
| 14 // tree order. | 14 // tree order. |
| 15 const a = document.getElementById('a'); | 15 const a = document.getElementById('a'); |
| 16 const b = document.getElementById('b'); | 16 const b = document.getElementById('b'); |
| 17 | 17 |
| 18 // Expect first a fullscreenchange event for the second (!) request, then a | 18 // Expect first a fullscreenchange event for the second (!) request, then a |
| 19 // fullscreenerror event for the first request. TODO(foolip): Remove the | 19 // fullscreenerror event for the first request. TODO(foolip): Remove the |
| 20 // Fullscreen hierarchy restrictions. https://crbug.com/627792 | 20 // Fullscreen hierarchy restrictions. https://crbug.com/627792 |
| 21 a.contentDocument.onfullscreenchange = t.step_func_done(() => { | 21 a.contentDocument.onfullscreenerror = t.step_func(() => { |
| 22 assert_equals(document.fullscreenElement, a, 'fullscreenElement'); | 22 b.contentDocument.onfullscreenchange = t.step_func_done(() => { |
| 23 assert_equals(a.contentDocument.fullscreenElement, a.contentDocument.body, '
fullscreenElement in iframe a'); | 23 assert_equals(document.fullscreenElement, b, 'fullscreenElement'); |
| 24 b.contentDocument.onfullscreenerror = t.step_func(() => { | 24 assert_equals(a.contentDocument.fullscreenElement, null, 'fullscreenElemen
t in iframe a'); |
| 25 assert_equals(b.contentDocument.fullscreenElement, null, 'fullscreenElemen
t in iframe b'); | 25 assert_equals(b.contentDocument.fullscreenElement, b.contentDocument.body,
'fullscreenElement in iframe b'); |
| 26 }); | 26 }); |
| 27 }); | 27 }); |
| 28 a.contentDocument.onfullscreenerror = t.unreached_func('fullscreenerror event
in iframe a'); | 28 a.contentDocument.onfullscreenchange = t.unreached_func('fullscreenchange even
t in iframe a'); |
| 29 b.contentDocument.onfullscreenchange = t.unreached_func('fullscreenchange even
t in iframe b'); | 29 b.contentDocument.onfullscreenerror = t.unreached_func('fullscreenerror event
in iframe b'); |
| 30 | 30 |
| 31 trusted_click(t.step_func(() => { | 31 trusted_click(t.step_func(() => { |
| 32 b.contentDocument.body.requestFullscreen(); | 32 b.contentDocument.body.requestFullscreen(); |
| 33 a.contentDocument.body.requestFullscreen(); | 33 a.contentDocument.body.requestFullscreen(); |
| 34 }), document.body); | 34 }), document.body); |
| 35 }); | 35 }); |
| 36 </script> | 36 </script> |
| OLD | NEW |