-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[atomics] Add WPT for Atomics.waitAsync
Bug: v8:10239 Change-Id: Ie478aed6e069d23964331fa07bfe190c55798ab3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4545947 Reviewed-by: Domenic Denicola <domenic@chromium.org> Commit-Queue: Shu-yu Guo <syg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1146132}
- Loading branch information
1 parent
bc194a5
commit 195925f
Showing
4 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...g-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}`); |
2 changes: 2 additions & 0 deletions
2
...2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Cross-Origin-Embedder-Policy: require-corp | ||
Cross-Origin-Opener-Policy: same-origin |
5 changes: 5 additions & 0 deletions
5
...essing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
onmessage = (e) => { | ||
const sab = e.data; | ||
const ta = new Int32Array(sab); | ||
Atomics.notify(ta, 0); | ||
}; |
1 change: 1 addition & 0 deletions
1
...odel-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cross-Origin-Embedder-Policy: require-corp |