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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/pointerevents/pointerevent_capture_suppressing_mouse-manual.html

Issue 2376103007: Import wpt@09907a9c4bcee14986431d53e4381384c7c69107 (Closed)
Patch Set: update platform expectations Created 4 years, 2 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 <html> 2 <html>
3 <head> 3 <head>
4 <title>Set/Release capture</title> 4 <title>Set/Release capture</title>
5 <meta name="viewport" content="width=device-width"> 5 <meta name="viewport" content="width=device-width">
6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> 6 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
7 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testharnessreport.js"></script>
9 <!-- Additional helper script for common checks across event types --> 9 <!-- Additional helper script for common checks across event types -->
10 <script type="text/javascript" src="pointerevent_support.js"></script> 10 <script type="text/javascript" src="pointerevent_support.js"></script>
11 </head> 11 </head>
12 <body> 12 <body>
13 <h1>Pointer Events capture test</h1> 13 <h1>Pointer Events capture test</h1>
14 <h4> 14 <h4>
15 Test Description: This test checks if setCapture/releaseCapture func tions works properly. Complete the following actions: 15 Test Description: This test checks if setCapture/releaseCapture func tions works properly. Complete the following actions:
16 <ol> 16 <ol>
17 <li> Put your mouse over the black rectangle. pointerover and po interenter should be logged inside of it.</li> 17 <li> Put your mouse over the black rectangle. pointerover and po interenter should be logged inside of it.</li>
18 <li> Move your mouse out of the black rectangle. pointerout and pointerleave should be logged inside of it</li> 18 <li> Move your mouse out of the black rectangle. pointerout and pointerleave should be logged inside of it</li>
19 <li> Put your mouse over the purple rectangle. pointerover and p ointerenter should be logged inside of it.</li> 19 <li> Put your mouse over the purple rectangle. pointerover and p ointerenter should be logged inside of it.</li>
20 <li> Move your mouse out of the purple rectangle. pointerout and pointerleave should be logged inside of it</li> 20 <li> Move your mouse out of the purple rectangle. pointerout and pointerleave should be logged inside of it</li>
21 <li> Press and hold left mouse button over "Set Capture" button. "gotpointercapture" should be logged in the black rectangle</li> 21 <li> Press and hold left mouse button over "Set Capture" button and move mouse a litte inside the button. "gotpointercapture", "pointerover", an d "pointerenter" should be logged in the black rectangle</li>
22 <li> Put your mouse over the purple rectangle and then move it o ut. Nothing should happen</li> 22 <li> Put your mouse over the purple rectangle and then move it o ut. Nothing should happen</li>
23 <li> Put your mouse over the black rectangle. pointerover and po interenter should be logged inside of it.</li> 23 <li> Put your mouse over the black rectangle and then move it ou t. Nothing should happen.</li>
24 <li> Move your mouse out of the black rectangle. pointerout and pointerleave should be logged inside of it</li> 24 <li> Put your mouse over the purple rectangle and then release l eft mouse button. "lostpointercapture" should be logged in the black rectangle. Move your mouse in the purple rectangle a little. "pointerout" and "pointerleave " should be logged in the black rectangle. Also "pointerover" and "pointerenter" should be logged in the purple rectangle"</li>
25 <li> Release left mouse button. "lostpointercapture" should be l ogged in the black rectangle</li>
26 </ol> 25 </ol>
27 </h4> 26 </h4>
28 Test passes if the proper behaviour of the events is observed. 27 Test passes if the proper behaviour of the events is observed.
29 <div id="target0"></div> 28 <div id="target0"></div>
30 <br> 29 <br>
31 <div id="target1"></div> 30 <div id="target1"></div>
32 <br> 31 <br>
33 <input type="button" id="btnCapture" value="Set Capture"> 32 <input type="button" id="btnCapture" value="Set Capture">
34 <script type='text/javascript'> 33 <script type='text/javascript'>
35 var isPointerCapture = false; 34 var isPointerCapture = false;
36 var isRelatedTargetValueTested = false; 35 var isRelatedTargetValueTested = false;
37 var isTargetAuthenticityTested = false; 36 var isTargetAuthenticityTested = false;
37 var lostPointerCaptureReceived = false;
38 var count = 0; 38 var count = 0;
39 39
40 var detected_pointertypes = {}; 40 var detected_pointertypes = {};
41 add_completion_callback(showPointerTypes); 41 add_completion_callback(showPointerTypes);
42 42
43 var target0 = document.getElementById('target0'); 43 var target0 = document.getElementById('target0');
44 var target1 = document.getElementById('target1'); 44 var target1 = document.getElementById('target1');
45 var captureButton = document.getElementById('btnCapture'); 45 var captureButton = document.getElementById('btnCapture');
46 46
47 var test_gotpointercapture = async_test("gotpointercapture event rec eived"); 47 var test_gotpointercapture = async_test("gotpointercapture event rec eived");
48 var test_lostpointercapture = async_test("lostpointercapture event r eceived"); 48 var test_lostpointercapture = async_test("lostpointercapture event r eceived");
49 49
50 var test_pointerover_no_capture = async_test("pointerover event with out capture received"); 50 var test_pointerover_no_capture = async_test("pointerover event with out capture received");
51 var test_pointerover_capture = async_test("pointerover event with ca pture received"); 51 var test_pointerover_capture = async_test("pointerover event with ca pture received");
52 52
53 var test_pointerout_no_capture = async_test("pointerout event withou t capture received"); 53 var test_pointerout_no_capture = async_test("pointerout event withou t capture received");
54 var test_pointerout_capture = async_test("pointerout event with capt ure received"); 54 var test_pointerout_after_capture = async_test("pointerout event aft er lostpointercapture received");
55 55
56 var test_pointerenter_no_capture = async_test("pointerenter event wi thout capture received"); 56 var test_pointerenter_no_capture = async_test("pointerenter event wi thout capture received");
57 var test_pointerenter_capture = async_test("pointerenter event with capture received"); 57 var test_pointerenter_capture = async_test("pointerenter event with capture received");
58 58
59 var test_pointerleave_no_capture = async_test("pointerleave event wi thout capture received"); 59 var test_pointerleave_no_capture = async_test("pointerleave event wi thout capture received");
60 var test_pointerleave_capture = async_test("pointerleave event with capture received"); 60 var test_pointerleave_after_capture = async_test("pointerleave event after lostpointercapture received");
61 61
62 window.onload = function() { 62 window.onload = function() {
63 on_event(captureButton, 'pointerdown', function(e) { 63 on_event(captureButton, 'pointerdown', function(e) {
64 if(isPointerCapture == false) { 64 if(isPointerCapture == false) {
65 sPointerCapture(e); 65 sPointerCapture(e);
66 isPointerCapture = true; 66 isPointerCapture = true;
67 } 67 }
68 }); 68 });
69 69
70 on_event(target0, 'gotpointercapture', function(e) { 70 on_event(target0, 'gotpointercapture', function(e) {
71 test_gotpointercapture.done(); 71 test_gotpointercapture.done();
72 log("gotpointercapture", target0); 72 log("gotpointercapture", target0);
73 }); 73 });
74 74
75 on_event(target0, 'lostpointercapture', function(e) { 75 on_event(target0, 'lostpointercapture', function(e) {
76 isPointerCapture = false; 76 isPointerCapture = false;
77 lostPointerCaptureReceived = true;
77 test_lostpointercapture.done(); 78 test_lostpointercapture.done();
78 log("lostpointercapture", target0); 79 log("lostpointercapture", target0);
79 }); 80 });
80 81
81 run(); 82 run();
82 } 83 }
83 84
84 function run() { 85 function run() {
85 on_event(target0, "pointerover", function (event) { 86 on_event(target0, "pointerover", function (event) {
86 detected_pointertypes[ event.pointerType ] = true; 87 detected_pointertypes[ event.pointerType ] = true;
87 log("pointerover", target0); 88 log("pointerover", target0);
88 if(isPointerCapture) { 89 if(isPointerCapture) {
89 test_pointerover_capture.done(); 90 test_pointerover_capture.done();
90 if (!isRelatedTargetValueTested) { 91 if (!isRelatedTargetValueTested) {
91 test(function() { 92 test(function() {
92 assert_true(event.relatedTarget==null, "relatedT arget is null when the capture is set") 93 assert_not_equals(event.relatedTarget, null, "re latedTarget should behave the same as when the capture is not set")
93 }, "relatedTarget is null when the capture is set. r elatedTarget is " + event.relatedTarget); 94 }, "relatedTarget is not null for boundary events ev en when the capture is set.");
94 isRelatedTargetValueTested = true; 95 isRelatedTargetValueTested = true;
95 } 96 }
96 var hitTest = document.elementFromPoint(event.clientX, e vent.clientY); 97 var hitTest = document.elementFromPoint(event.clientX, e vent.clientY);
97 if(event.target !== hitTest && !isTargetAuthenticityTest ed) { 98 if(event.target !== hitTest && !isTargetAuthenticityTest ed) {
98 test(function () { 99 test(function () {
99 assert_unreached("pointerover for this target sh ouldn't trigger events on capture target"); 100 assert_not_equals(event.target, hitTest, "pointe rover should be fired on capture target even if the pointer it not over the capt ure target");
100 }, "pointerover should only trigger over the black r ectangle"); 101 }, "pointerover should trigger the black rectangle e ven when pointer is not over black rectangle.");
101 isTargetAuthenticityTested = true; 102 isTargetAuthenticityTested = true;
102 } 103 }
103 } 104 }
104 else { 105 else {
105 test_pointerover_no_capture.done(); 106 test_pointerover_no_capture.done();
106 } 107 }
107 }); 108 });
108 109
109 on_event(target0, "pointerout", function (event) { 110 on_event(target0, "pointerout", function (event) {
110 log("pointerout", target0); 111 log("pointerout", target0);
111 if(isPointerCapture) { 112 if(isPointerCapture) {
112 test_pointerout_capture.done(); 113 test(function() {
114 assert_unreached("pointerout shouldn't be sent to ca ptured node as all the events are targeted at the capturing node");
115 }, "pointerout shouldn't be sent to captured node as all the events are targeted at the capturing node.");
113 } 116 }
114 else { 117 else {
115 test_pointerout_no_capture.done(); 118 if (lostPointerCaptureReceived) {
119 test_pointerout_after_capture.done();
120 } else {
121 test_pointerout_no_capture.done();
122 }
116 } 123 }
117 }); 124 });
118 125
119 on_event(target0, "pointerenter", function (event) { 126 on_event(target0, "pointerenter", function (event) {
120 log("pointerenter", target0); 127 log("pointerenter", target0);
121 if(isPointerCapture) { 128 if(isPointerCapture) {
122 test_pointerenter_capture.done(); 129 test_pointerenter_capture.done();
123 } 130 }
124 else { 131 else {
125 test_pointerenter_no_capture.done(); 132 test_pointerenter_no_capture.done();
126 } 133 }
127 }); 134 });
128 135
129 on_event(target0, "pointerleave", function (event) { 136 on_event(target0, "pointerleave", function (event) {
130 log("pointerleave", target0); 137 log("pointerleave", target0);
131 if(isPointerCapture) { 138 if(isPointerCapture) {
132 test_pointerleave_capture.done(); 139 test(function() {
140 assert_unreached("pointerleave shouldn't be sent to captured node as all the events are targeted at the capturing node");
141 }, "pointerleave shouldn't be sent to captured node as a ll the events are targeted at the capturing node.");
133 } 142 }
134 else { 143 else {
135 test_pointerleave_no_capture.done(); 144 if (lostPointerCaptureReceived) {
145 test_pointerleave_after_capture.done();
146 } else {
147 test_pointerleave_no_capture.done();
148 }
136 } 149 }
137 }); 150 });
138 151
139 // fail if capture is set but event is received for the non-capt ured target 152 // fail if capture is set but event is received for the non-capt ured target
140 on_event(target1, "pointerover", function (event) { 153 on_event(target1, "pointerover", function (event) {
141 log("pointerover", target1); 154 log("pointerover", target1);
142 if(isPointerCapture == true) { 155 if(isPointerCapture == true) {
143 test(function() { 156 test(function() {
144 assert_unreached("pointerover shouldn't trigger for this target when capture is enabled"); 157 assert_unreached("pointerover shouldn't trigger for this target when capture is enabled");
145 }, "pointerover shouldn't trigger for the purple rectang le while the black rectangle has capture"); 158 }, "pointerover shouldn't trigger for the purple rectang le while the black rectangle has capture");
(...skipping 27 matching lines...) Expand all
173 } 186 }
174 }); 187 });
175 } 188 }
176 </script> 189 </script>
177 <h1>Pointer Events Capture Test</h1> 190 <h1>Pointer Events Capture Test</h1>
178 <div id="complete-notice"> 191 <div id="complete-notice">
179 <p>The following pointer types were detected: <span id="pointertype- log"></span>.</p> 192 <p>The following pointer types were detected: <span id="pointertype- log"></span>.</p>
180 </div> 193 </div>
181 <div id="log"></div> 194 <div id="log"></div>
182 </body> 195 </body>
183 </html> 196 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698