Index: third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html |
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html b/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4e5ce83c4f9c8f26b5fe8b424b3ebbe75c039362 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow.html |
@@ -0,0 +1,46 @@ |
+<!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='v0'> |
+ <content></content> |
+ </template> |
+ <div id='hostV0'> |
+ <template data-mode='v0'> |
+ <canvas></canvas> |
+ </template> |
+ </div> |
+</div> |
+ |
+<script> |
+async_test((test) => { |
+ document.onpointerlockerror = () => { |
+ assert_true(false, 'onpointerlockerror is not expected.'); |
+ test.done(); |
+ }; |
+ |
+ document.onpointerlockchange = () => { |
+ // Not interested in handling before or after exitPointerLock. |
+ if (document.pointerLockElement === null) |
+ return; |
+ |
+ assert_equals(document.pointerLockElement, canvas, 'if in V0, return the target itself.'); |
+ assert_equals(host.shadowRoot.pointerLockElement, null); |
+ assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
+ |
+ document.exitPointerLock(); |
+ test.done(); |
+ }; |
+ |
+ convertTemplatesToShadowRootsWithin(host); |
+ |
+ assert_equals(document.pointerLockElement, null); |
+ assert_equals(host.shadowRoot.pointerLockElement, null); |
+ assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
+ |
+ var canvas = hostV0.shadowRoot.querySelector('canvas'); |
+ canvas.requestPointerLock(); |
+}, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); |
+</script> |