test_notification_worker_child.html (1296B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=916893 5 --> 6 <head> 7 <title>Bug 916893 - Test Notifications in child workers.</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script type="text/javascript" src="/tests/dom/notification/test/mochitest/NotificationTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=916893">Bug 916893</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 </div> 17 <pre id="test"> 18 </pre> 19 <script type="text/javascript"> 20 SimpleTest.requestFlakyTimeout("Mock alert service dispatches show event."); 21 async function runTest() { 22 var w = new Worker("notification_worker_child-parent.js"); 23 w.onmessage = function(e) { 24 if (e.data.type === 'finish') { 25 SimpleTest.finish(); 26 } else if (e.data.type === 'ok') { 27 ok(e.data.test, e.data.message); 28 } else if (e.data.type === 'is') { 29 is(e.data.test1, e.data.test2, e.data.message); 30 } 31 } 32 33 SimpleTest.waitForExplicitFinish(); 34 await NotificationTest.allowNotifications(); 35 w.postMessage('start') 36 } 37 38 SimpleTest.waitForExplicitFinish(); 39 runTest(); 40 </script> 41 </body> 42 </html>