5 <script src=
"../resources/js-test.js"></script>
6 <script src=
"resources/compatibility.js"></script>
7 <script src=
"resources/audio-testing.js"></script>
12 description("Basic tests for ChannelMerger.");
13 window
.jsTestIsAsync
= true;
15 var audit
= Audit
.createTaskRunner();
17 // Task: Checking constraints in ChannelMergerNode.
18 audit
.defineTask('exceptions-channels', function (done
) {
19 var context
= new OfflineAudioContext(2, 128, 44100);
22 Should('context.createChannelMerger()', function () {
23 merger
= context
.createChannelMerger();
26 Should('context.createChannelMerger(0)', function () {
27 merger
= context
.createChannelMerger(0);
28 }).throw('IndexSizeError');
30 Should('context.createChannelMerger(32)', function () {
31 merger
= context
.createChannelMerger(32);
34 // Can't create a channel merger with 33 channels because the audio
35 // context has a 32-channel-limit in Chrome.
36 Should('context.createChannelMerger(33)', function () {
37 merger
= context
.createChannelMerger(33);
38 }).throw('IndexSizeError');
43 // Task: checking the channel-related properties have the correct value and
45 audit
.defineTask('exceptions-properties', function (done
) {
46 var context
= new OfflineAudioContext(2, 128, 44100);
47 var merger
= context
.createChannelMerger();
49 Should('merger.channelCount', merger
.channelCount
).beEqualTo(1);
51 Should('merger.channelCount = 3', function () {
52 merger
.channelCount
= 3;
53 }).throw('InvalidStateError');
55 Should('merger.channelCountMode', merger
.channelCountMode
).beEqualTo('explicit');
57 Should('merger.channelCountMode = "max"', function () {
58 merger
.channelCountMode
= 'max';
59 }).throw('InvalidStateError');
64 audit
.defineTask('finish', function (done
) {
70 'exceptions-channels',
71 'exceptions-properties',
75 successfullyParsed
= true;