Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | 1 <!doctype> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> | |
| 5 <script src="../resources/audit-util.js"></script> | 6 <script src="../resources/audit-util.js"></script> |
| 6 <script src="../resources/audio-testing.js"></script> | 7 <script src="../resources/audit.js"></script> |
| 7 <script src="../resources/note-grain-on-testing.js"></script> | 8 <script src="../resources/note-grain-on-testing.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 let squarePulseBuffer; |
| 15 description("Test timing of noteGrainOn."); | |
| 16 | 16 |
| 17 var squarePulseBuffer; | 17 function checkResult(buffer, should) { |
| 18 renderedData = buffer.getChannelData(0); | |
| 19 let nSamples = renderedData.length; | |
| 20 let startEndFrames = findStartAndEndSamples(renderedData); | |
| 18 | 21 |
| 19 function checkResult(event) { | 22 verifyStartAndEndFrames(startEndFrames, should); |
| 20 var buffer = event.renderedBuffer; | |
| 21 renderedData = buffer.getChannelData(0); | |
| 22 var nSamples = renderedData.length; | |
| 23 | |
| 24 var success = true; | |
| 25 | |
| 26 var startEndFrames = findStartAndEndSamples(renderedData); | |
| 27 | |
| 28 success = success && verifyStartAndEndFrames(startEndFrames); | |
| 29 | |
| 30 if (success) { | |
| 31 testPassed("noteGrainOn timing tests passed."); | |
| 32 } else { | |
| 33 testFailed("noteGrainOn timing tests failed."); | |
| 34 } | |
| 35 | |
| 36 finishJSTest(); | |
| 37 } | 23 } |
| 38 | 24 |
| 39 function runTest() { | 25 audit.define("Test timing of noteGrainOn", function (task, should) { |
| 40 if (window.testRunner) { | |
| 41 testRunner.dumpAsText(); | |
| 42 testRunner.waitUntilDone(); | |
| 43 } | |
| 44 | |
| 45 window.jsTestIsAsync = true; | |
| 46 | |
| 47 // Create offline audio context. | 26 // Create offline audio context. |
| 48 context = new OfflineAudioContext(2, sampleRate * renderTime, sampleRa te); | 27 context = new OfflineAudioContext(2, sampleRate * renderTime, sampleRa te); |
|
hongchan
2017/01/20 17:46:09
Wrap at 80.
Raymond Toy
2017/01/20 19:37:10
Done.
| |
| 49 | 28 |
| 50 squarePulseBuffer = createSignalBuffer(context, function (k) { return 1 }); | 29 squarePulseBuffer = createSignalBuffer(context, function (k) { return 1 }); |
|
hongchan
2017/01/20 17:46:09
Wrap at 80.
Raymond Toy
2017/01/20 19:37:10
Done.
| |
| 51 | 30 |
| 52 playAllGrains(context, squarePulseBuffer, numberOfTests); | 31 playAllGrains(context, squarePulseBuffer, numberOfTests); |
| 53 | 32 |
| 54 context.oncomplete = checkResult; | 33 context.startRendering() |
| 55 context.startRendering(); | 34 .then(function (audioBuffer) { |
| 56 } | 35 checkResult(audioBuffer, should); |
|
hongchan
2017/01/20 17:46:09
We can call task.done() right after this.
Raymond Toy
2017/01/20 19:37:10
Done.
| |
| 36 }) | |
| 37 .then(task.done.bind(task));; | |
| 38 }); | |
| 57 | 39 |
| 58 runTest(); | 40 audit.run(); |
| 59 successfullyParsed = true; | |
| 60 | |
| 61 </script> | 41 </script> |
| 62 | 42 |
| 63 </body> | 43 </body> |
| 64 </html> | 44 </html> |
| OLD | NEW |