Index: third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-fft-sizing.html |
diff --git a/third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-fft-sizing.html b/third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-fft-sizing.html |
index d3da16012c0eb6360bfbc2f91e493f994adcbe5c..16e72bc7fd33d55152c457fc4cbbcb80bfff6643 100644 |
--- a/third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-fft-sizing.html |
+++ b/third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-fft-sizing.html |
@@ -2,54 +2,50 @@ |
<html> |
<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/audio-testing.js"></script> |
+<script src="../resources/audit.js"></script> |
</head> |
<body> |
-<div id="description"></div> |
-<div id="console"></div> |
- |
<script> |
-description("Test that re-sizing the FFT arrays does not fail."); |
- |
-if (window.testRunner) { |
- testRunner.dumpAsText(); |
- testRunner.waitUntilDone(); |
-} |
- |
-var doTest = function(fftSize, illegal) { |
- var c = new OfflineAudioContext(1, 1000, 44100); |
- var a = c.createAnalyser(); |
- try { |
- a.fftSize = fftSize; |
- if (illegal) |
- testFailed("No exception thrown for illegal fftSize " + fftSize + "."); |
- else |
- testPassed("Successfully set legal fftSize " + fftSize + "."); |
- } 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); |
+let audit = Audit.createTaskRunner(); |
+ |
+function doTest(fftSize, illegal, should) { |
+ let c = new OfflineAudioContext(1, 1000, 44100); |
+ let a = c.createAnalyser(); |
+ let message = "Setting fftSize to " + fftSize; |
+ let tester = function () { |
+ a.fftSize = fftSize; |
+ }; |
+ |
+ if (illegal) { |
+ should(tester, message) |
+ .throw("IndexSizeError"); |
+ } else { |
+ should(tester, message) |
+ .notThrow(); |
+ } |
} |
-doTest(-1, true); |
-doTest(0, true); |
-doTest(1, true); |
-for (var i = 2; i <= 0x20000; i *= 2) { |
- if (i >= 32 && i <= 32768) |
- doTest(i, false); |
+audit.define("FFT size test", function (task, should) { |
+ task.describe("Test that re-sizing the FFT arrays does not fail."); |
+ doTest(-1, true, should); |
+ doTest(0, true, should); |
+ doTest(1, true, should); |
+ for (let i = 2; i <= 0x20000; i *= 2) { |
+ if (i >= 32 && i <= 32768) |
+ doTest(i, false, should); |
else |
- doTest(i, true); |
- doTest(i + 1, true); |
-} |
+ doTest(i, true, should); |
+ doTest(i + 1, true, should); |
+ } |
+ |
+ task.done(); |
+}); |
-if (window.testRunner) |
- testRunner.notifyDone(); |
-testPassed("AudioContext survived multiple invalid FFT array resizings."); |
+audit.run(); |
</script> |
</body> |