Bug 916735 - use a pref to fast-forward animation for tests, r=Unfocused

This commit is contained in:
Gijs Kruitbosch 2013-09-20 14:16:33 +02:00
parent 1c70a0dcab
commit b24ca79ec2
3 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,7 @@ this.EXPORTED_SYMBOLS = ["CustomizeMode"];
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const kPrefCustomizationDebug = "browser.uiCustomization.debug";
const kPrefCustomizationAnimation = "browser.uiCustomization.disableAnimation";
const kPaletteId = "customization-palette";
const kAboutURI = "about:customizing";
const kDragDataTypePrefix = "text/toolbarwrapper-id/";
@ -27,7 +28,13 @@ Cu.import("resource://gre/modules/Promise.jsm");
let gModuleName = "[CustomizeMode]";
#include logging.js
let gDisableAnimation = null;
function CustomizeMode(aWindow) {
if (gDisableAnimation === null) {
gDisableAnimation = Services.prefs.getPrefType(kPrefCustomizationAnimation) == Ci.nsIPrefBranch.PREF_BOOL &&
Services.prefs.getBoolPref(kPrefCustomizationAnimation);
}
this.window = aWindow;
this.document = aWindow.document;
this.browser = aWindow.gBrowser;
@ -293,6 +300,9 @@ CustomizeMode.prototype = {
}.bind(this);
deck.addEventListener("transitionend", customizeTransitionEnd);
if (gDisableAnimation) {
deck.setAttribute("fastcustomizeanimation", true);
}
if (aEntering) {
this.document.documentElement.setAttribute("customizing", true);
} else {

View File

@ -174,6 +174,7 @@ function waitForCondition(aConditionFn, aMaxTries=50, aCheckInterval=100) {
}
function testRunner(testAry, asyncCleanup) {
Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", true);
for (let test of testAry) {
info(test.desc);
@ -191,6 +192,7 @@ function testRunner(testAry, asyncCleanup) {
yield asyncCleanup();
}
ok(CustomizableUI.inDefaultState, "Should remain in default state");
Services.prefs.clearUserPref("browser.uiCustomization.disableAnimation");
}
function runTests(testAry, asyncCleanup) {

View File

@ -10,6 +10,11 @@
transition-timing-function: ease-out;
}
#tab-view-deck[fastcustomizeanimation] {
transition-duration: 1ms;
transition-timing-function: linear;
}
#main-window[customizing] .customization-target {
margin: 3px;
}