blob: d670b14a5ba9ee3144f943339d8409690f98920e [file] [log] [blame]
<body>
<script src="full-screen-test.js"></script>
<span></span>
<script>
// Bail out early if the full screen API is not enabled or is missing:
if (Element.prototype.webkitRequestFullScreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
var callback;
var fullscreenChanged = function(event)
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var span = document.getElementsByTagName('span')[0];
var spanEnteredFullScreen = function() {
testExpected("document.webkitIsFullScreen", true);
testExpected("document.webkitCurrentFullScreenElement", span);
callback = cancelledFullScreen;
document.webkitCancelFullScreen();
};
var cancelledFullScreen = function() {
testExpected("document.webkitIsFullScreen", false);
testExpected("document.webkitCurrentFullScreenElement", undefined);
callback = failFullScreenTest;
document.webkitCancelFullScreen();
setTimeout(endTest, 0);
};
var failFullScreenTest = function() {
consoleWrite("Should not have received a webkitfullscreenchange event.");
endTest();
};
callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen()});
}
</script>