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

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: Initialize m_frameScale in PointerEventFactoryTest 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 eventSender.keyDown('ArrowRight'); 374 eventSender.keyDown('ArrowRight');
375 else 375 else
376 reject(); 376 reject();
377 resolve(); 377 resolve();
378 } else { 378 } else {
379 reject(); 379 reject();
380 } 380 }
381 }); 381 });
382 } 382 }
383 383
384 function smoothDrag(targetSelector1, targetSelector2, pointerType) {
385 return new Promise(function(resolve, reject) {
386 if (window.chrome && chrome.gpuBenchmarking) {
387 scrollPageIfNeeded(targetSelector1, document);
388 var target1 = document.querySelector(targetSelector1);
389 var targetRect1 = target1.getBoundingClientRect();
390 var xPosition1 = targetRect1.left + boundaryOffset;
391 var yPosition1 = targetRect1.top + boundaryOffset;
392 var target2 = document.querySelector(targetSelector2);
393 var targetRect2 = target2.getBoundingClientRect();
394 var xPosition2 = targetRect2.left + boundaryOffset;
395 var yPosition2 = targetRect2.top + boundaryOffset;
396 var action = '[{"source": "' + pointerType + '", "actions": [{ "name": "po interDown", "x":' + xPosition1 +', "y":' + yPosition1 +' },';
397 var maxStep = Math.max(1, Math.floor(Math.max(Math.abs(xPosition2 - xPosit ion1), Math.abs(yPosition2 - yPosition1))/15));
398 for (var step=1; step<=maxStep; step++)
399 action += '{ "name": "pointerMove", "x":' + (xPosition1 + Math.floor((st ep/maxStep)*(xPosition2 - xPosition1))) +', "y":' + (yPosition1 + Math.floor((st ep/maxStep)*(yPosition2 - yPosition1))) +' },';
400 action += '{ "name": "pointerUp" }]}]';
401 chrome.gpuBenchmarking.pointerActionSequence(JSON.parse(action), resolve);
402 } else {
403 reject();
404 }
405 });
406 }
407
384 { 408 {
385 var pointerevent_automation = async_test("PointerEvent Automation"); 409 var pointerevent_automation = async_test("PointerEvent Automation");
386 // Defined in every test and should return a promise that gets resolved when i nput is finished. 410 // Defined in every test and should return a promise that gets resolved when i nput is finished.
387 inject_input().then(function() { 411 inject_input().then(function() {
388 pointerevent_automation.done(); 412 pointerevent_automation.done();
389 }); 413 });
390 } 414 }
391
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698