OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Service Worker: WebSockets can be created in a Service Worker</title> | |
3 <script src="/resources/testharness.js"></script> | |
4 <script src="/resources/testharnessreport.js"></script> | |
5 <script src="/resources/get-host-info.js?pipe=sub"></script> | |
falken
2016/12/08 07:29:26
i don't think you need this
tyoshino (SeeGerritForStatus)
2016/12/08 08:55:01
Done.
| |
6 <script src="../resources/test-helpers.js"></script> | |
7 <script> | |
8 promise_test(t => { | |
9 const SCRIPT = 'resources/simple.js'; | |
10 const SCOPE = 'resources/blank.html'; | |
11 let registration; | |
12 return service_worker_unregister_and_register(t, SCRIPT, SCOPE) | |
13 .then(r => { | |
14 registration = r; | |
15 return wait_for_state(t, r.installing, 'activated'); | |
16 }) | |
17 .then(() => { | |
18 return new Promise(resolve => { | |
19 const channel = new MessageChannel(); | |
20 channel.port1.onmessage = t.step_func(msg => { | |
21 assert_equals(msg.data, 'PASS'); | |
22 resolve(); | |
23 }); | |
24 registration.active.postMessage({port: channel.port2}, [channel.port2] ); | |
falken
2016/12/08 07:29:26
You don't need ports. Just registration.active.pos
tyoshino (SeeGerritForStatus)
2016/12/08 08:55:01
Done.
| |
25 }); | |
26 }) | |
27 .then(() => { | |
28 return service_worker_unregister(t, SCOPE); | |
falken
2016/12/08 07:29:26
you can just call add_completion_callback(() => {
tyoshino (SeeGerritForStatus)
2016/12/08 08:55:01
Done.
| |
29 }); | |
30 }, 'Verify WebSockets can be created in a Service Worker'); | |
falken
2016/12/08 07:29:26
this should be indented in service worker test sty
tyoshino (SeeGerritForStatus)
2016/12/08 08:55:01
Done.
| |
31 </script> | |
OLD | NEW |