| Index: third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html
|
| diff --git a/third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html b/third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..da2b77b181c683fc71308f1e85596b8cab153f8b
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/shadow-dom/pointer-lock-in-shadow.html
|
| @@ -0,0 +1,70 @@
|
| +<!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>
|
| + <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.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, host2, 'document.pointerLockElement should be shadow host2.');
|
| + assert_equals(host.shadowRoot.pointerLockElement, null, 'host\'s shadowRoot.pointerLockElement should be null.');
|
| + assert_equals(host2.shadowRoot.pointerLockElement, host3, 'host2\'s shadowRoot.pointerLockElement should be host3.');
|
| + assert_equals(host3.shadowRoot.pointerLockElement, canvas, 'host3\'s shadowRoot.pointerLockElement should be canvas element.');
|
| + assert_equals(host4.shadowRoot.pointerLockElement, null, 'host4\'s shadowRoot.pointerLockElement should be null.');
|
| + assert_equals(host5.shadowRoot.pointerLockElement, null, 'host5\'s shadowRoot.pointerLockElement should be null.');
|
| +
|
| + document.exitPointerLock();
|
| + test.done();
|
| + };
|
| +
|
| + convertTemplatesToShadowRootsWithin(host);
|
| + var host3 = host2.shadowRoot.querySelector('#host3');
|
| + var host4 = host3.shadowRoot.querySelector('#host4');
|
| + var host5 = host2.shadowRoot.querySelector('#host5');
|
| +
|
| + // All pointerLockElement should default to null.
|
| + assert_equals(document.pointerLockElement, null);
|
| + assert_equals(host.shadowRoot.pointerLockElement, null);
|
| + assert_equals(host2.shadowRoot.pointerLockElement, null);
|
| + assert_equals(host3.shadowRoot.pointerLockElement, null);
|
| + assert_equals(host4.shadowRoot.pointerLockElement, null);
|
| + assert_equals(host5.shadowRoot.pointerLockElement, null);
|
| +
|
| + var canvas = host3.shadowRoot.querySelector('canvas');
|
| + canvas.requestPointerLock();
|
| +}, 'Test for pointerLockElement adjustment for Shadow DOM.');
|
| +</script>
|
|
|