Backout 2af1ca98c935, bug 1012466 for xpcshell-test failures. a=BUSTAGE
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Wed, 16 Jul 2014 14:41:43 +0200
changeset 209095 5465ee62d826c44625ef1b56a453978be7763eb3
parent 209094 ada88bfa9f0a41630f2ec42713a463800b15d2a6
child 209096 a3386f2441d615e80785b8a96da462b83a61f71e
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBUSTAGE
bugs1012466
milestone32.0a2
backs out2af1ca98c935bf533f88e6e6d740bfa033b4359c
Backout 2af1ca98c935, bug 1012466 for xpcshell-test failures. a=BUSTAGE
browser/experiments/test/xpcshell/test_api.js
browser/experiments/test/xpcshell/test_conditions.js
browser/experiments/test/xpcshell/test_healthreport.js
--- a/browser/experiments/test/xpcshell/test_api.js
+++ b/browser/experiments/test/xpcshell/test_api.js
@@ -1521,18 +1521,19 @@ add_task(function* testEnabledAfterResta
   let fromManifest = yield experiments.getExperiments();
   Assert.equal(fromManifest.length, 1, "A single experiment is known.");
 
   addons = yield getExperimentAddons();
   Assert.equal(addons.length, 1, "A single experiment add-on is installed.");
   Assert.ok(addons[0].isActive, "That experiment is active.");
 
   dump("Restarting Addon Manager\n");
+  experiments._unregisterWithAddonManager();
   restartManager();
-  experiments = new Experiments.Experiments(gPolicy);
+  experiments._registerWithAddonManager();
 
   addons = yield getExperimentAddons();
   Assert.equal(addons.length, 1, "The experiment is still there after restart.");
   Assert.ok(addons[0].userDisabled, "But it is disabled.");
   Assert.equal(addons[0].isActive, false, "And not active.");
 
   yield experiments.updateManifest();
   Assert.ok(addons[0].isActive, "It activates when the manifest is evaluated.");
@@ -1579,16 +1580,17 @@ add_task(function* test_foreignUninstall
   Assert.equal(addons.length, 0, "Experiment add-on should have been removed.");
 
   experimentList = yield experiments.getExperiments();
   Assert.equal(experimentList.length, 1, "A single experiment is known.");
   Assert.equal(experimentList[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
   Assert.ok(!experimentList[0].active, "Experiment 1 should not be active anymore.");
 
   // Fake restart behaviour.
+  yield experiments.uninit();
   restartManager();
   experiments = new Experiments.Experiments(gPolicy);
   yield experiments.updateManifest();
 
   let addons = yield getExperimentAddons();
   Assert.equal(addons.length, 0, "No experiment add-ons installed.");
 
   experimentList = yield experiments.getExperiments();
--- a/browser/experiments/test/xpcshell/test_conditions.js
+++ b/browser/experiments/test/xpcshell/test_conditions.js
@@ -63,16 +63,18 @@ add_task(function* test_setup() {
     locale: () => "en-US",
     healthReportPayload: () => Promise.resolve(payload),
     random: () => 0.5,
   });
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
+
+  let experiments = new Experiments.Experiments();
 });
 
 function arraysEqual(a, b) {
   if (a.length !== b.length) {
     return false;
   }
 
   for (let i=0; i<a.length; ++i) {
--- a/browser/experiments/test/xpcshell/test_healthreport.js
+++ b/browser/experiments/test/xpcshell/test_healthreport.js
@@ -1,17 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource:///modules/experiments/Experiments.jsm");
-Cu.import("resource://testing-common/AddonManagerTesting.jsm");
 Cu.import("resource://testing-common/services/healthreport/utils.jsm");
 Cu.import("resource://testing-common/services-common/logging.js");
 
 const kMeasurementVersion = 2;
 
 function getStorageAndProvider(name) {
   return Task.spawn(function* get() {
     let storage = yield Metrics.Storage(name);
@@ -24,17 +23,16 @@ function getStorageAndProvider(name) {
 
 function run_test() {
   run_next_test();
 }
 
 add_test(function setup() {
   do_get_profile();
   initTestLogging();
-  loadAddonManager();
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
   Services.prefs.setBoolPref(PREF_HEALTHREPORT_ENABLED, true);
 
   run_next_test();
 });