Bug 1012403 - Reenable SettingsService chrome tests, on B2G only; a=TEST-ONLY
authorKyle Machulis <kyle@nonpolynomial.com>
Mon, 15 Jun 2015 15:19:01 -0700
changeset 249184 c82ca63f7310f96151368fb7d3c023934f2e5a37
parent 249183 afb4264004a3f065fbdfe47338a82e301bed712f
child 249185 df2676f8ee8b5e07f8a6d58bd1de4a2023c36a9e
push id61163
push userkmachulis@mozilla.com
push dateTue, 16 Jun 2015 21:14:28 +0000
treeherdermozilla-inbound@c82ca63f7310 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersTEST-ONLY
bugs1012403
milestone41.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 1012403 - Reenable SettingsService chrome tests, on B2G only; a=TEST-ONLY
dom/settings/tests/chrome.ini
dom/settings/tests/mochitest.ini
dom/settings/tests/test_settings_service.js
--- a/dom/settings/tests/chrome.ini
+++ b/dom/settings/tests/chrome.ini
@@ -1,8 +1,10 @@
 [DEFAULT]
-skip-if = buildapp == 'b2g'
+skip-if = buildapp != 'b2g'
+support-files =
+  test_settings_service.js
+  test_settings_service_callback.js
 
-[test_settings_service.js]
+
 [test_settings_service.xul]
 skip-if= buildapp == 'mulet'
-[test_settings_service_callback.js]
 [test_settings_service_callback.xul]
--- a/dom/settings/tests/mochitest.ini
+++ b/dom/settings/tests/mochitest.ini
@@ -1,10 +1,9 @@
 [DEFAULT]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure, bug 932878
 support-files =
   file_loadserver.js
   file_bug1110872.js
   file_bug1110872.html
 
 [test_settings_basics.html]
 [test_settings_permissions.html]
 [test_settings_blobs.html]
--- a/dom/settings/tests/test_settings_service.js
+++ b/dom/settings/tests/test_settings_service.js
@@ -13,109 +13,114 @@ Cu.import("resource://gre/modules/Servic
 
 SimpleTest.waitForExplicitFinish();
 
 XPCOMUtils.defineLazyServiceGetter(this, "SettingsService",
                                    "@mozilla.org/settingsService;1",
                                    "nsISettingsService");
 
 let tests = [
-  /* Callback tests */
-  function() {
-    let callbackCount = 10;
+      /* Callback tests */
+      function() {
+        let callbackCount = 10;
 
-    let callback = {
-      handle: function(name, result) {
-        switch (callbackCount) {
-        case 10:
-        case 9:
-          is(result, true, "result is true");
-          break;
-        case 8:
-        case 7:
-          is(result, false, "result is false");
-          break;
-        case 6:
-        case 5:
-          is(result, 9, "result is 9");
-          break;
-        case 4:
-        case 3:
-          is(result, 9.4, "result is 9.4");
-          break;
-        case 2:
-          is(result, false, "result is false");
-          break;
-        case 1:
-          is(result, null, "result is null");
-          break;
-        default:
-          ok(false, "Unexpected call: " + callbackCount);
-        }
+        let callback = {
+          handle: function(name, result) {
+            switch (callbackCount) {
+              case 10:
+              case 9:
+                is(result, true, "result is true");
+                break;
+              case 8:
+              case 7:
+                is(result, false, "result is false");
+                break;
+              case 6:
+              case 5:
+                is(result, 9, "result is 9");
+                break;
+              case 4:
+              case 3:
+                is(result, 9.4, "result is 9.4");
+                break;
+              case 2:
+                is(result, false, "result is false");
+                break;
+              case 1:
+                is(result, null, "result is null");
+                break;
+              default:
+                ok(false, "Unexpected call: " + callbackCount);
+            }
 
-        --callbackCount;
-        if (callbackCount === 0) {
-          next();
-        }
+            --callbackCount;
+            if (callbackCount === 0) {
+              next();
+            }
+          },
+
+          handleError: function(name) {
+            ok(false, "error: " + name);
+          }
+        };
+
+        let lock = SettingsService.createLock();
+        let lock1 = SettingsService.createLock();
+
+        lock.set("asdf", true, callback, null);
+        lock1.get("asdf", callback);
+        lock.get("asdf", callback);
+        lock.set("asdf", false, callback, null);
+        lock.get("asdf", callback);
+        lock.set("int", 9, callback, null);
+        lock.get("int", callback);
+        lock.set("doub", 9.4, callback, null);
+        lock.get("doub", callback);
+        lock1.get("asdfxxx", callback);
       },
 
-      handleError: function(name) {
-        ok(false, "error: " + name);
-      }
-    };
-
-    let lock = SettingsService.createLock();
-    let lock1 = SettingsService.createLock();
+      /* 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";
 
-    lock.set("asdf", true, callback, null);
-    lock1.get("asdf", callback);
-    lock.get("asdf", callback);
-    lock.set("asdf", false, callback, null);
-    lock.get("asdf", callback);
-    lock.set("int", 9, callback, null);
-    lock.get("int", callback);
-    lock.set("doub", 9.4, callback, null);
-    lock.get("doub", callback);
-    lock1.get("asdfxxx", callback);
-  },
-
-  /* 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";
+        var obs = {
+          observe: function (subject, topic, data) {
 
-    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);
-      }
+            if (topic !== MOZSETTINGS_CHANGED) {
+              ok(false, "Event is not mozsettings-changed.");
+              return;
+            }
+            // Data is now stored in subject
+            if ("wrappedJSObject" in subject) {
+              ok(true, "JS object wrapped into subject");
+              subject = subject.wrappedJSObject;
+            }
+            function checkProp(name, type, value) {
+              ok(name in subject, "subject." + name + " is present");
+              is(typeof subject[name], type, "subject." + name + " is " + type);
+              is(subject[name], value, "subject." + name + " is " + value);
+            }
 
-      checkProp("key", "string", TEST_OBSERVER_KEY);
-      checkProp("value", "boolean", TEST_OBSERVER_VALUE);
-      checkProp("isInternalChange", "boolean", true);
+            checkProp("key", "string", TEST_OBSERVER_KEY);
+            checkProp("value", "boolean", TEST_OBSERVER_VALUE);
+            checkProp("isInternalChange", "boolean", true);
 
-        Services.obs.removeObserver(this, MOZSETTINGS_CHANGED);
-        next();
+            Services.obs.removeObserver(this, MOZSETTINGS_CHANGED);
+            next();
+          }
+        };
+
+        Services.obs.addObserver(obs, MOZSETTINGS_CHANGED, false);
+
+        let lock = SettingsService.createLock();
+        lock.set(TEST_OBSERVER_KEY, TEST_OBSERVER_VALUE, null);
       }
-
-    Services.obs.addObserver(observer, MOZSETTINGS_CHANGED, false);
-
-    let lock = SettingsService.createLock();
-    lock.set(TEST_OBSERVER_KEY, TEST_OBSERVER_VALUE, null);
-  }
 ];
 
 function next() {
   let step = tests.shift();
   if (step) {
     try {
       step();
     } catch(e) {