<!DOCTYPE html>
<html>
    <head>
        <script src="../resources/js-test-pre.js"></script>
    </head>
    <body>
        <p>
            Tests that a table-section element can be used in full screen mode.
        </p>
        <div id="test" style="display: table-footer-group">Test Element</div>
        <p>
            Hit Enter to run if not in test runner.
        </p>
        <script>
            if (window.testRunner) {
                testRunner.dumpAsText(false /* runPixelTests */);
                testRunner.waitUntilDone();
            }

            var testElement = document.getElementById('test');

            document.addEventListener('webkitfullscreenchange', function(e) {
                if (document.webkitFullscreenElement) {
                    shouldBe("document.webkitFullscreenElement.id", "'test'");
                    document.webkitCancelFullScreen();
                    if (window.testRunner)
                        testRunner.notifyDone();
                }
            }, false /* useCapture */);
            
            document.addEventListener("keydown", function(e) {
                if (e.keyCode == 13 /* Enter */)
                    testElement.webkitRequestFullscreen();
            }, false /* useCapture */);
            
            if (window.eventSender)
                eventSender.keyDown("\n");
        </script>
    </body>
</html>
