Commit 1ccc5796 authored by rtoy's avatar rtoy Committed by Commit bot

Convert realtimeanalyser-fft-sizing tst to testharness

Test converted to use testharness and new Audit.

The expected result file is also removed.

BUG=675987
TEST=realtimeanalyser-fft-sizing.html

Review-Url: https://codereview.chromium.org/2603483002
Cr-Commit-Position: refs/heads/master@{#441442}
parent ba7b9d74
Test that re-sizing the FFT arrays does not fail.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Exception thrown for illegal fftSize -1.
PASS Exception thrown for illegal fftSize 0.
PASS Exception thrown for illegal fftSize 1.
PASS Exception thrown for illegal fftSize 2.
PASS Exception thrown for illegal fftSize 3.
PASS Exception thrown for illegal fftSize 4.
PASS Exception thrown for illegal fftSize 5.
PASS Exception thrown for illegal fftSize 8.
PASS Exception thrown for illegal fftSize 9.
PASS Exception thrown for illegal fftSize 16.
PASS Exception thrown for illegal fftSize 17.
PASS Successfully set legal fftSize 32.
PASS Exception thrown for illegal fftSize 33.
PASS Successfully set legal fftSize 64.
PASS Exception thrown for illegal fftSize 65.
PASS Successfully set legal fftSize 128.
PASS Exception thrown for illegal fftSize 129.
PASS Successfully set legal fftSize 256.
PASS Exception thrown for illegal fftSize 257.
PASS Successfully set legal fftSize 512.
PASS Exception thrown for illegal fftSize 513.
PASS Successfully set legal fftSize 1024.
PASS Exception thrown for illegal fftSize 1025.
PASS Successfully set legal fftSize 2048.
PASS Exception thrown for illegal fftSize 2049.
PASS Successfully set legal fftSize 4096.
PASS Exception thrown for illegal fftSize 4097.
PASS Successfully set legal fftSize 8192.
PASS Exception thrown for illegal fftSize 8193.
PASS Successfully set legal fftSize 16384.
PASS Exception thrown for illegal fftSize 16385.
PASS Successfully set legal fftSize 32768.
PASS Exception thrown for illegal fftSize 32769.
PASS Exception thrown for illegal fftSize 65536.
PASS Exception thrown for illegal fftSize 65537.
PASS Exception thrown for illegal fftSize 131072.
PASS Exception thrown for illegal fftSize 131073.
PASS AudioContext survived multiple invalid FFT array resizings.
PASS successfullyParsed is true
TEST COMPLETE
...@@ -2,54 +2,50 @@ ...@@ -2,54 +2,50 @@
<html> <html>
<head> <head>
<script src="../../resources/js-test.js"></script> <script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script> <script src="../resources/audit-util.js"></script>
<script src="../resources/audio-testing.js"></script> <script src="../resources/audit.js"></script>
</head> </head>
<body> <body>
<div id="description"></div>
<div id="console"></div>
<script> <script>
description("Test that re-sizing the FFT arrays does not fail."); let audit = Audit.createTaskRunner();
if (window.testRunner) { function doTest(fftSize, illegal, should) {
testRunner.dumpAsText(); let c = new OfflineAudioContext(1, 1000, 44100);
testRunner.waitUntilDone(); let a = c.createAnalyser();
} let message = "Setting fftSize to " + fftSize;
let tester = function () {
var doTest = function(fftSize, illegal) { a.fftSize = fftSize;
var c = new OfflineAudioContext(1, 1000, 44100); };
var a = c.createAnalyser();
try { if (illegal) {
a.fftSize = fftSize; should(tester, message)
if (illegal) .throw("IndexSizeError");
testFailed("No exception thrown for illegal fftSize " + fftSize + "."); } else {
else should(tester, message)
testPassed("Successfully set legal fftSize " + fftSize + "."); .notThrow();
} catch(e) { }
testPassed("Exception thrown for illegal fftSize " + fftSize + ".");
}
// This arbitrary size does not affect the correctness of the test.
var arr = new Float32Array(100);
a.getFloatFrequencyData(arr);
} }
doTest(-1, true); audit.define("FFT size test", function (task, should) {
doTest(0, true); task.describe("Test that re-sizing the FFT arrays does not fail.");
doTest(1, true); doTest(-1, true, should);
for (var i = 2; i <= 0x20000; i *= 2) { doTest(0, true, should);
if (i >= 32 && i <= 32768) doTest(1, true, should);
doTest(i, false); for (let i = 2; i <= 0x20000; i *= 2) {
if (i >= 32 && i <= 32768)
doTest(i, false, should);
else else
doTest(i, true); doTest(i, true, should);
doTest(i + 1, true); doTest(i + 1, true, should);
} }
task.done();
});
if (window.testRunner) audit.run();
testRunner.notifyDone();
testPassed("AudioContext survived multiple invalid FFT array resizings.");
</script> </script>
</body> </body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment