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

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, 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
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'},
Navid Zolghadr 2017/05/17 16:30:10 Can you add a little move after the left pressed a
lanwei 2017/05/19 15:05:00 Done.
221 {name: 'pause', duration: 0.1},
222 {name: 'pointerDown', x: xPosition, y: yPosition, button: 'middle'},
223 {name: 'pointerMove', x: xPosition + 30, y: yPosition + 30},
224 ]}], resolve);
225 } else {
226 reject();
227 }
228 });
229 }
230
196 // Touch inputs. 231 // Touch inputs.
197 function touchTapInTarget(targetSelector, targetFrame) { 232 function touchTapInTarget(targetSelector, targetFrame) {
198 var targetDocument = document; 233 var targetDocument = document;
199 var frameLeft = 0; 234 var frameLeft = 0;
200 var frameTop = 0; 235 var frameTop = 0;
201 if (targetFrame !== undefined) { 236 if (targetFrame !== undefined) {
202 targetDocument = targetFrame.contentDocument; 237 targetDocument = targetFrame.contentDocument;
203 var frameRect = targetFrame.getBoundingClientRect(); 238 var frameRect = targetFrame.getBoundingClientRect();
204 frameLeft = frameRect.left; 239 frameLeft = frameRect.left;
205 frameTop = frameRect.top; 240 frameTop = frameRect.top;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 }); 516 });
482 } 517 }
483 518
484 { 519 {
485 var pointerevent_automation = async_test("PointerEvent Automation"); 520 var pointerevent_automation = async_test("PointerEvent Automation");
486 // Defined in every test and should return a promise that gets resolved when i nput is finished. 521 // Defined in every test and should return a promise that gets resolved when i nput is finished.
487 inject_input().then(function() { 522 inject_input().then(function() {
488 pointerevent_automation.done(); 523 pointerevent_automation.done();
489 }); 524 });
490 } 525 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698