Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html

Issue 2114783003: Fix the testharness async test API usage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698