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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js

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
1 // This file contains the commonly used functions in pointerevent tests. 1 // This file contains the commonly used functions in pointerevent tests.
2 2
3 const scrollOffset = 20; 3 const scrollOffset = 20;
4 const boundaryOffset = 2; 4 const boundaryOffset = 2;
5 5
6 function delayPromise(delay) { 6 function delayPromise(delay) {
7 return new Promise(function(resolve, reject) { 7 return new Promise(function(resolve, reject) {
8 window.setTimeout(resolve, delay); 8 window.setTimeout(resolve, delay);
9 }); 9 });
10 } 10 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 eventSender.continuousMouseScrollBy(0, -scrollOffset); 186 eventSender.continuousMouseScrollBy(0, -scrollOffset);
187 else 187 else
188 reject(); 188 reject();
189 resolve(); 189 resolve();
190 } else { 190 } else {
191 reject(); 191 reject();
192 } 192 }
193 }); 193 });
194 } 194 }
195 195
196 // Request a pointer lock and capture.
197 function mouseRequestPointerLockAndCaptureInTarget(targetSelector, targetFrame) {
198 var targetDocument = document;
199 var frameLeft = 0;
200 var frameTop = 0;
201 var button = 'left';
202 if (targetFrame !== undefined) {
203 targetDocument = targetFrame.contentDocument;
204 var frameRect = targetFrame.getBoundingClientRect();
205 frameLeft = frameRect.left;
206 frameTop = frameRect.top;
207 }
208 return new Promise(function(resolve, reject) {
209 if (window.chrome && chrome.gpuBenchmarking) {
210 scrollPageIfNeeded(targetSelector, targetDocument);
211 var target = targetDocument.querySelector(targetSelector);
212 var targetRect = target.getBoundingClientRect();
213 var xPosition = frameLeft + targetRect.left + boundaryOffset;
214 var yPosition = frameTop + targetRect.top + boundaryOffset;
215
216 chrome.gpuBenchmarking.pointerActionSequence( [
217 {source: 'mouse',
218 actions: [
219 {name: 'pointerMove', x: xPosition, y: yPosition},
220 {name: 'pointerDown', x: xPosition, y: yPosition, button: 'left'},
221 {name: 'pointerMove', x: xPosition + 30, y: yPosition + 30},
222 {name: 'pointerMove', x: xPosition + 30, y: yPosition},
223 {name: 'pointerMove', x: xPosition + 60, y: yPosition + 30},
224 {name: 'pointerMove', x: xPosition + 30, y: yPosition + 20},
225 {name: 'pointerMove', x: xPosition + 10, y: yPosition + 50},
226 {name: 'pointerMove', x: xPosition + 40, y: yPosition + 10},
227 ]}], resolve);
228 } else {
229 reject();
230 }
231 });
232 }
233
196 // Touch inputs. 234 // Touch inputs.
197 function touchTapInTarget(targetSelector, targetFrame) { 235 function touchTapInTarget(targetSelector, targetFrame) {
198 var targetDocument = document; 236 var targetDocument = document;
199 var frameLeft = 0; 237 var frameLeft = 0;
200 var frameTop = 0; 238 var frameTop = 0;
201 if (targetFrame !== undefined) { 239 if (targetFrame !== undefined) {
202 targetDocument = targetFrame.contentDocument; 240 targetDocument = targetFrame.contentDocument;
203 var frameRect = targetFrame.getBoundingClientRect(); 241 var frameRect = targetFrame.getBoundingClientRect();
204 frameLeft = frameRect.left; 242 frameLeft = frameRect.left;
205 frameTop = frameRect.top; 243 frameTop = frameRect.top;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 }); 547 });
510 } 548 }
511 549
512 { 550 {
513 var pointerevent_automation = async_test("PointerEvent Automation"); 551 var pointerevent_automation = async_test("PointerEvent Automation");
514 // Defined in every test and should return a promise that gets resolved when i nput is finished. 552 // Defined in every test and should return a promise that gets resolved when i nput is finished.
515 inject_input().then(function() { 553 inject_input().then(function() {
516 pointerevent_automation.done(); 554 pointerevent_automation.done();
517 }); 555 });
518 } 556 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698