Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / resources / gesture-helpers.js
blob30aaa345ac760dd75ccdb75efa17f80f89858e71
1 function recordWheel(event)
3     debug('wheel event ' + wheelEventsOccurred + '+> ' + event.target);
4     wheelEventsOccurred++;
7 function recordScroll(event)
9     debug('scroll event ' + scrollEventsOccurred + '+> ' + event.target);
10     scrollEventsOccurred++;
12     if (window.eventSender) {
13         // Because scroll events arrive asynchronously, only one will arrive.
14         if (gesturesOccurred == expectedGesturesTotal) {
15             shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred);
16             if (window.jsTestIsAsync) {
17                 finishJSTest();
18             } else {
19                 // If we've got here, we've passed.
20                 successfullyParsed = true;
21                 isSuccessfullyParsed();
22                 if (window.testRunner)
23                     testRunner.notifyDone();
24             }
25         }
26     }
29 function exitIfNecessary()
31     debug('gesture events not implemented on this platform or gesture event scrolling of a document is broken');
32     if (window.jsTestIsAsync) {
33         finishJSTest();
34     } else {
35         // If we've got here, we've passed.
36         successfullyParsed = true;
37         isSuccessfullyParsed();
38         if (window.testRunner)
39             testRunner.notifyDone();
40     }
43 function checkTestDependencies()
45     return eventSender.gestureScrollBegin && eventSender.gestureScrollUpdate && eventSender.gestureScrollEnd;
48 function checkScrollOffset()
50     if (window.eventSender) {
51         shouldBe(scrolledElement + '.' + 'scrollTop', scrollAmountY[gesturesOccurred]);
52         shouldBe(scrolledElement + '.' + 'scrollLeft', scrollAmountX[gesturesOccurred]);
53         shouldBe('wheelEventsOccurred', expectedWheelEventsOccurred[gesturesOccurred]);
54         gesturesOccurred++;
55     }
56     if (gesturesOccurred < expectedGesturesTotal) {
57         wheelEventsOccurred = 0;
58         secondGestureScroll();
59     }