Backed out changeset 292bc13fdc7f (bug 1164432) for test_try_registering_offline_disabled.html timeouts.
authorRyan VanderMeulen <ryanvm@gmail.com>
Sat, 19 Mar 2016 13:45:42 -0400
changeset 323525 332ce77a41c79b38bcb280655f6323bb8f70ec5d
parent 323524 07ffad91cb33df1d72fd3d08ef6af24dd1554607
child 323526 09df85bf34d9dc48c539b4ef6972f6c3ae22772b
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1164432
milestone47.0a2
backs out292bc13fdc7fed7f95620dcfd0c98669821c7517
Backed out changeset 292bc13fdc7f (bug 1164432) for test_try_registering_offline_disabled.html timeouts.
dom/push/test/mochitest.ini
dom/push/test/mockpushserviceparent.js
dom/push/test/test_try_registering_offline_disabled.html
--- a/dom/push/test/mochitest.ini
+++ b/dom/push/test/mochitest.ini
@@ -12,10 +12,11 @@ support-files =
 [test_permissions.html]
 [test_register.html]
 [test_multiple_register.html]
 [test_multiple_register_during_service_activation.html]
 [test_unregister.html]
 [test_multiple_register_different_scope.html]
 [test_subscription_change.html]
 [test_data.html]
-[test_try_registering_offline_disabled.html]
+# Disabled for too many intermittent failures (bug 1164432)
+#  [test_try_registering_offline_disabled.html]
 [test_serviceworker_lifetime.html]
--- a/dom/push/test/mockpushserviceparent.js
+++ b/dom/push/test/mockpushserviceparent.js
@@ -80,27 +80,23 @@ MockNetworkInfo.prototype = {
 var pushService = Cc["@mozilla.org/push/Service;1"].
                   getService(Ci.nsIPushService).
                   wrappedJSObject;
 
 var mockWebSocket;
 
 addMessageListener("setup", function () {
   mockWebSocket = new Promise((resolve, reject) => {
-    var mockSocket = null;
     pushService.replaceServiceBackend({
       serverURI: "wss://push.example.org/",
       networkInfo: new MockNetworkInfo(),
       makeWebSocket(uri) {
-        if (!mockSocket) {
-          mockSocket = new MockWebSocketParent(uri);
-          resolve(mockSocket);
-        }
-
-        return mockSocket;
+        var socket = new MockWebSocketParent(uri);
+        resolve(socket);
+        return socket;
       }
     });
   });
 });
 
 addMessageListener("teardown", function () {
   mockWebSocket.then(socket => {
     socket.close();
--- a/dom/push/test/test_try_registering_offline_disabled.html
+++ b/dom/push/test/test_try_registering_offline_disabled.html
@@ -5,17 +5,16 @@ Bug 1150812: Try to register when servic
 
 Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/licenses/publicdomain/
 
 -->
 <head>
   <title>Test for Bug 1150812</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="/tests/dom/push/test/test_utils.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
 </head>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1150812">Mozilla Bug 1150812</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
@@ -82,27 +81,16 @@ http://creativecommons.org/licenses/publ
         ok(subOld.endpoint == sub.endpoint, "getEndpoint - Got the same endpoint back.");
         return sub;
       }, err => {
           ok(false, "could not register for push notification");
           throw err;
       });
   }
 
-  // Load chrome script to change offline status in the
-  // parent process.
-  var chromeScript = SpecialPowers.loadChromeScript(_ => {
-    var { classes: Cc, interfaces: Ci } = Components;
-    var ioService = Cc["@mozilla.org/network/io-service;1"]
-                      .getService(Ci.nsIIOService);
-    addMessageListener("change-status", function(offline) {
-      ioService.offline = offline;
-    });
-  });
-
   function offlineObserver(res) {
     this._res = res;
   }
   offlineObserver.prototype = {
     _res: null,
 
     observe: function(subject, topic, data) {
       debug("observe: " + subject + " " + topic + " " + data);
@@ -117,23 +105,26 @@ http://creativecommons.org/licenses/publ
 
   function changeOfflineState(offline) {
     return new Promise(function(res, rej) {
       var obsService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
                          .getService(SpecialPowers.Ci.nsIObserverService);
       obsService.addObserver(SpecialPowers.wrapCallbackObject(new offlineObserver(res)),
                              "network:offline-status-changed",
                              false);
-      chromeScript.sendAsyncMessage("change-status", offline);
+      var ioService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+                        .getService(SpecialPowers.Ci.nsIIOService);
+      ioService.offline = offline;
     });
   }
 
   function changePushServerConnectionEnabled(enable) {
     debug("changePushServerConnectionEnabled");
-    SpecialPowers.setBoolPref("dom.push.connection.enabled", enable);
+    SpecialPowers.pushPrefEnv({"set": [["dom.push.connection.enabled", enable]]},
+                              null);
   }
 
   function unsubscribe(sub) {
     return sub.unsubscribe()
       .then(_ => {ok(true, "Unsubscribed!");});
   }
 
   // go offline then go online
@@ -291,14 +282,20 @@ http://creativecommons.org/licenses/publ
     .then(_ => runTest2())
     .then(_ => runTest3())
     .then(_ => runTest4())
     .then(_ => runTest5())
     .then(_ => runTest6())
     .then(SimpleTest.finish);
   }
 
-  setupPrefsAndMock(new MockWebSocket()).then(_ => runTest());
+  SpecialPowers.pushPrefEnv({"set": [
+    ["dom.push.enabled", true],
+    ["dom.push.connection.enabled", true],
+    ["dom.serviceWorkers.exemptFromPerDomainMax", true],
+    ["dom.serviceWorkers.enabled", true],
+    ["dom.serviceWorkers.testing.enabled", true]
+    ]}, runTest);
   SpecialPowers.addPermission("desktop-notification", true, document);
   SimpleTest.waitForExplicitFinish();
 </script>
 </body>
 </html>