| Index: third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html b/third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3c12bda7fdc8b0f49299208a35eb5fbdaa03091b
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html
|
| @@ -0,0 +1,63 @@
|
| +<!doctype html>
|
| +<html>
|
| + <head>
|
| + <script src="../resources/js-test.js"></script>
|
| + <script src="resources/compatibility.js"></script>
|
| + <script src="resources/audio-testing.js"></script>
|
| + <title>Test getFloatFrequencyData With Zero Inputs</title>
|
| + </head>
|
| +
|
| + <body>
|
| + <script>
|
| + description("Test AnalyserNode getFloatFrequencyData With Zero-Valued Input");
|
| + window.jsTestIsAsync = true;
|
| +
|
| + var sampleRate = 48000;
|
| +
|
| + // Render enough data to run the test.
|
| + var renderFrames = 2*1024;
|
| + var renderDuration = renderFrames / sampleRate;
|
| +
|
| + var audit = Audit.createTaskRunner();
|
| +
|
| +
|
| + // Test that getFloatFrequencyData returns -Infinity when the input is all-zeroes.
|
| + audit.defineTask("zero input", function (done) {
|
| + var context = new OfflineAudioContext(1, renderFrames, sampleRate);
|
| +
|
| + // Constant source of 0's.
|
| + var source = context.createBufferSource();
|
| + source.buffer = createConstantBuffer(context, 1, 0);
|
| + source.loop = true;
|
| +
|
| + // Create analyser and use some non-default minDecibels value.
|
| + var analyser = context.createAnalyser();
|
| + analyser.minDecibels = -123;
|
| +
|
| + source.connect(analyser);
|
| + analyser.connect(context.destination);
|
| +
|
| + source.start();
|
| +
|
| + // Suspend after some number of frames and grab the float frequency data.
|
| + context.suspend(1024 / sampleRate).then(function () {
|
| + var f = new Float32Array(analyser.frequencyBinCount);
|
| + analyser.getFloatFrequencyData(f);
|
| +
|
| + Should("getFloatFrequencyData() with zero-valued input", f)
|
| + .beConstantValueOf(-Infinity);
|
| + }).then(context.resume.bind(context));
|
| +
|
| + context.startRendering().then(done);
|
| + });
|
| +
|
| + audit.defineTask("finish", function (done) {
|
| + finishJSTest();
|
| + done();
|
| + });
|
| +
|
| + audit.runTasks();
|
| +
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|