|
79 | 79 | // Test a processor that has a get parameterDescriptors, but it returns
|
80 | 80 | // something that is not iterable.
|
81 | 81 | try {
|
82 |
| - registerProcessor("invalid", |
83 |
| - class InvalidParamProcessor extends AudioWorkletProcessor { |
84 |
| - static get parameterDescriptors() { |
85 |
| - return 4; |
86 |
| - } |
87 |
| - constructor() { super(); } |
88 |
| - process() { } |
89 |
| - }); |
90 |
| - throw "This should not have been reached."; |
| 82 | + registerProcessor("invalid", |
| 83 | + class InvalidParamProcessor extends AudioWorkletProcessor { |
| 84 | + static get parameterDescriptors() { |
| 85 | + return 4; |
| 86 | + } |
| 87 | + constructor() { super(); } |
| 88 | + process() { } |
| 89 | + }); |
| 90 | + throw "This should not have been reached."; |
91 | 91 | } catch (e) {
|
92 | 92 | // unclear how to signal success here, but we can signal failure in the
|
93 | 93 | // developer console
|
94 | 94 | if (e.name != "TypeError") {
|
95 | 95 | throw "This should be TypeError";
|
96 | 96 | }
|
97 | 97 | }
|
| 98 | + // Test a processor that has a get parameterDescriptors, with a duplicate |
| 99 | + // param name something that is not iterable. |
| 100 | + try { |
| 101 | + registerProcessor("duplicate-param-name", |
| 102 | + class DuplicateParamProcessor extends AudioWorkletProcessor { |
| 103 | + static get parameterDescriptors() { |
| 104 | + var p = { |
| 105 | + name: "a", |
| 106 | + defaultValue: 1, |
| 107 | + minValue: 0, |
| 108 | + maxValue: 1, |
| 109 | + automationRate: "k-rate", |
| 110 | + }; |
| 111 | + return [p,p]; |
| 112 | + } |
| 113 | + constructor() { super(); } |
| 114 | + process() { } |
| 115 | + }); |
| 116 | + throw "This should not have been reached."; |
| 117 | + } catch (e) { |
| 118 | + // unclear how to signal success here, but we can signal failure in the |
| 119 | + // developer console |
| 120 | + if (e.name != "NotSupportedError") { |
| 121 | + throw "This should be NotSupportedError"; |
| 122 | + } |
| 123 | + } |
98 | 124 | // Test a processor that has a no get parameterDescriptors.
|
99 | 125 | try {
|
100 | 126 | registerProcessor("no-params",
|
|
163 | 189 | new AudioWorkletNode(ac, "no-params");
|
164 | 190 | }, `Attempting to create an AudioWorkletNode from a processor
|
165 | 191 | that does not have a parameterDescriptors getter should work`);
|
| 192 | + }) |
| 193 | + .then(function() { |
| 194 | + test(function() { |
| 195 | + assert_throws_dom("InvalidStateError", function() { |
| 196 | + new AudioWorkletNode(ac, "duplicate-param-name"); |
| 197 | + }); |
| 198 | + }, `Attempting to create an AudioWorkletNode with two parameter |
| 199 | + descriptor with the same name should not work`); |
166 | 200 | }).then(function() {
|
167 | 201 | done();
|
168 | 202 | });
|
|
0 commit comments