Change fast/e* files to use pre and post js files in LayoutTests/resources.
[WebKit-https.git] / LayoutTests / fast / events / touch / gesture / touch-gesture-noscroll-iframe.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../../../js/resources/js-test-style.css">
5 <script src="../../../../resources/js-test-pre.js"></script>
6 <script src="resources/gesture-helpers.js"></script>
7 <style type="text/css">
8 #touchtarget {
9   width: 200px;
10   height: 200px;
11   position: relative;
12   background: white;
13 }
14
15 ::-webkit-scrollbar {
16     width: 0px;
17     height: 0px;
18 }
19
20 </style>
21 </head>
22 <body>
23 <iframe id="touchtarget" src="resources/scroll-inside-iframe.html" scrolling="no"></iframe>
24     <p id="description"></p>
25 <div id="console"></div>
26 <script type="text/javascript">
27
28 var touchtarget;
29 var expectedGesturesTotal = 2;
30 var gesturesOccurred = 0;
31 var scrollAmountX = ['0', '0'];
32 var scrollAmountY = ['0', '0'];
33 var wheelEventsOccurred = 0;
34 var expectedWheelEventsOccurred = ['0', '0'];
35 var scrollEventsOccurred = 0;
36 var expectedScrollEventsOccurred = '0';
37 var scrolledElement = 'touchtarget.contentDocument.body'
38
39 function firstGestureScroll()
40 {
41     debug("first gesture");
42     eventSender.gestureScrollBegin(12, 150);
43     eventSender.gestureScrollUpdate(0, -140);
44     eventSender.gestureScrollEnd(0, 0);
45
46     // Wait for layout.
47     checkScrollOffset();
48 }
49
50 function secondGestureScroll()
51 {
52     debug("second gesture");
53     eventSender.gestureScrollBegin(12, 110);
54     eventSender.gestureScrollUpdate(0, -60);
55     eventSender.gestureScrollEnd(0, 0);
56
57     // Wait for layout.
58     checkScrollOffset();
59
60     // In this test we do not expect any scroll events to
61     // be received by the event listener, so we signal
62     // the end of the test by calling this function instead
63     // of relying on recordScroll() to do it.
64     finishTest();
65 }
66
67 if (window.testRunner)
68     testRunner.waitUntilDone();
69
70 function runTest()
71 {
72     touchtarget = document.getElementById('touchtarget');
73     touchtarget.contentDocument.addEventListener("scroll", recordScroll);
74     touchtarget.contentDocument.body.addEventListener("mousewheel", recordWheel);
75
76     if (window.eventSender) {
77         description('This tests that non-scrollable iframes cannot be scrolled with touch.');
78         if (checkTestDependencies())
79             firstGestureScroll();
80         else
81             exitIfNecessary();
82     } else {
83         debug("This test requires DumpRenderTree .  Touch-scroll the red/green strip.");
84     }
85 }
86
87 function finishTest()
88 {
89     if (window.eventSender) {
90         if (gesturesOccurred == expectedGesturesTotal) {
91             shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred);
92             successfullyParsed = true;
93             isSuccessfullyParsed();
94             if (window.testRunner)
95                 testRunner.notifyDone();
96         }
97     }
98 }
99 </script>
100 </body>
101 </html>