diff options
Diffstat (limited to 'testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js')
-rw-r--r-- | testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js new file mode 100644 index 0000000000..3a3ea40d77 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js @@ -0,0 +1,25 @@ +// META: global=window,dedicatedworker + +promise_test(async () => { + const sab = new SharedArrayBuffer(64); + const ta = new Int32Array(sab); + + const waitAsyncObj = Atomics.waitAsync(ta, 0, 0, 10); + assert_equals(waitAsyncObj.async, true); + const v = await waitAsyncObj.value; + assert_equals(v, "timed-out"); +}, `Atomics.waitAsync timeout in a ${self.constructor.name}`); + +promise_test(async () => { + const sab = new SharedArrayBuffer(64); + const ta = new Int32Array(sab); + + const waitAsyncObj = Atomics.waitAsync(ta, 0, 0); + assert_equals(waitAsyncObj.async, true); + + const worker = new Worker("resources/notify-worker.js"); + worker.postMessage(sab); + + const v = await waitAsyncObj.value; + assert_equals(v, "ok"); +}, `Atomics.waitAsync notification in a ${self.constructor.name}`); |