Bug 1241284: mozscreenshots: Move TestRunner.init to `start` to avoid unnecessary work in other suites. r=bgrins
The extension is installed in all mochitest suites so we shouldn't do work that's not needed in those suites.
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
@@ -33,56 +33,57 @@ XPCOMUtils.defineLazyGetter(this, "log",
this.TestRunner = {
combos: null,
completedCombos: 0,
currentComboIndex: 0,
_lastCombo: null,
_libDir: null,
init(extensionPath) {
- let subDirs = ["mozscreenshots",
- (new Date()).toISOString().replace(/:/g, "-") + "_" + Services.appinfo.OS];
- let screenshotPath = FileUtils.getFile("TmpD", subDirs).path;
-
- const MOZ_UPLOAD_DIR = env.get("MOZ_UPLOAD_DIR");
- if (MOZ_UPLOAD_DIR) {
- screenshotPath = MOZ_UPLOAD_DIR;
- }
-
- log.info("Saving screenshots to:", screenshotPath);
- log.debug("TestRunner.init");
-
- let screenshotPrefix = Services.appinfo.appBuildID + "_";
- Screenshot.init(screenshotPath, extensionPath, screenshotPrefix);
- this._libDir = extensionPath.QueryInterface(Ci.nsIFileURL).file.clone();
- this._libDir.append("chrome");
- this._libDir.append("mozscreenshots");
- this._libDir.append("lib");
-
- // Setup some prefs
- Services.prefs.setCharPref("browser.aboutHomeSnippets.updateUrl", "data:");
- Services.prefs.setCharPref("extensions.ui.lastCategory", "addons://list/extension");
- // Don't let the caret blink since it causes false positives for image diffs
- Services.prefs.setIntPref("ui.caretBlinkTime", -1);
+ this._extensionPath = extensionPath;
},
/**
* Load specified sets, execute all combinations of them, and capture screenshots.
*/
start(setNames = null) {
setNames = setNames || defaultSetNames;
let sets = this.loadSets(setNames);
log.info(sets.length + " sets:", setNames);
this.combos = new LazyProduct(sets);
log.info(this.combos.length + " combinations");
this.currentComboIndex = this.completedCombos = 0;
this._lastCombo = null;
+ let subDirs = ["mozscreenshots",
+ (new Date()).toISOString().replace(/:/g, "-") + "_" + Services.appinfo.OS];
+ let screenshotPath = FileUtils.getFile("TmpD", subDirs).path;
+
+ const MOZ_UPLOAD_DIR = env.get("MOZ_UPLOAD_DIR");
+ if (MOZ_UPLOAD_DIR) {
+ screenshotPath = MOZ_UPLOAD_DIR;
+ }
+
+ log.info("Saving screenshots to:", screenshotPath);
+
+ let screenshotPrefix = Services.appinfo.appBuildID + "_";
+ Screenshot.init(screenshotPath, this._extensionPath, screenshotPrefix);
+ this._libDir = this._extensionPath.QueryInterface(Ci.nsIFileURL).file.clone();
+ this._libDir.append("chrome");
+ this._libDir.append("mozscreenshots");
+ this._libDir.append("lib");
+
+ // Setup some prefs
+ Services.prefs.setCharPref("browser.aboutHomeSnippets.updateUrl", "data:");
+ Services.prefs.setCharPref("extensions.ui.lastCategory", "addons://list/extension");
+ // Don't let the caret blink since it causes false positives for image diffs
+ Services.prefs.setIntPref("ui.caretBlinkTime", -1);
+
return Task.spawn(function* doStart() {
for (let i = 0; i < this.combos.length;
i++){
this.currentComboIndex = i;
yield* this._performCombo(this.combos.item(this.currentComboIndex));
}
log.info("Done: Completed " + this.completedCombos + " out of " +