Commit 202e04f1 authored by Camille Lamy's avatar Camille Lamy Committed by Commit Bot

Revert "Convert middleClickAutoscroll.js to use gpu benchmarking"

This reverts commit e186dbf7.

Reason for revert: Introduced flakyness in virtual/user-activation-v2/fast/events/middleClickAutoscroll-drag.html.

See https://crbug.com/891155

Original change's description:
> Convert middleClickAutoscroll.js to use gpu benchmarking
> 
> This cl converts middleClickAutoscroll.js and the middle click autoscroll
> layout tests that are using it to use gpu benchmarking.
> 
> Bug: 875945
> Change-Id: Ic5acb4367dd406de3e5897063bfe6b1b44e7daa6
> Reviewed-on: https://chromium-review.googlesource.com/1251901
> Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
> Commit-Queue: Sahel Sharify <sahel@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#595596}

TBR=nzolghadr@chromium.org,sahel@chromium.org

Change-Id: I108620182b4466997df7734f01718e102628fcf6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 875945
Reviewed-on: https://chromium-review.googlesource.com/1256923Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Commit-Queue: Camille Lamy <clamy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595818}
parent 0ba49762
PASS autoscroll started
Mouse cursor shape: type=SouthPanning hotSpot=0,0
PASS autoscroll stopped
PASS Mouse cursor cleared
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <html>
<script src="../../resources/testharness.js"></script> <head>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/gesture-util.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<style type="text/css"> <style type="text/css">
#scrollable { #scrollable {
height: 200px; height: 200px;
...@@ -11,21 +8,25 @@ ...@@ -11,21 +8,25 @@
font-size: 80px; font-size: 80px;
} }
</style> </style>
<script src="../../resources/js-test.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script> <script>
function start() { function start()
testSetUp({ {
description('Check pan scroll by click mouse');
testPanScroll({
'clickOrDrag': 'click', 'clickOrDrag': 'click',
'scrollable': $('scrollable'), 'scrollable': $('scrollable'),
}); });
} }
</script> </script>
</head>
<body onload="start()"> <body onload="start()">
<div id="container"> <div id="container">
<p id="description"></p> <p id="description"></p>
For manual testing, click middle button in scrollable and move around mouse pointer for scrolling, then click middle button again to stop scrolling. For manual testing, hold middle button in scrollable and move aroudn mouse pointer for scrolling, then release middle button to stop scrolling.
<div id="scrollable"></div> <div id="scrollable"></div>
</div> </div>
<div id="console"></div> <div id="console"></div>
</body> </body>
</html>
PASS autoscroll started
Mouse cursor shape: type=SouthPanning hotSpot=0,0
PASS autoscroll stopped
PASS Mouse cursor cleared
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <html>
<script src="../../resources/testharness.js"></script> <head>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/gesture-util.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<style type="text/css"> <style type="text/css">
#scrollable { #scrollable {
height: 200px; height: 200px;
...@@ -11,15 +8,19 @@ ...@@ -11,15 +8,19 @@
font-size: 80px; font-size: 80px;
} }
</style> </style>
<script src="../../resources/js-test.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script> <script>
function start() { function start()
testSetUp({ {
description('Check pan scroll by drag mouse');
testPanScroll({
'clickOrDrag': 'drag', 'clickOrDrag': 'drag',
'scrollable': $('scrollable'), 'scrollable': $('scrollable'),
}); });
} }
</script> </script>
</head>
<body onload="start()"> <body onload="start()">
<div id="container"> <div id="container">
<p id="description"></p> <p id="description"></p>
...@@ -28,3 +29,4 @@ For manual testing, hold middle button in scrollable and move aroudn mouse point ...@@ -28,3 +29,4 @@ For manual testing, hold middle button in scrollable and move aroudn mouse point
</div> </div>
<div id="console"></div> <div id="console"></div>
</body> </body>
</html>
PASS autoscroll started
Mouse cursor shape: type=SouthPanning hotSpot=0,0
PASS autoscroll stopped
PASS Mouse cursor cleared
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <html>
<script src="../../resources/testharness.js"></script> <head>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/gesture-util.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<style type="text/css"> <style type="text/css">
#scrollable { #scrollable {
height: 200px; height: 200px;
...@@ -11,22 +8,22 @@ ...@@ -11,22 +8,22 @@
font-size: 80px; font-size: 80px;
} }
</style> </style>
<script src="../../resources/js-test.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script> <script>
var mousedown_fired = false;
window.addEventListener('mousedown', function(event) { window.addEventListener('mousedown', function(event) {
mousedown_fired = true;
}); });
function start() { function start()
testSetUp({ {
description('Check pan scroll with mousedown event handler');
testPanScroll({
'clickOrDrag': 'drag', 'clickOrDrag': 'drag',
'scrollable': $('scrollable'), 'scrollable': $('scrollable'),
'finishTest': function() {
assert_true(mousedown_fired);
},
}); });
} }
</script> </script>
</head>
<body onload="start()"> <body onload="start()">
<div id="container"> <div id="container">
<p id="description"></p> <p id="description"></p>
...@@ -37,3 +34,4 @@ To test manually, try to pan scroll inside this div. ...@@ -37,3 +34,4 @@ To test manually, try to pan scroll inside this div.
</div> </div>
<div id="console"></div> <div id="console"></div>
</body> </body>
</html>
PASS autoscroll started
Mouse cursor shape: type=SouthPanning hotSpot=0,0
PASS autoscroll stopped
PASS Mouse cursor cleared
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <html>
<script src="../../resources/testharness.js"></script> <head>
<script src="../../resources/testharnessreport.js"></script> <script src="../../resources/js-test.js"></script>
<script src="../../resources/gesture-util.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script> <script src="./resources/middleClickAutoscroll.js"></script>
<script> <script>
function start() { function start() {
description('Check pan scroll in iframe');
var iframe = $('iframe'); var iframe = $('iframe');
var offsetLeft = iframe.offsetLeft; var offsetLeft = iframe.offsetLeft;
var offsetTop = iframe.offsetTop; var offsetTop = iframe.offsetTop;
testSetUp({ testPanScroll({
'clickOrDrag': 'click', 'clickOrDrag': 'click',
'endX': offsetLeft + 5, 'endX': offsetLeft + 5,
'endY': offsetTop + 50, 'endY': offsetTop + 50,
'scrollable': iframe.contentDocument.body, 'scrollable': iframe.contentDocument.body,
'scrolledObject': iframe.contentWindow.document.scrollingElement, 'scrolledObject': iframe.contentWindow,
'startX': offsetLeft + 5, 'startX': offsetLeft + 5,
'startY': offsetTop + 5, 'startY': offsetTop + 5,
}); });
} }
</script> </script>
</head>
<body onload="start()"> <body onload="start()">
<div id="container"> <div id="container">
<p id="description"></p> <p id="description"></p>
<iframe id="iframe" width="640" height="100"></iframe> <iframe id="iframe" width="640" height="100"></iframe>
</div> </div>
</body> </body>
</html>
PASS autoscroll started
Mouse cursor shape: type=SouthPanning hotSpot=0,0
PASS autoscroll stopped
PASS Mouse cursor cleared
PASS successfullyParsed is true
TEST COMPLETE
Top of outer div.
Inner div.
Bottom of outer div.
Test for bug 232965 This tests that vertical pan scrolling does not propagate from the inner div to the outer div when the outer div has no vertical overflow.
PASS autoscroll started
Mouse cursor shape: type=NorthEastPanning hotSpot=0,0
PASS autoscroll stopped
PASS Mouse cursor cleared
PASS outerdiv.scrollLeft is not 0
PASS outerdiv.scrollTop is 0
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../resources/testharness.js"></script> <html>
<script src="../../resources/testharnessreport.js"></script> <head>
<script src="../../resources/gesture-util.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<style type="text/css"> <style type="text/css">
div { div {
line-height: 50px; line-height: 50px;
...@@ -18,17 +16,20 @@ div { ...@@ -18,17 +16,20 @@ div {
padding: 5px; padding: 5px;
} }
</style> </style>
<script src="../../resources/js-test.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script> <script>
function start() { function start()
{
outerdiv = $('outerdiv'); outerdiv = $('outerdiv');
testSetUp({ testPanScroll({
'clickOrDrag': 'drag', 'clickOrDrag': 'drag',
'endX': 225, 'endX': 225,
'endY': 75, 'endY': 75,
'finishTest': function() { 'finishTest': function() {
assert_not_equals(outerdiv.scrollLeft, 0); shouldNotBe('outerdiv.scrollLeft', '0');
assert_equals(outerdiv.scrollTop, 0); shouldBeZero('outerdiv.scrollTop');
}, },
'scrollable': outerdiv, 'scrollable': outerdiv,
'startX': 150, 'startX': 150,
...@@ -36,6 +37,7 @@ function start() { ...@@ -36,6 +37,7 @@ function start() {
}); });
} }
</script> </script>
</head>
<body onload="start()"> <body onload="start()">
<div id="outerdiv"> <div id="outerdiv">
<p>Top of outer div.</p> <p>Top of outer div.</p>
...@@ -47,3 +49,4 @@ function start() { ...@@ -47,3 +49,4 @@ function start() {
<p>Test for <a href="http://crbug.com/232965">bug 232965</a> This tests that vertical pan scrolling does not propagate from the inner div to the outer div when the outer div has no vertical overflow.</p> <p>Test for <a href="http://crbug.com/232965">bug 232965</a> This tests that vertical pan scrolling does not propagate from the inner div to the outer div when the outer div has no vertical overflow.</p>
<div id="console"></div> <div id="console"></div>
</body> </body>
</html>
<!DOCTYPE html> <html>
<script src="../../resources/testharness.js"></script> <head>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/gesture-util.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<style type="text/css"> <style type="text/css">
#scrollable { #scrollable {
width:500px; width:500px;
height:300px; height:300px;
overflow:auto; overflow:auto;
border:2px solid red; border:2px solid red;
padding:10px; padding:10px";
} }
</style> </style>
<script src="../../resources/js-test.js"></script>
<script src="./resources/middleClickAutoscroll.js"></script>
<script> <script>
function start() { function start()
testSetUp({ {
description('Check pan scroll in nested divs');
testPanScroll({
'clickOrDrag': 'click', 'clickOrDrag': 'click',
'scrollable': $('scrollable'), 'scrollable': $('scrollable'),
}); });
} }
</script> </script>
</head>
<body onload="start()"> <body onload="start()">
<div id="container"> <div id="container">
<p id="description"></p> <p id="description"></p>
...@@ -41,4 +41,6 @@ propagates correctly up the DOM tree. On success, our scroll offset should be no ...@@ -41,4 +41,6 @@ propagates correctly up the DOM tree. On success, our scroll offset should be no
</div> </div>
</div> </div>
</div> </div>
<div id="console"></div>
</body> </body>
</html>
var autoscrollInterval = 50;
var middleButton = 1;
var middleClickAutoscrollRadius = 15; // from FrameView::noPanScrollRadius var middleClickAutoscrollRadius = 15; // from FrameView::noPanScrollRadius
var waitTimeBeforeMoveInSeconds = 0.1;
var scrollable;
var scrolledObject;
var startX;
var startY;
var endX;
var endY;
var autoscrollParam;
function $(id) { window.jsTestIsAsync = true;
function $(id)
{
return document.getElementById(id); return document.getElementById(id);
} }
function testSetUp(param) { function testPanScroll(param)
scrollable = param.scrollable; {
scrolledObject = param.scrolledObject || scrollable; function finishTest()
startX = param.startX || scrollable.offsetLeft + 5; {
startY = param.startY || scrollable.offsetTop + 5; if ($('container'))
endX = param.endX || scrollable.offsetLeft + 5; $('container').innerHTML = '';
endY = param.endY || scrollable.offsetTop + middleClickAutoscrollRadius + 6; if (param.finishTest)
autoscrollParam = param; param.finishTest();
if (window.finishJSTest) {
finishJSTest();
return;
}
if (window.testRunner)
testRunner.notifyDone();
}
var scrollable = param.scrollable;
var scrolledObject = param.scrolledObject || scrollable;
if (!scrollable.innerHTML) { if (!scrollable.innerHTML) {
for (var i = 0; i < 100; ++i) { for (var i = 0; i < 100; ++i) {
var line = document.createElement('div'); var line = document.createElement('div');
...@@ -27,39 +35,56 @@ function testSetUp(param) { ...@@ -27,39 +35,56 @@ function testSetUp(param) {
scrollable.appendChild(line); scrollable.appendChild(line);
} }
} }
promise_test (async () => {
// Start atuoscrolling. var noModeScroll = false;
if (autoscrollParam.clickOrDrag == 'click') { var scrolled = false;
await mouseMoveTo(startX, startY);
await mouseClickOn(startX, startY, 'middle'); scrolledObject.onscroll = function() {
await mouseMoveTo(endX, endY); if (noModeScroll) {
} else { testFailed('still autoscroll');
assert_equals('drag', autoscrollParam.clickOrDrag); finishTest();
mouseDragAndDrop(startX, startY, endX, endY, 'middle', return;
waitTimeBeforeMoveInSeconds);
} }
// Wait for some scrolling, then end the autoscroll. if (scrolled)
await waitFor(() => { return;
return scrolledObject.scrollTop > 0 || scrolledObject.scrollLeft > 0; scrolled = true;
}); testPassed('autoscroll started');
if (autoscrollParam.clickOrDrag == 'click') var cursorInfo = internals.getCurrentCursorInfo();
await mouseClickOn(endX, endY, 'middle'); debug("Mouse cursor shape: " + cursorInfo);
if (window.eventSender) {
if (param.clickOrDrag == 'click')
eventSender.mouseDown(middleButton);
eventSender.mouseUp(middleButton);
}
};
// Wait for the cursor shape to go back to normal. scrollable.ownerDocument.onmouseup = function(e) {
await waitFor(() => { if (!scrolled || e.button != middleButton)
return;
noMoreScroll = true;
window.setTimeout(function() {
testPassed('autoscroll stopped');
var cursorInfo = internals.getCurrentCursorInfo(); var cursorInfo = internals.getCurrentCursorInfo();
return cursorInfo == "type=Pointer hotSpot=0,0" || if (cursorInfo == "type=Pointer hotSpot=0,0" || cursorInfo == "type=IBeam hotSpot=0,0")
cursorInfo == "type=IBeam hotSpot=0,0"; testPassed('Mouse cursor cleared');
}); else
testFailed('Mouse cursor shape: ' + cursorInfo);
finishTest(); finishTest();
}); }, autoscrollInterval * 2);
} };
function finishTest() { if (!window.eventSender)
if ($('container')) return;
$('container').innerHTML = ''; var startX = param.startX || scrollable.offsetLeft + 5;
if (autoscrollParam.finishTest) var startY = param.startY || scrollable.offsetTop + 5;
autoscrollParam.finishTest(); var endX = param.endX || scrollable.offsetLeft + 5;
var endY = param.endY || scrollable.offsetTop + middleClickAutoscrollRadius + 6;
eventSender.mouseMoveTo(startX, startY);
eventSender.mouseDown(middleButton);
if (param.clickOrDrag == 'click')
eventSender.mouseUp(middleButton);
eventSender.mouseMoveTo(endX, endY);
} }
...@@ -242,7 +242,7 @@ function mousePressOn(x, y, t) { ...@@ -242,7 +242,7 @@ function mousePressOn(x, y, t) {
// Simulate a mouse drag and drop. mouse down at {start_x, start_y}, move to // Simulate a mouse drag and drop. mouse down at {start_x, start_y}, move to
// {end_x, end_y} and release. // {end_x, end_y} and release.
function mouseDragAndDrop(start_x, start_y, end_x, end_y, button = 'left', t = 0) { function mouseDragAndDrop(start_x, start_y, end_x, end_y, button = 'left') {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (chrome && chrome.gpuBenchmarking) { if (chrome && chrome.gpuBenchmarking) {
let pointerActions = [{ let pointerActions = [{
...@@ -250,9 +250,7 @@ function mouseDragAndDrop(start_x, start_y, end_x, end_y, button = 'left', t = 0 ...@@ -250,9 +250,7 @@ function mouseDragAndDrop(start_x, start_y, end_x, end_y, button = 'left', t = 0
actions: [ actions: [
{ 'name': 'pointerMove', 'x': start_x, 'y': start_y }, { 'name': 'pointerMove', 'x': start_x, 'y': start_y },
{ 'name': 'pointerDown', 'x': start_x, 'y': start_y, 'button': button }, { 'name': 'pointerDown', 'x': start_x, 'y': start_y, 'button': button },
{ 'name': 'pause', 'duration': t},
{ 'name': 'pointerMove', 'x': end_x, 'y': end_y }, { 'name': 'pointerMove', 'x': end_x, 'y': end_y },
{ 'name': 'pause', 'duration': t},
{ 'name': 'pointerUp', 'button': button }, { 'name': 'pointerUp', 'button': button },
] ]
}]; }];
......
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