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 <canvas></canvas> | 12 <canvas></canvas> |
13 </template> | 13 </template> |
14 </div> | 14 </div> |
15 </div> | 15 </div> |
16 | 16 |
17 <script> | 17 <script> |
18 async_test((test) => { | 18 async_test((test) => { |
19 document.onpointerlockerror = () => { | 19 document.onpointerlockerror = test.unreached_func('onpointerlockerror is not
expected.'); |
20 assert_true(false, 'onpointerlockerror is not expected.'); | |
21 test.done(); | |
22 }; | |
23 | 20 |
24 document.onpointerlockchange = () => { | 21 document.onpointerlockchange = test.step_func(() => { |
25 // Not interested in handling before or after exitPointerLock. | 22 // Not interested in handling before or after exitPointerLock. |
26 if (document.pointerLockElement === null) | 23 if (document.pointerLockElement === null) |
27 return; | 24 return; |
28 | 25 |
29 assert_equals(document.pointerLockElement, canvas, 'if in V0, return the
target itself.'); | 26 assert_equals(document.pointerLockElement, canvas, 'if in V0, return the
target itself.'); |
30 assert_equals(host.shadowRoot.pointerLockElement, null); | 27 assert_equals(host.shadowRoot.pointerLockElement, null); |
31 assert_equals(hostV0.shadowRoot.pointerLockElement, null); | 28 assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
32 | 29 |
33 document.exitPointerLock(); | 30 document.exitPointerLock(); |
34 test.done(); | 31 test.done(); |
35 }; | 32 }); |
36 | 33 |
37 convertTemplatesToShadowRootsWithin(host); | 34 convertTemplatesToShadowRootsWithin(host); |
38 | 35 |
39 assert_equals(document.pointerLockElement, null); | 36 test.step(() => { |
40 assert_equals(host.shadowRoot.pointerLockElement, null); | 37 assert_equals(document.pointerLockElement, null); |
41 assert_equals(hostV0.shadowRoot.pointerLockElement, null); | 38 assert_equals(host.shadowRoot.pointerLockElement, null); |
| 39 assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
| 40 }); |
42 | 41 |
43 var canvas = hostV0.shadowRoot.querySelector('canvas'); | 42 var canvas = hostV0.shadowRoot.querySelector('canvas'); |
44 canvas.requestPointerLock(); | 43 canvas.requestPointerLock(); |
45 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); | 44 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); |
46 </script> | 45 </script> |
OLD | NEW |