mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 639705 (Lion Full Screen) Part 4: Fix content tests [r=cpearce]
--HG-- extra : rebase_source : 52bafed68c81c56aab0fe520dc51cb4a04103886
This commit is contained in:
parent
62ec9ec258
commit
0f018487d9
@ -15,7 +15,7 @@ Test that restricted key pressed drop documents out of DOM full-screen mode.
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="document.body.mozRequestFullScreen();">
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
@ -92,28 +92,35 @@ function testScriptInitiatedKeyEvents() {
|
||||
|
||||
function testNextKey() {
|
||||
if (!document.mozFullScreen) {
|
||||
document.addEventListener("mozfullscreenchange", reallyTestNextKey, false);
|
||||
document.body.mozRequestFullScreen();
|
||||
}
|
||||
// mozRequestFullScreen() is async...
|
||||
setTimeout(
|
||||
function() {
|
||||
ok(document.mozFullScreen, "Must be in full-screen mode");
|
||||
else {
|
||||
reallyTestNextKey();
|
||||
}
|
||||
}
|
||||
|
||||
gKeyName = keyList[gKeyTestIndex].code;
|
||||
gKeyCode = KeyEvent["DOM_" + gKeyName];
|
||||
gKeySuppressed = keyList[gKeyTestIndex].suppressed;
|
||||
gKeyTestIndex++;
|
||||
function reallyTestNextKey() {
|
||||
document.removeEventListener("mozfullscreenchange", reallyTestNextKey, false);
|
||||
|
||||
testScriptInitiatedKeyEvents();
|
||||
testTrustedKeyEvents();
|
||||
}, 0);
|
||||
ok(document.mozFullScreen, "Must be in full-screen mode");
|
||||
|
||||
gKeyName = keyList[gKeyTestIndex].code;
|
||||
gKeyCode = KeyEvent["DOM_" + gKeyName];
|
||||
gKeySuppressed = keyList[gKeyTestIndex].suppressed;
|
||||
gKeyTestIndex++;
|
||||
|
||||
testScriptInitiatedKeyEvents();
|
||||
testTrustedKeyEvents();
|
||||
}
|
||||
|
||||
window.addEventListener("keydown", keyHandler, true);
|
||||
window.addEventListener("keyup", keyHandler, true);
|
||||
window.addEventListener("keypress", keyHandler, true);
|
||||
setTimeout(testNextKey, 0);
|
||||
|
||||
function begin() {
|
||||
testNextKey();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -16,7 +16,7 @@ Test DOM full-screen API.
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<body>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 545812 **/
|
||||
@ -47,8 +47,6 @@ var fullScreenChangeCount = 0;
|
||||
var fullscreendenied = false;
|
||||
var fullScreenErrorRun = false;
|
||||
|
||||
document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true;}, false);
|
||||
|
||||
function sendMouseClick(element) {
|
||||
synthesizeMouseAtCenter(element, {});
|
||||
}
|
||||
@ -232,10 +230,11 @@ function fullScreenChange(event) {
|
||||
fullScreenChangeCount++;
|
||||
}
|
||||
|
||||
document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true;}, false);
|
||||
document.addEventListener("mozfullscreenchange", fullScreenChange, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {fullScreenElement().mozRequestFullScreen();});
|
||||
function begin() {
|
||||
fullScreenElement().mozRequestFullScreen();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -15,7 +15,7 @@ Test DOM full-screen API.
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="run();">
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
@ -35,7 +35,7 @@ document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true
|
||||
|
||||
var gotFullScreenChange = false;
|
||||
|
||||
function run() {
|
||||
function begin() {
|
||||
document.addEventListener("mozfullscreenchange",
|
||||
function() {
|
||||
ok(false, "Should never receive a mozfullscreenchange event in the main window.");
|
||||
|
@ -16,7 +16,7 @@ exit DOM full-screen mode.
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="startTest();">
|
||||
<body>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
@ -49,9 +49,9 @@ function fullscreenchange2(event) {
|
||||
finish();
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
function begin() {
|
||||
document.addEventListener("mozfullscreenchange", fullscreenchange1, false);
|
||||
SimpleTest.waitForFocus(function() {document.body.mozRequestFullScreen();});
|
||||
document.body.mozRequestFullScreen();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -8,7 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=697636
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="boom();">
|
||||
<body>
|
||||
|
||||
<iframe id="f" src="data:text/html,<body text=green>1" mozallowfullscreen></iframe>
|
||||
|
||||
@ -25,7 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=697636
|
||||
var frameWin;
|
||||
var e1;
|
||||
|
||||
function boom()
|
||||
function begin()
|
||||
{
|
||||
frameWin = document.getElementById("f").contentWindow;
|
||||
e1 = frameWin.document.documentElement;
|
||||
|
@ -8,7 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=685402
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="boom();" style="background-color: gray;">
|
||||
<body style="background-color: gray;">
|
||||
|
||||
<iframe id="f" src="data:text/html,<body text=green>1" mozallowfullscreen></iframe>
|
||||
|
||||
@ -27,16 +27,17 @@ var e1;
|
||||
var prevEnabled;
|
||||
var prevTrusted;
|
||||
|
||||
function boom()
|
||||
function begin()
|
||||
{
|
||||
frameWin = document.getElementById("f").contentWindow;
|
||||
e1 = frameWin.document.body;
|
||||
document.addEventListener("mozfullscreenchange", function onfullscreen() {
|
||||
document.removeEventListener("mozfullscreenchange", onfullscreen, false);
|
||||
opener.ok(document.mozFullScreen, "[navigation] Request should be granted");
|
||||
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
|
||||
}, false);
|
||||
|
||||
e1.mozRequestFullScreen();
|
||||
setTimeout(
|
||||
function() {
|
||||
opener.ok(document.mozFullScreen, "[navigation] Request should be granted");
|
||||
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function b2()
|
||||
|
@ -21,7 +21,7 @@ Test plugins with DOM full-screen API:
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="scheduleTest();">
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Windowed plugin, focusing should revoke full-screen. -->
|
||||
@ -59,7 +59,7 @@ const isMacOs = navigator.appVersion.indexOf("Macintosh") != -1;
|
||||
|
||||
var windowedPlugin = null;
|
||||
|
||||
function scheduleTest() {
|
||||
function begin() {
|
||||
// Delay test startup long enough for the windowed plugin in the subframe to
|
||||
// start up and create its window.
|
||||
opener.SimpleTest.executeSoon(function() {
|
||||
|
@ -20,7 +20,7 @@ Tests:
|
||||
<title>Test for Bug 700764</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<body>
|
||||
|
||||
<div id="fse">
|
||||
<div id="fse-inner">
|
||||
@ -54,13 +54,9 @@ function e(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(
|
||||
function() {
|
||||
addListener("change", change1);
|
||||
e("fse").mozRequestFullScreen();
|
||||
}
|
||||
);
|
||||
function begin() {
|
||||
addListener("change", change1);
|
||||
e("fse").mozRequestFullScreen();
|
||||
}
|
||||
|
||||
function change1() {
|
||||
|
@ -24,12 +24,10 @@
|
||||
/** Tests for Bug 545812 **/
|
||||
|
||||
// Ensure the full-screen api is enabled, and will be disabled on test exit.
|
||||
var prevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
|
||||
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
|
||||
|
||||
// Disable the requirement for trusted contexts only, so the tests are easier
|
||||
// to write.
|
||||
var prevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
|
||||
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
|
||||
|
||||
// Run the tests which go full-screen in new windows, as mochitests normally
|
||||
@ -50,6 +48,7 @@ var testWindow = null;
|
||||
var gTestIndex = 0;
|
||||
|
||||
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
|
||||
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||
|
||||
function nextTest() {
|
||||
if (isWinXP) {
|
||||
@ -59,13 +58,34 @@ function nextTest() {
|
||||
}
|
||||
if (testWindow) {
|
||||
testWindow.close();
|
||||
if (isOSXLion) {
|
||||
// On OS X Lion, tests cause problems. Timeouts are a bad way to get around
|
||||
// the problem and may lead to future [orange], but they are the only option
|
||||
// at this point.
|
||||
SimpleTest.waitForFocus(function() { setTimeout(runNextTest, 3000); });
|
||||
return;
|
||||
}
|
||||
}
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
if (gTestIndex < gTestWindows.length) {
|
||||
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 {
|
||||
SpecialPowers.setBoolPref("full-screen-api.enabled", prevEnabled);
|
||||
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", prevTrusted);
|
||||
SpecialPowers.clearUserPref("full-screen-api.enabled");
|
||||
SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user