| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 <script src="resources/compatibility.js"></script> | 5 <script src="resources/compatibility.js"></script> |
| 6 <script src="resources/audio-testing.js"></script> | 6 <script src="resources/audio-testing.js"></script> |
| 7 <title>Test AudioParam Nominal Range Values</title> | 7 <title>Test AudioParam Nominal Range Values</title> |
| 8 </head> | 8 </head> |
| 9 | 9 |
| 10 <body> | 10 <body> |
| 11 <script> | 11 <script> |
| 12 description("Test Automation of SpatialListener Position."); | 12 description("Test AudioParam Nominal Range Values."); |
| 13 window.jsTestIsAsync = true; | 13 window.jsTestIsAsync = true; |
| 14 | 14 |
| 15 // Some arbitrary sample rate for the offline context. | 15 // Some arbitrary sample rate for the offline context. |
| 16 var sampleRate = 48000; | 16 var sampleRate = 48000; |
| 17 | 17 |
| 18 // The actual offline context | 18 // The actual offline context |
| 19 var context; | 19 var context; |
| 20 | 20 |
| 21 // The set of all methods that we've tested for verifying that we tested a
ll of the necessary | 21 // The set of all methods that we've tested for verifying that we tested a
ll of the necessary |
| 22 // objects. | 22 // objects. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 limits: { | 137 limits: { |
| 138 frequency: { | 138 frequency: { |
| 139 minValue: 0, | 139 minValue: 0, |
| 140 maxValue: sampleRate / 2 | 140 maxValue: sampleRate / 2 |
| 141 }, | 141 }, |
| 142 detune: { | 142 detune: { |
| 143 minValue: -mostPositiveFloat, | 143 minValue: -mostPositiveFloat, |
| 144 maxValue: mostPositiveFloat | 144 maxValue: mostPositiveFloat |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 }, { |
| 148 creator: "createPanner", |
| 149 args: [], |
| 150 limits : { |
| 151 positionX: { |
| 152 minValue: -mostPositiveFloat, |
| 153 maxValue: mostPositiveFloat, |
| 154 }, |
| 155 positionY: { |
| 156 minValue: -mostPositiveFloat, |
| 157 maxValue: mostPositiveFloat, |
| 158 }, |
| 159 positionZ: { |
| 160 minValue: -mostPositiveFloat, |
| 161 maxValue: mostPositiveFloat, |
| 162 }, |
| 163 orientationX: { |
| 164 minValue: -mostPositiveFloat, |
| 165 maxValue: mostPositiveFloat, |
| 166 }, |
| 167 orientationY: { |
| 168 minValue: -mostPositiveFloat, |
| 169 maxValue: mostPositiveFloat, |
| 170 }, |
| 171 orientationZ: { |
| 172 minValue: -mostPositiveFloat, |
| 173 maxValue: mostPositiveFloat, |
| 174 } |
| 175 }, |
| 147 }, | 176 }, |
| 148 // These nodes don't have AudioParams, but we want to test them anyway. A
ny arguments for the | 177 // These nodes don't have AudioParams, but we want to test them anyway. A
ny arguments for the |
| 149 // constructor are pretty much arbitrary; they just need to be valid. | 178 // constructor are pretty much arbitrary; they just need to be valid. |
| 150 { | 179 { |
| 151 creator: "createBuffer", | 180 creator: "createBuffer", |
| 152 args: [1, 1, sampleRate], | 181 args: [1, 1, sampleRate], |
| 153 }, { | 182 }, { |
| 154 creator: "createIIRFilter", | 183 creator: "createIIRFilter", |
| 155 args: [[1,2],[3,4]] | 184 args: [[1,2],[3,4]] |
| 156 }, { | 185 }, { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 168 }, { | 197 }, { |
| 169 creator: "createPeriodicWave", | 198 creator: "createPeriodicWave", |
| 170 args: [Float32Array.from([0, 0]), Float32Array.from([1, 0])], | 199 args: [Float32Array.from([0, 0]), Float32Array.from([1, 0])], |
| 171 }, { | 200 }, { |
| 172 creator: "createChannelSplitter", | 201 creator: "createChannelSplitter", |
| 173 args: [], | 202 args: [], |
| 174 }, { | 203 }, { |
| 175 creator: "createChannelMerger", | 204 creator: "createChannelMerger", |
| 176 args: [], | 205 args: [], |
| 177 }, { | 206 }, { |
| 178 creator: "createPanner", | |
| 179 args: [], | |
| 180 }, { | |
| 181 creator: "createMediaElementSource", | 207 creator: "createMediaElementSource", |
| 182 args: [new Audio()] | 208 args: [new Audio()] |
| 183 },{ | 209 },{ |
| 184 creator: "createMediaStreamDestination", | 210 creator: "createMediaStreamDestination", |
| 185 args: [] | 211 args: [] |
| 186 } | 212 } |
| 187 // Can't currently test MediaStreamSource | 213 // Can't currently test MediaStreamSource |
| 188 ]; | 214 ]; |
| 189 | 215 |
| 190 // Create the context so we can use it in the following test. | 216 // Create the context so we can use it in the following test. |
| 191 audit.defineTask("initialize", function (done) { | 217 audit.defineTask("initialize", function (done) { |
| 192 // Just any context so that we can create the nodes. | 218 // Just any context so that we can create the nodes. |
| 193 context = new OfflineAudioContext(1, 1, sampleRate); | 219 context = new OfflineAudioContext(1, 1, sampleRate); |
| 194 done(); | 220 done(); |
| 195 }); | 221 }); |
| 196 | 222 |
| 197 // Create a task for each entry in testConfigs | 223 // Create a task for each entry in testConfigs |
| 198 for (var test in testConfigs) { | 224 for (var test in testConfigs) { |
| 199 var config = testConfigs[test] | 225 var config = testConfigs[test] |
| 200 audit.defineTask(config.creator, (function (c) { | 226 audit.defineTask(config.creator, (function (c) { |
| 201 return function (done) { | 227 return function (done) { |
| 202 var node = context[c.creator](...c.args); | 228 var node = context[c.creator](...c.args); |
| 203 testLimits(c.creator, node, c.limits); | 229 testLimits(c.creator, node, c.limits); |
| 204 done(); | 230 done(); |
| 205 }; | 231 }; |
| 206 })(config)); | 232 })(config)); |
| 207 } | 233 } |
| 208 | 234 |
| 235 // Test the AudioListener params that were added for the automated Panner |
| 236 audit.defineTask("AudioListener", function (done) { |
| 237 testLimits("", context.listener, { |
| 238 positionX: { |
| 239 minValue: -mostPositiveFloat, |
| 240 maxValue: mostPositiveFloat, |
| 241 }, |
| 242 positionY: { |
| 243 minValue: -mostPositiveFloat, |
| 244 maxValue: mostPositiveFloat, |
| 245 }, |
| 246 positionZ: { |
| 247 minValue: -mostPositiveFloat, |
| 248 maxValue: mostPositiveFloat, |
| 249 }, |
| 250 forwardX: { |
| 251 minValue: -mostPositiveFloat, |
| 252 maxValue: mostPositiveFloat, |
| 253 }, |
| 254 forwardY: { |
| 255 minValue: -mostPositiveFloat, |
| 256 maxValue: mostPositiveFloat, |
| 257 }, |
| 258 forwardZ: { |
| 259 minValue: -mostPositiveFloat, |
| 260 maxValue: mostPositiveFloat, |
| 261 }, |
| 262 upX: { |
| 263 minValue: -mostPositiveFloat, |
| 264 maxValue: mostPositiveFloat, |
| 265 }, |
| 266 upY: { |
| 267 minValue: -mostPositiveFloat, |
| 268 maxValue: mostPositiveFloat, |
| 269 }, |
| 270 upZ: { |
| 271 minValue: -mostPositiveFloat, |
| 272 maxValue: mostPositiveFloat, |
| 273 } |
| 274 }); |
| 275 done(); |
| 276 }); |
| 277 |
| 209 // Verify that we have tested all the create methods available on the cont
ext. | 278 // Verify that we have tested all the create methods available on the cont
ext. |
| 210 audit.defineTask("verifyTests", function (done) { | 279 audit.defineTask("verifyTests", function (done) { |
| 211 var allNodes = new Set(); | 280 var allNodes = new Set(); |
| 212 // Create the set of all "create" methods from the context. | 281 // Create the set of all "create" methods from the context. |
| 213 for (var method in context) { | 282 for (var method in context) { |
| 214 if (typeof context[method] === "function" && method.substring(0, 6) ==
= "create") { | 283 if (typeof context[method] === "function" && method.substring(0, 6) ==
= "create") { |
| 215 allNodes.add(method); | 284 allNodes.add(method); |
| 216 } | 285 } |
| 217 } | 286 } |
| 218 | 287 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } else { | 456 } else { |
| 388 if (limits) | 457 if (limits) |
| 389 testFailed(nodeName + " has no AudioParams but test expected " + lim
its + ".\n"); | 458 testFailed(nodeName + " has no AudioParams but test expected " + lim
its + ".\n"); |
| 390 else | 459 else |
| 391 testPassed(nodeName + " has no AudioParams as expected.\n"); | 460 testPassed(nodeName + " has no AudioParams as expected.\n"); |
| 392 } | 461 } |
| 393 } | 462 } |
| 394 </script> | 463 </script> |
| 395 </body> | 464 </body> |
| 396 </html> | 465 </html> |
| OLD | NEW |