Backed out changeset 39e6a7e77cfb (bug 1927808) for causing multiple failures. CLOSED...
[gecko.git] / dom / tests / mochitest / chrome / sizemode_attribute.xhtml
blob76e2a422b25bb1ea3e463628c2a51b44ad405212
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
4 <!--
5 Test for fullscreen sizemode in chrome
6 -->
7 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
8 persist="sizemode"
9 sizemode="normal"
10 onload="nextStep()">
12 <script type="text/javascript">
13 let tests = [
14 function test1() {
15 checkAndContinue("normal");
18 function test2() {
19 listen("fullscreen", () => checkAndContinue("fullscreen"));
20 window.fullScreen = true;
23 function test3() {
24 listen("fullscreen", () => checkAndContinue("normal"));
25 window.fullScreen = false;
28 function test4() {
29 listen("resize", () => checkAndContinue("maximized"));
30 window.maximize();
33 function test5() {
34 listen("fullscreen", () => checkAndContinue("fullscreen"));
35 window.fullScreen = true;
38 function test6() {
39 listen("fullscreen", () => checkAndContinue("maximized"));
40 window.fullScreen = false;
43 function test7() {
44 listen("resize", () => checkAndContinue("normal"));
45 window.restore();
48 function test8() {
49 window.arguments[0].done();
53 function nextStep() {
54 tests.shift()();
57 function listen(event, fn) {
58 window.addEventListener(event, function listener() {
59 fn();
60 }, { once: true });
63 function checkAndContinue(sizemode) {
65 let windowStates = {
66 "fullscreen": window.STATE_FULLSCREEN,
67 "normal": window.STATE_NORMAL,
68 "maximized": window.STATE_MAXIMIZED
71 setTimeout(function() {
72 is(window.document.documentElement.getAttribute("sizemode"), sizemode, "sizemode attribute should match actual window state");
73 is(window.fullScreen, sizemode == "fullscreen", "window.fullScreen should match actual window state");
74 is(window.windowState, windowStates[sizemode], "window.sizeMode should match actual window state");
75 nextStep();
76 }, 0);
79 let is = window.arguments[0].is;
81 </script>
83 <body xmlns="http://www.w3.org/1999/xhtml">
85 </body>
86 </window>