gecko-dev/dom/html/test/test_fullscreen-api.html
Nigel Babu 64f3815bd7 Backed out 4 changesets (bug 1160014) for M2 bustages CLOSED TREE
Backed out changeset 87b00a9dac95 (bug 1160014)
Backed out changeset d4fa5c794e08 (bug 1160014)
Backed out changeset fca26897d534 (bug 1160014)
Backed out changeset b0b7f4f09ed2 (bug 1160014)
2015-07-11 10:49:25 +05:30

97 lines
2.9 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 545812</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<style>
body {
background-color: black;
}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=545812">Mozilla Bug 545812</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Tests for Bug 545812 **/
SimpleTest.requestFlakyTimeout("untriaged");
// Run the tests which go full-screen in new windows, as mochitests normally
// run in an iframe, which by default will not have the allowfullscreen
// attribute set, so full-screen won't work.
var gTestWindows = [
"file_fullscreen-ancestor-stacking-context.html",
"file_fullscreen-multiple.html",
"file_fullscreen-rollback.html",
"file_fullscreen-esc-context-menu.html",
"file_fullscreen-esc-exit.html",
"file_fullscreen-denied.html",
"file_fullscreen-api.html",
"file_fullscreen-api-keys.html",
"file_fullscreen-plugins.html",
"file_fullscreen-hidden.html",
"file_fullscreen-svg-element.html",
"file_fullscreen-navigation.html"
];
var testWindow = null;
var gTestIndex = 0;
function finish() {
SimpleTest.finish();
}
function nextTest() {
if (testWindow) {
testWindow.close();
}
runNextTest();
}
function runNextTest() {
if (gTestIndex < gTestWindows.length) {
info("Run test " + gTestWindows[gTestIndex]);
testWindow = window.open(gTestWindows[gTestIndex], "", "width=500,height=500");
// We'll wait for the window to load, then make sure our window is refocused
// before starting the test, which will get kicked off on "focus".
// This ensures that we're essentially back on the primary "desktop" on
// OS X Lion before we run the test.
testWindow.addEventListener("load", function onload() {
testWindow.removeEventListener("load", onload, false);
SimpleTest.waitForFocus(function() {
SimpleTest.waitForFocus(testWindow.begin, testWindow);
});
}, false);
gTestIndex++;
} else {
SimpleTest.finish();
}
}
try {
window.fullScreen = true;
} catch (e) {
}
is(window.fullScreen, false, "Shouldn't be able to set window fullscreen from content");
// Ensure the full-screen api is enabled, and will be disabled on test exit.
// Disable the requirement for trusted contexts only, so the tests are easier
// to write
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({
"set":[["full-screen-api.enabled", true],
["full-screen-api.allow-trusted-requests-only", false]]}, nextTest);
});
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>