Commit 024d8515 authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

Reland "Adapt scroll-visual-viewport-send-boundary-events.html to run with a compositor"

This is a reland of ec54e1ca

Original change's description:
> Adapt scroll-visual-viewport-send-boundary-events.html to run with a compositor
> 
> Since this test uses chrome.gpuBenchmarking.pinchBy, we need to have
> it run with a compositor. As part of issue 787924, we will no longer
> handle gesture pinch events on the main thread.
> 
> Bug: 787924
> Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
> Change-Id: I0127028f246ae72a772ef8c9f163b4403b6c3036
> Reviewed-on: https://chromium-review.googlesource.com/1068625
> Commit-Queue: Kevin McNee <mcnee@chromium.org>
> Reviewed-by: Ella Ge <eirage@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#560831}

Bug: 787924
Change-Id: I1d662bb8855ac32226cfd149c58b80d318e9adb7
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Reviewed-on: https://chromium-review.googlesource.com/1071807Reviewed-by: default avatarKevin McNee <mcnee@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561536}
parent f456c792
......@@ -228,7 +228,8 @@ crbug.com/836913 virtual/threaded/fast/scrolling/hover-during-scroll.html [ Fail
crbug.com/841567 virtual/threaded/fast/scrolling/listbox-wheel-event.html [ Failure Pass Crash ]
crbug.com/836913 virtual/threaded/fast/scrolling/overflow-scrollability.html [ Failure Pass ]
crbug.com/836913 virtual/threaded/fast/scrolling/overlay-scrollbars.html [ Failure Crash ]
crbug.com/845635 fast/events/scroll-visual-viewport-send-boundary-events.html [ Crash ]
crbug.com/845635 fast/events/pinch/scroll-visual-viewport-send-boundary-events.html [ Crash ]
crbug.com/845635 virtual/threaded/fast/events/pinch/scroll-visual-viewport-send-boundary-events.html [ Failure Crash ]
# These visual viewport tests should pass.
Bug(none) external/wpt/visual-viewport [ Pass ]
......
......@@ -1038,6 +1038,7 @@ crbug.com/667946 fast/compositor-wheel-scroll-latching/animated-scroll/touchpad-
Bug(none) virtual/threaded/http/tests/devtools/ [ Skip ]
Bug(none) virtual/threaded/fast/events/pinch/gesture-pinch-zoom-scroll-bubble.html [ Failure Crash ]
Bug(none) virtual/threaded/fast/events/pinch/gesture-pinch-zoom-prevent-in-handler.html [ Failure Crash ]
Bug(none) virtual/threaded/fast/events/pinch/scroll-visual-viewport-send-boundary-events.html [ Failure Crash ]
Bug(none) virtual/threaded/fast/events/pointerevents/pinch/pointerevent_touch-action-pinch_zoom_touch.html [ Pass Failure ]
Bug(none) virtual/threaded/fast/scroll-behavior/ [ Skip ]
Bug(none) virtual/threaded/compositing/visibility/layer-visible-content.html [ Failure ]
......@@ -1359,7 +1360,7 @@ Bug(none) fast/dom/viewport/viewport-dimensions-under-browser-zoom.html [ Crash
Bug(none) fast/dom/viewport/viewport-scale-inert.html [ Crash ]
Bug(none) fast/dom/viewport/viewport-scrolling-element-inert.html [ Crash ]
Bug(none) fast/events/pinch/gesture-pinch-zoom-prevent-in-handler.html [ Crash ]
Bug(none) fast/events/scroll-visual-viewport-send-boundary-events.html [ Crash ]
Bug(none) fast/events/pinch/scroll-visual-viewport-send-boundary-events.html [ Crash ]
Bug(none) fast/events/menu-key-context-menu-document-pinch-zoom.html [ Crash ]
Bug(none) fast/events/page-scaled-mouse-click-iframe.html [ Crash ]
Bug(none) fast/events/page-scaled-mouse-click.html [ Crash ]
......
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/wait-for-compositor-commit.js"></script>
<script src="../../resources/gesture-util.js"></script>
<div id='target' style="margin: 0px; width: 100px; height: 100px;" onmouseover="this.innerHTML='OVER';" onmouseout="this.innerHTML='OUT'">OUT</div>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/wait-for-compositor-commit.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<style>
#target {
margin: 0px;
width: 100px;
height: 100px;
border: solid;
position: absolute;
left: 100px;
top: 100px;
}
</style>
<div id='target' onmouseover="this.innerHTML='OVER';" onmouseout="this.innerHTML='OUT'">OUT</div>
<script>
const TEST_X = 40;
const TEST_Y = 70;
// The pinch is done away from the edge of the viewport so the anchor doesn't
// snap to the edge.
const TEST_X = 150;
const TEST_Y = 150;
const TEST_SCALE = 2;
const EPSILON = 0.001;
const SCROLL_TOLERANCE = 5;
const SCROLL_TOLERANCE = 10;
const MOUSE_INPUT = 2; // Gesture source type from synthetic_gesture_params.h
function waitForVisualViewportOffset(x, y) {
......@@ -19,7 +32,8 @@ function waitForVisualViewportOffset(x, y) {
Math.abs(window.visualViewport.offsetTop - y) <= SCROLL_TOLERANCE) {
resolve();
} else if (frames > 500) {
reject();
reject("Scroll timeout. visualViewport.offsetLeft = " + visualViewport.offsetLeft +
"visualViewport.offsetTop = " + visualViewport.offsetTop);
} else {
window.requestAnimationFrame(pollForOffset.bind(this, frames + 1));
}
......@@ -44,24 +58,24 @@ function waitForFakeMouseMoveSent() {
}
promise_test(async () => {
await waitForCompositorCommit;
// Move mouse to hover the target
await mouseMoveTo(TEST_X, TEST_Y);
await waitForCompositorCommit();
assert_equals(target.innerHTML, 'OVER', 'cursor over target after mouse move');
// pinch to create an scrollable visual viewport
await pinchBy(TEST_SCALE, TEST_X, TEST_Y, undefined, MOUSE_INPUT)
assert_approx_equals(window.visualViewport.scale, TEST_SCALE, EPSILON);
assert_approx_equals(window.visualViewport.offsetLeft, 20, EPSILON);
assert_approx_equals(window.visualViewport.offsetTop, 35, EPSILON);
assert_approx_equals(window.visualViewport.offsetLeft, 75, EPSILON);
assert_approx_equals(window.visualViewport.offsetTop, 75, EPSILON);
await waitForFakeMouseMoveSent();
assert_equals(target.innerHTML, 'OVER', 'cursor over target after pinch zoom');
// scroll visual viewport
await waitForCompositorCommit();
await smoothScroll(100, TEST_X, TEST_Y, MOUSE_INPUT, 'down');
await smoothScroll(200, TEST_X, TEST_Y, MOUSE_INPUT, 'down');
await waitForVisualViewportOffset(20, 85);
await waitForVisualViewportOffset(75, 175);
assert_equals(window.scrollX, 0);
assert_equals(window.scrollY, 0);
await waitForFakeMouseMoveSent();
......
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