Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>
audiochannelmerger-basic.html
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/webaudio/resources/audit-util.js"></script>
<script src="/webaudio/resources/audit.js"></script>
</head>
<body>
<script id="layout-test-code">
let audit = Audit.createTaskRunner();
// Task: Checking constraints in ChannelMergerNode.
audit.define('exceptions-channels', (task, should) => {
let context = new OfflineAudioContext(2, 128, 44100);
let merger;
should(function() {
merger = context.createChannelMerger();
}, 'context.createChannelMerger()').notThrow();
should(function() {
merger = context.createChannelMerger(0);
}, 'context.createChannelMerger(0)').throw(DOMException, 'IndexSizeError');
should(function() {
merger = context.createChannelMerger(32);
}, 'context.createChannelMerger(32)').notThrow();
// Can't create a channel merger with 33 channels because the audio
// context has a 32-channel-limit in Chrome.
should(function() {
merger = context.createChannelMerger(33);
}, 'context.createChannelMerger(33)').throw(DOMException, 'IndexSizeError');
task.done();
});
// Task: checking the channel-related properties have the correct value
// and can't be changed.
audit.define('exceptions-properties', (task, should) => {
let context = new OfflineAudioContext(2, 128, 44100);
let merger = context.createChannelMerger();
should(merger.channelCount, 'merger.channelCount').beEqualTo(1);
should(function() {
merger.channelCount = 3;
}, 'merger.channelCount = 3').throw(DOMException, 'InvalidStateError');
should(merger.channelCountMode, 'merger.channelCountMode')
.beEqualTo('explicit');
should(function() {
merger.channelCountMode = 'max';
}, 'merger.channelCountMode = "max"').throw(DOMException, 'InvalidStateError');
task.done();
});
audit.run();
</script>
</body>
</html>