2008-12-08 04:47:42 -08:00
|
|
|
var tabElm, zoomLevel;
|
|
|
|
function start_test_prefNotSet() {
|
|
|
|
is(ZoomManager.zoom, 1, "initial zoom level should be 1");
|
|
|
|
FullZoom.enlarge();
|
|
|
|
|
|
|
|
//capture the zoom level to test later
|
|
|
|
zoomLevel = ZoomManager.zoom;
|
|
|
|
isnot(zoomLevel, 1, "zoom level should have changed");
|
|
|
|
|
2010-03-25 03:52:21 -07:00
|
|
|
afterZoomAndLoad(continue_test_prefNotSet);
|
2008-12-08 04:47:42 -08:00
|
|
|
content.location =
|
2010-03-12 13:53:36 -08:00
|
|
|
"http://mochi.test:8888/browser/browser/base/content/test/moz.png";
|
2008-12-08 04:47:42 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function continue_test_prefNotSet () {
|
2009-09-09 13:04:05 -07:00
|
|
|
is(ZoomManager.zoom, 1, "zoom level pref should not apply to an image");
|
2008-12-08 04:47:42 -08:00
|
|
|
FullZoom.reset();
|
|
|
|
|
2010-03-25 03:52:21 -07:00
|
|
|
afterZoomAndLoad(end_test_prefNotSet);
|
2008-12-08 04:47:42 -08:00
|
|
|
content.location =
|
2010-03-12 13:53:36 -08:00
|
|
|
"http://mochi.test:8888/browser/browser/base/content/test/zoom_test.html";
|
2008-12-08 04:47:42 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function end_test_prefNotSet() {
|
|
|
|
is(ZoomManager.zoom, zoomLevel, "the zoom level should have persisted");
|
|
|
|
|
2009-01-01 23:34:44 -08:00
|
|
|
// Reset the zoom so that other tests have a fresh zoom level
|
|
|
|
FullZoom.reset();
|
2008-12-08 04:47:42 -08:00
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
|
|
|
tabElm = gBrowser.addTab();
|
|
|
|
gBrowser.selectedTab = tabElm;
|
|
|
|
|
2010-03-25 03:52:21 -07:00
|
|
|
afterZoomAndLoad(start_test_prefNotSet);
|
2008-12-08 04:47:42 -08:00
|
|
|
content.location =
|
2010-03-12 13:53:36 -08:00
|
|
|
"http://mochi.test:8888/browser/browser/base/content/test/zoom_test.html";
|
2010-03-25 03:52:21 -07:00
|
|
|
}
|
2008-12-08 04:47:42 -08:00
|
|
|
|
2010-03-25 03:52:21 -07:00
|
|
|
function afterZoomAndLoad(cb) {
|
2012-01-20 07:21:46 -08:00
|
|
|
let didLoad = false;
|
|
|
|
let didZoom = false;
|
2010-03-25 03:52:21 -07:00
|
|
|
tabElm.linkedBrowser.addEventListener("load", function() {
|
|
|
|
tabElm.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
|
|
|
didLoad = true;
|
|
|
|
if (didZoom)
|
|
|
|
executeSoon(cb);
|
|
|
|
}, true);
|
2012-01-18 16:01:19 -08:00
|
|
|
let oldSZFB = ZoomManager.setZoomForBrowser;
|
|
|
|
ZoomManager.setZoomForBrowser = function(browser, value) {
|
|
|
|
oldSZFB.call(ZoomManager, browser, value);
|
|
|
|
ZoomManager.setZoomForBrowser = oldSZFB;
|
2010-03-25 03:52:21 -07:00
|
|
|
didZoom = true;
|
|
|
|
if (didLoad)
|
|
|
|
executeSoon(cb);
|
|
|
|
};
|
2008-12-08 04:47:42 -08:00
|
|
|
}
|