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

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

Issue 2807433003: No pointer captured when the pointer lock is applied (Closed)
Patch Set: pointer lock Created 3 years, 6 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>
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 try {
33 div2.setPointerCapture(event.pointerId);
34 test_pointerEvent.step(function () {
35 assert_unreached("DOMException: InvalidState Error should have been thrown.");
36 });
37 } catch (e) {
38 test_pointerEvent.step(function () {
39 assert_equals(e.name, "InvalidStateError", " DOMException should be InvalidStateError");
40 });
41 }
42 } else if (mouse_move_count == 3) {
43 document.exitPointerLock();
44 mouse_move_count = 0;
45 }
46
47 } else if (lock_change_count == 2) {
48 mouse_move_count++;
49 if (mouse_move_count == 2) {
50 test_pointerEvent.step(function() {
51 assert_equals(capture_count, 0, "There shouldn't be any capture events fired.");
52 });
53 test_pointerEvent.done();
54 }
55 }
56 });
57 on_event(div2, 'gotpointercapture', function(event) {
58 capture_count++;
59 });
60 on_event(div2, 'lostpointercapture', function(event) {
61 capture_count++;
62 });
63 on_event(document, 'pointerlockchange', function(event) {
64 lock_change_count++;
65 test_pointerEvent.step(function() {
66 if (lock_change_count == 1)
67 assert_equals(document.pointerLockElement, div1, "do cument.pointerLockElement should be div1.");
68 else if (lock_change_count == 2)
69 assert_equals(document.pointerLockElement, null, "do cument.pointerLockElement should be null.");
70 });
71 });
72 }
73 </script>
74 </head>
75 <body onload="run()">
76 <h1>Pointer Events pointer lock test</h1>
77 <h2 id="pointerTypeDescription"></h2>
78 <h4>
79 Test Description: This test checks that we do not set the pointer ca pture when any element in the page gets a pointer lock.
80 <ol>
81 <li>Press left button down on the green rectangle and hold it.< /li>
82 <li>Move the mouse inside the green rectangle.</li>
83 </ol>
84
85 Test passes if the pointer capture is not set when the green rectang le gets the pointer lock.
86 </h4>
87 <div id="testContainer">
88 <div id="div1" style="width:800px;height:250px;background:green"></d iv>
89 <div id="div2" style="width:800px;height:250px;background:yellow"></ div>
90 </div>
91 <div class="spacer"></div>
92 </body>
93 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698