OLD | NEW |
1 description("Tests basic use of GestureFlingStart"); | 1 description("Tests basic use of GestureFlingStart"); |
2 | 2 |
3 var actualWheelEventsOccurred = 0; | 3 var actualWheelEventsOccurred = 0; |
4 var cumulativeScrollX = 0; | 4 var cumulativeScrollX = 0; |
5 var cumulativeScrollY = 0; | 5 var cumulativeScrollY = 0; |
6 | 6 |
7 var minimumWheelEventsExpected = 40; | 7 var minimumWheelEventsExpected = "2"; |
8 var minimumScrollXExpected = "200"; | 8 var minimumScrollXExpected = 300; |
9 var minimumScrollYExpected = "200"; | 9 var minimumScrollYExpected = 300; |
10 | 10 |
11 var positionX = 10; | 11 var positionX = 10; |
12 var positionY = 11; | 12 var positionY = 11; |
13 var velocityX = 10000; | 13 var velocityX = 10000; |
14 var velocityY = 10000; | 14 var velocityY = 10000; |
15 | 15 |
16 function recordWheelEvent(event) | 16 function recordWheelEvent(event) |
17 { | 17 { |
18 if (event.clientX != 10) | 18 if (event.clientX != 10) |
19 debug('FAIL: clientX != 10'); | 19 debug('FAIL: clientX != 10'); |
20 | 20 |
21 if (event.clientY != 11) | 21 if (event.clientY != 11) |
22 debug('FAIL: event.clientY != 11'); | 22 debug('FAIL: event.clientY != 11'); |
23 | 23 |
24 actualWheelEventsOccurred++; | 24 actualWheelEventsOccurred++; |
25 cumulativeScrollX += event.wheelDeltaX; | 25 cumulativeScrollX += event.wheelDeltaX; |
26 cumulativeScrollY += event.wheelDeltaY; | 26 cumulativeScrollY += event.wheelDeltaY; |
27 | 27 |
28 if (actualWheelEventsOccurred == minimumWheelEventsExpected) { | 28 if (cumulativeScrollX >= minimumScrollXExpected |
29 shouldBeGreaterThanOrEqual('cumulativeScrollX', minimumScrollXExpected); | 29 && cumulativeScrollY >= minimumScrollYExpected) { |
30 shouldBeGreaterThanOrEqual('cumulativeScrollY', minimumScrollYExpected); | 30 shouldBeGreaterThanOrEqual('actualWheelEventsOccurred', minimumWheelEvents
Expected); |
| 31 shouldBeGreaterThanOrEqual('cumulativeScrollX', minimumScrollXExpected.toS
tring()); |
| 32 shouldBeGreaterThanOrEqual('cumulativeScrollY', minimumScrollYExpected.toS
tring()); |
31 | 33 |
32 isSuccessfullyParsed(); | 34 isSuccessfullyParsed(); |
33 if (window.testRunner) | 35 if (window.testRunner) |
34 testRunner.notifyDone(); | 36 testRunner.notifyDone(); |
35 } | 37 } |
| 38 event.preventDefault(); |
36 } | 39 } |
37 | 40 |
38 document.addEventListener("mousewheel", recordWheelEvent); | 41 document.addEventListener("mousewheel", recordWheelEvent); |
39 | 42 |
40 if (window.testRunner && window.eventSender && window.eventSender.gestureFlingSt
art) { | 43 if (window.testRunner && window.eventSender && window.eventSender.gestureFlingSt
art) { |
41 eventSender.gestureFlingStart(positionX, positionY, velocityX, velocityY); | 44 eventSender.gestureFlingStart(positionX, positionY, velocityX, velocityY); |
42 } | 45 } |
43 | 46 |
44 if (window.testRunner) | 47 if (window.testRunner) |
45 testRunner.waitUntilDone(); | 48 testRunner.waitUntilDone(); |
46 | 49 |
OLD | NEW |