test_notification_worker.html (1256B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=916893 5 --> 6 <head> 7 <title>Bug 916893</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 and click events."); 21 22 async function runTest() { 23 var w = new Worker("notification_worker.js"); 24 w.onmessage = function(e) { 25 if (e.data.type === 'finish') { 26 SimpleTest.finish(); 27 } else if (e.data.type === 'ok') { 28 ok(e.data.test, e.data.message); 29 } else if (e.data.type === 'is') { 30 is(e.data.test1, e.data.test2, e.data.message); 31 } 32 } 33 34 SimpleTest.waitForExplicitFinish(); 35 await NotificationTest.allowNotifications(); 36 w.postMessage('start') 37 } 38 39 SimpleTest.waitForExplicitFinish(); 40 runTest(); 41 </script> 42 </body> 43 </html>