Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / gesture-scroll.html
blob0c388b94470d953346e2046e8beeaf327b105ba4
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 <style type="text/css">
6 #gesturetarget {
7 width: 100px;
8 height: 100px;
9 position: relative;
10 background: white;
13 ::-webkit-scrollbar {
14 width: 0px;
15 height: 0px;
18 #movingbox {
19 width: 100%;
20 height: 100%;
21 position: absolute;
22 word-wrap: break-word;
23 overflow-y: scroll;
24 overflow-x: scroll;
25 display: block;
28 #greenbox {
29 width: 100px;
30 height: 100px;
31 background: green;
32 padding: 0px;
33 margin: 0px;
36 #redbox {
37 width: 100px;
38 height: 100px;
39 background: red;
40 padding: 0px;
41 margin: 0px;
44 td {
45 padding: 0px;
47 </style>
48 </head>
49 <body style="margin:0" onload="runTest();">
50 <div id="gesturetarget">
51 <div id="movingbox">
52 <table border="0" cellspacing="0px">
53 <tr>
54 <td><div id="redbox"></div></td>
55 <td><div id="greenbox"></div></td>
56 </tr>
57 <tr>
58 <td><div id="greenbox"></div></td>
59 <td><div id="greenbox"></div></td>
60 </tr>
61 </table>
62 </div>
63 </div>
65 <p id="description"></p>
66 <div id="console"></div>
67 <script type="text/javascript">
69 var movingdiv;
70 var expectedScrollsTotal = 2;
71 var scrollsOccurred = 0;
72 var scrollAmountX = ['90', '90'];
73 var scrollAmountY = ['0', '95'];
75 function checkScrollOffset()
77 movingdiv = document.getElementById('movingbox');
78 if (window.eventSender) {
79 shouldBe('movingdiv.scrollTop', scrollAmountY[scrollsOccurred]);
80 shouldBe('movingdiv.scrollLeft', scrollAmountX[scrollsOccurred]);
81 scrollsOccurred++;
84 if (scrollsOccurred == expectedScrollsTotal) {
85 // If we've got here, we've passed.
86 isSuccessfullyParsed();
87 if (window.testRunner)
88 testRunner.notifyDone();
89 } else {
90 secondGestureScrollSequence();
94 function firstGestureScrollSequence()
96 debug("first gesture");
98 eventSender.gestureScrollBegin(95, 12);
99 eventSender.gestureScrollUpdate(-90, 0);
100 eventSender.gestureScrollEnd(0, 0);
102 // Wait for layout.
103 checkScrollOffset();
106 function secondGestureScrollSequence()
108 debug("second gesture");
110 eventSender.gestureScrollBegin(12, 97);
111 eventSender.gestureScrollUpdate(0, -95);
112 eventSender.gestureScrollEnd(0, 0);
114 // Wait for layout.
115 checkScrollOffset();
118 function exitIfNecessary()
120 debug('Gesture events not implemented on this platform or broken');
121 isSuccessfullyParsed();
122 if (window.testRunner)
123 testRunner.notifyDone();
126 if (window.testRunner)
127 testRunner.waitUntilDone();
129 function runTest()
131 var movingdiv = document.getElementById('movingbox');
133 if (window.eventSender) {
134 description('This tests scroll gesture events. ' +
135 'Square is (mostly) green on pass');
137 if (eventSender.clearTouchPoints)
138 firstGestureScrollSequence();
139 else
140 exitIfNecessary();
141 } else {
142 debug("This test requires DumpRenderTree.");
145 </script>
146 </body>
147 </html>