Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / frame-click-focus.html
blob71c3026584f0f5d41cdaa51c9c4ecbf48574fbda
1 <html>
2 <head>
3 <script>
4 function log(msg) {
5 document.getElementById('log').appendChild(document.createTextNode(msg + '\n'));
8 function test() {
9 if (window.testRunner) {
10 testRunner.dumpAsText();
13 window.onfocus = function() { log('main frame focused'); }
14 window.onblur = function() { log('main frame blurred'); }
16 var w = document.getElementById('frame').contentWindow;
17 w.onfocus = function() { log('iframe focused'); }
18 w.onblur = function() { log('iframe blurred'); }
20 if (window.eventSender) {
21 eventSender.mouseMoveTo(1, 300);
22 eventSender.mouseDown();
23 eventSender.mouseUp();
25 // We need to "wait" a bit before the next click -- otherwise it is ignored
26 eventSender.leapForward(2000);
28 eventSender.mouseMoveTo(50, 50);
29 eventSender.mouseDown();
30 eventSender.mouseUp();
32 eventSender.leapForward(2000);
34 eventSender.mouseMoveTo(1, 300);
35 eventSender.mouseDown();
36 eventSender.mouseUp();
39 </script>
40 </head>
41 <body onload="test()">
42 <iframe id="frame" style="width: 100px; height: 100px; margin: 0px; border: 2px solid black;"></iframe>
43 <p>This page tests that frames receive focus events when a click occurs
44 within their content area, and blur events when a click occurs outside
45 their content area.</p>
46 <p>To test, click in the frame and then click on this text.</p>
48 <pre id="log"></pre>
49 </body>
50 </html>