From e69093233fd93ae72023f8956464185a2cfda031 Mon Sep 17 00:00:00 2001 From: Mike Cooper Date: Fri, 2 Jun 2017 16:27:06 -0700 Subject: [PATCH] recipe-client-addon: Fix test failure in PreferenceExperiments. (#790) Fixes #789. --- .../test/browser/browser_PreferenceExperiments.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipe-client-addon/test/browser/browser_PreferenceExperiments.js b/recipe-client-addon/test/browser/browser_PreferenceExperiments.js index 63756fbc..dcf98d30 100644 --- a/recipe-client-addon/test/browser/browser_PreferenceExperiments.js +++ b/recipe-client-addon/test/browser/browser_PreferenceExperiments.js @@ -367,6 +367,9 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc // stop should also support user pref experiments add_task(withMockExperiments(withMockPreferences(async function(experiments, mockPreferences) { const stopObserver = sinon.stub(PreferenceExperiments, "stopObserver"); + const hasObserver = sinon.stub(PreferenceExperiments, "hasObserver"); + hasObserver.returns(true); + mockPreferences.set("fake.preference", "experimentvalue", "user"); experiments["test"] = experimentFactory({ name: "test", @@ -377,7 +380,6 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc previousPreferenceValue: "oldvalue", preferenceBranchType: "user", }); - PreferenceExperiments.startObserver("test", "fake.preference", "experimentvalue"); await PreferenceExperiments.stop("test"); ok(stopObserver.calledWith("test"), "stop removed an observer"); @@ -389,6 +391,7 @@ add_task(withMockExperiments(withMockPreferences(async function(experiments, moc ); stopObserver.restore(); + hasObserver.restore(); }))); // stop should not call stopObserver if there is no observer registered.