Index: third_party/WebKit/LayoutTests/shadow-dom/fullscreen-element-in-shadow.html |
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/fullscreen-element-in-shadow.html b/third_party/WebKit/LayoutTests/shadow-dom/fullscreen-element-in-shadow.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e9595ad7cb30e7bf2db254e7bcd3ded468c01407 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/shadow-dom/fullscreen-element-in-shadow.html |
@@ -0,0 +1,91 @@ |
+<!DOCTYPE html> |
+<script src='../resources/testharness.js'></script> |
+<script src='../resources/testharnessreport.js'></script> |
+<script src='resources/shadow-dom.js'></script> |
+ |
+<div id='host'> |
+ <template data-mode='open'> |
+ <slot></slot> |
+ </template> |
+ <div id='host2'> |
+ <template data-mode='open'> |
+ <div id='host3'> |
+ <template data-mode='open'> |
+ <canvas></canvas> |
foolip
2016/09/20 13:44:21
Can you turn this into the minimal tree needed for
kochi
2016/10/07 14:26:42
This tests cases where some trees are involved and
|
+ <div id='host4'> |
+ <template data-mode='open'> |
+ <div></div> |
+ </template> |
+ </div> |
+ </template> |
+ </div> |
+ <div id='host5'> |
+ <template data-mode='open'> |
+ <div></div> |
+ </template> |
+ </div> |
+ </template> |
+ </div> |
+</div> |
+ |
+<script> |
+async_test((test) => { |
+ document.onfullscreenerror = test.unreached_func('onfullscreenerror is not expected.'); |
+ |
+ document.onfullscreenchange = test.step_func_done(() => { |
+ // Not interested in handling before or after exitFullscreen. |
+ if (document.fullscreenElement === null) |
+ return; |
+ |
+ assert_equals(document.fullscreenElement, host2); |
+ assert_equals(document.webkitFullscreenElement, host2); |
+ assert_equals(document.webkitCurrentFullScreenElement, host2); |
+ |
+ assert_equals(host.shadowRoot.fullscreenElement, null); |
+ assert_equals(host.shadowRoot.webkitFullscreenElement, null); |
+ assert_equals(host.shadowRoot.webkitCurrentFullScreenElement, null); |
+ |
+ assert_equals(host2.shadowRoot.fullscreenElement, host3); |
+ assert_equals(host2.shadowRoot.webkitFullscreenElement, host3); |
+ assert_equals(host2.shadowRoot.webkitCurrentFullScreenElement, host3); |
+ |
+ assert_equals(host3.shadowRoot.fullscreenElement, canvas); |
+ assert_equals(host3.shadowRoot.webkitFullscreenElement, canvas); |
+ assert_equals(host3.shadowRoot.webkitCurrentFullScreenElement, canvas); |
+ |
+ assert_equals(host4.shadowRoot.fullscreenElement, null); |
+ assert_equals(host4.shadowRoot.webkitFullscreenElement, null); |
+ assert_equals(host4.shadowRoot.webkitCurrentFullScreenElement, null); |
+ |
+ assert_equals(host5.shadowRoot.fullscreenElement, null); |
+ assert_equals(host5.shadowRoot.webkitFullscreenElement, null); |
+ assert_equals(host5.shadowRoot.webkitCurrentFullScreenElement, null); |
+ |
+ document.exitFullscreen(); |
+ }); |
+ |
+ convertTemplatesToShadowRootsWithin(host); |
+ var host3 = host2.shadowRoot.querySelector('#host3'); |
+ var host4 = host3.shadowRoot.querySelector('#host4'); |
+ var host5 = host2.shadowRoot.querySelector('#host5'); |
+ |
+ // All fullscreenElement should default to null. |
+ assert_equals(document.fullscreenElement, null); |
+ assert_equals(host.shadowRoot.fullscreenElement, null); |
+ assert_equals(host2.shadowRoot.fullscreenElement, null); |
+ assert_equals(host3.shadowRoot.fullscreenElement, null); |
+ assert_equals(host4.shadowRoot.fullscreenElement, null); |
+ assert_equals(host5.shadowRoot.fullscreenElement, null); |
+ |
+ var canvas = host3.shadowRoot.querySelector('canvas'); |
+ if (window.testRunner) { |
+ setTimeout(() => { |
+ document.onclick = () => { |
+ canvas.requestFullscreen(); |
foolip
2016/09/20 13:44:21
Tests for nested fullscreen cases and when the :-w
kochi
2016/10/07 14:26:42
Changed to use the function in fullscreen/trusted-
|
+ }; |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ }, 0); |
+ } |
+}, 'Test for fullscreenElement adjustment for Shadow DOM.'); |
+</script> |