Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / pad-gesture-fling.js
blob5b86bedbb09c8f5599ab6c8cc208eae470c2dcc8
1 description("Tests basic use of GestureFlingStart");
3 var actualWheelEventsOccurred = 0;
4 var cumulativeScrollX = 0;
5 var cumulativeScrollY = 0;
7 var minimumWheelEventsExpected = "2";
8 var minimumScrollXExpected = 300;
9 var minimumScrollYExpected = 300;
11 var positionX = 10;
12 var positionY = 11;
13 var velocityX = 10000;
14 var velocityY = 10000;
16 function recordWheelEvent(event)
18 if (event.clientX != 10)
19 debug('FAIL: clientX != 10');
21 if (event.clientY != 11)
22 debug('FAIL: event.clientY != 11');
24 actualWheelEventsOccurred++;
25 cumulativeScrollX += event.wheelDeltaX;
26 cumulativeScrollY += event.wheelDeltaY;
28 if (cumulativeScrollX >= minimumScrollXExpected
29 && cumulativeScrollY >= minimumScrollYExpected) {
30 shouldBeGreaterThanOrEqual('actualWheelEventsOccurred', minimumWheelEventsExpected);
31 shouldBeGreaterThanOrEqual('cumulativeScrollX', minimumScrollXExpected.toString());
32 shouldBeGreaterThanOrEqual('cumulativeScrollY', minimumScrollYExpected.toString());
34 isSuccessfullyParsed();
35 if (window.testRunner)
36 testRunner.notifyDone();
38 event.preventDefault();
41 document.addEventListener("mousewheel", recordWheelEvent);
43 if (window.testRunner && window.eventSender && window.eventSender.gestureFlingStart) {
44 eventSender.gestureFlingStart(positionX, positionY, velocityX, velocityY, "touchpad");
47 if (window.testRunner)
48 testRunner.waitUntilDone();