dom/tests/mochitest/chrome/sizemode_attribute.xul

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
michael@0 4 <!--
michael@0 5 Test for fullscreen sizemode in chrome
michael@0 6 -->
michael@0 7 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 8 persist="sizemode"
michael@0 9 sizemode="normal"
michael@0 10 onload="nextStep()">
michael@0 11
michael@0 12 <script type="text/javascript;version=1.8">
michael@0 13 let tests = [
michael@0 14 function test1() {
michael@0 15 checkAndContinue("normal");
michael@0 16 },
michael@0 17
michael@0 18 function test2() {
michael@0 19 listen("fullscreen", function() checkAndContinue("fullscreen"));
michael@0 20 window.fullScreen = true;
michael@0 21 },
michael@0 22
michael@0 23 function test3() {
michael@0 24 listen("fullscreen", function() checkAndContinue("normal"));
michael@0 25 window.fullScreen = false;
michael@0 26 },
michael@0 27
michael@0 28 function test4() {
michael@0 29 listen("resize", function() checkAndContinue("maximized"));
michael@0 30 window.maximize();
michael@0 31 },
michael@0 32
michael@0 33 function test5() {
michael@0 34 listen("fullscreen", function() checkAndContinue("fullscreen"));
michael@0 35 window.fullScreen = true;
michael@0 36 },
michael@0 37
michael@0 38 function test6() {
michael@0 39 listen("fullscreen", function() checkAndContinue("maximized"));
michael@0 40 window.fullScreen = false;
michael@0 41 },
michael@0 42
michael@0 43 function test7() {
michael@0 44 listen("resize", function() checkAndContinue("normal"));
michael@0 45 window.restore();
michael@0 46 },
michael@0 47
michael@0 48 function test8() {
michael@0 49 window.opener.wrappedJSObject.done();
michael@0 50 }
michael@0 51 ];
michael@0 52
michael@0 53 function nextStep() {
michael@0 54 tests.shift()();
michael@0 55 }
michael@0 56
michael@0 57 function listen(event, fn) {
michael@0 58 window.addEventListener(event, function listener() {
michael@0 59 window.removeEventListener(event, listener, false);
michael@0 60 fn();
michael@0 61 }, false);
michael@0 62 }
michael@0 63
michael@0 64 function checkAndContinue(sizemode) {
michael@0 65
michael@0 66 let windowStates = {
michael@0 67 "fullscreen": window.STATE_FULLSCREEN,
michael@0 68 "normal": window.STATE_NORMAL,
michael@0 69 "maximized": window.STATE_MAXIMIZED
michael@0 70 };
michael@0 71
michael@0 72 setTimeout(function() {
michael@0 73 is(window.document.documentElement.getAttribute("sizemode"), sizemode, "sizemode attribute should match actual window state");
michael@0 74 is(window.fullScreen, sizemode == "fullscreen", "window.fullScreen should match actual window state");
michael@0 75 is(window.windowState, windowStates[sizemode], "window.sizeMode should match actual window state");
michael@0 76 nextStep();
michael@0 77 }, 0);
michael@0 78 }
michael@0 79
michael@0 80 let is = window.opener.wrappedJSObject.is;
michael@0 81
michael@0 82 </script>
michael@0 83
michael@0 84 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 85
michael@0 86 </body>
michael@0 87 </window>

mercurial