1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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>
|