forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that AudioContext's state is updated if "allowed to start" (web-…
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
webaudio/the-audio-api/the-audiocontext-interface/constructor-allowed-to-start.html
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 @@ | ||
<!doctype html> | ||
<title>AudioContext state around "allowed to start" in constructor</title> | ||
<link rel=help href=https://webaudio.github.io/web-audio-api/#dom-audiocontext-audiocontext> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src=/resources/testdriver.js></script> | ||
<script src=/resources/testdriver-vendor.js></script> | ||
<script> | ||
setup({ single_test: true }); | ||
test_driver.bless("audio playback", () => { | ||
const ctx = new AudioContext(); | ||
// Immediately after the constructor the state is "suspended" because the | ||
// control message to start processing has just been sent, but the state | ||
// should change soon. | ||
assert_equals(ctx.state, "suspended", "initial state"); | ||
ctx.onstatechange = () => { | ||
assert_equals(ctx.state, "running", "state after statechange event"); | ||
// Now create another context and ensure it starts out in the "suspended" | ||
// state too, ensuring it's not synchronously "running". | ||
const ctx2 = new AudioContext(); | ||
assert_equals(ctx2.state, "suspended", "initial state of 2nd context"); | ||
done(); | ||
}; | ||
}); | ||
</script> |