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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js

Issue 2348183003: Test synthetic pointer action on pointer event tests (Closed)
Patch Set: pointer event tests Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js b/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js
index c95af4ca9c5a9e80c1ba41974e6ba1d6d68c0171..6a4682ac79a6ed066f4eb30f3b57054307794a1e 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt_automation/pointerevents/pointerevent_common_input.js
@@ -4,6 +4,9 @@ const scrollOffset = 30;
const boundaryOffset = 5;
const touchSourceType = 1;
+var xPosition = 0;
+var yPosition = 0;
+
function delayPromise(delay) {
return new Promise(function(resolve, reject) {
window.setTimeout(resolve, delay);
@@ -140,7 +143,18 @@ function touchTapInTarget(targetSelector, targetFrame) {
scrollPageIfNeeded(targetSelector, targetDocument);
var target = targetDocument.querySelector(targetSelector);
var targetRect = target.getBoundingClientRect();
- chrome.gpuBenchmarking.tap(frameLeft + targetRect.left + boundaryOffset, frameTop + targetRect.top + boundaryOffset, resolve);
+ xPosition = frameLeft + targetRect.left + boundaryOffset;
+ yPosition = frameTop + targetRect.top + boundaryOffset;
+ chrome.gpuBenchmarking.pointerActionSequence( {
+ "source": "touch",
+ "pointer": [
+ {
+ "id": 1,
+ "actions": [
+ { "name": "pointerDown", "x": xPosition, "y": yPosition },
+ { "name": "pointerUp" }
+ ]
+ }]}, resolve);
} else {
reject();
}
@@ -153,8 +167,38 @@ function touchScrollInTarget(targetSelector, direction) {
scrollPageIfNeeded(targetSelector, document);
var target = document.querySelector(targetSelector);
var targetRect = target.getBoundingClientRect();
- chrome.gpuBenchmarking.smoothScrollBy(scrollOffset, resolve,
- targetRect.left + boundaryOffset, targetRect.top + boundaryOffset, touchSourceType, direction);
+ xPosition = targetRect.left + boundaryOffset;
+ 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 {
+ return false;
+ }
+ chrome.gpuBenchmarking.pointerActionSequence( {
+ "source": "touch",
+ "pointer": [
+ {
+ "id": 1,
+ "actions": [
+ { "name": "pointerDown", "x": xPosition, "y": yPosition },
+ { "name": "pointerMove", "x": newXPosition, "y": newYPosition },
+ { "name": "pause" },
+ { "name": "pause" },
+ { "name": "pause" },
+ { "name": "pause" },
+ { "name": "pause" },
+ { "name": "pause" },
+ { "name": "pointerUp" }
+ ]
+ }]}, resolve);
} else {
reject();
}
@@ -167,9 +211,38 @@ function pinchZoomInTarget(targetSelector, scale) {
scrollPageIfNeeded(targetSelector, document);
var target = document.querySelector(targetSelector);
var targetRect = target.getBoundingClientRect();
- chrome.gpuBenchmarking.pinchBy(scale, targetRect.left + (targetRect.width/2), targetRect.top + (targetRect.height/2), function() {
- resolve();
- });
+ xPosition = targetRect.left + (targetRect.width/2);
+ yPosition = targetRect.top + (targetRect.height/2);
+ chrome.gpuBenchmarking.pointerActionSequence( {
+ "source": "touch",
+ "pointer": [
+ {
+ "id": 1,
+ "actions": [
+ { "name": "pointerDown", "x": xPosition, "y": yPosition - 10},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition - 20},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition - 30},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition - 40},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition - 50},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition - 60},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition - 70},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition - 80},
+ { "name": "pointerUp" }
+ ]
+ }, {
+ "id": 2,
+ "actions": [
+ { "name": "pointerDown", "x": xPosition, "y": yPosition + 10},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition + 20},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition + 30},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition + 40},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition + 50},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition + 60},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition + 70},
+ { "name": "pointerMove", "x": xPosition, "y": yPosition + 80},
+ { "name": "pointerUp" }
+ ]
+ }]}, resolve);
} else {
reject();
}
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698