Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/ScriptProcessor/scriptprocessornode-zero-input-channels.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/ScriptProcessor/scriptprocessornode-zero-input-channels.html b/third_party/WebKit/LayoutTests/webaudio/ScriptProcessor/scriptprocessornode-zero-input-channels.html |
| index 4a05ed9321a2dd9595529546c5bf296e9abbf443..7e69528ab909e4ef85e988bb0b74323819c07b59 100644 |
| --- a/third_party/WebKit/LayoutTests/webaudio/ScriptProcessor/scriptprocessornode-zero-input-channels.html |
| +++ b/third_party/WebKit/LayoutTests/webaudio/ScriptProcessor/scriptprocessornode-zero-input-channels.html |
| @@ -1,67 +1,60 @@ |
| <!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/audio-testing.js"></script> |
| +<script src="../resources/audit.js"></script> |
| </head> |
| <body> |
| -<div id="description"></div> |
| -<div id="console"></div> |
| - |
| <script> |
| -description("Tests that ScriptProcessorNode accepts 0 input channels."); |
| - |
| -var sampleRate = 44100.0; |
| -var renderLengthInFrames = 512; |
| -var bufferSize = 512; |
| +let audit = Audit.createTaskRunner(); |
| -function checkResult(e) |
| -{ |
| - testPassed("ScriptProcessorNode accepts 0 input channels."); |
| +let sampleRate = 44100.0; |
| +let renderLengthInFrames = 512; |
| +let bufferSize = 512; |
| - finishJSTest(); |
| +function checkResult(e, task, should) { |
| + should(true, 'ScriptProcessorNode accepts 0 input channels').beTrue(); |
| + task.done(); |
|
hongchan
2017/02/24 23:12:46
These two lines can go into the line 51. Then we c
Raymond Toy
2017/02/27 17:31:22
Done.
|
| } |
| -function runTest() |
| -{ |
| - if (window.testRunner) { |
| - testRunner.dumpAsText(); |
| - testRunner.waitUntilDone(); |
| - } |
| - |
| - window.jsTestIsAsync = true; |
| +audit.define( |
| + { |
| + label: 'test', |
| + description: 'Tests that ScriptProcessorNode accepts 0 input channels' |
| + }, |
| + (task, should) => { |
| + let context = |
| + new OfflineAudioContext(1, renderLengthInFrames, sampleRate); |
| - var context = new OfflineAudioContext(1, renderLengthInFrames, sampleRate); |
| + let node; |
| - var node; |
| - |
| - try { |
| + should(() => { |
| node = context.createScriptProcessor(bufferSize, 0, 1); |
| - testPassed("Successfully created ScriptProcessorNode."); |
| - } catch (e) { |
| - testFailed("Failed to create ScriptProcessorNode."); |
| - } |
| - |
| - var source = context.createBufferSource(); |
| - source.buffer = createImpulseBuffer(context, bufferSize); |
| - |
| - // The onaudioprocess function doesn't need to do anything. We just need the process to start |
| - // to test that implementation accepts 0 input channels. |
| - // |
| - // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent. |
| - node.onaudioprocess = function(e) { }; |
| - source.connect(node); |
| - node.connect(context.destination); |
| - source.start(0); |
| - |
| - context.oncomplete = checkResult; |
| - context.startRendering(); |
| -} |
| - |
| -runTest(); |
| -successfullyParsed = true; |
| + }, 'node = context.createScriptProcessor(bufferSize, 0, 1)').notThrow(); |
| + let source = context.createBufferSource(); |
| + source.buffer = createImpulseBuffer(context, bufferSize); |
| + |
| + // The onaudioprocess function doesn't need to do anything. We just need |
| + // the process to start to test that implementation accepts 0 input |
| + // channels. |
| + // |
| + // FIXME: check the .inputBuffer attribute of the AudioProcessingEvent. |
| + node.onaudioprocess = function(e) {}; |
| + source.connect(node); |
| + node.connect(context.destination); |
| + source.start(0); |
| + |
| + context.oncomplete = event => { |
| + checkResult(event, task, should); |
| + }; |
| + ; |
| + context.startRendering(); |
| + }); |
| + |
| +audit.run(); |
| </script> |
| </body> |