Bug 1015518 - Update SettingsService mochitests; r=bent
☠☠ backed out by 7c97c5f7a05e ☠ ☠
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 27 Aug 2014 21:01:31 -0700
changeset 223764 d85b4e48b3b46233418d9f260a7277cbbf719c44
parent 223763 663b73ba69ec7a522635c879f61ebf3fae2df788
child 223765 52b00288469cd91f430c5f722078603c39314f25
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs1015518
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1015518 - Update SettingsService mochitests; r=bent
dom/settings/tests/test_settings_service.js
--- a/dom/settings/tests/test_settings_service.js
+++ b/dom/settings/tests/test_settings_service.js
@@ -1,14 +1,18 @@
 "use strict";
 
 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");
 
 SimpleTest.waitForExplicitFinish();
 
 XPCOMUtils.defineLazyServiceGetter(this, "SettingsService",
                                    "@mozilla.org/settingsService;1",
                                    "nsISettingsService");
@@ -75,53 +79,42 @@ let tests = [
 
   /* Observer tests */
   function() {
     const MOZSETTINGS_CHANGED   = "mozsettings-changed";
     const TEST_OBSERVER_KEY     = "test.observer.key";
     const TEST_OBSERVER_VALUE   = true;
     const TEST_OBSERVER_MESSAGE = "test.observer.message";
 
-    let observerCount = 2;
-
     function observer(subject, topic, data) {
 
       if (topic !== MOZSETTINGS_CHANGED) {
         ok(false, "Event is not mozsettings-changed.");
         return;
       }
 
       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);
         is(data[name], value, "data." + name + " is " + value);
       }
 
       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);
   }
 ];
 
 function next() {
   let step = tests.shift();
   if (step) {
     try {
       step();