OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function log(msg) { | 4 function log(msg) { |
5 document.getElementById('log').appendChild(document.createTextNode(m
sg + '\n')); | 5 document.getElementById('log').appendChild(document.createTextNode(m
sg + '\n')); |
6 } | 6 } |
7 | 7 |
8 function test() { | 8 function test() { |
9 if (window.testRunner) { | 9 if (window.testRunner) { |
10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
11 } | 11 } |
12 | 12 |
13 window.onfocus = function() { log('main frame focused'); } | 13 window.onfocus = function() { log('main frame focused'); } |
14 window.onblur = function() { log('main frame blurred'); } | 14 window.onblur = function() { log('main frame blurred'); } |
15 | 15 |
16 var w = document.getElementById('frame').contentWindow; | 16 var w = document.getElementById('frame').contentWindow; |
17 w.onfocus = function() { log('iframe focused'); } | 17 w.onfocus = function() { log('iframe focused'); } |
18 w.onblur = function() { log('iframe blurred'); } | 18 w.onblur = function() { log('iframe blurred'); } |
19 | 19 |
20 if (window.eventSender) { | 20 if (window.eventSender) { |
21 // Mouse events only work after an initial layout | |
22 document.body.offsetLeft; | |
23 eventSender.mouseMoveTo(1, 300); | 21 eventSender.mouseMoveTo(1, 300); |
24 eventSender.mouseDown(); | 22 eventSender.mouseDown(); |
25 eventSender.mouseUp(); | 23 eventSender.mouseUp(); |
26 | 24 |
27 // We need to "wait" a bit before the next click -- otherwise it
is ignored | 25 // We need to "wait" a bit before the next click -- otherwise it
is ignored |
28 eventSender.leapForward(2000); | 26 eventSender.leapForward(2000); |
29 | 27 |
30 eventSender.mouseMoveTo(50, 50); | 28 eventSender.mouseMoveTo(50, 50); |
31 eventSender.mouseDown(); | 29 eventSender.mouseDown(); |
32 eventSender.mouseUp(); | 30 eventSender.mouseUp(); |
(...skipping 10 matching lines...) Expand all Loading... |
43 <body onload="test()"> | 41 <body onload="test()"> |
44 <iframe id="frame" style="width: 100px; height: 100px; margin: 0px; border:
2px solid black;"></iframe> | 42 <iframe id="frame" style="width: 100px; height: 100px; margin: 0px; border:
2px solid black;"></iframe> |
45 <p>This page tests that frames receive focus events when a click occurs | 43 <p>This page tests that frames receive focus events when a click occurs |
46 within their content area, and blur events when a click occurs outside | 44 within their content area, and blur events when a click occurs outside |
47 their content area.</p> | 45 their content area.</p> |
48 <p>To test, click in the frame and then click on this text.</p> | 46 <p>To test, click in the frame and then click on this text.</p> |
49 | 47 |
50 <pre id="log"></pre> | 48 <pre id="log"></pre> |
51 </body> | 49 </body> |
52 </html> | 50 </html> |
OLD | NEW |