| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Budget interfaces available in a Service Worker</title> |
| 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> |
| 7 <script src="../serviceworker/resources/test-helpers.js"></script> |
| 8 <script src="../notifications/resources/test-helpers.js"></script> |
| 9 </head> |
| 10 <body> |
| 11 <script> |
| 12 promise_test(function(test) { |
| 13 const script = 'resources/instrumentation-service-worker.js'; |
| 14 const scope = 'resources/scope/' + location.pathname; |
| 15 let port; |
| 16 |
| 17 return getActiveServiceWorkerWithMessagePort(test, script, scope) |
| 18 .then(function(workerInfo) { |
| 19 port = workerInfo.port; |
| 20 |
| 21 port.addEventListener('message', function(event) { |
| 22 if (typeof event.data != 'object' || !event.data.command) |
| 23 assert_unreached('Invalid message from the service worker'); |
| 24 |
| 25 assert_equals(event.data.command, 'checkInterfaces'); |
| 26 assert_true(event.data.success, |
| 27 'checkInterfaces should succeed but failed with error: ' + |
| 28 event.data.message); |
| 29 }); |
| 30 |
| 31 return sendCommand(port, { command: 'checkInterfaces' }); |
| 32 }) |
| 33 .catch(unreached_rejection(test)); |
| 34 }, 'Budget interfaces should be available in a Service Worker'); |
| 35 </script> |
| 36 </body> |
| 37 </html> |
| OLD | NEW |