| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../../resources/js-test.js"></script> | 4 <script src="../../../../resources/js-test.js"></script> |
| 5 <script src="resources/gesture-helpers.js"></script> | 5 <script src="resources/gesture-helpers.js"></script> |
| 6 <style type="text/css"> | 6 <style type="text/css"> |
| 7 ::-webkit-scrollbar { | 7 ::-webkit-scrollbar { |
| 8 width: 0px; | 8 width: 0px; |
| 9 height: 0px; | 9 height: 0px; |
| 10 } | 10 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 <tr><td><div id="redbox"></div></td></tr> | 36 <tr><td><div id="redbox"></div></td></tr> |
| 37 </table> | 37 </table> |
| 38 | 38 |
| 39 <p id="description"></p> | 39 <p id="description"></p> |
| 40 <div id="console"></div> | 40 <div id="console"></div> |
| 41 <script type="text/javascript"> | 41 <script type="text/javascript"> |
| 42 | 42 |
| 43 var expectedGesturesTotal = 2; | 43 var expectedGesturesTotal = 2; |
| 44 var gesturesOccurred = 0; | 44 var gesturesOccurred = 0; |
| 45 var scrollAmountX = ['0', '0']; | 45 var scrollAmountX = ['0', '0']; |
| 46 var scrollAmountY = ['70', '130']; | 46 var scrollAmountY = ['140', '40']; |
| 47 var wheelEventsOccurred = 0; | 47 var wheelEventsOccurred = 0; |
| 48 var expectedWheelEventsOccurred = ['0', '0']; | 48 var expectedWheelEventsOccurred = ['0', '0']; |
| 49 var scrollEventsOccurred = 0; | 49 var scrollEventsOccurred = 0; |
| 50 var scrolledElement = 'document.documentElement' | 50 var scrolledElement = 'document.documentElement' |
| 51 var scrollEventsOccurred = 0; | 51 var scrollEventsOccurred = 0; |
| 52 var expectedScrollEventsOccurred = '1'; | 52 var expectedScrollEventsOccurred = '1'; |
| 53 | 53 |
| 54 function recordScroll(event) { | 54 function recordScroll(event) { |
| 55 » debug('scroll event ' + scrollEventsOccurred + '+> ' + event.target); | 55 debug('scroll event ' + scrollEventsOccurred + '+> ' + event.target); |
| 56 » scrollEventsOccurred++; | 56 scrollEventsOccurred++; |
| 57 | 57 |
| 58 » if (window.eventSender) { | 58 if (window.eventSender) { |
| 59 » » // Because scroll events arrive asynchronously, only one will ar
rive. | 59 // Because scroll events arrive asynchronously, only one will arrive. |
| 60 » if (gesturesOccurred == expectedGesturesTotal) { | 60 if (gesturesOccurred == expectedGesturesTotal) { |
| 61 » » » shouldBe('scrollEventsOccurred', expectedScrollEventsOcc
urred); | 61 shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred); |
| 62 » // If we've got here, we've passed. | 62 // If we've got here, we've passed. |
| 63 » successfullyParsed = true; | 63 successfullyParsed = true; |
| 64 » isSuccessfullyParsed(); | 64 isSuccessfullyParsed(); |
| 65 » if (window.testRunner) | 65 if (window.testRunner) |
| 66 » testRunner.notifyDone(); | 66 testRunner.notifyDone(); |
| 67 » » } | 67 } |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Always construct a page larger than the vertical height of the window. | 71 // Always construct a page larger than the vertical height of the window. |
| 72 function buildPage() | 72 function buildPage() |
| 73 { | 73 { |
| 74 var table = document.getElementById('table_to_fill'); | 74 var table = document.getElementById('table_to_fill'); |
| 75 var targetHeight = document.body.offsetHeight; | 75 var targetHeight = document.body.offsetHeight; |
| 76 var cellPairHeight = table.offsetHeight; | 76 var cellPairHeight = table.offsetHeight; |
| 77 var numberOfReps = targetHeight / cellPairHeight * 2; | 77 var numberOfReps = targetHeight / cellPairHeight * 4; |
| 78 var i; | 78 var i; |
| 79 for (i = 0; i < numberOfReps; i++) { | 79 for (i = 0; i < numberOfReps; i++) { |
| 80 var p = document.createElement('tr'); | 80 var p = document.createElement('tr'); |
| 81 p.innerHTML = '<td><div id="greenbox"></div></td>'; | 81 p.innerHTML = '<td><div id="greenbox"></div></td>'; |
| 82 table.appendChild(p); | 82 table.appendChild(p); |
| 83 var p = document.createElement('tr'); | 83 var p = document.createElement('tr'); |
| 84 p.innerHTML = '<td><div id="redbox"></div></td>'; | 84 p.innerHTML = '<td><div id="redbox"></div></td>'; |
| 85 table.appendChild(p); | 85 table.appendChild(p); |
| 86 } | 86 } |
| 87 | 87 |
| 88 window.addEventListener("scroll", recordScroll); | 88 window.addEventListener("scroll", recordScroll); |
| 89 window.addEventListener("mousewheel", recordWheel); | 89 window.addEventListener("mousewheel", recordWheel); |
| 90 } | 90 } |
| 91 | 91 |
| 92 function firstGestureScroll() | 92 function firstGestureScroll() |
| 93 { | 93 { |
| 94 debug("first gesture"); | 94 debug("first gesture"); |
| 95 |
| 96 window.internals.setZoomFactor(0.5); |
| 95 eventSender.gestureScrollBegin(10, 72); | 97 eventSender.gestureScrollBegin(10, 72); |
| 96 eventSender.gestureScrollUpdate(0, -30); | 98 eventSender.gestureScrollUpdate(0, -30); |
| 97 eventSender.gestureScrollUpdate(0, -40); | 99 eventSender.gestureScrollUpdate(0, -40); |
| 98 eventSender.gestureScrollEnd(0, 0); | 100 eventSender.gestureScrollEnd(0, 0); |
| 99 | 101 |
| 100 // Wait for layout. | 102 // Wait for layout. |
| 101 checkScrollOffset(); | 103 checkScrollOffset(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 function secondGestureScroll() | 106 function secondGestureScroll() |
| 105 { | 107 { |
| 106 debug("second gesture"); | 108 debug("second gesture"); |
| 109 |
| 110 eventSender.gestureScrollBegin(10, 72); |
| 111 eventSender.gestureScrollUpdate(0, 200); |
| 112 eventSender.gestureScrollEnd(0, 0); |
| 113 |
| 114 window.internals.setZoomFactor(2.0); |
| 107 eventSender.gestureScrollBegin(800, 40); | 115 eventSender.gestureScrollBegin(800, 40); |
| 108 eventSender.gestureScrollUpdate(0, -30); | 116 eventSender.gestureScrollUpdate(0, -40); |
| 109 eventSender.gestureScrollUpdate(0, -30); | 117 eventSender.gestureScrollUpdate(0, -40); |
| 110 eventSender.gestureScrollEnd(0, 0); | 118 eventSender.gestureScrollEnd(0, 0); |
| 111 | 119 |
| 112 // Wait for layout. | 120 // Wait for layout. |
| 113 checkScrollOffset(); | 121 checkScrollOffset(); |
| 114 } | 122 } |
| 115 | 123 |
| 116 if (window.testRunner) | 124 if (window.testRunner) |
| 117 testRunner.waitUntilDone(); | 125 testRunner.waitUntilDone(); |
| 118 | 126 |
| 119 function runTest() | 127 function runTest() |
| 120 { | 128 { |
| 121 buildPage(); | 129 buildPage(); |
| 122 if (window.eventSender) { | 130 if (window.eventSender) { |
| 123 description('This tests scroll gesture event scrolling on a whole page.'
); | 131 description('This tests scroll gesture event scrolling on a whole page w
ith browser zoom.'); |
| 124 if (checkTestDependencies()) | 132 if (checkTestDependencies()) |
| 125 firstGestureScroll(); | 133 firstGestureScroll(); |
| 126 else | 134 else |
| 127 exitIfNecessary(); | 135 exitIfNecessary(); |
| 128 } else { | 136 } else { |
| 129 debug("This test requires DumpRenderTree. Gesture-scroll the page to va
lidate the implementation."); | 137 debug("This test requires DumpRenderTree. Gesture-scroll the page to va
lidate the implementation."); |
| 130 } | 138 } |
| 131 } | 139 } |
| 132 </script> | 140 </script> |
| 133 | 141 |
| 134 | 142 |
| 135 | 143 |
| 136 </body> | 144 </body> |
| 137 </html> | 145 </html> |
| OLD | NEW |