blob: 768c6a56b0a4f9f8bcb856ec7b8e46f48c559134 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>
Test Constructor: MediaStreamAudioSource
</title>
<script src="../../imported/w3c/web-platform-tests/resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script>
<script src="../resources/audit.js"></script>
<script src="../resources/audionodeoptions.js"></script>
</head>
<body>
<script id="layout-test-code">
let context;
let audit = Audit.createTaskRunner();
audit.define('initialize', (task, should) => {
// Need AudioContext, not OfflineAudioContext, for these tests.
should(() => {
context = new AudioContext();
}, 'context = new AudioContext()').notThrow();
task.done();
});
audit.define('invalid constructor', (task, should) => {
testInvalidConstructor(should, 'MediaStreamAudioSourceNode', context);
task.done();
});
audit.define('constructor options', (task, should) => {
let node;
let options = {mediaStream: new MediaStream()};
// We throw because the mediaStream has no tracks. But otherwise the
// constructor worked.
should(
() => {
node = new MediaStreamAudioSourceNode(context, options);
},
'node = new MediaStreamAudioSourceNode(context, ' +
JSON.stringify(options) + ')')
.throw(DOMException, 'InvalidStateError');
task.done();
});
audit.run();
</script>
</body>
</html>