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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/realtimeanalyser-zero.html

Issue 2581463002: Refactor WebAudio test directory (Closed)
Patch Set: Use correct path for wav result files Created 3 years, 12 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
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="resources/compatibility.js"></script>
6 <script src="resources/audit-util.js"></script>
7 <script src="resources/audio-testing.js"></script>
8 <title>Test getFloatFrequencyData With Zero Inputs</title>
9 </head>
10
11 <body>
12 <script>
13 description("Test AnalyserNode getFloatFrequencyData With Zero-Valued Inpu t");
14 window.jsTestIsAsync = true;
15
16 var sampleRate = 48000;
17
18 // Render enough data to run the test.
19 var renderFrames = 2*1024;
20 var renderDuration = renderFrames / sampleRate;
21
22 var audit = Audit.createTaskRunner();
23
24
25 // Test that getFloatFrequencyData returns -Infinity when the input is all -zeroes.
26 audit.defineTask("zero input", function (done) {
27 var context = new OfflineAudioContext(1, renderFrames, sampleRate);
28
29 // Constant source of 0's.
30 var source = context.createBufferSource();
31 source.buffer = createConstantBuffer(context, 1, 0);
32 source.loop = true;
33
34 // Create analyser and use some non-default minDecibels value.
35 var analyser = context.createAnalyser();
36 analyser.minDecibels = -123;
37
38 source.connect(analyser);
39 analyser.connect(context.destination);
40
41 source.start();
42
43 // Suspend after some number of frames and grab the float frequency data .
44 context.suspend(1024 / sampleRate).then(function () {
45 var f = new Float32Array(analyser.frequencyBinCount);
46 analyser.getFloatFrequencyData(f);
47
48 Should("getFloatFrequencyData() with zero-valued input", f)
49 .beConstantValueOf(-Infinity);
50 }).then(context.resume.bind(context));
51
52 context.startRendering().then(done);
53 });
54
55 audit.defineTask("finish", function (done) {
56 finishJSTest();
57 done();
58 });
59
60 audit.runTasks();
61
62 </script>
63 </body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698