Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webaudio / note-grain-on-timing.html
blob543f8b9ecef6d8907b36d268b166da0c3b410d3f
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <script src="resources/compatibility.js"></script>
5 <script src="resources/audio-testing.js"></script>
6 <script src="resources/note-grain-on-testing.js"></script>
7 <script src="../resources/js-test.js"></script>
8 </head>
10 <body>
11 <div id="description"></div>
12 <div id="console"></div>
14 <script>
15 description("Test timing of noteGrainOn.");
17 var squarePulseBuffer;
19 function checkResult(event) {
20 var buffer = event.renderedBuffer;
21 renderedData = buffer.getChannelData(0);
22 var nSamples = renderedData.length;
24 var success = true;
26 var startEndFrames = findStartAndEndSamples(renderedData);
28 success = success && verifyStartAndEndFrames(startEndFrames);
30 if (success) {
31 testPassed("noteGrainOn timing tests passed.");
32 } else {
33 testFailed("noteGrainOn timing tests failed.");
36 finishJSTest();
39 function runTest() {
40 if (window.testRunner) {
41 testRunner.dumpAsText();
42 testRunner.waitUntilDone();
45 window.jsTestIsAsync = true;
47 // Create offline audio context.
48 context = new OfflineAudioContext(2, sampleRate * renderTime, sampleRate);
50 squarePulseBuffer = createSignalBuffer(context, function (k) { return 1 });
52 playAllGrains(context, squarePulseBuffer, numberOfTests);
54 context.oncomplete = checkResult;
55 context.startRendering();
58 runTest();
59 successfullyParsed = true;
61 </script>
63 </body>
64 </html>