Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / touch-gesture-noscroll-div.html
blob071ba05f985ea9201f3d166ccb6bef12510c2f08
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 <script src="resources/gesture-helpers.js"></script>
6 <style type="text/css">
7 #touchtarget {
8 width: 100px;
9 height: 100px;
10 background: white;
11 overflow:hidden;
14 ::-webkit-scrollbar {
15 width: 0px;
16 height: 0px;
19 #greenbox {
20 width: 100px;
21 height: 100px;
22 background: green;
23 padding: 0px;
24 margin: 0px;
27 #redbox {
28 width: 100px;
29 height: 100px;
30 background: red;
31 padding: 0px;
32 margin: 0px;
35 td {
36 padding: 0px;
38 </style>
39 </head>
40 <body style="margin:0" onload="runTest();">
41 <div id="touchtarget">
42 <table border="0" cellspacing="0px" id="tablefoo">
43 <tr>
44 <td><div id="redbox"></div></td>
45 <td><div id="greenbox"></div></td>
46 </tr>
47 <tr>
48 <td><div id="greenbox"></div></td>
49 <td><div id="greenbox"></div></td>
50 </tr>
51 </table>
52 </div>
54 <p id="description"></p>
55 <div id="console"></div>
56 <script type="text/javascript">
58 var movingdiv;
59 var expectedGesturesTotal = 2;
60 var gesturesOccurred = 0;
61 var scrollAmountX = ['0', '0'];
62 var scrollAmountY = ['0', '0'];
63 var wheelEventsOccurred = 0;
64 var expectedWheelEventsOccurred = ['0', '0'];
65 var scrollEventsOccurred = 0;
66 var expectedScrollEventsOccurred = '0';
67 var scrolledElement = 'movingdiv'
69 function firstGestureScroll()
71 debug("first gesture");
72 eventSender.gestureScrollBegin(95, 12);
73 eventSender.gestureScrollUpdate(-90, 0);
74 eventSender.gestureScrollEnd(0, 0);
76 // Wait for layout.
77 checkScrollOffset();
80 function secondGestureScroll()
82 debug("second gesture");
83 eventSender.gestureScrollBegin(12, 97);
84 eventSender.gestureScrollUpdate(0, -95);
85 eventSender.gestureScrollEnd(0, 0);
87 // Wait for layout.
88 checkScrollOffset();
90 // In this test we do not expect any scroll events to
91 // be received by the event listener, so we signal
92 // the end of the test by calling this function instead
93 // of relying on recordScroll() to do it.
94 finishTest();
97 if (window.testRunner)
98 testRunner.waitUntilDone();
100 function runTest()
102 movingdiv = document.getElementById('touchtarget');
103 movingdiv.addEventListener("scroll", recordScroll);
104 window.addEventListener("mousewheel", recordWheel);
106 if (window.eventSender) {
107 description('This tests that a non-scrollable div cannot be scrolled with touch.');
109 if (checkTestDependencies())
110 firstGestureScroll();
111 else
112 exitIfNecessary();
113 } else {
114 debug("This test requires DumpRenderTree. Touch scroll the red rect to log.");
118 function finishTest()
120 if (window.eventSender) {
121 if (gesturesOccurred == expectedGesturesTotal) {
122 shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred);
123 successfullyParsed = true;
124 isSuccessfullyParsed();
125 if (window.testRunner)
126 testRunner.notifyDone();
130 </script>
131 </body>
132 </html>