Chromium Code Reviews| 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 maximumWheelEventsExpected = 500; |
| 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 (actualWheelEventsOccurred == maximumWheelEventsExpected |
| 29 shouldBeGreaterThanOrEqual('cumulativeScrollX', minimumScrollXExpected); | 29 || (cumulativeScrollX >= minimumScrollXExpected |
| 30 shouldBeGreaterThanOrEqual('cumulativeScrollY', minimumScrollYExpected); | 30 && cumulativeScrollY >= minimumScrollYExpected |
| 31 && actualWheelEventsOccurred < maximumWheelEventsExpected)) { | |
|
bokan
2014/04/01 18:37:10
I don't think you need this last condition. If act
jdduke (slow)
2014/04/01 18:38:45
OK I wasn't sure if |notifyDone()| forcefully term
| |
| 32 shouldBeGreaterThanOrEqual(maximumWheelEventsExpected.toString(), 'actualW heelEventsOccurred'); | |
|
bokan
2014/04/01 18:37:10
This seems kind of weird, why would we want a maxi
jdduke (slow)
2014/04/01 18:38:45
Why 2? Why not 1? Ideally we'd just keep going un
| |
| 33 shouldBeGreaterThanOrEqual('cumulativeScrollX', minimumScrollXExpected.toS tring()); | |
| 34 shouldBeGreaterThanOrEqual('cumulativeScrollY', minimumScrollYExpected.toS tring()); | |
| 31 | 35 |
| 32 isSuccessfullyParsed(); | 36 isSuccessfullyParsed(); |
| 33 if (window.testRunner) | 37 if (window.testRunner) |
| 34 testRunner.notifyDone(); | 38 testRunner.notifyDone(); |
| 35 } | 39 } |
| 40 event.preventDefault(); | |
| 36 } | 41 } |
| 37 | 42 |
| 38 document.addEventListener("mousewheel", recordWheelEvent); | 43 document.addEventListener("mousewheel", recordWheelEvent); |
| 39 | 44 |
| 40 if (window.testRunner && window.eventSender && window.eventSender.gestureFlingSt art) { | 45 if (window.testRunner && window.eventSender && window.eventSender.gestureFlingSt art) { |
| 41 eventSender.gestureFlingStart(positionX, positionY, velocityX, velocityY); | 46 eventSender.gestureFlingStart(positionX, positionY, velocityX, velocityY); |
| 42 } | 47 } |
| 43 | 48 |
| 44 if (window.testRunner) | 49 if (window.testRunner) |
| 45 testRunner.waitUntilDone(); | 50 testRunner.waitUntilDone(); |
| 46 | 51 |
| OLD | NEW |