Commit abe21f39 authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

Change some of the scroll-behavior Layouttests to use gpu benchmarking.

Bug: 846424
Change-Id: I8162eb0abaeed40a75638165c71a2306c99e8d3d
Reviewed-on: https://chromium-review.googlesource.com/1097943
Commit-Queue: Sahel Sharifymoghaddam <sahel@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569045}
parent 8b04a211
...@@ -2342,9 +2342,8 @@ crbug.com/574283 [ Mac ] virtual/threaded/fast/scroll-behavior/smooth-scroll/mai ...@@ -2342,9 +2342,8 @@ crbug.com/574283 [ Mac ] virtual/threaded/fast/scroll-behavior/smooth-scroll/mai
crbug.com/574283 [ Mac ] virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html [ Skip ] crbug.com/574283 [ Mac ] virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html [ Skip ]
crbug.com/665577 virtual/threaded/fast/scroll-behavior/overflow-scroll-root-frame-animates.html [ Pass Timeout ] crbug.com/665577 virtual/threaded/fast/scroll-behavior/overflow-scroll-root-frame-animates.html [ Pass Timeout ]
crbug.com/665577 virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll.html [ Pass Failure ]
crbug.com/665577 [ Linux Win ] virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html [ Pass Failure Timeout ] crbug.com/665577 [ Linux Win ] virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html [ Pass Failure Timeout ]
crbug.com/665577 [ Linux Win Mac ] virtual/threaded/fast/scroll-behavior/smooth-scroll/track-scroll.html [ Pass Failure Crash ] crbug.com/665577 [ Mac ] virtual/threaded/fast/scroll-behavior/smooth-scroll/track-scroll.html [ Pass Failure ]
crbug.com/599670 [ Win ] http/tests/devtools/resource-parameters-ipv6.js [ Pass Failure ] crbug.com/599670 [ Win ] http/tests/devtools/resource-parameters-ipv6.js [ Pass Failure ]
crbug.com/472330 fast/borders/border-image-outset-split-inline-vertical-lr.html [ Failure ] crbug.com/472330 fast/borders/border-image-outset-split-inline-vertical-lr.html [ Failure ]
...@@ -3818,7 +3817,6 @@ crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/horizontal- ...@@ -3818,7 +3817,6 @@ crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/horizontal-
crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html [ Skip ] crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html [ Skip ]
crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/ongoing-smooth-scroll-anchors.html [ Skip ] crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/ongoing-smooth-scroll-anchors.html [ Skip ]
crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/ongoing-smooth-scroll-vertical-rl-anchors.html [ Skip ] crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/ongoing-smooth-scroll-vertical-rl-anchors.html [ Skip ]
crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/scroll-during-selection.html [ Skip ]
crbug.com/766357 virtual/threaded/fast/scroll-behavior/wheel-and-touch-scroll-use-count.html [ Pass Failure ] crbug.com/766357 virtual/threaded/fast/scroll-behavior/wheel-and-touch-scroll-use-count.html [ Pass Failure ]
......
This is a test for http://crbug.com/516245. It ensures that pinch-zooming and selecting doesn't autoscroll the page. To manually test, on Mac, pinch-zoom in and select text below. The page should not autoscroll.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Scroll offset did not change when text selected.
PASS successfullyParsed is true
TEST COMPLETE
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
height: 1000px; height: 1000px;
} }
</style> </style>
<script src="../../resources/js-test.js"></script> <script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/gesture-util.js"></script>
<div id="content"> <div id="content">
<span id="select">This text is selected.</span> <span id="select">This text is selected.</span>
...@@ -13,45 +15,32 @@ ...@@ -13,45 +15,32 @@
<script type="text/javascript"> <script type="text/javascript">
var scrollTopBefore; var scrollTopBefore;
var element = document.getElementById('select');
jsTestIsAsync = true;
description("This is a test for http://crbug.com/516245. It ensures that pinch-zooming and selecting doesn't autoscroll the page. To manually test, on Mac, pinch-zoom in and select text below. The page should not autoscroll.");
function finishTest() {
eventSender.mouseUp();
if (document.scrollingElement.scrollTop == scrollTopBefore) {
testPassed("Scroll offset did not change when text selected.");
} else {
testFailed("Scroll offset changed when text selected.");
}
document.getElementById('content').style.display = 'none';
finishJSTest();
}
function MouseWheelHandler(e) { function MouseWheelHandler(e) {
return false; return false;
} }
// The autoscroll bug happens when there is a mousewheel event listener on
// the page.
element.addEventListener("mousewheel", MouseWheelHandler, false);
window.onload = function () { promise_test (async () => {
var element = document.getElementById('select'); if (window.internals && internals.setPageScaleFactor(2.5) &&
// The autoscroll bug happens when there is a mousewheel event listener on internals.setVisualViewportOffset(0, 30.2)) {
// the page.
element.addEventListener("mousewheel", MouseWheelHandler, false);
if (window.internals && internals.magnifyScaleAroundAnchor(2.5, 0, 30.2)) {
element.scrollIntoView(); element.scrollIntoView();
scrollTopBefore = document.scrollingElement.scrollTop; scrollTopBefore = document.scrollingElement.scrollTop;
var y = element.offsetHeight / 2; var y = element.offsetHeight / 2;
var endX = element.offsetWidth + 100; var endX = element.offsetWidth + 100;
eventSender.dragMode = false; await mouseMoveTo(element.offsetLeft, y);
eventSender.mouseMoveTo(element.offsetLeft, y); await mouseDownAt(element.offsetLeft, y);
eventSender.mouseDown(); await mouseMoveTo(endX - 30, y);
eventSender.mouseMoveTo(endX - 30, y); await mouseMoveTo(endX, y);
eventSender.mouseMoveTo(endX, y);
// Wait for the autoscroll timer to fire. // Wait for the autoscroll timer to fire.
window.requestAnimationFrame(finishTest); await waitForCompositorCommit();
assert_equals(document.scrollingElement.scrollTop, scrollTopBefore);
document.getElementById('content').style.display = 'none';
} }
} }, "This is a test for http://crbug.com/516245. It ensures that pinch-zooming" +
" and selecting doesn't autoscroll the page. To manually test, on Mac" +
" pinch-zoom in and select text below. The page should not autoscroll.");
</script> </script>
This test ensures that consecutive mouse wheel ticks scroll to the right offset. The main purpose of this test is to ensure that smooth scrolling on the compositor works as intended (tested via virtual suite virtual/threaded/).
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.scrollingElement.scrollTop == 80 && document.scrollingElement.scrollLeft == 80 became true
PASS document.scrollingElement.scrollTop == 40 && document.scrollingElement.scrollLeft == 40 became true
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/js-test.js"></script> <script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<style> <style>
body { body {
height: 2000px; height: 2000px;
width: 2000px; width: 2000px;
} }
</style> </style>
<script> <script>
window.jsTestIsAsync = true; // Turn on smooth scrolling.
internals.settings.setScrollAnimatorEnabled(true);
description("This test ensures that consecutive mouse wheel ticks scroll\
to the right offset. The main purpose of this test is to ensure that\ var x = 20;
smooth scrolling on the compositor works as intended (tested via\ var y = 20;
virtual suite virtual/threaded/)."); var px_per_tick = 40;
var source = GestureSourceType.MOUSE_INPUT;
function testDiagonalScroll() {
// Reset promise_test(async () => {
document.scrollingElement.scrollTop = 0; // Scroll 3 ticks diagonally.
document.scrollingElement.scrollLeft = 0; await smoothScroll(3 * px_per_tick , x, y, source, 'downright',
SPEED_INSTANT);
eventSender.mouseMoveTo(20, 20); // Undo 2 ticks in each direction.
// Scroll 3 ticks diagonally. await smoothScroll(2 * px_per_tick, x, y, source, 'upleft',
eventSender.mouseScrollBy(-3, -3); SPEED_INSTANT);
// Undo 2 ticks in each direction.
eventSender.mouseScrollBy(2, 2); // 40px per tick.
// 40px per tick. await waitFor( () => {return document.scrollingElement.scrollTop == 40 &&
shouldBecomeEqual("document.scrollingElement.scrollTop == 40 && " + document.scrollingElement.scrollLeft == 40;});
"document.scrollingElement.scrollLeft == 40", "true", finishJSTest);
}
function runTest() {
if (!window.eventSender || !window.internals) {
finishJSTest();
return;
}
// Turn on smooth scrolling.
internals.settings.setScrollAnimatorEnabled(true);
eventSender.mouseMoveTo(20, 20);
// Scroll down 3 ticks.
eventSender.mouseScrollBy(0, -1);
eventSender.mouseScrollBy(0, -2);
// Scroll right 3 ticks.
eventSender.mouseScrollBy(-1, 0);
eventSender.mouseScrollBy(-2, 0);
// Undo 1 tick in each direction.
eventSender.mouseScrollBy(0, 1);
eventSender.mouseScrollBy(1, 0);
// 40px per tick.
shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " +
"document.scrollingElement.scrollLeft == 80", "true", testDiagonalScroll);
}
</script>
<body onload="runTest()"></body> // Undo the last tick in each direction to reset the scroll state before
// starting the second test.
await smoothScroll(1 * px_per_tick, x, y, source, 'upleft',
SPEED_INSTANT);
await waitFor( () => {return document.scrollingElement.scrollTop == 0 &&
document.scrollingElement.scrollLeft == 0;});
}, "This test ensures that consecutive mouse wheel ticks diagonally " +
"scroll to the right offset. The main purpose of this test is to " +
"ensure that smooth scrolling on the compositor works as intended " +
"(tested via virtual suite virtual/threaded/).");
promise_test(async () => {
// Scroll down 3 ticks.
await smoothScroll(1 * px_per_tick, x, y, source, 'down',
SPEED_INSTANT);
await smoothScroll(2 * px_per_tick, x, y, source, 'down',
SPEED_INSTANT);
// Scroll right 3 ticks.
await smoothScroll(1 * px_per_tick, x, y, source, 'right',
SPEED_INSTANT);
await smoothScroll(2 * px_per_tick, x, y, source, 'right',
SPEED_INSTANT);
// Undo 1 tick in each direction.
await smoothScroll(1 * px_per_tick, x, y, source, 'up',
SPEED_INSTANT);
await smoothScroll(1 * px_per_tick, x, y, source, 'left',
SPEED_INSTANT);
// 40px per tick.
await waitFor( () => {return document.scrollingElement.scrollTop == 80 &&
document.scrollingElement.scrollLeft == 80;});
}, "This test ensures that consecutive mouse wheel ticks vertically or " +
"horizontally scroll to the right offset. The main purpose of this " +
"test is to ensure that smooth scrolling on the compositor works as " +
"intended (tested via virtual suite virtual/threaded/).");
</script>
TEXT
This test verifies that text selection does not prevent smooth scrolls running on the main thread.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS scrollY became 40
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/js-test.js"></script> <script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<style> <style>
body { body {
height: 1000px; height: 1000px;
...@@ -19,21 +21,16 @@ body { ...@@ -19,21 +21,16 @@ body {
<div id="text">TEXT</div> <div id="text">TEXT</div>
<div id="console"></div> <div id="console"></div>
<script> <script>
promise_test (async () => {
// Start a text selection.
await mouseMoveTo(20, 20);
await mouseDownAt(20, 20);
await mouseMoveTo(40, 20);
var jsTestIsAsync = true; // Scroll before releasing the mouse.
await smoothScroll(40, 40, 20, GestureSourceType.MOUSE_INPUT, 'down',
description( SPEED_INSTANT);
"This test verifies that text selection does not prevent smooth " + await waitFor( () => {return scrollY == 40;});
}, "This test verifies that text selection does not prevent smooth " +
"scrolls running on the main thread."); "scrolls running on the main thread.");
eventSender.dragMode = false;
// Start a text selection.
eventSender.mouseMoveTo(20, 20);
eventSender.mouseDown();
eventSender.mouseMoveTo(40, 20);
eventSender.mouseScrollBy(0, -1);
shouldBecomeEqual("scrollY", "40", finishJSTest);
</script> </script>
This test scrolls by clicking in the scrollbar track.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS scrollY became pageStep
PASS scrollY is pageStep
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/js-test.js"></script> <script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<style> <style>
body { body {
height: 1800px; height: 1800px;
...@@ -7,41 +9,24 @@ body { ...@@ -7,41 +9,24 @@ body {
</style> </style>
<body> <body>
<script> <script>
window.jsTestIsAsync = true;
description("This test scrolls by clicking in the scrollbar track.");
// Compute ScrollableArea::pageStep. // Compute ScrollableArea::pageStep.
var pageStep = innerHeight * 0.875; var pageStep = innerHeight * 0.875;
if (navigator.userAgent.indexOf("Mac OS X") >= 0) if (navigator.userAgent.indexOf("Mac OS X") >= 0)
pageStep = Math.max(pageStep, innerHeight - 40); pageStep = Math.max(pageStep, innerHeight - 40);
onload = function() { // Turn on smooth scrolling.
if (!window.eventSender || !window.internals) { internals.settings.setScrollAnimatorEnabled(true);
finishJSTest();
return;
}
// Turn on smooth scrolling.
internals.settings.setScrollAnimatorEnabled(true);
promise_test(async () => {
// Click in the vertical scrollbar track, below the thumb. // Click in the vertical scrollbar track, below the thumb.
eventSender.mouseMoveTo(790, 280); await mouseClickOn(790, 280);
eventSender.mouseDown();
eventSender.mouseUp();
// A second click should have no effect since we will be under the thumb // A second click should have no effect since we will be under the thumb
// by the time the animation completes. // by the time the animation completes.
eventSender.mouseDown(); await mouseClickOn(790, 280);
eventSender.mouseUp();
shouldBecomeEqual("scrollY", "pageStep", function() { await waitFor( () => {return scrollY == pageStep;});
requestAnimationFrame(function() { }, 'This test scrolls by clicking in the scrollbar track.');
// Make sure we stopped here.
shouldBe("scrollY", "pageStep");
finishJSTest();
});
});
};
</script> </script>
</body> </body>
...@@ -90,6 +90,34 @@ function mouseMoveTo(xPosition, yPosition) { ...@@ -90,6 +90,34 @@ function mouseMoveTo(xPosition, yPosition) {
}); });
} }
function mouseDownAt(xPosition, yPosition) {
return new Promise(function(resolve, reject) {
if (chrome && chrome.gpuBenchmarking) {
chrome.gpuBenchmarking.pointerActionSequence([
{source: 'mouse',
actions: [
{ name: 'pointerDown', x: xPosition, y: yPosition },
]}], resolve);
} else {
reject('This test requires chrome.gpuBenchmarking');
}
});
}
function mouseUpAt(xPosition, yPosition) {
return new Promise(function(resolve, reject) {
if (chrome && chrome.gpuBenchmarking) {
chrome.gpuBenchmarking.pointerActionSequence([
{source: 'mouse',
actions: [
{ name: 'pointerUp', x: xPosition, y: yPosition },
]}], resolve);
} else {
reject('This test requires chrome.gpuBenchmarking');
}
});
}
// Simulate a mouse click on point. // Simulate a mouse click on point.
function mouseClickOn(x, y) { function mouseClickOn(x, y) {
return new Promise((resolve, reject) => { return new Promise((resolve, 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