Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html b/third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html |
| index eb9d4ff357e8d13f4b236b639ec5841a4013f8cd..6cd2c0869301ab21b4490205fcd7fd09f0962a5c 100644 |
| --- a/third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html |
| +++ b/third_party/WebKit/LayoutTests/webaudio/WaveShaper/waveshaper-limits.html |
| @@ -1,15 +1,15 @@ |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <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/audit.js"></script> |
| </head> |
| <body> |
| - <div id="description"></div> |
| - <div id="console"></div> |
| - |
| <script> |
| - description("Test WaveShaperNode including values outside the range of [-1,1]"); |
| + var audit = Audit.createTaskRunner(); |
| var context; |
| var bufferData; |
| @@ -48,37 +48,23 @@ |
| return ref; |
| } |
| - function checkResult (event) { |
| - outputData = event.renderedBuffer.getChannelData(0); |
| + function checkResult (renderedBuffer, should) { |
| + outputData = renderedBuffer.getChannelData(0); |
| reference = generateReference(); |
| var success = true; |
| // Verify that every output value matches our expected reference value. |
| + |
|
hongchan
2017/02/22 19:05:35
An empty line.
|
| for (var k = 0; k < outputData.length; ++k) { |
| var diff = outputData[k] - reference[k]; |
| - if (Math.abs(diff) <= diffThreshold) { |
| - testPassed(bufferData[k].toFixed(decimals) + " -> " + outputData[k].toFixed(decimals) + "."); |
| - } else { |
| - testFailed(bufferData[k].toFixed(decimals) + " -> " + outputData[k].toFixed(decimals) + ", but expected " + reference[k].toFixed(decimals) + "."); |
| - success = false; |
| - } |
| + should(Math.abs(diff), |
| + "Max error mapping " + bufferData[k].toFixed(decimals) + " to " + |
| + outputData[k].toFixed(decimals)) |
| + .beLessThanOrEqualTo(diffThreshold); |
| } |
| - |
| - if (success) |
| - testPassed("All outputs matched expected results."); |
| - else |
| - testFailed("Some outputs did not match expected results."); |
| - |
| - finishJSTest(); |
| } |
| - function runTest () { |
| - if (window.testRunner) { |
| - testRunner.dumpAsText(); |
| - testRunner.waitUntilDone(); |
| - } |
| - |
| - window.jsTestIsAsync = true; |
| - |
| + audit.define("test", function (task, should) { |
| + task.describe("Test WaveShaperNode including values outside the range of [-1,1]"); |
|
hongchan
2017/02/22 19:05:34
Hmm. Should we try to land this after the 'task.de
Raymond Toy
2017/02/22 19:23:24
Yes. I'll wait and then rebase this.
|
| context = new OfflineAudioContext(1, testFrames, sampleRate); |
| // Create input values between -1.1 and 1.1 |
| var buffer = context.createBuffer(1, testFrames, context.sampleRate); |
| @@ -103,12 +89,12 @@ |
| shaper.connect(context.destination); |
| source.start(); |
| - context.oncomplete = checkResult; |
| - context.startRendering(); |
| - } |
| + context.startRendering() |
| + .then(buffer => checkResult(buffer, should)) |
| + .then(task.done.bind(task)); |
|
hongchan
2017/02/22 19:05:34
() => task.done()
We should move away from .bind(
Raymond Toy
2017/02/22 19:23:24
Done.
|
| + }); |
| - runTest(); |
| - successfullyParsed = true; |
| + audit.run(); |
| </script> |
| </body> |
| </html> |