blob: c13b2a79577459638fac2b6edbe546f14bfa5d5d [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/audio-testing.js"></script>
<script src="resources/audiobuffersource-testing.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Tests that AnalyserNode validates minDecibels, maxDecibels and smoothingTimeConstant values.");
var analyser;
function runTest() {
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.jsTestIsAsync = true;
var sampleRate = 44100.0;
var numberOfFrames = 32;
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();
}
runTest();
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>