Bug 806703 - Port browser_privatebrowsing_zoomrestore.js to the new per-window PB APIs

--HG--
rename : browser/components/privatebrowsing/test/browser/global/browser_privatebrowsing_zoomrestore.js => browser/components/privatebrowsing/test/browser/perwindow/browser_privatebrowsing_zoomrestore.js
This commit is contained in:
Mario Alvarado [:marioalv] 2012-11-13 15:02:23 -06:00
parent 2182288fed
commit 58fdd3f074
2 changed files with 64 additions and 0 deletions

View File

@ -29,6 +29,7 @@ MOCHITEST_BROWSER_FILES = \
browser_privatebrowsing_localStorage_page2.html \
browser_privatebrowsing_opendir.js \
browser_privatebrowsing_theming.js \
+ browser_privatebrowsing_zoomrestore.js \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,63 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This test makes sure that about:privatebrowsing does not appear zoomed in
// if there is already a zoom site pref for about:blank (bug 487656).
function test() {
// initialization
waitForExplicitFinish();
let windowsToClose = [];
let windowsToReset = [];
function doTest(aIsZoomedWindow, aWindow, aCallback) {
aWindow.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
if (aIsZoomedWindow) {
// change the zoom on the blank page
aWindow.FullZoom.enlarge();
isnot(aWindow.ZoomManager.zoom, 1, "Zoom level for about:blank should be changed");
} else {
// make sure the zoom level is set to 1
is(aWindow.ZoomManager.zoom, 1, "Zoom level for about:privatebrowsing should be reset");
}
aCallback();
}, true);
aWindow.gBrowser.selectedBrowser.loadURI("about:blank");
}
function finishTest() {
// cleanup
windowsToReset.forEach(function(win) {
win.FullZoom.reset();
});
finish();
}
function testOnWindow(options, callback) {
let win = OpenBrowserWindow(options);
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
windowsToClose.push(win);
windowsToReset.push(win);
executeSoon(function() callback(win));
}, false);
};
registerCleanupFunction(function() {
windowsToClose.forEach(function(win) {
win.close();
});
});
testOnWindow({}, function(win) {
doTest(true, win, function() {
testOnWindow({private: true}, function(win) {
doTest(false, win, finishTest);
});
});
});
}