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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow3.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
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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='hostV1'> 10 <div id='hostV1'>
11 <template data-mode='open'> 11 <template data-mode='open'>
12 <div id='hostV1inV1'> 12 <div id='hostV1inV1'>
13 <template data-mode='open'> 13 <template data-mode='open'>
14 <div id='hostV0inV1inV1'> 14 <div id='hostV0inV1inV1'>
15 <template data-mode='v0'> 15 <template data-mode='v0'>
16 <canvas></canvas> 16 <canvas></canvas>
17 </template> 17 </template>
18 </div> 18 </div>
19 </template> 19 </template>
20 </div> 20 </div>
21 </template> 21 </template>
22 </div> 22 </div>
23 </div> 23 </div>
24 24
25 <script> 25 <script>
26 async_test((test) => { 26 async_test((test) => {
27 document.onpointerlockerror = () => { 27 document.onpointerlockerror = test.unreached_func('onpointerlockerror is not expected.');
28 assert_true(false, 'onpointerlockerror is not expected.');
29 test.done();
30 };
31 28
32 document.onpointerlockchange = () => { 29 document.onpointerlockchange = test.step_func(() => {
33 // Not interested in handling before or after exitPointerLock. 30 // Not interested in handling before or after exitPointerLock.
34 if (document.pointerLockElement === null) 31 if (document.pointerLockElement === null)
35 return; 32 return;
36 33
37 assert_equals(document.pointerLockElement, canvas, 'if it is in V0 shado w, return as it is.'); 34 assert_equals(document.pointerLockElement, canvas, 'if it is in V0 shado w, return as it is.');
38 assert_equals(host.shadowRoot.pointerLockElement, null); 35 assert_equals(host.shadowRoot.pointerLockElement, null);
39 assert_equals(hostV1.shadowRoot.pointerLockElement, hostV1inV1) 36 assert_equals(hostV1.shadowRoot.pointerLockElement, hostV1inV1)
40 assert_equals(hostV1inV1.shadowRoot.pointerLockElement, canvas); 37 assert_equals(hostV1inV1.shadowRoot.pointerLockElement, canvas);
41 assert_equals(hostV0inV1inV1.shadowRoot.pointerLockElement, null); 38 assert_equals(hostV0inV1inV1.shadowRoot.pointerLockElement, null);
42 39
43 document.exitPointerLock(); 40 document.exitPointerLock();
44 test.done(); 41 test.done();
45 }; 42 });
46 43
47 convertTemplatesToShadowRootsWithin(host); 44 convertTemplatesToShadowRootsWithin(host);
48 var hostV1inV1 = hostV1.shadowRoot.querySelector('#hostV1inV1'); 45 var hostV1inV1 = hostV1.shadowRoot.querySelector('#hostV1inV1');
49 var hostV0inV1inV1 = hostV1inV1.shadowRoot.querySelector('#hostV0inV1inV1'); 46 var hostV0inV1inV1 = hostV1inV1.shadowRoot.querySelector('#hostV0inV1inV1');
50 47
51 assert_equals(document.pointerLockElement, null); 48 test.step(() => {
52 assert_equals(host.shadowRoot.pointerLockElement, null); 49 assert_equals(document.pointerLockElement, null);
53 assert_equals(hostV1.shadowRoot.pointerLockElement, null); 50 assert_equals(host.shadowRoot.pointerLockElement, null);
54 assert_equals(hostV1inV1.shadowRoot.pointerLockElement, null); 51 assert_equals(hostV1.shadowRoot.pointerLockElement, null);
55 assert_equals(hostV0inV1inV1.shadowRoot.pointerLockElement, null); 52 assert_equals(hostV1inV1.shadowRoot.pointerLockElement, null);
53 assert_equals(hostV0inV1inV1.shadowRoot.pointerLockElement, null);
54 });
56 55
57 var canvas = hostV0inV1inV1.shadowRoot.querySelector('canvas'); 56 var canvas = hostV0inV1inV1.shadowRoot.querySelector('canvas');
58 canvas.requestPointerLock(); 57 canvas.requestPointerLock();
59 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); 58 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.');
60 </script> 59 </script>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/v0/pointer-lock-in-shadow2.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698