Use testRunner instead of layoutTestController in fast/doctypes, dom, dynamic, encodi...
[WebKit-https.git] / LayoutTests / platform / qt / fast / events / event-sender-keydown-frame.html
1 <head>
2 </head>
3 <body>
4     <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=20303">bug 20303</a>:
5     [Qt] key events are not working in frames.</p>
6 <script>
7     if (window.testRunner) {
8         testRunner.dumpAsText();
9         testRunner.waitUntilDone();
10     }
11     function reportIFramePos()
12     {
13         var x = document.getElementById("anIFrame").contentDocument.body.scrollLeft;
14         var y = document.getElementById("anIFrame").contentDocument.body.scrollTop;
15
16         // result, the iframe should be scrolled down
17         if (y > 0)
18             document.getElementById("console").innerHTML = "SUCCESS";
19         else
20             document.getElementById("console").innerHTML = "FAILURE";
21         testRunner.notifyDone();
22     }
23
24     function testAndReport() {
25         if (window.eventSender) {
26             var frame = document.getElementById("anIFrame");
27
28             // center the mouse cursor
29             var x = frame.offsetLeft + frame.offsetWidth/2;
30             var y = frame.offsetTop + frame.offsetHeight/2;
31
32             // send mouse event to focus the iframe
33             eventSender.mouseMoveTo(x, y);
34             eventSender.mouseDown();
35             eventSender.mouseUp();
36
37             // send key down event
38             eventSender.keyDown('\uf701');
39
40             // report
41             reportIFramePos();
42         }
43     }
44 </script>
45
46 <iframe style="width:350px;border:dotted green 1px" width="200" height="200"
47  id="anIFrame" src="resources/divs.html" onload="testAndReport();"></iframe>
48 <div id="result">
49 </div>
50 <div id="console">
51 </div>
52 </body>
53 </html>