1 /* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */
3 function info(message) {
4 dump("INFO: " + message + "\n");
7 function ok(test, message) {
8 postMessage({ type: "ok", test, message });
11 function is(a, b, message) {
12 postMessage({ type: "is", test1: a, test2: b, message });
15 if (self.Notification) {
18 info("Test notification permission");
19 ok(typeof Notification === "function", "Notification constructor exists");
21 Notification.permission === "denied",
22 "Notification.permission is denied."
25 var n = new Notification("Hello");
26 n.onerror = function (e) {
27 ok(true, "error called due to permission denied.");
33 onmessage = function (e) {
35 (function executeRemainingTests(remainingTests) {
36 if (!remainingTests.length) {
37 postMessage({ type: "finish" });
41 var nextTest = remainingTests.shift();
42 var finishTest = executeRemainingTests.bind(null, remainingTests);
43 var startTest = nextTest.call.bind(nextTest, context, finishTest);
47 // if no callback was defined for test function,
48 // we must manually invoke finish to continue
49 if (nextTest.length === 0) {
53 ok(false, "Test threw exception! " + nextTest + " " + ex);
59 ok(true, "Notifications are not enabled in workers on the platform.");
60 postMessage({ type: "finish" });