OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 | |
3 <html> | |
4 <head> | |
5 <script src="../resources/js-test.js"></script> | |
6 <script src="resources/compatibility.js"></script> | |
7 <script src="resources/audit-util.js"></script> | |
8 <script src="resources/audio-testing.js"></script> | |
9 </head> | |
10 | |
11 <body> | |
12 <div id="description"></div> | |
13 <div id="console"></div> | |
14 | |
15 <script> | |
16 description("Test that re-sizing the FFT arrays does not fail."); | |
17 | |
18 if (window.testRunner) { | |
19 testRunner.dumpAsText(); | |
20 testRunner.waitUntilDone(); | |
21 } | |
22 | |
23 var doTest = function(fftSize, illegal) { | |
24 var c = new OfflineAudioContext(1, 1000, 44100); | |
25 var a = c.createAnalyser(); | |
26 try { | |
27 a.fftSize = fftSize; | |
28 if (illegal) | |
29 testFailed("No exception thrown for illegal fftSize " + fftSize + "."
); | |
30 else | |
31 testPassed("Successfully set legal fftSize " + fftSize + "."); | |
32 } catch(e) { | |
33 testPassed("Exception thrown for illegal fftSize " + fftSize + "."); | |
34 } | |
35 // This arbitrary size does not affect the correctness of the test. | |
36 var arr = new Float32Array(100); | |
37 a.getFloatFrequencyData(arr); | |
38 } | |
39 | |
40 doTest(-1, true); | |
41 doTest(0, true); | |
42 doTest(1, true); | |
43 for (var i = 2; i <= 0x20000; i *= 2) { | |
44 if (i >= 32 && i <= 32768) | |
45 doTest(i, false); | |
46 else | |
47 doTest(i, true); | |
48 doTest(i + 1, true); | |
49 } | |
50 | |
51 if (window.testRunner) | |
52 testRunner.notifyDone(); | |
53 testPassed("AudioContext survived multiple invalid FFT array resizings."); | |
54 </script> | |
55 | |
56 </body> | |
57 </html> | |
OLD | NEW |