Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | |
michael@0 | 6 | <window title="Window Position On Resize Test" |
michael@0 | 7 | onload="startTest()" |
michael@0 | 8 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 9 | |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 14 | |
michael@0 | 15 | <script class="testbody" type="application/javascript"><![CDATA[ |
michael@0 | 16 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 17 | let win, x, y; |
michael@0 | 18 | |
michael@0 | 19 | function startTest() { |
michael@0 | 20 | win = window.openDialog("about:blank", |
michael@0 | 21 | null, |
michael@0 | 22 | "chrome,dialog=no,outerHeight=170,outerWidth=200"); |
michael@0 | 23 | waitForSuccess(function() { return win.mozPaintCount }, |
michael@0 | 24 | "No paint received", checkInitialSize); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function checkInitialSize() { |
michael@0 | 28 | let runtime = Components.classes["@mozilla.org/xre/app-info;1"] |
michael@0 | 29 | .getService(Components.interfaces.nsIXULRuntime); |
michael@0 | 30 | let test = runtime.widgetToolkit == "windows" ? todo_is : is; // bug 602745 |
michael@0 | 31 | test(win.outerHeight,170, "initial outerHeight"); |
michael@0 | 32 | test(win.outerWidth, 200, "initial outerWidth"); |
michael@0 | 33 | x = win.screenX; |
michael@0 | 34 | y = win.screenY; |
michael@0 | 35 | shrink(); |
michael@0 | 36 | } |
michael@0 | 37 | function shrink() { |
michael@0 | 38 | win.resizeTo(180, 160); |
michael@0 | 39 | waitForSuccess(function() { return win.outerHeight == 160 }, |
michael@0 | 40 | "outerHeight did not change to 160", checkShrink); |
michael@0 | 41 | } |
michael@0 | 42 | function checkShrink() { |
michael@0 | 43 | is(win.outerWidth, 180, "resized outerWidth"); |
michael@0 | 44 | is(win.screenY, y, "resized window top should not change"); |
michael@0 | 45 | y = win.screenY; |
michael@0 | 46 | restore(); |
michael@0 | 47 | } |
michael@0 | 48 | function restore() { |
michael@0 | 49 | win.resizeBy(20, 10); |
michael@0 | 50 | waitForSuccess(function() { return win.outerHeight == 170 }, |
michael@0 | 51 | "outerHeight did not change to 170", checkRestore); |
michael@0 | 52 | } |
michael@0 | 53 | function checkRestore() { |
michael@0 | 54 | is(win.outerWidth, 200, "restored outerWidth"); |
michael@0 | 55 | is(win.screenX, x, "restored window left should not change"); |
michael@0 | 56 | is(win.screenY, y, "restored window top should not change"); |
michael@0 | 57 | done(); |
michael@0 | 58 | } |
michael@0 | 59 | function done() { |
michael@0 | 60 | win.close(); |
michael@0 | 61 | SimpleTest.finish(); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | function waitForSuccess(testForSuccess, failureMsg, nextFunc) { |
michael@0 | 65 | var waitCount = 0; |
michael@0 | 66 | |
michael@0 | 67 | function repeatWait() { |
michael@0 | 68 | ++waitCount; |
michael@0 | 69 | |
michael@0 | 70 | if (testForSuccess()) { |
michael@0 | 71 | nextFunc(); |
michael@0 | 72 | } |
michael@0 | 73 | else if (waitCount > 50) { |
michael@0 | 74 | ok(false, failureMsg); |
michael@0 | 75 | nextFunc(); |
michael@0 | 76 | } else { |
michael@0 | 77 | setTimeout(repeatWait, 100); |
michael@0 | 78 | } |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | repeatWait(); |
michael@0 | 82 | } |
michael@0 | 83 | ]]></script> |
michael@0 | 84 | |
michael@0 | 85 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 86 | <p id="display"> |
michael@0 | 87 | </p> |
michael@0 | 88 | <div id="content" style="display: none"> |
michael@0 | 89 | </div> |
michael@0 | 90 | <pre id="test"> |
michael@0 | 91 | </pre> |
michael@0 | 92 | </body> |
michael@0 | 93 | |
michael@0 | 94 | </window> |