Commit f65f9d0c authored by David Bokan's avatar David Bokan Committed by Commit Bot

Move autoscroll-over-scrollbar.html to scrolling/

This test is currently running in the main-thread scrolling path only.
This CL modernizes the test to ensure it runs in both main and
compositor threaded modes.

Bug: 915926
Change-Id: Ia58cd94f5e6bcdd8b55fc2282f7d009936f034ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442104Reviewed-by: default avatarRahul Arakeri <arakeri@microsoft.com>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812831}
parent 362ca055
<!DOCTYPE HTML> <!DOCTYPE HTML>
<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/gesture-util.js"></script>
<script src="../../resources/compositor-controls.js"></script> <script src="../../resources/compositor-controls.js"></script>
<style> <style>
body { body {
...@@ -27,36 +28,14 @@ ...@@ -27,36 +28,14 @@
<script> <script>
setAnimationRequiresRaster(); setAnimationRequiresRaster();
var scrollable = document.getElementById('scrollable'); var scrollable = document.getElementById('scrollable');
function autoScroll(start_x, start_y, end_x, end_y) { async function autoScroll(start_x, start_y, end_x, end_y) {
return new Promise((resolve, reject) => { const MIDDLE_BUTTON = 1;
if (!window.eventSender) { await mouseMoveTo(start_x, start_y);
reject(); await mouseClickOn(start_x, start_y, MIDDLE_BUTTON);
} else { await mouseMoveTo(end_x, end_y);
const MIDDLE_BUTTON = 1;
eventSender.mouseMoveTo(start_x, start_y);
eventSender.mouseDown(MIDDLE_BUTTON);
eventSender.mouseUp(MIDDLE_BUTTON);
eventSender.mouseMoveTo(end_x, end_y);
resolve();
}
});
} }
function waitForScrollAndCheck() { promise_test(async t => {
const MAX_FRAME = 500;
return new Promise((resolve, reject) => {
function tick(frames) {
// We requestAnimationFrame either for 500 frames or until scrollable scrolls.
if (frames >= MAX_FRAME || scrollable.scrollTop > 0)
resolve();
else
requestAnimationFrame(tick.bind(this, frames + 1));
}
tick(0);
});
}
promise_test(t => {
const MIDDLE_CLICK_AUTOSCROLL_RADIUS = 15; // from blink::kNoMiddleClickAutoscrollRadius const MIDDLE_CLICK_AUTOSCROLL_RADIUS = 15; // from blink::kNoMiddleClickAutoscrollRadius
var rect = scrollable.getBoundingClientRect(); var rect = scrollable.getBoundingClientRect();
var startX = rect.right - 5; var startX = rect.right - 5;
...@@ -64,11 +43,10 @@ promise_test(t => { ...@@ -64,11 +43,10 @@ promise_test(t => {
var endX = startX; var endX = startX;
var endY = startY + 2 * MIDDLE_CLICK_AUTOSCROLL_RADIUS; var endY = startY + 2 * MIDDLE_CLICK_AUTOSCROLL_RADIUS;
assert_equals(scrollable.scrollTop, 0); assert_equals(scrollable.scrollTop, 0);
return autoScroll(startX, startY, endX, endY) await autoScroll(startX, startY, endX, endY);
.then(waitForScrollAndCheck) await waitUntil(() => {return scrollable.scrollTop > 0;});
.then(() => {
assert_greater_than(scrollable.scrollTop, 0); assert_greater_than(scrollable.scrollTop, 0);
});
}); });
</script> </script>
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