| Index: third_party/WebKit/LayoutTests/broadcastchannel/workers.html
|
| diff --git a/third_party/WebKit/LayoutTests/broadcastchannel/workers.html b/third_party/WebKit/LayoutTests/broadcastchannel/workers.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..793380989d65dc92d9793d149c5e8e85844b7718
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/broadcastchannel/workers.html
|
| @@ -0,0 +1,39 @@
|
| +<!DOCTYPE html>
|
| +<meta charset=utf-8>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script>
|
| +
|
| +async_test(t => {
|
| + let c1 = new BroadcastChannel('worker');
|
| + let c2 = new BroadcastChannel('worker');
|
| + let events = [];
|
| +
|
| + c1.onmessage = e => events.push(e);
|
| + c2.onmessage = e => events.push(e);
|
| +
|
| + c2.addEventListener('message', e => {
|
| + console.log(e);
|
| + if (e.data == 'from worker') {
|
| + c2.postMessage('from c2');
|
| + c1.postMessage('done');
|
| + }
|
| + });
|
| +
|
| + let worker = new Worker('resources/worker.js');
|
| + worker.onmessage = t.step_func(e => {
|
| + assert_equals(events.length, 4);
|
| + assert_equals(events[0].data, 'from worker');
|
| + assert_equals(events[0].target, c1);
|
| + assert_equals(events[1].data, 'from worker');
|
| + assert_equals(events[1].target, c2);
|
| + assert_equals(events[2].data, 'from c2');
|
| + assert_equals(events[3].data, 'done');
|
| + assert_array_equals(e.data, ['from c2', 'done']);
|
| + t.done();
|
| + });
|
| + worker.postMessage({channel: 'worker'});
|
| +
|
| + }, 'BroadcastChannel works in workers');
|
| +
|
| +</script>
|
|
|