<html>
    <head>
        <script>
            if (window.testRunner)
                testRunner.dumpAsText();

            function moveFocus() {
                var ifrm = document.getElementById("rte");
                ifrm.contentWindow.focus();
            }
            
            function init() {
                var ifrm = document.getElementById("rte");
                ifrm.contentDocument.designMode = "on";
                ifrm.contentWindow.focus();
                
                if (window.testRunner) {
                    eventSender.keyDown('T');
                    eventSender.keyDown('E');
                    eventSender.keyDown('S');
                    eventSender.keyDown('T');
                    
                    // Click elsewhere to move the focus, and then move the focus back
                    eventSender.mouseMoveTo(10, 10);
                    eventSender.mouseDown();
                    eventSender.mouseUp();
                    
                    // Newline character
                    eventSender.keyDown(String.fromCharCode(0x000a));
                    
                    eventSender.keyDown('P');
                    eventSender.keyDown('A');
                    eventSender.keyDown('S');
                    eventSender.keyDown('S');
                }
                document.getElementById('res').innerHTML = ifrm.contentDocument.body.innerHTML;
            }
        </script>
    </head>
    <body onload="init()">
        <div id="dv" onclick="moveFocus()">This tests that focusing an editable iframe's window works correctly and allows text and newlines to be entered.<div>
        <iframe id="rte" style="border: 1px solid black"></iframe>
        <div id="res"></div>
    </body>
</html>

