| <script src="../resources/js-test-pre.js"></script> |
| <script src="resources/audio-testing.js"></script> |
| <script src="resources/audiobuffersource-testing.js"></script> |
| <div id="description"></div> |
| description("Tests that AnalyserNode validates minDecibels, maxDecibels and smoothingTimeConstant values."); |
| testRunner.waitUntilDone(); |
| window.jsTestIsAsync = true; |
| var sampleRate = 44100.0; |
| var context = new webkitOfflineAudioContext(1, numberOfFrames, sampleRate); |
| analyser = context.createAnalyser(); |
| analyser.connect(context.destination); |
| // 'minDecibels' shouldn't be greater than 'maxDecibels' which defaults to -30dB. |
| shouldThrow("analyser.minDecibels = -20", "'Error: IndexSizeError: DOM Exception 1'"); |
| // 'maxDecibels' shouldn't be less than 'minDecibels' which defaults to -100dB. |
| shouldThrow("analyser.maxDecibels = -120", "'Error: IndexSizeError: DOM Exception 1'"); |
| // 'smoothingTimeConstant' range is between 0 and 1. |
| shouldThrow("analyser.smoothingTimeConstant = 2", "'Error: IndexSizeError: DOM Exception 1'"); |
| context.oncomplete = finishJSTest; |
| context.startRendering(); |
| <script src="../resources/js-test-post.js"></script> |