Bug 1136390 - test_TelemetryTimestamps.js/test_conditions.js are missing AddonManager initialization. r=gfritzsche

This commit is contained in:
Alessio Placitelli 2015-02-25 23:54:35 +01:00
parent 06176ed800
commit 182d8eef97
3 changed files with 24 additions and 0 deletions

View File

@ -153,6 +153,15 @@ function loadAddonManager() {
startupManager();
}
// Starts the addon manager without creating app info. We can't directly use
// |loadAddonManager| defined above in test_conditions.js as it would make the test fail.
function startAddonManagerOnly() {
let addonManager = Cc["@mozilla.org/addons/integration;1"]
.getService(Ci.nsIObserver)
.QueryInterface(Ci.nsITimerCallback);
addonManager.observe(null, "addons-startup", null);
}
function getExperimentAddons(previous=false) {
let deferred = Promise.defer();

View File

@ -69,6 +69,7 @@ function run_test() {
add_task(function* test_setup() {
createAppInfo();
gProfileDir = do_get_profile();
startAddonManagerOnly();
yield initialiseTelemetry();
gPolicy = new Experiments.Policy();

View File

@ -20,6 +20,18 @@ XPCOMUtils.defineLazyGetter(this, "gDatareportingService",
Cu.import("resource://testing-common/AppInfo.jsm");
updateAppInfo();
let gGlobalScope = this;
function loadAddonManager() {
let ns = {};
Cu.import("resource://gre/modules/Services.jsm", ns);
let head = "../../../mozapps/extensions/test/xpcshell/head_addons.js";
let file = do_get_file(head);
let uri = ns.Services.io.newFileURI(file);
ns.Services.scriptloader.loadSubScript(uri.spec, gGlobalScope);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
startupManager();
}
function getSimpleMeasurementsFromTelemetryPing() {
return TelemetrySession.getPayload().simpleMeasurements;
}
@ -36,6 +48,8 @@ function initialiseTelemetry() {
}
function run_test() {
// Telemetry needs the AddonManager.
loadAddonManager();
// Make profile available for |TelemetrySession.shutdown()|.
do_get_profile();