Bug 728893 - Allow mochitest iframe to go fullscreen. r=ctalbert

This commit is contained in:
Diogo Golovanevsky Monteiro 2012-05-15 09:00:54 -04:00
Родитель 8e5a2dc231
Коммит 156539e715
6 изменённых файлов: 59 добавлений и 3 удалений

Просмотреть файл

@ -82,7 +82,7 @@ function loadTests()
</div>
<div class="clear"></div>
<div class="frameholder">
<iframe type="content" scrolling="no" id="testframe" width="550" height="350"></iframe>
<iframe type="content" scrolling="no" id="testframe" width="550" height="350" mozallowfullscreen="true"></iframe>
</div>
<div class="clear"></div>
<div class="toggle">

Просмотреть файл

@ -43,7 +43,7 @@ function loadTests()
</div>
<div class="clear"></div>
<div class="frameholder">
<iframe type="content" scrolling="no" id="testframe" width="550" height="350"></iframe>
<iframe type="content" scrolling="no" id="testframe" width="550" height="350" mozallowfullscreen="true"></iframe>
</div>
<div class="clear"></div>
<div class="toggle">

Просмотреть файл

@ -653,7 +653,7 @@ function testListing(metadata, response)
),
DIV({class: "clear"}),
DIV({class: "frameholder"},
IFRAME({scrolling: "no", id: "testframe", width: "500", height: "300"})
IFRAME({scrolling: "no", id: "testframe", width: "500", height: "300", mozallowfullscreen: "true"})
),
DIV({class: "clear"}),
DIV({class: "toggle"},

Просмотреть файл

@ -60,6 +60,7 @@ _TEST_FILES = \
test_SpecialPowersExtension.html \
test_SpecialPowersExtension2.html \
file_SpecialPowersFrame1.html \
test_cancelFullScreen.html \
$(NULL)
ifneq ($(OS_TARGET),Android)

Просмотреть файл

@ -680,6 +680,10 @@ SimpleTest.executeSoon = function(aFunc) {
* SimpleTest.waitForExplicitFinish() has been invoked.
**/
SimpleTest.finish = function () {
// Cancel element fullscreen mode due to Bug 728893
if (document && document.mozFullScreenElement) {
document.mozCancelFullScreen();
}
if (SimpleTest._expectingUncaughtException) {
SimpleTest.ok(false, "expectUncaughtException was called but no uncaught exception was detected!");
}

Просмотреть файл

@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 728893</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="start()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=728893">
Mozilla Bug
</a>
<div id="div">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 728893
Checks if SimpleTest.finish cancels fullscreen mode
The assertion happens after calling SimpleTest.finish
Running the test without the harness won't work
**/
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only",
false);
SimpleTest.waitForExplicitFinish();
var div = document.getElementById("div");
document.addEventListener("mozfullscreenchange", function (e) {
if (document.mozFullScreenElement === div) {
SimpleTest.finish();
}
else {
is(false, document.mozFullScreen,
"SimpleTest.finish should cancel fullscreen mode");
}
}, false);
function start() {
SimpleTest.waitForFocus(function() {
div.mozRequestFullScreen();
});
}
</script>
</pre>
</body>
</html>