Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html |
| index cc49d1a84729525c2321a0746c3a123061cd6b9f..1d97067dfb089123c1299a01e68a7a91574f1682 100644 |
| --- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html |
| +++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/note-grain-on-timing.html |
| @@ -1,49 +1,28 @@ |
| -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| +<!doctype> |
| <html> |
| <head> |
| - <script src="../../resources/js-test.js"></script> |
| + <script src="../../resources/testharness.js"></script> |
| + <script src="../../resources/testharnessreport.js"></script> |
| <script src="../resources/audit-util.js"></script> |
| - <script src="../resources/audio-testing.js"></script> |
| + <script src="../resources/audit.js"></script> |
| <script src="../resources/note-grain-on-testing.js"></script> |
| </head> |
| <body> |
| - <div id="description"></div> |
| - <div id="console"></div> |
| - |
| <script> |
| - description("Test timing of noteGrainOn."); |
| + let audit = Audit.createTaskRunner(); |
| - var squarePulseBuffer; |
| + let squarePulseBuffer; |
| - function checkResult(event) { |
| - var buffer = event.renderedBuffer; |
| + function checkResult(buffer, should) { |
| renderedData = buffer.getChannelData(0); |
| - var nSamples = renderedData.length; |
| - |
| - var success = true; |
| - |
| - var startEndFrames = findStartAndEndSamples(renderedData); |
| - |
| - success = success && verifyStartAndEndFrames(startEndFrames); |
| - |
| - if (success) { |
| - testPassed("noteGrainOn timing tests passed."); |
| - } else { |
| - testFailed("noteGrainOn timing tests failed."); |
| - } |
| + let nSamples = renderedData.length; |
| + let startEndFrames = findStartAndEndSamples(renderedData); |
| - finishJSTest(); |
| + verifyStartAndEndFrames(startEndFrames, should); |
| } |
| - function runTest() { |
| - if (window.testRunner) { |
| - testRunner.dumpAsText(); |
| - testRunner.waitUntilDone(); |
| - } |
| - |
| - window.jsTestIsAsync = true; |
| - |
| + audit.define("Test timing of noteGrainOn", function (task, should) { |
| // Create offline audio context. |
| context = new OfflineAudioContext(2, sampleRate * renderTime, sampleRate); |
|
hongchan
2017/01/20 17:46:09
Wrap at 80.
Raymond Toy
2017/01/20 19:37:10
Done.
|
| @@ -51,13 +30,14 @@ |
| playAllGrains(context, squarePulseBuffer, numberOfTests); |
| - context.oncomplete = checkResult; |
| - context.startRendering(); |
| - } |
| + context.startRendering() |
| + .then(function (audioBuffer) { |
| + 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.
|
| + }) |
| + .then(task.done.bind(task));; |
| + }); |
| - runTest(); |
| - successfullyParsed = true; |
| - |
| + audit.run(); |
| </script> |
| </body> |