browser/devtools/commandline/test/head.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:710cd0851a36
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/. */
4
5 const TEST_BASE_HTTP = "http://example.com/browser/browser/devtools/commandline/test/";
6 const TEST_BASE_HTTPS = "https://example.com/browser/browser/devtools/commandline/test/";
7
8 // Import the GCLI test helper
9 let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
10 Services.scriptloader.loadSubScript(testDir + "/helpers.js", this);
11 Services.scriptloader.loadSubScript(testDir + "/mockCommands.js", this);
12
13 gDevTools.testing = true;
14 SimpleTest.registerCleanupFunction(() => {
15 gDevTools.testing = false;
16 });
17
18 function whenDelayedStartupFinished(aWindow, aCallback) {
19 Services.obs.addObserver(function observer(aSubject, aTopic) {
20 if (aWindow == aSubject) {
21 Services.obs.removeObserver(observer, aTopic);
22 executeSoon(aCallback);
23 }
24 }, "browser-delayed-startup-finished", false);
25 }
26
27 /**
28 * Force GC on shutdown, because it seems that GCLI can outrun the garbage
29 * collector in some situations, which causes test failures in later tests
30 * Bug 774619 is an example.
31 */
32 registerCleanupFunction(function tearDown() {
33 window.QueryInterface(Ci.nsIInterfaceRequestor)
34 .getInterface(Ci.nsIDOMWindowUtils)
35 .garbageCollect();
36 });

mercurial