| Index: third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js
|
| diff --git a/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js b/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js
|
| index 16e8661887b4a9594c703cc4299ea3d6465d89c4..be0029ea4d77711803dd50b347ad498ced99291c 100644
|
| --- a/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js
|
| +++ b/third_party/WebKit/LayoutTests/external/wpt_automation/pointerevents/pointerevent_common_input.js
|
| @@ -393,6 +393,30 @@ function keyboardScroll(direction) {
|
| });
|
| }
|
|
|
| +function smoothDrag(targetSelector1, targetSelector2, pointerType) {
|
| + return new Promise(function(resolve, reject) {
|
| + if (window.chrome && chrome.gpuBenchmarking) {
|
| + scrollPageIfNeeded(targetSelector1, document);
|
| + var target1 = document.querySelector(targetSelector1);
|
| + var targetRect1 = target1.getBoundingClientRect();
|
| + var xPosition1 = targetRect1.left + boundaryOffset;
|
| + var yPosition1 = targetRect1.top + boundaryOffset;
|
| + var target2 = document.querySelector(targetSelector2);
|
| + var targetRect2 = target2.getBoundingClientRect();
|
| + var xPosition2 = targetRect2.left + boundaryOffset;
|
| + var yPosition2 = targetRect2.top + boundaryOffset;
|
| + var action = '[{"source": "' + pointerType + '", "actions": [{ "name": "pointerDown", "x":' + xPosition1 +', "y":' + yPosition1 +' },';
|
| + var maxStep = Math.max(1, Math.floor(Math.max(Math.abs(xPosition2 - xPosition1), Math.abs(yPosition2 - yPosition1))/15));
|
| + for (var step=1; step<=maxStep; step++)
|
| + action += '{ "name": "pointerMove", "x":' + (xPosition1 + Math.floor((step/maxStep)*(xPosition2 - xPosition1))) +', "y":' + (yPosition1 + Math.floor((step/maxStep)*(yPosition2 - yPosition1))) +' },';
|
| + action += '{ "name": "pointerUp" }]}]';
|
| + chrome.gpuBenchmarking.pointerActionSequence(JSON.parse(action), resolve);
|
| + } else {
|
| + reject();
|
| + }
|
| + });
|
| +}
|
| +
|
| {
|
| var pointerevent_automation = async_test("PointerEvent Automation");
|
| // Defined in every test and should return a promise that gets resolved when input is finished.
|
| @@ -400,4 +424,3 @@ function keyboardScroll(direction) {
|
| pointerevent_automation.done();
|
| });
|
| }
|
| -
|
|
|