Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>getCost succeeds from a Service Worker</title> | |
|
Peter Beverloo
2016/12/12 14:28:43
nit: use a proper title. on line 34 too
harkness
2016/12/12 16:00:34
Done.
| |
| 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 var script = 'resources/instrumentation-service-worker.js'; | |
| 14 var scope = 'resources/scope/' + location.pathname; | |
| 15 var port; | |
|
Peter Beverloo
2016/12/12 14:28:43
var -> const/let
harkness
2016/12/12 16:00:34
Done.
| |
| 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 }, 'getCost should succeed from Service Worker'); | |
| 35 </script> | |
| 36 </body> | |
| 37 </html> | |
| OLD | NEW |