Bug 1205938 part 2 - Enable fullscreen-api-race test on e10s and OS X. r?smaug
MozReview-Commit-ID: 6CGfvSuyhVc
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -465,17 +465,17 @@ skip-if = buildapp == 'b2g' || toolkit =
[test_formSubmission2.html]
skip-if = toolkit == 'android'
[test_formelements.html]
[test_fullscreen-api.html]
tags = fullscreen
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' # b2g(time out, some kind of focus issue) b2g-debug(time out, some kind of focus issue) b2g-desktop(time out, some kind of focus issue)
[test_fullscreen-api-race.html]
tags = fullscreen
-skip-if = buildapp == 'b2g' || toolkit == 'android' || toolkit == 'cocoa' || e10s # just copy the conditions from the test above
+skip-if = buildapp == 'b2g' || toolkit == 'android' # just copy the conditions from the test above
[test_hidden.html]
[test_html_attributes_reflection.html]
[test_htmlcollection.html]
[test_iframe_sandbox_general.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
[test_iframe_sandbox_inheritance.html]
[test_iframe_sandbox_modal.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #modal tests fail on android # b2g(modal tests fail on B2G) b2g-debug(modal tests fail on B2G) b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
--- a/dom/html/test/test_fullscreen-api-race.html
+++ b/dom/html/test/test_fullscreen-api-race.html
@@ -10,16 +10,22 @@
<script>
function Deferred() {
this.promise = new Promise(resolve => {
this.resolve = resolve;
});
}
+function checkIsChromeFullscreen(win, inFullscreen) {
+ return SimpleTest.promiseWaitForCondition(
+ () => win.fullScreen == inFullscreen,
+ "The window should exit fullscreen state");
+}
+
SimpleTest.waitForExplicitFinish();
// XXX This actually exposes a true race condition, but it could rarely
// happen in real world, because it only happens when requestFullscreen
// is called immediately after exiting fullscreen in certain condition,
// and in real life, requestFullscreen can only be called inside a user
// event handler. But we want to fix this race condition at some point,
// via queuing all exiting request as well as entering request together
// which we may eventually need to do for bug 1188256.
@@ -42,37 +48,39 @@ const OPEN_WINDOW_FUNCS = [
const ACTION_FUNCS = [
function navigate(win) {
info("About to navigate to another page");
var deferred = new Deferred();
win.location = "data:text/html,<html>";
setTimeout(() => {
SimpleTest.waitForFocus(() => {
- ok(!win.fullScreen, "The window should no longer be in fullscreen");
- win.close();
- deferred.resolve();
+ checkIsChromeFullscreen(win, false).then(() => {
+ win.close();
+ deferred.resolve();
+ });
}, win);
}, 0);
return deferred.promise;
},
function closeWindow(win) {
info("About to close the window");
win.close();
return Promise.resolve();
},
function exitFullscreen(win) {
info("About to cancel fullscreen");
var deferred = new Deferred();
function listener() {
win.removeEventListener("fullscreenchange", listener);
ok(!win.document.fullscreenElement, "Should exit fullscreen");
- ok(!win.fullScreen, "The window should no longer be in fullscreen");
- win.close();
- deferred.resolve();
+ checkIsChromeFullscreen(win, false).then(() => {
+ win.close();
+ deferred.resolve();
+ });
}
win.addEventListener("fullscreenchange", listener);
win.document.exitFullscreen();
return deferred.promise;
},
function exitAndClose(win) {
info("About to cancel fullscreen and close the window");
win.document.exitFullscreen();