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

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

Issue 2624783002: Fix movementX/Y attributes for touch pointer events (Closed)
Patch Set: Move the logic to InputRouterImpl Created 3 years, 10 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 = 30; 3 const scrollOffset = 30;
4 const boundaryOffset = 5; 4 const boundaryOffset = 5;
5 const touchSourceType = 1; 5 const touchSourceType = 1;
6 6
7 function delayPromise(delay) { 7 function delayPromise(delay) {
8 return new Promise(function(resolve, reject) { 8 return new Promise(function(resolve, reject) {
9 window.setTimeout(resolve, delay); 9 window.setTimeout(resolve, delay);
10 }); 10 });
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 eventSender.keyDown('ArrowRight'); 386 eventSender.keyDown('ArrowRight');
387 else 387 else
388 reject(); 388 reject();
389 resolve(); 389 resolve();
390 } else { 390 } else {
391 reject(); 391 reject();
392 } 392 }
393 }); 393 });
394 } 394 }
395 395
396 function smoothDrag(targetSelector1, targetSelector2, pointerType) {
397 return new Promise(function(resolve, reject) {
398 if (window.chrome && chrome.gpuBenchmarking) {
399 scrollPageIfNeeded(targetSelector1, document);
400 var target1 = document.querySelector(targetSelector1);
401 var targetRect1 = target1.getBoundingClientRect();
402 var xPosition1 = targetRect1.left + boundaryOffset;
403 var yPosition1 = targetRect1.top + boundaryOffset;
404 var target2 = document.querySelector(targetSelector2);
405 var targetRect2 = target2.getBoundingClientRect();
406 var xPosition2 = targetRect2.left + boundaryOffset;
407 var yPosition2 = targetRect2.top + boundaryOffset;
408 var action = '[{"source": "' + pointerType + '", "actions": [{ "name": "po interDown", "x":' + xPosition1 +', "y":' + yPosition1 +' },';
409 var maxStep = Math.max(1, Math.floor(Math.max(Math.abs(xPosition2 - xPosit ion1), Math.abs(yPosition2 - yPosition1))/15));
410 for (var step=1; step<=maxStep; step++)
411 action += '{ "name": "pointerMove", "x":' + (xPosition1 + Math.floor((st ep/maxStep)*(xPosition2 - xPosition1))) +', "y":' + (yPosition1 + Math.floor((st ep/maxStep)*(yPosition2 - yPosition1))) +' },';
412 action += '{ "name": "pointerUp" }]}]';
413 chrome.gpuBenchmarking.pointerActionSequence(JSON.parse(action), resolve);
414 } else {
415 reject();
416 }
417 });
418 }
419
396 { 420 {
397 var pointerevent_automation = async_test("PointerEvent Automation"); 421 var pointerevent_automation = async_test("PointerEvent Automation");
398 // Defined in every test and should return a promise that gets resolved when i nput is finished. 422 // Defined in every test and should return a promise that gets resolved when i nput is finished.
399 inject_input().then(function() { 423 inject_input().then(function() {
400 pointerevent_automation.done(); 424 pointerevent_automation.done();
401 }); 425 });
402 } 426 }
403
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698