Worker-structure-message.html (937B)
1 <!DOCTYPE html> 2 <title>Test that pages and workers can send Structure Message to one another.</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script> 6 promise_test(t => { 7 let worker; 8 9 return new Promise(resolve => { 10 worker = new Worker("support/Worker-structure-message.js"); 11 worker.onmessage = resolve; 12 worker.postMessage({ 13 operation: 'find-edges', 14 input: new ArrayBuffer(20), 15 threshold: 0.6 16 }); 17 }).then(evt => { 18 assert_false(evt.data.startsWith('FAIL')); 19 return new Promise(resolve => worker.onmessage = resolve); 20 }).then(evt => { 21 assert_equals(evt.data.operation, 'find-edges'); 22 assert_true(ArrayBuffer.prototype.isPrototypeOf(evt.data.input)); 23 assert_equals(evt.data.input.byteLength, 20); 24 assert_equals(evt.data.threshold, 0.6); 25 }); 26 }, 'Tests sending structure message to/from worker.'); 27 </script>