Commit 05b74973 authored by Lan Wei's avatar Lan Wei Committed by Chromium LUCI CQ

Simulate user inputs in pointerevent_fractional_coordinates.html

Use testdriver Action API to simulate mouse and touch actions in
pointerevents/pointerevent_fractional_coordinates.html.

Bug: 1145677
Change-Id: I8ec66844c7662a88b9e7cb3d792778e9b6df6f57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568605
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarLiviu Tinta <liviutinta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833597}
parent d6b8cdd1
...@@ -2038,8 +2038,6 @@ crbug.com/626703 [ Linux ] external/wpt/payment-method-basic-card/billing-addres ...@@ -2038,8 +2038,6 @@ crbug.com/626703 [ Linux ] external/wpt/payment-method-basic-card/billing-addres
crbug.com/626703 [ Mac ] external/wpt/payment-method-basic-card/billing-address-is-null-manual.https.html [ Skip ] crbug.com/626703 [ Mac ] external/wpt/payment-method-basic-card/billing-address-is-null-manual.https.html [ Skip ]
crbug.com/626703 [ Win ] external/wpt/payment-method-basic-card/billing-address-is-null-manual.https.html [ Skip ] crbug.com/626703 [ Win ] external/wpt/payment-method-basic-card/billing-address-is-null-manual.https.html [ Skip ]
crbug.com/626703 [ Win7 ] external/wpt/pointerevents/pointerevent_fractional_coordinates-manual.html [ Skip ]
crbug.com/626703 [ Linux ] external/wpt/payment-request/dynamically-change-shipping-options-manual.https.html [ Skip ] crbug.com/626703 [ Linux ] external/wpt/payment-request/dynamically-change-shipping-options-manual.https.html [ Skip ]
crbug.com/626703 [ Mac ] external/wpt/payment-request/dynamically-change-shipping-options-manual.https.html [ Skip ] crbug.com/626703 [ Mac ] external/wpt/payment-request/dynamically-change-shipping-options-manual.https.html [ Skip ]
crbug.com/626703 [ Win ] external/wpt/payment-request/dynamically-change-shipping-options-manual.https.html [ Skip ] crbug.com/626703 [ Win ] external/wpt/payment-request/dynamically-change-shipping-options-manual.https.html [ Skip ]
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script type="text/javascript" src="pointerevent_support.js"></script> <script type="text/javascript" src="pointerevent_support.js"></script>
<style> <style>
#innerFrame { #innerFrame {
...@@ -43,6 +46,48 @@ ...@@ -43,6 +46,48 @@
eventsRecieved[event.type] = true; eventsRecieved[event.type] = true;
} }
function testInputType(inputSource) {
const scale = 5;
const width = 3;
const height = 3;
var targetFrame = document.querySelector('#innerFrame');
var frameRect = targetFrame.getBoundingClientRect();
frameLeft = frameRect.left;
frameTop = frameRect.top;
target = [{x: 10, y: 10}, {x: 30, y: 50}, {x: 50, y: 30}]
xPosition = []
yPosition = []
for (var i = 0; i < target.length; i++) {
xPosition.push((target[i].x + width / 2.0) * scale + frameLeft);
yPosition.push((target[i].y + height / 2.0) * scale + frameTop);
}
return sendInputAt(inputSource, xPosition[0], yPosition[0]).then(function() {
return sendInputAt(inputSource, xPosition[1], yPosition[1]);
}).then(function() {
return sendInputAt(inputSource, xPosition[2], yPosition[2]);
});
}
function sendInputAt(inputSource, xPosition, yPosition) {
if (inputSource == "touch") {
return new test_driver.Actions()
.addPointer("touchPointer1", "touch")
.pointerMove(Math.ceil(xPosition), Math.ceil(yPosition))
.pointerDown()
.pointerMove(Math.ceil(xPosition + 1), Math.ceil(yPosition + 1))
.pointerUp()
.send();
} else {
return new test_driver.Actions()
.pointerMove(Math.ceil(xPosition), Math.ceil(yPosition))
.pointerDown()
.pointerUp()
.send();
}
}
function run() { function run() {
var test_pointerEvent = setup_pointerevent_test("pointerevent events in capturing", ALL_POINTERS); var test_pointerEvent = setup_pointerevent_test("pointerevent events in capturing", ALL_POINTERS);
var innerFrame = document.getElementById('innerFrame'); var innerFrame = document.getElementById('innerFrame');
...@@ -70,6 +115,12 @@ ...@@ -70,6 +115,12 @@
} }
}); });
}); });
testInputType("mouse").then(function() {
return testInputType("touch");
}).then(function() {
return testInputType("pen");
});
} }
</script> </script>
</head> </head>
......
importAutomationScript('/pointerevents/pointerevent_common_input.js');
const scale = 5;
const width = 3;
const height = 3;
function inject_input() {
return testInputType("mouse").then(function() {
return testInputType("touch");
}).then(function() {
return testInputType("pen");
});
}
function testInputType(inputSource) {
var targetFrame = document.querySelector('#innerFrame');
var frameRect = targetFrame.getBoundingClientRect();
frameLeft = frameRect.left;
frameTop = frameRect.top;
target = [{x: 10, y: 10}, {x: 30, y: 50}, {x: 50, y: 30}]
xPosition = []
yPosition = []
for (var i = 0; i < target.length; i++) {
xPosition.push((target[i].x + width / 2.0) * scale + frameLeft);
yPosition.push((target[i].y + height / 2.0) * scale + frameTop);
}
return sendInputAt(inputSource, xPosition[0], yPosition[0]).then(function() {
return sendInputAt(inputSource, xPosition[1], yPosition[1]);
}).then(function() {
return sendInputAt(inputSource, xPosition[2], yPosition[2]);
});
}
function sendInputAt(inputSource, xPosition, yPosition) {
if (inputSource == "touch") {
pointerActions = [{name: 'pointerDown', x: xPosition, y: yPosition},
{name: 'pointerMove', x: xPosition + 1, y: yPosition + 1},
{name: 'pointerUp'}]
}
else {
pointerActions = [{name: 'pointerMove', x: xPosition, y: yPosition},
{name: 'pointerDown', x: xPosition, y: yPosition},
{name: 'pointerUp'}]
}
return new Promise(function(resolve, reject) {
if (window.chrome && chrome.gpuBenchmarking) {
chrome.gpuBenchmarking.pointerActionSequence(
[{
source: inputSource,
actions: pointerActions
}],
resolve);
} else {
reject();
}
});
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment