| 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..8a79e442d878ec2f60344376fc5d621de0356b03 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
|
| @@ -1,8 +1,7 @@
|
| // This file contains the commonly used functions in pointerevent tests.
|
|
|
| -const scrollOffset = 30;
|
| -const boundaryOffset = 5;
|
| -const touchSourceType = 1;
|
| +const scrollOffset = 20;
|
| +const boundaryOffset = 2;
|
|
|
| function delayPromise(delay) {
|
| return new Promise(function(resolve, reject) {
|
| @@ -23,8 +22,8 @@ function mouseMoveToDocument() {
|
| if (window.chrome && chrome.gpuBenchmarking) {
|
| chrome.gpuBenchmarking.pointerActionSequence(
|
| [{
|
| - 'source': 'mouse',
|
| - 'actions': [{'name': 'pointerMove', 'x': 0, 'y': 0}]
|
| + source: 'mouse',
|
| + actions: [{name: 'pointerMove', x: 0, y: 0}]
|
| }],
|
| resolve);
|
| } else {
|
| @@ -52,9 +51,9 @@ function mouseMoveIntoTarget(targetSelector, targetFrame) {
|
| var yPosition = frameTop + targetRect.top + boundaryOffset;
|
| chrome.gpuBenchmarking.pointerActionSequence(
|
| [{
|
| - 'source': 'mouse',
|
| - 'actions':
|
| - [{'name': 'pointerMove', 'x': xPosition, 'y': yPosition}]
|
| + source: 'mouse',
|
| + actions:
|
| + [{name: 'pointerMove', x: xPosition, y: yPosition}]
|
| }],
|
| resolve);
|
| } else {
|
| @@ -73,22 +72,22 @@ function mouseChordedButtonPress(targetSelector) {
|
| var yPosition = targetRect.top + boundaryOffset;
|
| chrome.gpuBenchmarking.pointerActionSequence(
|
| [{
|
| - 'source': 'mouse',
|
| - 'actions': [
|
| + source: 'mouse',
|
| + actions: [
|
| {
|
| - 'name': 'pointerDown',
|
| - 'x': xPosition,
|
| - 'y': yPosition,
|
| - 'button': 'left'
|
| + name: 'pointerDown',
|
| + x: xPosition,
|
| + y: yPosition,
|
| + button: 'left'
|
| },
|
| {
|
| - 'name': 'pointerDown',
|
| - 'x': xPosition,
|
| - 'y': yPosition,
|
| - 'button': 'middle'
|
| + name: 'pointerDown',
|
| + x: xPosition,
|
| + y: yPosition,
|
| + button: 'middle'
|
| },
|
| - {'name': 'pointerUp', 'button': 'middle'},
|
| - {'name': 'pointerUp', 'button': 'left'}
|
| + {name: 'pointerUp', button: 'middle'},
|
| + {name: 'pointerUp', button: 'left'}
|
| ]
|
| }],
|
| resolve);
|
| @@ -117,11 +116,11 @@ function mouseClickInTarget(targetSelector, targetFrame) {
|
| var yPosition = frameTop + targetRect.top + boundaryOffset;
|
| chrome.gpuBenchmarking.pointerActionSequence(
|
| [{
|
| - 'source': 'mouse',
|
| - 'actions': [
|
| - {'name': 'pointerMove', 'x': xPosition, 'y': yPosition},
|
| - {'name': 'pointerDown', 'x': xPosition, 'y': yPosition},
|
| - {'name': 'pointerUp'}
|
| + source: 'mouse',
|
| + actions: [
|
| + {name: 'pointerMove', x: xPosition, y: yPosition},
|
| + {name: 'pointerDown', x: xPosition, y: yPosition},
|
| + {name: 'pointerUp'}
|
| ]
|
| }],
|
| resolve);
|
| @@ -143,7 +142,7 @@ function mouseDragInTargets(targetSelectorList) {
|
| var pointerAction = pointerActions[0];
|
| pointerAction.actions = [];
|
| pointerAction.actions.push(
|
| - {'name': 'pointerDown', 'x': xPosition, 'y': yPosition});
|
| + {name: 'pointerDown', x: xPosition, y: yPosition});
|
| for (var i = 1; i < targetSelectorList.length; i++) {
|
| scrollPageIfNeeded(targetSelectorList[i], document);
|
| target = document.querySelector(targetSelectorList[i]);
|
| @@ -151,9 +150,9 @@ function mouseDragInTargets(targetSelectorList) {
|
| xPosition = targetRect.left + boundaryOffset;
|
| yPosition = targetRect.top + boundaryOffset;
|
| pointerAction.actions.push(
|
| - {'name': 'pointerMove', 'x': xPosition, 'y': yPosition});
|
| + {name: 'pointerMove', x: xPosition, y: yPosition});
|
| }
|
| - pointerAction.actions.push({'name': 'pointerUp'});
|
| + pointerAction.actions.push({name: 'pointerUp'});
|
| chrome.gpuBenchmarking.pointerActionSequence(pointerActions, resolve);
|
| } else {
|
| reject();
|
| @@ -207,10 +206,61 @@ function touchTapInTarget(targetSelector, targetFrame) {
|
| var xPosition = frameLeft + targetRect.left + boundaryOffset;
|
| var yPosition = frameTop + targetRect.top + boundaryOffset;
|
| chrome.gpuBenchmarking.pointerActionSequence( [
|
| - {"source": "touch",
|
| - "actions": [
|
| - { "name": "pointerDown", "x": xPosition, "y": yPosition },
|
| - { "name": "pointerUp" }
|
| + {source: 'touch',
|
| + actions: [
|
| + { name: 'pointerDown', x: xPosition, y: yPosition },
|
| + { name: 'pointerUp' }
|
| + ]}], resolve);
|
| + } else {
|
| + reject();
|
| + }
|
| + });
|
| +}
|
| +
|
| +function twoPointerDragInTarget(pointerType, targetSelector, direction) {
|
| + return new Promise(function(resolve, reject) {
|
| + if (window.chrome && chrome.gpuBenchmarking) {
|
| + scrollPageIfNeeded(targetSelector, document);
|
| + var target = document.querySelector(targetSelector);
|
| + var targetRect = target.getBoundingClientRect();
|
| + var xPosition1 = targetRect.left + boundaryOffset + scrollOffset;
|
| + var yPosition1 = targetRect.top + boundaryOffset + scrollOffset;
|
| + var xPosition2 = xPosition1;
|
| + var yPosition2 = yPosition1;
|
| + var xPosition3 = xPosition1;
|
| + var yPosition3 = yPosition1;
|
| + if (direction == "down") {
|
| + yPosition1 -= scrollOffset;
|
| + yPosition3 += scrollOffset;
|
| + } else if (direction == "up") {
|
| + yPosition1 += scrollOffset;
|
| + yPosition3 -= scrollOffset;
|
| + } else if (direction == "right") {
|
| + xPosition1 -= scrollOffset;
|
| + xPosition3 += scrollOffset;
|
| + } else if (direction == "left") {
|
| + xPosition1 += scrollOffset;
|
| + xPosition3 -= scrollOffset;
|
| + } else {
|
| + throw("drag direction '" + direction + "' is not expected, direction should be 'down', 'up', 'left' or 'right'");
|
| + }
|
| +
|
| + chrome.gpuBenchmarking.pointerActionSequence( [
|
| + {source: pointerType,
|
| + actions: [
|
| + { name: 'pointerDown', x: xPosition1, y: yPosition1 },
|
| + { name: 'pointerMove', x: xPosition2, y: yPosition2 },
|
| + { name: 'pointerMove', x: xPosition3, y: yPosition3 },
|
| + { name: 'pause', duration: 0.1 },
|
| + { name: 'pointerUp' }
|
| + ]},
|
| + {source: pointerType,
|
| + actions: [
|
| + { name: 'pointerDown', x: xPosition1 + boundaryOffset, y: yPosition1 },
|
| + { name: 'pointerMove', x: xPosition2 + boundaryOffset, y: yPosition2 },
|
| + { name: 'pointerMove', x: xPosition3 + boundaryOffset, y: yPosition3 },
|
| + { name: 'pause', duration: 0.1 },
|
| + { name: 'pointerUp' }
|
| ]}], resolve);
|
| } else {
|
| reject();
|
| @@ -224,28 +274,36 @@ function pointerDragInTarget(pointerType, targetSelector, direction) {
|
| scrollPageIfNeeded(targetSelector, document);
|
| var target = document.querySelector(targetSelector);
|
| var targetRect = target.getBoundingClientRect();
|
| - var xPosition = targetRect.left + boundaryOffset;
|
| - var yPosition = targetRect.top + boundaryOffset;
|
| - var newXPosition = xPosition;
|
| - var newYPosition = yPosition;
|
| - if (direction == "down")
|
| - newYPosition += scrollOffset;
|
| - else if (direction == "up")
|
| - newYPosition -= scrollOffset;
|
| - else if (direction == "right")
|
| - newXPosition += scrollOffset;
|
| - else if (direction == "left")
|
| - newXPosition -= scrollOffset;
|
| - else
|
| + var xPosition1 = targetRect.left + boundaryOffset + scrollOffset;
|
| + var yPosition1 = targetRect.top + boundaryOffset + scrollOffset;
|
| + var xPosition2 = xPosition1;
|
| + var yPosition2 = yPosition1;
|
| + var xPosition3 = xPosition1;
|
| + var yPosition3 = yPosition1;
|
| + if (direction == "down") {
|
| + yPosition1 -= scrollOffset;
|
| + yPosition3 += scrollOffset;
|
| + } else if (direction == "up") {
|
| + yPosition1 += scrollOffset;
|
| + yPosition3 -= scrollOffset;
|
| + } else if (direction == "right") {
|
| + xPosition1 -= scrollOffset;
|
| + xPosition3 += scrollOffset;
|
| + } else if (direction == "left") {
|
| + xPosition1 += scrollOffset;
|
| + xPosition3 -= scrollOffset;
|
| + } else {
|
| throw("drag direction '" + direction + "' is not expected, direction should be 'down', 'up', 'left' or 'right'");
|
| + }
|
|
|
| chrome.gpuBenchmarking.pointerActionSequence( [
|
| - {"source": pointerType,
|
| - "actions": [
|
| - { "name": "pointerDown", "x": xPosition, "y": yPosition },
|
| - { "name": "pointerMove", "x": newXPosition, "y": newYPosition },
|
| - { "name": "pause", "duration": 0.1 },
|
| - { "name": "pointerUp" }
|
| + {source: pointerType,
|
| + actions: [
|
| + { name: 'pointerDown', x: xPosition1, y: yPosition1 },
|
| + { name: 'pointerMove', x: xPosition2, y: yPosition2 },
|
| + { name: 'pointerMove', x: xPosition3, y: yPosition3 },
|
| + { name: 'pause', duration: 0.1 },
|
| + { name: 'pointerUp' }
|
| ]}], resolve);
|
| } else {
|
| reject();
|
| @@ -280,23 +338,23 @@ function pinchZoomInTarget(targetSelector, scale) {
|
| pointerAction1.actions = [];
|
| pointerAction2.actions = [];
|
| pointerAction1.actions.push(
|
| - {'name': 'pointerDown', 'x': xPosition, 'y': yPosition1});
|
| + {name: 'pointerDown', x: xPosition, y: yPosition1});
|
| pointerAction2.actions.push(
|
| - {'name': 'pointerDown', 'x': xPosition, 'y': yPosition2});
|
| + {name: 'pointerDown', x: xPosition, y: yPosition2});
|
| for (var offset = 10; offset < 80; offset += 10) {
|
| pointerAction1.actions.push({
|
| - 'name': 'pointerMove',
|
| - 'x': xPosition,
|
| - 'y': (yPosition1 - offset)
|
| + name: 'pointerMove',
|
| + x: xPosition,
|
| + y: (yPosition1 - offset)
|
| });
|
| pointerAction2.actions.push({
|
| - 'name': 'pointerMove',
|
| - 'x': xPosition,
|
| - 'y': (yPosition2 + offset)
|
| + name: 'pointerMove',
|
| + x: xPosition,
|
| + y: (yPosition2 + offset)
|
| });
|
| }
|
| - pointerAction1.actions.push({'name': 'pointerUp'});
|
| - pointerAction2.actions.push({'name': 'pointerUp'});
|
| + pointerAction1.actions.push({name: 'pointerUp'});
|
| + pointerAction2.actions.push({name: 'pointerUp'});
|
| chrome.gpuBenchmarking.pointerActionSequence(pointerActions, resolve);
|
| } else {
|
| reject();
|
| @@ -309,9 +367,9 @@ function penMoveToDocument() {
|
| return new Promise(function(resolve, reject) {
|
| if (window.chrome && chrome.gpuBenchmarking) {
|
| chrome.gpuBenchmarking.pointerActionSequence( [
|
| - {"source": "pen",
|
| - "actions": [
|
| - { "name": "pointerMove", "x": 0, "y": 0 }
|
| + {source: 'pen',
|
| + actions: [
|
| + { name: 'pointerMove', x: 0, y: 0 }
|
| ]}], resolve);
|
| } else {
|
| reject();
|
| @@ -336,9 +394,9 @@ function penMoveIntoTarget(targetSelector, targetFrame) {
|
| var xPosition = frameLeft + targetRect.left + boundaryOffset;
|
| var yPosition = frameTop + targetRect.top + boundaryOffset;
|
| chrome.gpuBenchmarking.pointerActionSequence( [
|
| - {"source": "pen",
|
| - "actions": [
|
| - { "name": "pointerMove", "x": xPosition, "y": yPosition }
|
| + {source: 'pen',
|
| + actions: [
|
| + { name: 'pointerMove', x: xPosition, y: yPosition }
|
| ]}], resolve);
|
| } else {
|
| reject();
|
| @@ -364,11 +422,11 @@ function penClickInTarget(targetSelector, targetFrame) {
|
| var xPosition = frameLeft + targetRect.left + boundaryOffset;
|
| var yPosition = frameTop + targetRect.top + boundaryOffset;
|
| chrome.gpuBenchmarking.pointerActionSequence( [
|
| - {"source": "pen",
|
| - "actions": [
|
| - { "name": "pointerMove", "x": xPosition, "y": yPosition },
|
| - { "name": "pointerDown", "x": xPosition, "y": yPosition },
|
| - { "name": "pointerUp" }
|
| + {source: 'pen',
|
| + actions: [
|
| + { name: 'pointerMove', x: xPosition, y: yPosition },
|
| + { name: 'pointerDown', x: xPosition, y: yPosition },
|
| + { name: 'pointerUp' }
|
| ]}], resolve);
|
| } else {
|
| reject();
|
|
|