Commit aeca68ca authored by Navid Zolghadr's avatar Navid Zolghadr Committed by Commit Bot

Move gesture-scroll-amount test to gpubenchmarking

Bug: 1047176
Change-Id: Ic44fee80db7b74a5062cef1c9b8ff14565dd1dc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2159541Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarLan Wei <lanwei@chromium.org>
Commit-Queue: Navid Zolghadr <nzolghadr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762156}
parent 453cf902
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<script src="../../../resources/js-test.js"></script>
<!DOCTYPE html>
<script src='../../../resources/testharness.js'></script>
<script src='../../../resources/testharnessreport.js'></script>
<script src='../../../resources/gesture-util.js'></script>
<style type="text/css">
body {
height: 2000px;
......@@ -8,77 +10,21 @@
</style>
<script>
var expectedScrollsTotal = 2;
var scrollsOccurred = 0;
var scrollAmountX = ['1', '3'];
var scrollAmountY = ['1', '3'];
promise_test(async () => {
await smoothScrollWithXY(1, 1, 50, 50, GestureSourceType.MOUSE_INPUT, SPEED_INSTANT);
function checkScrollOffset()
{
if (window.eventSender) {
shouldBe('document.scrollingElement.scrollTop', scrollAmountY[scrollsOccurred]);
shouldBe('document.scrollingElement.scrollLeft', scrollAmountX[scrollsOccurred]);
scrollsOccurred++;
}
if (scrollsOccurred == expectedScrollsTotal) {
// If we've got here, we've passed.
isSuccessfullyParsed();
if (window.testRunner)
testRunner.notifyDone();
} else {
secondGestureScrollSequence();
}
}
function firstGestureScrollSequence()
{
debug("first gesture");
eventSender.gestureScrollBegin(50, 50);
eventSender.gestureScrollUpdate(-1, -1);
eventSender.gestureScrollEnd(0, 0);
// Wait for layout.
checkScrollOffset();
}
await waitFor( () => {
return document.scrollingElement.scrollTop == 1;
});
assert_equals(document.scrollingElement.scrollTop, 1);
assert_equals(document.scrollingElement.scrollLeft, 1);
function secondGestureScrollSequence()
{
debug("second gesture");
await smoothScrollWithXY(2, 2, 50, 50, GestureSourceType.MOUSE_INPUT, SPEED_INSTANT);
eventSender.gestureScrollBegin(50, 50);
eventSender.gestureScrollUpdate(-2, -2);
eventSender.gestureScrollEnd(0, 0);
// Wait for layout.
checkScrollOffset();
}
function exitIfNecessary()
{
debug('Gesture events not implemented on this platform or broken');
isSuccessfullyParsed();
if (window.testRunner)
testRunner.notifyDone();
}
if (window.testRunner)
testRunner.waitUntilDone();
function runTest()
{
if (window.eventSender) {
description('This test ensures that touch gesture scrolls ' +
'the right amount pixels in high dpi mode.');
if (eventSender.clearTouchPoints)
firstGestureScrollSequence();
else
exitIfNecessary();
} else {
debug("This test requires eventSender.");
}
}
await waitFor( () => {
return document.scrollingElement.scrollTop == 3;
});
assert_equals(document.scrollingElement.scrollTop, 3);
assert_equals(document.scrollingElement.scrollLeft, 3);
}, "Scrolling in a high dpi settings yeilds in the correct offset");
</script>
<body onload="runTest()"></body>
This test ensures that touch gesture scrolls the right amount pixels in high dpi mode.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
first gesture
PASS document.scrollingElement.scrollTop is 1
PASS document.scrollingElement.scrollLeft is 1
second gesture
PASS document.scrollingElement.scrollTop is 3
PASS document.scrollingElement.scrollLeft is 3
PASS successfullyParsed is true
TEST COMPLETE
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