Commit 5f7a0b82 authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

Convert Layouttests with wheelDelta to use gpu benchmarking.

Bug: 846424
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I214fa0e5a1e6604e27d6066278c7d647a583a4e8
Reviewed-on: https://chromium-review.googlesource.com/1108445
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572379}
parent 79cbcdf6
...@@ -474,7 +474,6 @@ Bug(none) fast/dom/focus-contenteditable.html [ Failure ] ...@@ -474,7 +474,6 @@ Bug(none) fast/dom/focus-contenteditable.html [ Failure ]
Bug(none) fast/dynamic/anchor-lock.html [ Failure ] Bug(none) fast/dynamic/anchor-lock.html [ Failure ]
crbug.com/667946 fast/events/autoscroll-disabled-in-fix.html [ Skip ] crbug.com/667946 fast/events/autoscroll-disabled-in-fix.html [ Skip ]
Bug(none) fast/events/keyboard-scroll-by-page.html [ Failure ] Bug(none) fast/events/keyboard-scroll-by-page.html [ Failure ]
Bug(none) fast/events/platform-wheelevent-in-scrolling-div.html [ Failure ]
Bug(none) fast/events/platform-wheelevent-paging-x-in-scrolling-page.html [ Failure ] Bug(none) fast/events/platform-wheelevent-paging-x-in-scrolling-page.html [ Failure ]
Bug(none) fast/events/platform-wheelevent-paging-xy-in-scrolling-page.html [ Failure ] Bug(none) fast/events/platform-wheelevent-paging-xy-in-scrolling-page.html [ Failure ]
Bug(none) fast/events/platform-wheelevent-paging-y-in-scrolling-page.html [ Failure ] Bug(none) fast/events/platform-wheelevent-paging-y-in-scrolling-page.html [ Failure ]
...@@ -497,6 +496,7 @@ Bug(none) fast/events/touch/touch-rect-assert-first-layer-special.html [ Failure ...@@ -497,6 +496,7 @@ Bug(none) fast/events/touch/touch-rect-assert-first-layer-special.html [ Failure
Bug(none) fast/events/touch/touch-rect-crash-on-unpromote-layer.html [ Failure ] Bug(none) fast/events/touch/touch-rect-crash-on-unpromote-layer.html [ Failure ]
Bug(none) fast/events/wheel/wheelevent-in-horizontal-scrollbar-in-rtl.html [ Failure ] Bug(none) fast/events/wheel/wheelevent-in-horizontal-scrollbar-in-rtl.html [ Failure ]
Bug(none) fast/events/wheel/wheelevent-in-vertical-scrollbar-in-rtl.html [ Failure ] Bug(none) fast/events/wheel/wheelevent-in-vertical-scrollbar-in-rtl.html [ Failure ]
Bug(none) fast/events/wheel/wheelevent-in-scrolling-div.html [ Failure ]
Bug(none) fast/forms/button-default-title.html [ Failure ] Bug(none) fast/forms/button-default-title.html [ Failure ]
Bug(none) fast/forms/fieldset/fieldset-align.html [ Failure ] Bug(none) fast/forms/fieldset/fieldset-align.html [ Failure ]
Bug(none) fast/forms/select/listbox-appearance-basic.html [ Failure ] Bug(none) fast/forms/select/listbox-appearance-basic.html [ Failure ]
......
PASS event.wheelDeltaY is window.expectedScrollTop*-120
PASS event.wheelDeltaX is window.expectedScrollLeft*-120
PASS event.wheelDelta is window.expectedScrollTop*-120
PASS div.scrollTop == expectedScrollTop*40 && div.scrollLeft == expectedScrollLeft*40 became true
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
window.jsTestIsAsync = true;
var expectedScrollTop = 5;
var expectedScrollLeft = 3;
var event;
var div;
function runTest()
{
var overflowElement = document.getElementById("overflow");
if (overflowElement)
overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
if (window.eventSender) {
eventSender.mouseMoveTo(100, 110);
eventSender.mouseScrollBy(-window.expectedScrollLeft, -window.expectedScrollTop);
}
div = document.getElementById("overflow");
// Note that there are 40 pixels per wheel tick.
shouldBecomeEqual("div.scrollTop == expectedScrollTop*40 && " +
"div.scrollLeft == expectedScrollLeft*40", "true", finishJSTest);
}
function mousewheelHandler(e)
{
event = e;
shouldBe("event.wheelDeltaY", "window.expectedScrollTop*-120");
shouldBe("event.wheelDeltaX", "window.expectedScrollLeft*-120");
if (e.wheelDeltaY)
shouldBe("event.wheelDelta", "window.expectedScrollTop*-120");
else
shouldBe("event.wheelDelta", "window.expectedScrollLeft*-120");
}
</script>
</head>
<body style="margin:0" onload="runTest()">
<div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
<div style="background-color:red;height:200px;width:400px;"></div>
<div style="background-color:green;height:200px;width:400px;"></div>
<div style="background-color:red;height:200px;width:400px;"></div>
</div>
<div id="console"></div>
</body>
</html>
PASS event.deltaY is window.expectedScrollTop
PASS event.deltaX is window.expectedScrollLeft
PASS event.wheelDeltaY is -5*120
PASS event.wheelDeltaX is -2.5*120
PASS event.wheelDelta is -5*120
PASS div.scrollTop == window.expectedScrollTop && div.scrollLeft == window.expectedScrollLeft became true
PASS successfullyParsed is true
TEST COMPLETE
<html> <!DOCTYPE html>
<head> <script src="../../../resources/testharness.js"></script>
<script src="../../../resources/js-test.js"></script> <script src="../../../resources/testharnessreport.js"></script>
<script> <script src="../../../resources/gesture-util.js"></script>
window.jsTestIsAsync = true; <div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
var expectedScrollTop = 200; <div style="background-color:red;height:200px;width:400px;"></div>
var expectedScrollLeft = 100; <div style="background-color:green;height:200px;width:400px;"></div>
var event; <div style="background-color:red;height:200px;width:400px;"></div>
var div; </div>
<div id="console"></div>
<script>
// scroll diagonally for 1 tick.
var expectedScroll = pixelsPerTick();
function runTest() var overflowElement = document.getElementById("overflow");
{ overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
var overflowElement = document.getElementById("overflow"); var eventHandlerResolve;
if (overflowElement) { eventHandlerPromise = new Promise(function(resolve) {
overflowElement.addEventListener("mousewheel", mousewheelHandler, false); eventHandlerResolve = resolve;
});
// EventSender uses 40px per tick. promise_test (async () => {
eventSender.mouseMoveTo(overflowElement.offsetLeft + 5, overflowElement.offsetTop + 5); var x = overflowElement.offsetLeft + 5;
eventSender.mouseScrollBy(-2.5, -5, false, true, 0, true, "phaseBegan"); var y = overflowElement.offsetTop + 5
} await mouseMoveTo(x, y);
await smoothScroll(pixelsPerTick(), x, y, GestureSourceType.MOUSE_INPUT,
"downright", SPEED_INSTANT);
await waitFor( () => {
return overflowElement.scrollTop == expectedScroll &&
overflowElement.scrollLeft == expectedScroll;
});
// The test will timeout if the event handler doesn't resolve this promise.
await eventHandlerPromise;
});
div = document.getElementById("overflow"); function mousewheelHandler(e) {
shouldBecomeEqual("div.scrollTop == window.expectedScrollTop && " + // e.wheelDeltaX/Y is equal to number of ticks * 120. See kTickMultiplier
"div.scrollLeft == window.expectedScrollLeft", "true", finishJSTest); // in src/third_party/blink/renderer/core/events/wheel_event.h
} if (e.deltaY == expectedScroll && e.deltaX == expectedScroll &&
e.wheelDeltaY == -120 && e.wheelDeltaX == -120 && e.wheelDelta == -120) {
function mousewheelHandler(e) eventHandlerResolve();
{ }
event = e; }
shouldBe("event.deltaY", "window.expectedScrollTop"); </script>
shouldBe("event.deltaX", "window.expectedScrollLeft");
shouldBe("event.wheelDeltaY", "-5*120");
shouldBe("event.wheelDeltaX", "-2.5*120");
if (e.wheelDeltaY)
shouldBe("event.wheelDelta", "-5*120");
else
shouldBe("event.wheelDelta", "-2.5*120");
}
</script>
</head>
<body style="margin:0" onload="runTest()">
<div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
<div style="background-color:red;height:200px;width:400px;"></div>
<div style="background-color:green;height:200px;width:400px;"></div>
<div style="background-color:red;height:200px;width:400px;"></div>
</div>
<div id="console"></div>
</body>
</html>
...@@ -60,6 +60,25 @@ function smoothScroll(pixels_to_scroll, start_x, start_y, gesture_source_type, d ...@@ -60,6 +60,25 @@ function smoothScroll(pixels_to_scroll, start_x, start_y, gesture_source_type, d
}); });
} }
// Returns the number of pixels per wheel tick which is a platform specific value.
function pixelsPerTick() {
// Comes from ui/events/event.cc
if (navigator.platform.indexOf("Win") != -1)
return 120;
if (navigator.platform.indexOf("Mac") != -1 || navigator.platform.indexOf("iPhone") != -1 ||
navigator.platform.indexOf("iPod") != -1 || navigator.platform.indexOf("iPad") != -1) {
return 40;
}
// Some android devices return android while others return Android.
if (navigator.platform.toLowerCase().indexOf("android") != -1)
return 64;
// Comes from ui/events/event.cc
return 53;
}
function pinchBy(scale, centerX, centerY, speed_in_pixels_s, gesture_source_type) { function pinchBy(scale, centerX, centerY, speed_in_pixels_s, gesture_source_type) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (chrome && chrome.gpuBenchmarking) { if (chrome && chrome.gpuBenchmarking) {
......
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