Bug 1170369 - Enable tests of Fullscreen API and PointerLock API on Windows XP and OS X 10.6+. r=RyanVM

This commit is contained in:
Xidorn Quan 2015-07-09 08:00:33 +10:00
parent ee2b9ffbaa
commit 75d45d1b36
2 changed files with 13 additions and 53 deletions

View File

@ -45,32 +45,13 @@ var gTestWindows = [
var testWindow = null;
var gTestIndex = 0;
// TODO: if ever we remove these checks for XP and Lion, we should do the same
// in dom/tests/mochitest/pointerlock/test_pointerlock-api.html, which uses the same pattern.
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
const isOSXMtnLion = navigator.userAgent.indexOf("Mac OS X 10.8") != -1;
const isOSXYosemite = navigator.userAgent.indexOf("Mac OS X 10.10") != -1;
function finish() {
SimpleTest.finish();
}
function nextTest() {
if (isWinXP) {
todo(false, "Can't reliably run full-screen tests on Windows XP due to bug 704010");
SimpleTest.finish();
return;
}
if (testWindow) {
testWindow.close();
if (isOSXLion || isOSXMtnLion || isOSXYosemite) {
// 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();
}
@ -95,24 +76,20 @@ function runNextTest() {
}
}
if (isOSXLion || isOSXMtnLion || isOSXYosemite) {
todo(false, "Can't reliably run full-screen tests on OS X (bug 900453 comment 18 & bug 802504)");
} else {
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();
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>

View File

@ -71,13 +71,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
var gTestWindow = null;
var gTestIndex = 0;
// TODO: if ever we remove these checks for XP and Lion, we should do the same
// in dom/html/test/test_fullscreen-api.html, which uses the same pattern.
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
const isOSXMtnLion = navigator.userAgent.indexOf("Mac OS X 10.8") != -1;
const isOSXYosemite = navigator.userAgent.indexOf("Mac OS X 10.10") != -1;
function finish() {
SpecialPowers.clearUserPref("full-screen-api.enabled");
SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
@ -86,16 +79,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633602
}
function nextTest() {
if (isWinXP) {
todo(false, "Can't reliably run full-screen tests on Windows XP due to bug 704010");
finish();
return;
}
if (isOSXLion || isOSXMtnLion || isOSXYosemite) {
todo(false, "Can't reliably run full-screen tests on OS X Lion or Mountain Lion or Yosemite, see bug 744125");
finish();
return;
}
if (gTestWindow) {
gTestWindow.close();
}