mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +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>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body onload="document.body.mozRequestFullScreen();">
|
<body>
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
|
|
||||||
@ -92,11 +92,17 @@ function testScriptInitiatedKeyEvents() {
|
|||||||
|
|
||||||
function testNextKey() {
|
function testNextKey() {
|
||||||
if (!document.mozFullScreen) {
|
if (!document.mozFullScreen) {
|
||||||
|
document.addEventListener("mozfullscreenchange", reallyTestNextKey, false);
|
||||||
document.body.mozRequestFullScreen();
|
document.body.mozRequestFullScreen();
|
||||||
}
|
}
|
||||||
// mozRequestFullScreen() is async...
|
else {
|
||||||
setTimeout(
|
reallyTestNextKey();
|
||||||
function() {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reallyTestNextKey() {
|
||||||
|
document.removeEventListener("mozfullscreenchange", reallyTestNextKey, false);
|
||||||
|
|
||||||
ok(document.mozFullScreen, "Must be in full-screen mode");
|
ok(document.mozFullScreen, "Must be in full-screen mode");
|
||||||
|
|
||||||
gKeyName = keyList[gKeyTestIndex].code;
|
gKeyName = keyList[gKeyTestIndex].code;
|
||||||
@ -106,14 +112,15 @@ function testNextKey() {
|
|||||||
|
|
||||||
testScriptInitiatedKeyEvents();
|
testScriptInitiatedKeyEvents();
|
||||||
testTrustedKeyEvents();
|
testTrustedKeyEvents();
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("keydown", keyHandler, true);
|
window.addEventListener("keydown", keyHandler, true);
|
||||||
window.addEventListener("keyup", keyHandler, true);
|
window.addEventListener("keyup", keyHandler, true);
|
||||||
window.addEventListener("keypress", keyHandler, true);
|
window.addEventListener("keypress", keyHandler, true);
|
||||||
setTimeout(testNextKey, 0);
|
|
||||||
|
|
||||||
|
function begin() {
|
||||||
|
testNextKey();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
|
@ -16,7 +16,7 @@ Test DOM full-screen API.
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body onload="start();">
|
<body>
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
|
|
||||||
/** Test for Bug 545812 **/
|
/** Test for Bug 545812 **/
|
||||||
@ -47,8 +47,6 @@ var fullScreenChangeCount = 0;
|
|||||||
var fullscreendenied = false;
|
var fullscreendenied = false;
|
||||||
var fullScreenErrorRun = false;
|
var fullScreenErrorRun = false;
|
||||||
|
|
||||||
document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true;}, false);
|
|
||||||
|
|
||||||
function sendMouseClick(element) {
|
function sendMouseClick(element) {
|
||||||
synthesizeMouseAtCenter(element, {});
|
synthesizeMouseAtCenter(element, {});
|
||||||
}
|
}
|
||||||
@ -232,10 +230,11 @@ function fullScreenChange(event) {
|
|||||||
fullScreenChangeCount++;
|
fullScreenChangeCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true;}, false);
|
||||||
document.addEventListener("mozfullscreenchange", fullScreenChange, false);
|
document.addEventListener("mozfullscreenchange", fullScreenChange, false);
|
||||||
|
|
||||||
function start() {
|
function begin() {
|
||||||
SimpleTest.waitForFocus(function() {fullScreenElement().mozRequestFullScreen();});
|
fullScreenElement().mozRequestFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -15,7 +15,7 @@ Test DOM full-screen API.
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body onload="run();">
|
<body>
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ document.addEventListener("mozfullscreenerror", function(){fullscreendenied=true
|
|||||||
|
|
||||||
var gotFullScreenChange = false;
|
var gotFullScreenChange = false;
|
||||||
|
|
||||||
function run() {
|
function begin() {
|
||||||
document.addEventListener("mozfullscreenchange",
|
document.addEventListener("mozfullscreenchange",
|
||||||
function() {
|
function() {
|
||||||
ok(false, "Should never receive a mozfullscreenchange event in the main window.");
|
ok(false, "Should never receive a mozfullscreenchange event in the main window.");
|
||||||
|
@ -16,7 +16,7 @@ exit DOM full-screen mode.
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body onload="startTest();">
|
<body>
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
|
|
||||||
@ -49,9 +49,9 @@ function fullscreenchange2(event) {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
function startTest() {
|
function begin() {
|
||||||
document.addEventListener("mozfullscreenchange", fullscreenchange1, false);
|
document.addEventListener("mozfullscreenchange", fullscreenchange1, false);
|
||||||
SimpleTest.waitForFocus(function() {document.body.mozRequestFullScreen();});
|
document.body.mozRequestFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -8,7 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=697636
|
|||||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body onload="boom();">
|
<body>
|
||||||
|
|
||||||
<iframe id="f" src="data:text/html,<body text=green>1" mozallowfullscreen></iframe>
|
<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 frameWin;
|
||||||
var e1;
|
var e1;
|
||||||
|
|
||||||
function boom()
|
function begin()
|
||||||
{
|
{
|
||||||
frameWin = document.getElementById("f").contentWindow;
|
frameWin = document.getElementById("f").contentWindow;
|
||||||
e1 = frameWin.document.documentElement;
|
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>
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
</head>
|
</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>
|
<iframe id="f" src="data:text/html,<body text=green>1" mozallowfullscreen></iframe>
|
||||||
|
|
||||||
@ -27,16 +27,17 @@ var e1;
|
|||||||
var prevEnabled;
|
var prevEnabled;
|
||||||
var prevTrusted;
|
var prevTrusted;
|
||||||
|
|
||||||
function boom()
|
function begin()
|
||||||
{
|
{
|
||||||
frameWin = document.getElementById("f").contentWindow;
|
frameWin = document.getElementById("f").contentWindow;
|
||||||
e1 = frameWin.document.body;
|
e1 = frameWin.document.body;
|
||||||
e1.mozRequestFullScreen();
|
document.addEventListener("mozfullscreenchange", function onfullscreen() {
|
||||||
setTimeout(
|
document.removeEventListener("mozfullscreenchange", onfullscreen, false);
|
||||||
function() {
|
|
||||||
opener.ok(document.mozFullScreen, "[navigation] Request should be granted");
|
opener.ok(document.mozFullScreen, "[navigation] Request should be granted");
|
||||||
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
|
frameWin.location = "data:text/html,<body text=blue onload='parent.b2()'>2";
|
||||||
}, 0);
|
}, false);
|
||||||
|
|
||||||
|
e1.mozRequestFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
function b2()
|
function b2()
|
||||||
|
@ -21,7 +21,7 @@ Test plugins with DOM full-screen API:
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body onload="scheduleTest();">
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<!-- Windowed plugin, focusing should revoke full-screen. -->
|
<!-- Windowed plugin, focusing should revoke full-screen. -->
|
||||||
@ -59,7 +59,7 @@ const isMacOs = navigator.appVersion.indexOf("Macintosh") != -1;
|
|||||||
|
|
||||||
var windowedPlugin = null;
|
var windowedPlugin = null;
|
||||||
|
|
||||||
function scheduleTest() {
|
function begin() {
|
||||||
// Delay test startup long enough for the windowed plugin in the subframe to
|
// Delay test startup long enough for the windowed plugin in the subframe to
|
||||||
// start up and create its window.
|
// start up and create its window.
|
||||||
opener.SimpleTest.executeSoon(function() {
|
opener.SimpleTest.executeSoon(function() {
|
||||||
|
@ -20,7 +20,7 @@ Tests:
|
|||||||
<title>Test for Bug 700764</title>
|
<title>Test for Bug 700764</title>
|
||||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body onload="start();">
|
<body>
|
||||||
|
|
||||||
<div id="fse">
|
<div id="fse">
|
||||||
<div id="fse-inner">
|
<div id="fse-inner">
|
||||||
@ -54,13 +54,9 @@ function e(id) {
|
|||||||
return document.getElementById(id);
|
return document.getElementById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function start() {
|
function begin() {
|
||||||
SimpleTest.waitForFocus(
|
|
||||||
function() {
|
|
||||||
addListener("change", change1);
|
addListener("change", change1);
|
||||||
e("fse").mozRequestFullScreen();
|
e("fse").mozRequestFullScreen();
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function change1() {
|
function change1() {
|
||||||
|
@ -24,12 +24,10 @@
|
|||||||
/** Tests for Bug 545812 **/
|
/** Tests for Bug 545812 **/
|
||||||
|
|
||||||
// Ensure the full-screen api is enabled, and will be disabled on test exit.
|
// 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);
|
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
|
||||||
|
|
||||||
// Disable the requirement for trusted contexts only, so the tests are easier
|
// Disable the requirement for trusted contexts only, so the tests are easier
|
||||||
// to write.
|
// to write.
|
||||||
var prevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
|
|
||||||
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
|
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
|
||||||
|
|
||||||
// Run the tests which go full-screen in new windows, as mochitests normally
|
// Run the tests which go full-screen in new windows, as mochitests normally
|
||||||
@ -50,6 +48,7 @@ var testWindow = null;
|
|||||||
var gTestIndex = 0;
|
var gTestIndex = 0;
|
||||||
|
|
||||||
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
|
const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
|
||||||
|
const isOSXLion = navigator.userAgent.indexOf("Mac OS X 10.7") != -1;
|
||||||
|
|
||||||
function nextTest() {
|
function nextTest() {
|
||||||
if (isWinXP) {
|
if (isWinXP) {
|
||||||
@ -59,13 +58,34 @@ function nextTest() {
|
|||||||
}
|
}
|
||||||
if (testWindow) {
|
if (testWindow) {
|
||||||
testWindow.close();
|
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) {
|
if (gTestIndex < gTestWindows.length) {
|
||||||
testWindow = window.open(gTestWindows[gTestIndex], "", "width=500,height=500");
|
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++;
|
gTestIndex++;
|
||||||
} else {
|
} else {
|
||||||
SpecialPowers.setBoolPref("full-screen-api.enabled", prevEnabled);
|
SpecialPowers.clearUserPref("full-screen-api.enabled");
|
||||||
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", prevTrusted);
|
SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user