diff options
Diffstat (limited to 'testing/web-platform/tests/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html')
-rw-r--r-- | testing/web-platform/tests/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html b/testing/web-platform/tests/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html new file mode 100644 index 0000000000..71a62f176f --- /dev/null +++ b/testing/web-platform/tests/webaudio/the-audio-api/the-channelmergernode-interface/audiochannelmerger-basic.html @@ -0,0 +1,67 @@ +<!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> |