michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: var prefsBranch = Cc["@mozilla.org/preferences-service;1"]. michael@0: getService(Ci.nsIPrefService). michael@0: getBranch("browser.panorama."); michael@0: michael@0: function animateZoom() prefsBranch.getBoolPref("animate_zoom"); michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: let charsetArg = "charset=" + window.content.document.characterSet; michael@0: let win = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", michael@0: "about:blank", charsetArg, null, null, true); michael@0: michael@0: registerCleanupFunction(function() { michael@0: prefsBranch.setBoolPref("animate_zoom", true); michael@0: win.close(); michael@0: }); michael@0: michael@0: ok(animateZoom(), "By default, we animate on zoom."); michael@0: prefsBranch.setBoolPref("animate_zoom", false); michael@0: ok(!animateZoom(), "animate_zoom = false"); michael@0: michael@0: let onLoad = function() { michael@0: win.removeEventListener("load", onLoad, false); michael@0: michael@0: // a few shared references michael@0: let tabViewWindow = null; michael@0: let transitioned = 0; michael@0: michael@0: let initCallback = function() { michael@0: tabViewWindow = win.TabView.getContentWindow(); michael@0: function onTransitionEnd(event) { michael@0: transitioned++; michael@0: info(transitioned); michael@0: } michael@0: tabViewWindow.document.addEventListener("transitionend", onTransitionEnd, false); michael@0: michael@0: // don't use showTabView() here because we only want to check whether michael@0: // zoom out animation happens. Other animations would happen before michael@0: // the callback as waitForFocus() was added to showTabView() in head.js michael@0: let onTabViewShown = function() { michael@0: tabViewWindow.removeEventListener("tabviewshown", onTabViewShown, false); michael@0: tabViewWindow.document.removeEventListener("transitionend", onTransitionEnd, false); michael@0: michael@0: ok(!transitioned, "There should be no transitions"); michael@0: michael@0: finish(); michael@0: }; michael@0: tabViewWindow.addEventListener("tabviewshown", onTabViewShown, false); michael@0: win.TabView.toggle(); michael@0: }; michael@0: michael@0: win.TabView._initFrame(initCallback); michael@0: } michael@0: win.addEventListener("load", onLoad, false); michael@0: }