| <html> |
| <head> |
| <script> |
| function runTests() |
| { |
| window.onfocus = onFocusFunc; |
| window.onblur = onBlurFunc; |
| if (window.layoutTestController) { |
| layoutTestController.dumpAsText(); |
| layoutTestController.setCanOpenWindows(); |
| layoutTestController.waitUntilDone(); |
| |
| // DumpRenderTreeWindow does not respond to focus events. Forcing onblur event so |
| // that the results matches what you'll see in the browser. |
| layoutTestController.setWindowIsKey(false); |
| } |
| showModalDialog("resources/modal-dialog.html"); |
| } |
| |
| function log(message) |
| { |
| var console = document.getElementById("console"); |
| var li = document.createElement("li"); |
| var text = document.createTextNode(message); |
| |
| console.appendChild(li); |
| li.appendChild(text); |
| } |
| |
| function onBlurFunc() |
| { |
| log("onblur fired. Should see this exactly once."); |
| } |
| |
| function onFocusFunc() |
| { |
| log("ERROR: onfocus fired."); |
| } |
| </script> |
| </head> |
| |
| <body onload="runTests()"> |
| <p>Pop up a modal dialog. Verifies that focus events are not fired while inside the message loop.</p><br/> |
| <p>You need to disable pop-up blocker for this test to run successfully in the browser.</p> |
| <ul id="console"></ul> |
| </body> |
| </html> |