Bug 1012466 - Properly synchronize experiments shutdown with the AddonManager by using its shutdown barrier. r=bsmedberg,a=lmandel
☠☠ backed out by 5465ee62d826 ☠ ☠
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Tue, 08 Jul 2014 17:36:24 +0200
changeset 208006 2af1ca98c935bf533f88e6e6d740bfa033b4359c
parent 208005 7d1746cdf76526ca9aefca4d5c7815f15250f985
child 208007 e776a6a21d1c665bba8a8f27ee6f4012b651c3da
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, lmandel
bugs1012466
milestone32.0a2
Bug 1012466 - Properly synchronize experiments shutdown with the AddonManager by using its shutdown barrier. r=bsmedberg,a=lmandel
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,19 +1521,18 @@ 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._registerWithAddonManager();
+  experiments = new Experiments.Experiments(gPolicy);
 
   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.");
@@ -1580,17 +1579,16 @@ 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,18 +63,16 @@ 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,16 +1,17 @@
 /* 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);
@@ -23,16 +24,17 @@ 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();
 });