Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encodi...
[WebKit-https.git] / LayoutTests / fast / events / touch / gesture / touch-gesture-scroll-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="../../../js/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"></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 = ['140', '200'];
33 var wheelEventsOccurred = 0;
34 var expectedWheelEventsOccurred = ['1', '1'];
35 var scrollEventsOccurred = 0;
36 var expectedScrollEventsOccurred = '1';
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
61 if (window.testRunner)
62     testRunner.waitUntilDone();
63
64 function runTest()
65 {
66     touchtarget = document.getElementById('touchtarget');
67     touchtarget.contentDocument.addEventListener("scroll", recordScroll);
68     touchtarget.contentDocument.body.addEventListener("mousewheel", recordWheel);
69
70     if (window.eventSender) {
71         description('This tests gesture event scrolling in iframes. ' +
72             'Red-green strip is scrolled on pass.');
73         if (checkTestDependencies())
74             firstGestureScroll();
75         else
76             exitIfNecessary();
77     } else {
78         debug("This test requires DumpRenderTree .  Touch-scroll the red/green strip.");
79     }
80 }
81 </script>
82 </body>
83 </html>