4 <script src=
"../../../../resources/js-test.js"></script>
5 <script src=
"resources/gesture-helpers.js"></script>
6 <style type=
"text/css">
32 <body style=
"margin:0" onload=
"runTest();">
34 <table id=
"table_to_fill">
35 <tr><td><div id=
"greenbox"></div></td></tr>
36 <tr><td><div id=
"redbox"></div></td></tr>
39 <p id=
"description"></p>
40 <div id=
"console"></div>
41 <script type=
"text/javascript">
43 var expectedGesturesTotal
= 2;
44 var gesturesOccurred
= 0;
45 var scrollAmountX
= ['0', '0'];
46 var scrollAmountY
= ['70', '130'];
47 var wheelEventsOccurred
= 0;
48 var expectedWheelEventsOccurred
= ['0', '0'];
49 var scrollEventsOccurred
= 0;
50 var scrolledElement
= 'document.scrollingElement'
51 var scrollEventsOccurred
= 0;
52 var expectedScrollEventsOccurred
= '1';
54 function recordScroll(event
) {
55 debug('scroll event ' + scrollEventsOccurred
+ '+> ' + event
.target
);
56 scrollEventsOccurred
++;
58 if (window
.eventSender
) {
59 // Because scroll events arrive asynchronously, only one will arrive.
60 if (gesturesOccurred
== expectedGesturesTotal
) {
61 shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred
);
62 // If we've got here, we've passed.
63 successfullyParsed
= true;
64 isSuccessfullyParsed();
65 if (window
.testRunner
)
66 testRunner
.notifyDone();
71 // Always construct a page larger than the vertical height of the window.
74 var table
= document
.getElementById('table_to_fill');
75 var targetHeight
= document
.body
.offsetHeight
;
76 var cellPairHeight
= table
.offsetHeight
;
77 var numberOfReps
= targetHeight
/ cellPairHeight
* 2;
79 for (i
= 0; i
< numberOfReps
; i
++) {
80 var p
= document
.createElement('tr');
81 p
.innerHTML
= '<td><div id="greenbox"></div></td>';
83 var p
= document
.createElement('tr');
84 p
.innerHTML
= '<td><div id="redbox"></div></td>';
88 window
.addEventListener("scroll", recordScroll
);
89 window
.addEventListener("mousewheel", recordWheel
);
92 function firstGestureScroll()
94 debug("first gesture");
95 eventSender
.gestureScrollBegin(10, 72);
96 eventSender
.gestureScrollUpdate(0, -30);
97 eventSender
.gestureScrollUpdate(0, -40);
98 eventSender
.gestureScrollEnd(0, 0);
104 function secondGestureScroll()
106 debug("second gesture");
107 eventSender
.gestureScrollBegin(800, 40);
108 eventSender
.gestureScrollUpdate(0, -30);
109 eventSender
.gestureScrollUpdate(0, -30);
110 eventSender
.gestureScrollEnd(0, 0);
116 if (window
.testRunner
)
117 testRunner
.waitUntilDone();
122 if (window
.eventSender
) {
123 description('This tests scroll gesture event scrolling on a whole page.');
124 if (checkTestDependencies())
125 firstGestureScroll();
129 debug("This test requires DumpRenderTree. Gesture-scroll the page to validate the implementation.");