1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* exported TestRunner, shouldCapture */
9 const chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
13 "chrome://mochitests/content/browser/browser/tools/mozscreenshots/mozscreenshots/extension/mozscreenshots/browser/";
17 async function setup() {
18 // This timeout doesn't actually end the job even if it is hit - the buildbot timeout will
19 // handle things for us if the test actually hangs.
20 requestLongerTimeout(100);
22 // Generate output so mozprocess knows we're still alive for the long session.
23 SimpleTest.requestCompleteLog();
25 info("installing extension temporarily");
26 let chromeURL = Services.io.newURI(EXTENSION_DIR);
27 let dir = chromeRegistry
28 .convertChromeURL(chromeURL)
29 .QueryInterface(Ci.nsIFileURL).file;
30 await AddonManager.installTemporaryAddon(dir);
32 info("Checking for mozscreenshots extension");
34 let aAddon = await AddonManager.getAddonByID("mozscreenshots@mozilla.org");
35 isnot(aAddon, null, "The mozscreenshots extension should be installed");
36 TestRunner = ChromeUtils.importESModule(
37 "resource://mozscreenshots/TestRunner.sys.mjs"
39 TestRunner.initTest(this);
43 * Used by pre-defined sets of configurations to decide whether to run for a build.
45 * This is not used by browser_screenshots.js which handles when MOZSCREENSHOTS_SETS is set.
47 * @returns {bool} whether to capture screenshots.
49 function shouldCapture() {
50 if (Services.env.get("MOZSCREENSHOTS_SETS")) {
53 "MOZSCREENSHOTS_SETS was specified so only capture what was " +
54 "requested (in browser_screenshots.js)"
59 if (AppConstants.MOZ_UPDATE_CHANNEL == "nightly") {
60 ok(true, "Screenshots aren't captured on Nightlies");