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"> <!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 type="text/css"> <style type="text/css">
body { body {
height: 2000px; height: 2000px;
...@@ -8,77 +10,21 @@ ...@@ -8,77 +10,21 @@
</style> </style>
<script> <script>
var expectedScrollsTotal = 2; promise_test(async () => {
var scrollsOccurred = 0; await smoothScrollWithXY(1, 1, 50, 50, GestureSourceType.MOUSE_INPUT, SPEED_INSTANT);
var scrollAmountX = ['1', '3'];
var scrollAmountY = ['1', '3'];
function checkScrollOffset() await waitFor( () => {
{ return document.scrollingElement.scrollTop == 1;
if (window.eventSender) { });
shouldBe('document.scrollingElement.scrollTop', scrollAmountY[scrollsOccurred]); assert_equals(document.scrollingElement.scrollTop, 1);
shouldBe('document.scrollingElement.scrollLeft', scrollAmountX[scrollsOccurred]); assert_equals(document.scrollingElement.scrollLeft, 1);
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();
}
function secondGestureScrollSequence() await smoothScrollWithXY(2, 2, 50, 50, GestureSourceType.MOUSE_INPUT, SPEED_INSTANT);
{
debug("second gesture");
eventSender.gestureScrollBegin(50, 50); await waitFor( () => {
eventSender.gestureScrollUpdate(-2, -2); return document.scrollingElement.scrollTop == 3;
eventSender.gestureScrollEnd(0, 0); });
assert_equals(document.scrollingElement.scrollTop, 3);
// Wait for layout. assert_equals(document.scrollingElement.scrollLeft, 3);
checkScrollOffset(); }, "Scrolling in a high dpi settings yeilds in the correct offset");
}
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.");
}
}
</script> </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