Commit cd6b3ed6 authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Use gpuBenchmarking to generate actions in transformed-events.html

After we finish the scroll unification, the scrolls happens mainly on
the compositor thread, and the scroll code in the main thread will be
removed. eventSender sends the scroll events to main thread, so it
would not work after the scroll unification. This CL we should replace
eventSender.mouseScrollBy with wheelTick which uses
gpuBenchmarking.smoothScrollByXY in
third_party/blink/web_tests/plugins/transformed-events.html and also
gpuBenchmarking.pointerActionSequence to generate touch, mouse and
gesture events.

Bug: 1047176
Change-Id: I08321de0e43cde7293ca017aae2270863af2401d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2262497
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785916}
parent 5ae0ff64
...@@ -18,6 +18,18 @@ Plugin received event: MouseMove ...@@ -18,6 +18,18 @@ Plugin received event: MouseMove
* 10.00, 10.00 * 10.00, 10.00
Plugin received event: MouseWheel Plugin received event: MouseWheel
* 10.00, 10.00 * 10.00, 10.00
Plugin received event: GestureScrollBegin
* 10.00, 10.00
Plugin received event: GestureScrollUpdate
* 10.00, 10.00
Plugin received event: GestureScrollEnd
* 10.00, 10.00
Plugin received event: TouchStart
* 10.00, 10.00: Pressed
Plugin received event: GestureTapDown
* 10.00, 10.00
Plugin received event: TouchEnd
* 10.00, 10.00: Released
Plugin received event: GestureShowPress Plugin received event: GestureShowPress
* 10.00, 10.00 * 10.00, 10.00
Plugin received event: GestureTap Plugin received event: GestureTap
...@@ -28,4 +40,7 @@ Plugin received event: MouseDown ...@@ -28,4 +40,7 @@ Plugin received event: MouseDown
* 10.00, 10.00 * 10.00, 10.00
Plugin received event: MouseUp Plugin received event: MouseUp
* 10.00, 10.00 * 10.00, 10.00
PASS successfullyParsed is true
TEST COMPLETE
<html> <html>
<head> <head>
<script src="../resources/js-test.js"></script>
<script src="../resources/gesture-util.js"></script>
<style> <style>
#plugin { #plugin {
width: 150px; width: 150px;
height: 150px; height: 150px;
touch-action: none;
background-color: coral;
transform: rotate(90deg); transform: rotate(90deg);
} }
</style> </style>
</head> </head>
<body> <body onload="runTest();">
<embed id="plugin" type="application/x-webkit-test-webplugin" accepts-touch="raw" print-event-details="true"></embed> <embed id="plugin" type="application/x-webkit-test-webplugin" accepts-touch="raw" print-event-details="true"></embed>
<script> <script>
jsTestIsAsync = true;
function touchTapAndMove(xPosition, yPosition, xPosition1, yPosition1) {
if (window.eventSender) {
eventSender.addTouchPoint(xPosition, yPosition);
eventSender.touchStart();
eventSender.updateTouchPoint(0, xPosition1, yPosition1);
eventSender.touchMove();
eventSender.releaseTouchPoint(0);
eventSender.touchEnd();
}
}
function mouseMoveAndClick(xPosition, yPosition, xPosition1, yPosition1) {
return new Promise(function(resolve, reject) {
if (window.chrome && chrome.gpuBenchmarking) {
chrome.gpuBenchmarking.pointerActionSequence( [
{source: 'mouse',
actions: [
{ name: 'pointerMove', x: xPosition, y: yPosition },
{ name: 'pointerDown', x: xPosition, y: yPosition },
{ name: 'pause', duration: 10 },
{ name: 'pointerMove', x: xPosition1, y: yPosition1 },
{ name: 'pointerUp' }
]}], resolve);
} else {
reject();
}
});
}
async function runTest() {
if (!window.testRunner || !window.eventSender) { if (!window.testRunner || !window.eventSender) {
document.write("This test requires DumpRenderTree."); document.write("This test requires DumpRenderTree.");
} else { } else {
...@@ -21,27 +56,20 @@ ...@@ -21,27 +56,20 @@
// Test touch events. // Test touch events.
var positionX = plugin.offsetLeft + plugin.offsetWidth - 10; var positionX = plugin.offsetLeft + plugin.offsetWidth - 10;
var positionY = plugin.offsetTop + 10; var positionY = plugin.offsetTop + 10;
eventSender.addTouchPoint(positionX, positionY); touchTapAndMove(positionX, positionY, positionX - 5, positionY + 10);
eventSender.touchStart();
eventSender.updateTouchPoint(0, positionX - 5, positionY + 10);
eventSender.touchMove();
eventSender.releaseTouchPoint(0);
eventSender.touchEnd();
// Test mouse events. // Test mouse events.
eventSender.mouseMoveTo(positionX, positionY); await mouseMoveAndClick(positionX, positionY, positionX - 5, positionY + 10);
eventSender.mouseDown();
eventSender.leapForward(10); // Test mouse wheel scroll.
eventSender.mouseMoveTo(positionX - 5, positionY + 10); var scroll_position = {x: positionX, y: positionY};
eventSender.mouseUp(); await wheelTick(1, 0, scroll_position);
eventSender.mouseMoveTo(positionX, positionY);
eventSender.mouseScrollBy(10, 0, false, false, 0, false);
// Test gesture events. // Test gesture events.
eventSender.gestureShowPress(positionX, positionY); await touchTapOn(positionX, positionY);
eventSender.gestureTap(positionX, positionY);
} }
finishJSTest();
}
</script> </script>
</body> </body>
</html> </html>
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