OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src='../resources/testharness.js'></script> |
| 3 <script src='../resources/testharnessreport.js'></script> |
| 4 <script src='resources/shadow-dom.js'></script> |
| 5 <script src='../fullscreen/trusted-event.js'></script> |
| 6 |
| 7 <div id='host1'> |
| 8 <template data-mode='open'> |
| 9 <slot></slot> |
| 10 </template> |
| 11 <div id='host2'> |
| 12 <template data-mode='open'> |
| 13 <div id='host3'> |
| 14 <template data-mode='open'> |
| 15 <canvas></canvas> |
| 16 <div id='host4'> |
| 17 <template data-mode='open'> |
| 18 <div></div> |
| 19 </template> |
| 20 </div> |
| 21 </template> |
| 22 </div> |
| 23 <div id='host5'> |
| 24 <template data-mode='open'> |
| 25 <div></div> |
| 26 </template> |
| 27 </div> |
| 28 </template> |
| 29 </div> |
| 30 </div> |
| 31 |
| 32 <script> |
| 33 async_test((test) => { |
| 34 document.onfullscreenerror = test.unreached_func('onfullscreenerror is not e
xpected.'); |
| 35 |
| 36 convertTemplatesToShadowRootsWithin(host1); |
| 37 |
| 38 var host3 = host2.shadowRoot.querySelector('#host3'); |
| 39 var host4 = host3.shadowRoot.querySelector('#host4'); |
| 40 var host5 = host2.shadowRoot.querySelector('#host5'); |
| 41 |
| 42 // All fullscreenElement should default to null. |
| 43 assert_equals(document.fullscreenElement, null); |
| 44 assert_equals(document.webkitFullscreenElement, null); |
| 45 assert_equals(document.webkitCurrentFullScreenElement, null); |
| 46 assert_equals(host1.shadowRoot.fullscreenElement, null); |
| 47 assert_equals(host2.shadowRoot.fullscreenElement, null); |
| 48 assert_equals(host3.shadowRoot.fullscreenElement, null); |
| 49 assert_equals(host4.shadowRoot.fullscreenElement, null); |
| 50 assert_equals(host5.shadowRoot.fullscreenElement, null); |
| 51 |
| 52 var canvas = host3.shadowRoot.querySelector('canvas'); |
| 53 trusted_request(canvas); |
| 54 |
| 55 document.onfullscreenchange = test.step_func(() => { |
| 56 // Not interested in handling before or after exitFullscreen. |
| 57 if (document.fullscreenElement === null) |
| 58 return; |
| 59 |
| 60 assert_equals(document.fullscreenElement, host2); |
| 61 assert_equals(document.webkitFullscreenElement, host2); |
| 62 assert_equals(document.webkitCurrentFullScreenElement, host2); |
| 63 |
| 64 assert_equals(host1.shadowRoot.fullscreenElement, null); |
| 65 assert_equals(host2.shadowRoot.fullscreenElement, host3); |
| 66 assert_equals(host3.shadowRoot.fullscreenElement, canvas); |
| 67 assert_equals(host4.shadowRoot.fullscreenElement, null); |
| 68 assert_equals(host5.shadowRoot.fullscreenElement, null); |
| 69 |
| 70 document.exitFullscreen(); |
| 71 test.done(); |
| 72 }); |
| 73 |
| 74 }, 'Test for fullscreenElement adjustment for multiple shadow trees.'); |
| 75 </script> |
OLD | NEW |