Bug 1440022: disconnect push tests from actually running r?lina
These tests were only not connecting due to an implementation detail
of the Push component.
MozReview-Commit-ID: 49JPgsfRxTF
--- a/devtools/client/aboutdebugging/test/browser_service_workers_push_service.js
+++ b/devtools/client/aboutdebugging/test/browser_service_workers_push_service.js
@@ -14,18 +14,16 @@ const TAB_URL = URL_ROOT + "service-work
const FAKE_ENDPOINT = "https://fake/endpoint";
const PushService = Cc["@mozilla.org/push/Service;1"]
.getService(Ci.nsIPushService).wrappedJSObject;
add_task(async function() {
info("Turn on workers via mochitest http.");
await enableServiceWorkerDebugging();
- // Enable the push service.
- await pushPref("dom.push.connection.enabled", true);
info("Mock the push service");
PushService.service = {
_registrations: new Map(),
_notify(scope) {
Services.obs.notifyObservers(
null,
PushService.subscriptionModifiedTopic,
--- a/dom/push/test/xpcshell/test_observer_remoting.js
+++ b/dom/push/test/xpcshell/test_observer_remoting.js
@@ -1,14 +1,15 @@
'use strict';
const pushNotifier = Cc['@mozilla.org/push/Notifier;1']
.getService(Ci.nsIPushNotifier);
add_task(async function test_observer_remoting() {
+ do_get_profile();
if (isParent) {
await testInParent();
} else {
await testInChild();
}
});
const childTests = [{
@@ -17,16 +18,17 @@ const childTests = [{
}];
const parentTests = [{
text: 'Hello from parent!',
principal: Services.scriptSecurityManager.getSystemPrincipal(),
}];
async function testInParent() {
+ setPrefs();
// Register observers for notifications from the child, then run the test in
// the child and wait for the notifications.
let promiseNotifications = childTests.reduce(
(p, test) => p.then(_ => waitForNotifierObservers(test, /* shouldNotify = */ false)),
Promise.resolve()
);
let promiseFinished = run_test_in_child('./test_observer_remoting.js');
await promiseNotifications;
--- a/dom/push/test/xpcshell/test_service_parent.js
+++ b/dom/push/test/xpcshell/test_service_parent.js
@@ -2,16 +2,17 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
const {PushDB, PushService, PushServiceWebSocket} = serviceExports;
function run_test() {
do_get_profile();
+ setPrefs();
run_next_test();
}
add_task(async function test_service_parent() {
let db = PushServiceWebSocket.newPushDB();
registerCleanupFunction(() => {return db.drop().then(_ => db.close());});
await setUpServiceInParent(PushService, db);
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -119,16 +119,20 @@ try {
let crashReporter =
Cc["@mozilla.org/toolkit/crash-reporter;1"]
.getService(Ci.nsICrashReporter);
crashReporter.UpdateCrashEventsDir();
crashReporter.minidumpPath = do_get_minidumpdir();
}
} catch (e) { }
+if (runningInParent) {
+ _Services.prefs.setBoolPref("dom.push.connection.enabled", false);
+}
+
// Configure a console listener so messages sent to it are logged as part
// of the test.
try {
let levelNames = {};
for (let level of ["debug", "info", "warn", "error"]) {
levelNames[Ci.nsIConsoleMessage[level]] = level;
}