mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1631735 Part 2: Add a fullscreen test that checks event order, and a test of fs->minimize->fs. r=mstange,emilio
The transition from fullscreen to minimize and back is not directly allowed in macOS, though our test harness can be forced to request it. The modified test forces this transition explicitly, so we can eliminate it as an accidental occurrence with other tests. The transition from minimize to fullscreen fails on Linux and Windows, so this change marks the entire test as failing on those platforms. New Bugs have been opened on this issue and those are noted in the fail-if. Depends on D166450 Differential Revision: https://phabricator.services.mozilla.com/D164248
This commit is contained in:
parent
35295e5966
commit
17087ede43
@ -14,6 +14,11 @@ support-files = fullscreen.html FullscreenFrame.sys.mjs
|
||||
support-files = fullscreen.html fullscreen_frame.html
|
||||
[browser_fullscreen_enterInUrlbar.js]
|
||||
skip-if = (os == 'mac') || (os == 'linux') # Bug 1648649
|
||||
[browser_fullscreen_from_minimize.js]
|
||||
skip-if =
|
||||
os == 'linux' # Bug 1818795
|
||||
fail-if =
|
||||
os == 'win' # Bug 1818796
|
||||
[browser_fullscreen_newtab.js]
|
||||
[browser_fullscreen_permissions_prompt.js]
|
||||
[browser_fullscreen_warning.js]
|
||||
|
@ -0,0 +1,72 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// This test checks whether fullscreen windows can transition to minimized windows,
|
||||
// and back again. This is sometimes not directly supported by the OS widgets. For
|
||||
// example, in macOS, the minimize button is greyed-out in the title bar of
|
||||
// fullscreen windows, making this transition impossible for users to initiate.
|
||||
// Still, web APIs do allow arbitrary combinations of window calls, and this test
|
||||
// exercises some of those combinations.
|
||||
|
||||
add_task(async function() {
|
||||
registerCleanupFunction(function() {
|
||||
window.restore();
|
||||
});
|
||||
|
||||
// We reuse these variables to create new promises for each transition.
|
||||
let promiseSizeModeChange;
|
||||
let promiseFullscreen;
|
||||
|
||||
ok(!window.fullScreen, "Window should be normal at start of test.");
|
||||
|
||||
// Get to fullscreen.
|
||||
info("Requesting fullscreen.");
|
||||
promiseFullscreen = document.documentElement.requestFullscreen();
|
||||
await promiseFullscreen;
|
||||
ok(window.fullScreen, "Window should be fullscreen before being minimized.");
|
||||
|
||||
// Transition between fullscreen and minimize states.
|
||||
info("Requesting minimize on a fullscreen window.");
|
||||
promiseSizeModeChange = BrowserTestUtils.waitForEvent(
|
||||
window,
|
||||
"sizemodechange"
|
||||
);
|
||||
window.minimize();
|
||||
await promiseSizeModeChange;
|
||||
is(
|
||||
window.windowState,
|
||||
window.STATE_MINIMIZED,
|
||||
"Window should be minimized after fullscreen."
|
||||
);
|
||||
|
||||
// Whether or not the previous transition worked, restore the window
|
||||
// and then minimize it.
|
||||
if (window.windowState != window.STATE_NORMAL) {
|
||||
info("Restoring window.");
|
||||
promiseSizeModeChange = BrowserTestUtils.waitForEvent(
|
||||
window,
|
||||
"sizemodechange"
|
||||
);
|
||||
window.restore();
|
||||
await promiseSizeModeChange;
|
||||
is(window.windowState, window.STATE_NORMAL, "Window should be normal.");
|
||||
}
|
||||
|
||||
info("Requesting minimize on a normal window.");
|
||||
promiseSizeModeChange = BrowserTestUtils.waitForEvent(
|
||||
window,
|
||||
"sizemodechange"
|
||||
);
|
||||
window.minimize();
|
||||
await promiseSizeModeChange;
|
||||
is(
|
||||
window.windowState,
|
||||
window.STATE_MINIMIZED,
|
||||
"Window should be minimized before fullscreen."
|
||||
);
|
||||
|
||||
info("Requesting fullscreen on a minimized window.");
|
||||
promiseFullscreen = document.documentElement.requestFullscreen();
|
||||
await promiseFullscreen;
|
||||
ok(window.fullScreen, "Window should be fullscreen after being minimized.");
|
||||
});
|
@ -404,7 +404,7 @@ skip-if =
|
||||
os == "win" && !debug
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_windowactivation.js]
|
||||
skip-if =
|
||||
skip-if =
|
||||
verify
|
||||
os == "linux" && debug # Bug 1678774
|
||||
support-files =
|
||||
|
78
dom/base/test/fullscreen/file_fullscreen-single.html
Normal file
78
dom/base/test/fullscreen/file_fullscreen-single.html
Normal file
@ -0,0 +1,78 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
|
||||
Open one window, focus it and enter fullscreen, then exit fullscreen.
|
||||
|
||||
-->
|
||||
<head>
|
||||
<title>Simple Fullscreen Enter and Exit Test</title>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="file_fullscreen-utils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="fullscreen-div"><p>Fullscreen div</p></div>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
function ok(condition, msg) {
|
||||
opener.ok(condition, "[single] " + msg);
|
||||
}
|
||||
|
||||
function is(value, expected, msg) {
|
||||
opener.is(value, expected, "[single] " + msg);
|
||||
}
|
||||
|
||||
function isnot(value, unexpected, msg) {
|
||||
opener.isnot(value, unexpected, "[single] " + msg);
|
||||
}
|
||||
|
||||
function info(msg) {
|
||||
opener.info("[single] " + msg);
|
||||
}
|
||||
|
||||
function windowResized() {
|
||||
info(`Window resized to width: ${window.innerWidth}, height: ${window.innerHeight}.`);
|
||||
}
|
||||
|
||||
async function begin() {
|
||||
window.addEventListener('resize', windowResized);
|
||||
|
||||
info(`Starting window width: ${window.innerWidth}, height: ${window.innerHeight}.`);
|
||||
let windowedWidth = window.innerWidth;
|
||||
let windowedHeight = window.innerHeight;
|
||||
|
||||
info("Requesting fullscreen.");
|
||||
let entryPromise = document.getElementById('fullscreen-div').requestFullscreen()
|
||||
info("Fullscreen requested, waiting for promise to resolve.");
|
||||
|
||||
await entryPromise;
|
||||
|
||||
info("element.requestFullscreen() promise resolved.");
|
||||
info(`Fullscreen window width: ${window.innerWidth}, height: ${window.innerHeight}.`);
|
||||
isnot(document.fullscreenElement, null, "document.fullscreenElement should exist.");
|
||||
ok(window.fullScreen, "window.fullScreen");
|
||||
isnot(windowedWidth, window.innerWidth, "window width should be changed.");
|
||||
isnot(windowedHeight, window.innerHeight, "window height should be changed.");
|
||||
|
||||
info("Requesting fullscreen exit.");
|
||||
let exitPromise = document.exitFullscreen()
|
||||
info("Fullscreen exit requested, waiting for promise to resolve.");
|
||||
|
||||
await exitPromise;
|
||||
|
||||
info("document.exitFullscreen() promise resolved.");
|
||||
info(`Restored window width: ${window.innerWidth}, height: ${window.innerHeight}.`);
|
||||
is(document.fullscreenElement, null, "document.fullscreenElement should be null.");
|
||||
ok(!window.fullScreen, "window.fullScreen should be false.");
|
||||
is(window.innerWidth, windowedWidth, "window width should be restored.");
|
||||
is(window.innerHeight, windowedHeight, "window height should be restored.");
|
||||
opener.nextTest();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,8 +1,8 @@
|
||||
[DEFAULT]
|
||||
tags = fullscreen
|
||||
support-files =
|
||||
file_fullscreen-api.html
|
||||
file_fullscreen-api-race.html
|
||||
file_fullscreen-api.html
|
||||
file_fullscreen-async.html
|
||||
file_fullscreen-backdrop.html
|
||||
file_fullscreen-denied-inner.html
|
||||
@ -27,6 +27,7 @@ support-files =
|
||||
file_fullscreen-scrollbar.html
|
||||
file_fullscreen-selector.html
|
||||
file_fullscreen-shadowdom.html
|
||||
file_fullscreen-single.html
|
||||
file_fullscreen-sub-iframe.html
|
||||
file_fullscreen-svg-element.html
|
||||
file_fullscreen-table.html
|
||||
@ -34,14 +35,13 @@ support-files =
|
||||
file_fullscreen-utils.js
|
||||
file_fullscreen-with-full-zoom.html
|
||||
|
||||
[test_fullscreen-api-race.html]
|
||||
skip-if = toolkit == 'android' # same as test_fullscreen-api.html, 1356570
|
||||
os == "mac" && debug
|
||||
[test_fullscreen-api.html]
|
||||
allow_xul_xbl = true # XUL is used in file_fullscreen-api.html
|
||||
skip-if =
|
||||
toolkit == 'android'
|
||||
os == 'mac' && bits == 64 && debug # Bug 1579623
|
||||
[test_fullscreen-api-race.html]
|
||||
skip-if = toolkit == 'android' # same as test_fullscreen-api.html, 1356570
|
||||
verify && debug && os == 'mac'
|
||||
os == "mac" && debug
|
||||
[test_fullscreen_meta_viewport.html]
|
||||
[test_fullscreen_modal.html]
|
||||
|
@ -28,6 +28,7 @@ SimpleTest.requestFlakyTimeout("untriaged");
|
||||
// run in an iframe, which by default will not have the allowfullscreen
|
||||
// attribute set, so full-screen won't work.
|
||||
var gTestWindows = [
|
||||
{ test: "file_fullscreen-single.html" },
|
||||
{ test: "file_fullscreen-multiple.html",
|
||||
prefs: [["full-screen-api.exit-on.windowRaise", false],
|
||||
["full-screen-api.exit-on.windowOpen", false]] },
|
||||
@ -72,6 +73,7 @@ function nextTest() {
|
||||
info("main window focused, starting next test");
|
||||
SimpleTest.executeSoon(runNextTest);
|
||||
}, {once: true});
|
||||
info("testWindow.close()");
|
||||
testWindow.close();
|
||||
} else {
|
||||
SimpleTest.executeSoon(runNextTest);
|
||||
|
Loading…
Reference in New Issue
Block a user