<script src="full-screen-test.js"></script>
<div>This tests that full screen mode will not exit when a non-ancestor iframe is loaded in the page. Click <button onclick="startTest();">enter full screen</button> to start test.</div>
<div id="target">
    <iframe id="iframe"></iframe>
</div>
<script>
    var target = document.getElementById('target');
    var iframe = document.getElementById('iframe');

    waitForEventOnce(document, 'webkitfullscreenchange', function() {
        waitForEvent(document, 'webkitfullscreenchange', function() {
           logResult(false, 'Exited full screen'); 
        });
        iframe.src = 'resources/empty.html';
    });

    waitForEvent(iframe, 'load', function() {
        testExpected("document.webkitIsFullScreen", true);
        endTest();
    });

    var startTest = function() {
        target.webkitRequestFullscreen();
    };

    if (window.testRunner)
        runWithKeyDown(startTest);
</script>
