OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <!-- Generate token with the command: | |
5 generate_token.py http://127.0.0.1:8000 BudgetQuery --expire-timestamp=2000 000000 | |
6 -- --> | |
7 <meta http-equiv="origin-trial" content="AgFtR2Ps1Z9M/FW14Tgcwbajvq7kvzc/b1 SPPSaaucG/P4ba6xC/69I9v8Pqx4wbsJINoqMabs9GE/LxOnPRfQIAAABTeyJvcmlnaW4iOiAiaHR0cD ovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiQnVkZ2V0UXVlcnkiLCAiZXhwaXJ5IjogMjAwMD AwMDAwMH0" /> | |
Peter Beverloo
2017/04/24 14:24:01
Ian, how does this work? The Service Worker will b
iclelland
2017/04/24 14:45:33
If this test is passing, and it appears that the t
| |
8 <title>Budget interfaces available in a Service Worker</title> | |
9 <script src="../../resources/testharness.js"></script> | |
10 <script src="../../resources/testharnessreport.js"></script> | |
11 <script src="../../serviceworker/resources/test-helpers.js"></script> | |
12 <script src="../../notifications/resources/test-helpers.js"></script> | |
13 </head> | |
14 <body> | |
15 <script> | |
16 promise_test(function(test) { | |
17 const script = '../../budget/resources/instrumentation-service-worker.js '; | |
18 const scope = '../../budget/resources/scope/' + location.pathname; | |
19 let port; | |
Peter Beverloo
2017/04/24 14:24:01
nit: |port| can be local to the function on line 2
| |
20 | |
21 return getActiveServiceWorkerWithMessagePort(test, script, scope) | |
22 .then(function(workerInfo) { | |
23 port = workerInfo.port; | |
24 | |
25 port.addEventListener('message', function(event) { | |
26 if (typeof event.data != 'object' || !event.data.command) | |
27 assert_unreached('Invalid message from the service worker'); | |
28 | |
29 assert_equals(event.data.command, 'checkInterfaces'); | |
30 assert_true(event.data.success, | |
31 'checkInterfaces should succeed but failed with error: ' + | |
32 event.data.message); | |
33 }); | |
34 | |
35 return sendCommand(port, { command: 'checkInterfaces' }); | |
Peter Beverloo
2017/04/24 14:24:01
Are we sure that the event listener on line 25 is
| |
36 }) | |
37 }, 'BudgetQuery interfaces should be available in a Service Worker.'); | |
38 </script> | |
39 </body> | |
40 </html> | |
OLD | NEW |