blob: 35f3c1566f29bdd9ac56dc840902ad66dcb79fb1 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>
scriptprocessornode-zero-input-channels.html
</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>
</head>
<body>
<script id="layout-test-code">
let audit = Audit.createTaskRunner();
let sampleRate = 44100.0;
let renderLengthInFrames = 512;
let bufferSize = 512;
audit.define(
{
label: 'test',
description:
'Tests that ScriptProcessorNode accepts 0 input channels'
},
(task, should) => {
let context =
new OfflineAudioContext(1, renderLengthInFrames, sampleRate);
let node;
should(
() => {
node = context.createScriptProcessor(bufferSize, 0, 1);
},
'node = context.createScriptProcessor(bufferSize, 0, 1)')
.notThrow();
let source = context.createBufferSource();
source.buffer = createImpulseBuffer(context, bufferSize);
// The onaudioprocess function doesn't need to do anything. We just
// need the process to start to test that implementation accepts 0
// input channels.
//
// FIXME: check the .inputBuffer attribute of the
// AudioProcessingEvent.
node.onaudioprocess = function(e) {};
source.connect(node);
node.connect(context.destination);
source.start(0);
context.oncomplete = event => {
should(true, 'ScriptProcessorNode accepts 0 input channels')
.beTrue();
task.done();
};
context.startRendering();
});
audit.run();
</script>
</body>
</html>