OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src='../../resources/testharness.js'></script> | 2 <script src='../../resources/testharness.js'></script> |
3 <script src='../../resources/testharnessreport.js'></script> | 3 <script src='../../resources/testharnessreport.js'></script> |
4 <script src='../resources/shadow-dom.js'></script> | 4 <script src='../resources/shadow-dom.js'></script> |
5 | 5 |
6 <div id='host'> | 6 <div id='host'> |
7 <template data-mode='v0'> | 7 <template data-mode='v0'> |
8 <content></content> | 8 <content></content> |
9 </template> | 9 </template> |
10 <div id='hostV0'> | 10 <div id='hostV0'> |
11 <template data-mode='v0'> | 11 <template data-mode='v0'> |
12 <div id='hostV1inV0'> | 12 <div id='hostV1inV0'> |
13 <template data-mode='open'> | 13 <template data-mode='open'> |
14 <canvas></canvas> | 14 <canvas></canvas> |
15 </template> | 15 </template> |
16 </div> | 16 </div> |
17 </template> | 17 </template> |
18 </div> | 18 </div> |
19 </div> | 19 </div> |
20 | 20 |
21 <script> | 21 <script> |
22 async_test((test) => { | 22 async_test((test) => { |
23 document.onpointerlockerror = () => { | 23 document.onpointerlockerror = test.unreached_func('onpointerlockerror is not
expected.'); |
24 assert_true(false, 'onpointerlockerror is not expected.'); | |
25 test.done(); | |
26 }; | |
27 | 24 |
28 document.onpointerlockchange = () => { | 25 document.onpointerlockchange = test.step_func(() => { |
29 // Not interested in handling before or after exitPointerLock. | 26 // Not interested in handling before or after exitPointerLock. |
30 if (document.pointerLockElement === null) | 27 if (document.pointerLockElement === null) |
31 return; | 28 return; |
32 | 29 |
33 assert_equals(document.pointerLockElement, hostV1inV0, 'if it is in V1,
return shadow host.'); | 30 assert_equals(document.pointerLockElement, hostV1inV0, 'if it is in V1,
return shadow host.'); |
34 assert_equals(host.shadowRoot.pointerLockElement, null); | 31 assert_equals(host.shadowRoot.pointerLockElement, null); |
35 assert_equals(hostV0.shadowRoot.pointerLockElement, null); | 32 assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
36 assert_equals(hostV1inV0.shadowRoot.pointerLockElement, canvas); | 33 assert_equals(hostV1inV0.shadowRoot.pointerLockElement, canvas); |
37 | 34 |
38 document.exitPointerLock(); | 35 document.exitPointerLock(); |
39 test.done(); | 36 test.done(); |
40 }; | 37 }); |
41 | 38 |
42 convertTemplatesToShadowRootsWithin(host); | 39 convertTemplatesToShadowRootsWithin(host); |
43 var hostV1inV0 = hostV0.shadowRoot.querySelector('#hostV1inV0'); | 40 var hostV1inV0 = hostV0.shadowRoot.querySelector('#hostV1inV0'); |
44 | 41 |
45 assert_equals(document.pointerLockElement, null); | 42 test.step(() => { |
46 assert_equals(host.shadowRoot.pointerLockElement, null); | 43 assert_equals(document.pointerLockElement, null); |
47 assert_equals(hostV0.shadowRoot.pointerLockElement, null); | 44 assert_equals(host.shadowRoot.pointerLockElement, null); |
48 assert_equals(hostV1inV0.shadowRoot.pointerLockElement, null); | 45 assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
| 46 assert_equals(hostV1inV0.shadowRoot.pointerLockElement, null); |
| 47 }); |
49 | 48 |
50 var canvas = hostV1inV0.shadowRoot.querySelector('canvas'); | 49 var canvas = hostV1inV0.shadowRoot.querySelector('canvas'); |
51 canvas.requestPointerLock(); | 50 canvas.requestPointerLock(); |
52 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); | 51 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); |
53 </script> | 52 </script> |
OLD | NEW |