Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-fft-sizing.html

Issue 2603483002: Convert realtimeanalyser-fft-sizing tst to testharness (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-fft-sizing-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 2
3 <html> 3 <html>
4 <head> 4 <head>
5 <script src="../../resources/js-test.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
6 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
7 <script src="../resources/audio-testing.js"></script> 8 <script src="../resources/audit.js"></script>
8 </head> 9 </head>
9 10
10 <body> 11 <body>
11 <div id="description"></div> 12 <script>
12 <div id="console"></div> 13 let audit = Audit.createTaskRunner();
13 14
14 <script> 15 function doTest(fftSize, illegal, should) {
15 description("Test that re-sizing the FFT arrays does not fail."); 16 let c = new OfflineAudioContext(1, 1000, 44100);
17 let a = c.createAnalyser();
18 let message = "Setting fftSize to " + fftSize;
19 let tester = function () {
20 a.fftSize = fftSize;
21 };
16 22
17 if (window.testRunner) { 23 if (illegal) {
18 testRunner.dumpAsText(); 24 should(tester, message)
19 testRunner.waitUntilDone(); 25 .throw("IndexSizeError");
26 } else {
27 should(tester, message)
28 .notThrow();
29 }
20 } 30 }
21 31
22 var doTest = function(fftSize, illegal) { 32 audit.define("FFT size test", function (task, should) {
23 var c = new OfflineAudioContext(1, 1000, 44100); 33 task.describe("Test that re-sizing the FFT arrays does not fail.");
24 var a = c.createAnalyser(); 34 doTest(-1, true, should);
25 try { 35 doTest(0, true, should);
26 a.fftSize = fftSize; 36 doTest(1, true, should);
27 if (illegal) 37 for (let i = 2; i <= 0x20000; i *= 2) {
28 testFailed("No exception thrown for illegal fftSize " + fftSize + "." ); 38 if (i >= 32 && i <= 32768)
29 else 39 doTest(i, false, should);
30 testPassed("Successfully set legal fftSize " + fftSize + "."); 40 else
31 } catch(e) { 41 doTest(i, true, should);
32 testPassed("Exception thrown for illegal fftSize " + fftSize + "."); 42 doTest(i + 1, true, should);
33 } 43 }
34 // This arbitrary size does not affect the correctness of the test.
35 var arr = new Float32Array(100);
36 a.getFloatFrequencyData(arr);
37 }
38 44
39 doTest(-1, true); 45 task.done();
40 doTest(0, true); 46 });
41 doTest(1, true);
42 for (var i = 2; i <= 0x20000; i *= 2) {
43 » if (i >= 32 && i <= 32768)
44 doTest(i, false);
45 else
46 doTest(i, true);
47 doTest(i + 1, true);
48 }
49 47
50 if (window.testRunner) 48 audit.run();
51 testRunner.notifyDone();
52 testPassed("AudioContext survived multiple invalid FFT array resizings.");
53 </script> 49 </script>
54 50
55 </body> 51 </body>
56 </html> 52 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/Analyser/realtimeanalyser-fft-sizing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698