Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / touch / gesture / touch-gesture-noscroll-iframe.html
blob5d4ed3c1f75b1726d621e5a15e0f15b5f45a6d39
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: 200px;
9 height: 200px;
10 position: relative;
11 background: white;
14 ::-webkit-scrollbar {
15 width: 0px;
16 height: 0px;
19 </style>
20 </head>
21 <body>
22 <iframe id="touchtarget" src="resources/scroll-inside-iframe.html" scrolling="no"></iframe>
23 <p id="description"></p>
24 <div id="console"></div>
25 <script type="text/javascript">
27 var touchtarget;
28 var expectedGesturesTotal = 2;
29 var gesturesOccurred = 0;
30 var scrollAmountX = ['0', '0'];
31 var scrollAmountY = ['0', '0'];
32 var wheelEventsOccurred = 0;
33 var expectedWheelEventsOccurred = ['0', '0'];
34 var scrollEventsOccurred = 0;
35 var expectedScrollEventsOccurred = '0';
36 var scrolledElement = 'touchtarget.contentDocument.scrollingElement'
38 function firstGestureScroll()
40 debug("first gesture");
41 eventSender.gestureScrollBegin(12, 150);
42 eventSender.gestureScrollUpdate(0, -140);
43 eventSender.gestureScrollEnd(0, 0);
45 // Wait for layout.
46 checkScrollOffset();
49 function secondGestureScroll()
51 debug("second gesture");
52 eventSender.gestureScrollBegin(12, 110);
53 eventSender.gestureScrollUpdate(0, -60);
54 eventSender.gestureScrollEnd(0, 0);
56 // Wait for layout.
57 checkScrollOffset();
59 // In this test we do not expect any scroll events to
60 // be received by the event listener, so we signal
61 // the end of the test by calling this function instead
62 // of relying on recordScroll() to do it.
63 finishTest();
66 if (window.testRunner)
67 testRunner.waitUntilDone();
69 function runTest()
71 touchtarget = document.getElementById('touchtarget');
72 touchtarget.contentDocument.addEventListener("scroll", recordScroll);
73 touchtarget.contentDocument.body.addEventListener("mousewheel", recordWheel);
75 if (window.eventSender) {
76 description('This tests that non-scrollable iframes cannot be scrolled with touch.');
77 if (checkTestDependencies())
78 firstGestureScroll();
79 else
80 exitIfNecessary();
81 } else {
82 debug("This test requires DumpRenderTree . Touch-scroll the red/green strip.");
86 function finishTest()
88 if (window.eventSender) {
89 if (gesturesOccurred == expectedGesturesTotal) {
90 shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred);
91 successfullyParsed = true;
92 isSuccessfullyParsed();
93 if (window.testRunner)
94 testRunner.notifyDone();
98 </script>
99 </body>
100 </html>