|
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()"> |
|
11 |
|
12 <script type="text/javascript;version=1.8"> |
|
13 let tests = [ |
|
14 function test1() { |
|
15 checkAndContinue("normal"); |
|
16 }, |
|
17 |
|
18 function test2() { |
|
19 listen("fullscreen", function() checkAndContinue("fullscreen")); |
|
20 window.fullScreen = true; |
|
21 }, |
|
22 |
|
23 function test3() { |
|
24 listen("fullscreen", function() checkAndContinue("normal")); |
|
25 window.fullScreen = false; |
|
26 }, |
|
27 |
|
28 function test4() { |
|
29 listen("resize", function() checkAndContinue("maximized")); |
|
30 window.maximize(); |
|
31 }, |
|
32 |
|
33 function test5() { |
|
34 listen("fullscreen", function() checkAndContinue("fullscreen")); |
|
35 window.fullScreen = true; |
|
36 }, |
|
37 |
|
38 function test6() { |
|
39 listen("fullscreen", function() checkAndContinue("maximized")); |
|
40 window.fullScreen = false; |
|
41 }, |
|
42 |
|
43 function test7() { |
|
44 listen("resize", function() checkAndContinue("normal")); |
|
45 window.restore(); |
|
46 }, |
|
47 |
|
48 function test8() { |
|
49 window.opener.wrappedJSObject.done(); |
|
50 } |
|
51 ]; |
|
52 |
|
53 function nextStep() { |
|
54 tests.shift()(); |
|
55 } |
|
56 |
|
57 function listen(event, fn) { |
|
58 window.addEventListener(event, function listener() { |
|
59 window.removeEventListener(event, listener, false); |
|
60 fn(); |
|
61 }, false); |
|
62 } |
|
63 |
|
64 function checkAndContinue(sizemode) { |
|
65 |
|
66 let windowStates = { |
|
67 "fullscreen": window.STATE_FULLSCREEN, |
|
68 "normal": window.STATE_NORMAL, |
|
69 "maximized": window.STATE_MAXIMIZED |
|
70 }; |
|
71 |
|
72 setTimeout(function() { |
|
73 is(window.document.documentElement.getAttribute("sizemode"), sizemode, "sizemode attribute should match actual window state"); |
|
74 is(window.fullScreen, sizemode == "fullscreen", "window.fullScreen should match actual window state"); |
|
75 is(window.windowState, windowStates[sizemode], "window.sizeMode should match actual window state"); |
|
76 nextStep(); |
|
77 }, 0); |
|
78 } |
|
79 |
|
80 let is = window.opener.wrappedJSObject.is; |
|
81 |
|
82 </script> |
|
83 |
|
84 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
85 |
|
86 </body> |
|
87 </window> |