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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/pointerevents/pointerlock/pointerevent_pointerlock-manual.html

Issue 2807433003: No pointer captured when the pointer lock is applied (Closed)
Patch Set: Change the tests and move code to WebFrameWidgetBase Created 3 years, 7 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
(Empty)
1 <!doctype html>
scheib 2017/05/26 05:44:12 Filename should be improved. e.g. ...pointerlock_
lanwei 2017/05/29 18:30:07 Done.
2 <html>
3 <head>
4 <title>Pointer Events pointer lock tests</title>
5 <meta name="viewport" content="width=device-width">
6 <link rel="stylesheet" type="text/css" href="../pointerevent_styles.css" >
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9 <!-- Additional helper script for common checks across event types -->
10 <script type="text/javascript" src="../pointerevent_support.js"></script >
11 <script>
12 var lock_change_count = 0;
13 var capture_count = 0;
14 var mouse_move_count = 0;
15
16 function resetTestState() {
17 }
18
19 function run() {
20 var test_pointerEvent = setup_pointerevent_test("no pointercaptu re while pointerlock", ['mouse']);
21 var div1 = document.getElementById("div1");
22 var div2 = document.getElementById("div2");
23
24 on_event(div1, 'pointerdown', function(event) {
25 div2.setPointerCapture(event.pointerId);
26 div1.requestPointerLock();
27 });
28 on_event(div1, 'pointermove', function(event) {
29 if (lock_change_count == 1) {
30 mouse_move_count++;
31 if (mouse_move_count == 2) {
32 document.exitPointerLock();
33 mouse_move_count = 0;
34 }
35 } else if (lock_change_count == 2) {
36 mouse_move_count++;
37 if (mouse_move_count == 2) {
38 test_pointerEvent.step(function() {
39 assert_equals(capture_count, 0, "There shouldn't be any capture events fired.");
40 });
41 test_pointerEvent.done();
42 }
43 }
44 });
45 on_event(div2, 'gotpointercapture', function(event) {
46 capture_count++;
47 });
48 on_event(div2, 'lostpointercapture', function(event) {
49 capture_count++;
50 });
51 on_event(document, 'pointerlockchange', function(event) {
52 lock_change_count++;
53 test_pointerEvent.step(function() {
54 if (lock_change_count == 1)
55 assert_equals(document.pointerLockElement, div1, "do cument.pointerLockElement should be div1.");
56 else if (lock_change_count == 2)
57 assert_equals(document.pointerLockElement, null, "do cument.pointerLockElement should be null.");
58 });
59 });
60 }
61 </script>
62 </head>
63 <body onload="run()">
64 <h1>Pointer Events pointer lock test</h1>
65 <h2 id="pointerTypeDescription"></h2>
66 <h4>
67 Test Description: This test checks that we do not set the pointer ca pture when any element in the page gets a pointer lock.
68 <ol>
69 <li>Press left button down on the green rectangle and hold it.< /li>
70 <li>Move the mouse inside the green rectangle.</li>
71 </ol>
72
73 Test passes if the pointer capture is not set when the green rectang le gets the pointer lock.
74 </h4>
75 <div id="testContainer">
76 <div id="div1" style="width:800px;height:250px;background:green"></d iv>
77 <div id="div2" style="width:800px;height:250px;background:yellow"></ div>
78 </div>
79 <div class="spacer"></div>
80 </body>
81 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698