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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/audiobuffersource-grain.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 <title>Test Start Grain with Delayed Buffer Setting </title>
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 <script>
13 description("Test setting the source buffer after starting the grain");
14
15 var context;
16 var source;
17 var buffer;
18 var renderedData;
19
20 var sampleRate = 44100;
21
22 var testDurationSec = 1;
23 var testDurationSamples = testDurationSec * sampleRate;
24 var startTime = 0.9 * testDurationSec;
25
26 function runTest() {
27 window.jsTestIsAsync = true;
28
29 context = new OfflineAudioContext(1, testDurationSamples, sampleRate);
30 context.oncomplete = checkResult;
31
32 buffer = createConstantBuffer(context, testDurationSamples, 1);
33 source = context.createBufferSource();
34 source.connect(context.destination);
35
36 // Start the source BEFORE we set the buffer. The grain offset and dur ation aren't
37 // important, as long as we specify some offset.
38 source.start(startTime, .1);
39 source.buffer = buffer;
40
41 // Render it!
42 context.startRendering();
43 }
44
45 function checkResult(event) {
46 var success = false;
47
48 renderedData = event.renderedBuffer.getChannelData(0);
49
50 // Check that the rendered data is not all zeroes. Any non-zero data means the test
51 // passed.
52 var startFrame = Math.round(startTime * sampleRate);
53 for (k = 0; k < renderedData.length; ++k) {
54 if (renderedData[k]) {
55 success = true;
56 break;
57 }
58 }
59
60 if (success)
61 testPassed("Buffer was played.");
62 else
63 testFailed("Buffer was not played.");
64
65 finishJSTest();
66 }
67
68 runTest();
69 successfullyParsed = true;
70 </script>
71 </body>
72 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698