Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that AudioContext's state is updated if "allowed to start" #24611

Merged
merged 2 commits into from Jul 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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 even.
foolip marked this conversation as resolved.
Show resolved Hide resolved
const ctx2 = new AudioContext();
assert_equals(ctx2.state, "suspended", "initial state of 2nd context");
done();
};
});
</script>