Commit d5760bc9 authored by jdduke@chromium.org's avatar jdduke@chromium.org

Update pad-gesture-fling test to accommodate short-circuited fling

The pad-gesture-fling layout tests assumes the fling curve will generate a
minimum number of events.  This may not always hold, depending on the
fling curve parameters, the fling curve update frequency and whether the main
thread is slow.  Instead, impose a maximum limit on the number of fling updates
it takes to reach the minimum offset target, and use preventDefault() on the
mousewheel event to prevent the fling from terminating early.

Review URL: https://codereview.chromium.org/219243010

git-svn-id: svn://svn.chromium.org/blink/trunk@170597 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 32df73f7
...@@ -6,8 +6,9 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -6,8 +6,9 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
PASS cumulativeScrollX is >= 200 PASS actualWheelEventsOccurred is >= 2
PASS cumulativeScrollY is >= 200 PASS cumulativeScrollX is >= 300
PASS cumulativeScrollY is >= 300
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -4,9 +4,9 @@ var actualWheelEventsOccurred = 0; ...@@ -4,9 +4,9 @@ var actualWheelEventsOccurred = 0;
var cumulativeScrollX = 0; var cumulativeScrollX = 0;
var cumulativeScrollY = 0; var cumulativeScrollY = 0;
var minimumWheelEventsExpected = 40; var minimumWheelEventsExpected = "2";
var minimumScrollXExpected = "200"; var minimumScrollXExpected = 300;
var minimumScrollYExpected = "200"; var minimumScrollYExpected = 300;
var positionX = 10; var positionX = 10;
var positionY = 11; var positionY = 11;
...@@ -25,14 +25,17 @@ function recordWheelEvent(event) ...@@ -25,14 +25,17 @@ function recordWheelEvent(event)
cumulativeScrollX += event.wheelDeltaX; cumulativeScrollX += event.wheelDeltaX;
cumulativeScrollY += event.wheelDeltaY; cumulativeScrollY += event.wheelDeltaY;
if (actualWheelEventsOccurred == minimumWheelEventsExpected) { if (cumulativeScrollX >= minimumScrollXExpected
shouldBeGreaterThanOrEqual('cumulativeScrollX', minimumScrollXExpected); && cumulativeScrollY >= minimumScrollYExpected) {
shouldBeGreaterThanOrEqual('cumulativeScrollY', minimumScrollYExpected); shouldBeGreaterThanOrEqual('actualWheelEventsOccurred', minimumWheelEventsExpected);
shouldBeGreaterThanOrEqual('cumulativeScrollX', minimumScrollXExpected.toString());
shouldBeGreaterThanOrEqual('cumulativeScrollY', minimumScrollYExpected.toString());
isSuccessfullyParsed(); isSuccessfullyParsed();
if (window.testRunner) if (window.testRunner)
testRunner.notifyDone(); testRunner.notifyDone();
} }
event.preventDefault();
} }
document.addEventListener("mousewheel", recordWheelEvent); document.addEventListener("mousewheel", recordWheelEvent);
......
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