Bug 1504062 - fix timeouts in dom test_fullscreen_api.html, r=kats

Differential Revision: https://phabricator.services.mozilla.com/D10723

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gijs Kruitbosch 2018-11-02 16:46:54 +00:00
Родитель 26f3fc7fec
Коммит ec4136b39b
4 изменённых файлов: 15 добавлений и 3 удалений

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

@ -10,14 +10,17 @@ function doRequestFullscreen() {
document.removeEventListener("fullscreenchange", handler); document.removeEventListener("fullscreenchange", handler);
document.removeEventListener("fullscreenerror", handler); document.removeEventListener("fullscreenerror", handler);
if (evt.type == "fullscreenchange") { if (evt.type == "fullscreenchange") {
document.addEventListener("fullscreenchange", () => parent.continueTest(evt.type), {once: true});
document.exitFullscreen(); document.exitFullscreen();
} } else {
parent.continueTest(evt.type); parent.continueTest(evt.type);
} }
}
parent.ok(document.fullscreenEnabled, "Fullscreen " + parent.ok(document.fullscreenEnabled, "Fullscreen " +
`should be enabled in ${parent.testTargetName}`); `should be enabled in ${parent.testTargetName}`);
document.addEventListener("fullscreenchange", handler); document.addEventListener("fullscreenchange", handler);
document.addEventListener("fullscreenerror", handler); document.addEventListener("fullscreenerror", handler);
parent.opener.info("Requesting fullscreen");
document.documentElement.requestFullscreen(); document.documentElement.requestFullscreen();
} }
</script> </script>

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

@ -55,6 +55,7 @@ function nextTest() {
} }
let test = tests.shift(); let test = tests.shift();
opener.info("Running " + test[0]);
// Create an iframe with an allowfullscreen and with an allow attribute. // Create an iframe with an allowfullscreen and with an allow attribute.
// The request should be denied or allowed, based on the current test. // The request should be denied or allowed, based on the current test.

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

@ -437,7 +437,7 @@ skip-if = toolkit == 'android'
[test_formelements.html] [test_formelements.html]
[test_fullscreen-api.html] [test_fullscreen-api.html]
tags = fullscreen tags = fullscreen
skip-if = toolkit == 'android' || (os == 'linux' && !debug) # linux opt/pgo timeouts: bug 1504062 skip-if = toolkit == 'android'
support-files = support-files =
file_fullscreen-api.html file_fullscreen-api.html
file_fullscreen-backdrop.html file_fullscreen-backdrop.html

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

@ -60,9 +60,15 @@ function finish() {
function nextTest() { function nextTest() {
if (testWindow) { if (testWindow) {
testWindow.close(); info("Waiting for focus to return to main window");
} window.addEventListener("focus", function() {
info("main window focused, starting next test");
SimpleTest.executeSoon(runNextTest); SimpleTest.executeSoon(runNextTest);
}, {once: true});
testWindow.close();
} else {
SimpleTest.executeSoon(runNextTest);
}
} }
var gHeadlessSkipList = [ var gHeadlessSkipList = [
@ -130,10 +136,12 @@ function runNextTest() {
waitForLoadAndPaint(testWindow, function() { waitForLoadAndPaint(testWindow, function() {
SimpleTest.waitForFocus(function() { SimpleTest.waitForFocus(function() {
SimpleTest.waitForFocus(function() { SimpleTest.waitForFocus(function() {
info("Were focused");
// For the platforms that support reporting occlusion state (e.g. Mac), // For the platforms that support reporting occlusion state (e.g. Mac),
// we should wait until the docshell has been activated again, // we should wait until the docshell has been activated again,
// otherwise, the fullscreen request might be denied. // otherwise, the fullscreen request might be denied.
if (testWindow.document.hidden) { if (testWindow.document.hidden) {
info("Waiting for document to unhide");
waitForEvent(testWindow.document, "visibilitychange", (event) => { waitForEvent(testWindow.document, "visibilitychange", (event) => {
return !testWindow.document.hidden; return !testWindow.document.hidden;
}, testWindow.begin); }, testWindow.begin);