<script>
var failed = false;

function runTest() {
    window.onfocus = windowFocused;
    window.onblur = windowBlurred;
    
    if (window.layoutTestController) {
        window.layoutTestController.dumpAsText();
        window.layoutTestController.setMainFrameIsFirstResponder(true);
        
        window.layoutTestController.setWindowIsKey(false);
        window.layoutTestController.setWindowIsKey(true);
        window.layoutTestController.setWindowIsKey(false);
    }
}

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 windowFocused() {
    log("Window was focused");
}

function windowBlurred() {
    log("Window was blurred");
}
</script>
<body>
This tests window.onFocus and window.onBlur handlers.  It uses the layoutTestControllers ability to mimic bringing the window to the front and pushing it to the back.
<p><b>It is not intended to be run interactively:</b> when you run it interactively, you should see 'Window was blurred' and 'Window was focused' messages as you push the window to the back and bring it to the front, respectively.</p>
<ul id="console"></ul>
<script>runTest();</script>
</body>
