From 5fb64db8dcbe8552f3d68f5c7e4c8ef34afdaa08 Mon Sep 17 00:00:00 2001 From: Kyle Machulis Date: Wed, 27 Aug 2014 21:01:31 -0700 Subject: [PATCH] Bug 1015518 - Update SettingsService mochitests; r=bent --- dom/settings/tests/test_settings_service.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/dom/settings/tests/test_settings_service.js b/dom/settings/tests/test_settings_service.js index dc8c6ea2be53..42f340acad12 100644 --- a/dom/settings/tests/test_settings_service.js +++ b/dom/settings/tests/test_settings_service.js @@ -4,6 +4,10 @@ const Cu = Components.utils; const Cc = Components.classes; const Ci = Components.interfaces; +if (SpecialPowers.isMainProcess()) { + SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm"); +} + Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); @@ -80,8 +84,6 @@ let tests = [ const TEST_OBSERVER_VALUE = true; const TEST_OBSERVER_MESSAGE = "test.observer.message"; - let observerCount = 2; - function observer(subject, topic, data) { if (topic !== MOZSETTINGS_CHANGED) { @@ -90,7 +92,6 @@ let tests = [ } data = JSON.parse(data); - function checkProp(name, type, value) { ok(name in data, "data." + name + " is present"); is(typeof data[name], type, "data." + name + " is " + type); @@ -99,24 +100,16 @@ let tests = [ checkProp("key", "string", TEST_OBSERVER_KEY); checkProp("value", "boolean", TEST_OBSERVER_VALUE); - if (observerCount === 2) { - checkProp("message", "object", null); - } else { - checkProp("message", "string", TEST_OBSERVER_MESSAGE); - } - --observerCount; + checkProp("isInternalChange", "boolean", true); - if (observerCount === 0) { Services.obs.removeObserver(this, MOZSETTINGS_CHANGED); next(); } - } Services.obs.addObserver(observer, MOZSETTINGS_CHANGED, false); let lock = SettingsService.createLock(); - lock.set(TEST_OBSERVER_KEY, TEST_OBSERVER_VALUE, null, null); - lock.set(TEST_OBSERVER_KEY, TEST_OBSERVER_VALUE, null, TEST_OBSERVER_MESSAGE); + lock.set(TEST_OBSERVER_KEY, TEST_OBSERVER_VALUE, null); } ];