Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/AudioNode/audionode.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioNode/audionode.html b/third_party/WebKit/LayoutTests/webaudio/AudioNode/audionode.html |
| index ff458518bbb72ea4739135db2d55b425707f3292..d71a5ce3555889631dc10a8e42ea73344726304d 100644 |
| --- a/third_party/WebKit/LayoutTests/webaudio/AudioNode/audionode.html |
| +++ b/third_party/WebKit/LayoutTests/webaudio/AudioNode/audionode.html |
| @@ -2,9 +2,10 @@ |
| <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> |
| @@ -12,83 +13,78 @@ |
| <div id="console"></div> |
| <script> |
| -description("Basic tests for AudioNode API."); |
| - |
| -var context = 0; |
| -var context2 = 0; |
| -var context3 = 0; |
| - |
| -function runTest() { |
| - if (window.testRunner) { |
| - testRunner.dumpAsText(); |
| - testRunner.waitUntilDone(); |
| - } |
| - |
| - window.jsTestIsAsync = true; |
| - |
| - context = new AudioContext(); |
| - window.audioNode = context.createBufferSource(); |
| - |
| - // Check input and output numbers of AudioSourceNode. |
| - if (audioNode.numberOfInputs === 0) |
| - testPassed("Source AudioNode has no inputs."); |
| - else |
| - testFailed("Source AudioNode should not have inputs."); |
| - |
| - if (audioNode.numberOfOutputs === 1) |
| - testPassed("Source AudioNode has one output."); |
| - else |
| - testFailed("Source AudioNode should have one output."); |
| - |
| - // Check input and output numbers of AudioDestinationNode |
| - if (context.destination.numberOfInputs === 1) |
| - testPassed("Destination AudioNode has one input."); |
| - else |
| - testFailed("Destination AudioNode should have one input."); |
| - |
| - if (context.destination.numberOfOutputs === 0) |
| - testPassed("Destination AudioNode has no outputs."); |
| - else |
| - testFailed("Destination AudioNode should have no outputs."); |
| - |
| - // Try calling connect() method with illegal values. |
| - shouldThrow('audioNode.connect(0, 0, 0)'); |
| - shouldThrow('audioNode.connect(null, 0, 0)'); |
| - shouldThrow('audioNode.connect(context.destination, 5, 0)'); |
| - shouldThrow('audioNode.connect(context.destination, 0, 5)'); |
| - |
| - shouldNotThrow('audioNode.connect(context.destination, 0, 0)'); |
| - |
| - // Create a new context and try to connect the other context's node to this one. |
| - try { |
| - context2 = new AudioContext(); |
| - window.audioNode.connect(context2.destination); |
| - testFailed("exception should be thrown when connecting to other context's node."); |
| - } catch(e) { |
| - testPassed("exception thrown when connecting to other context's node."); |
| - } |
| - |
| - // 3-arg AudioContext doesn't create an offline context anymore. |
| - shouldNotThrow("context3 = new AudioContext(1, 44100, 44100)"); |
| - if (context3 instanceof OfflineAudioContext) |
| - testFailed("context3 should not be an OfflineAudioContext"); |
| - else |
| - testPassed("context3 is not an OfflineAudioContext"); |
| - |
| - // Ensure it is an EventTarget |
| - try { |
| - audioNode.addEventListener('testEvent', function(){ |
| - testPassed("AudioNode is an EventTarget"); |
| - }); |
| - audioNode.dispatchEvent(new Event('testEvent')); |
| - } catch(e) { |
| - testFailed("exception shouldn't be thrown when testing whether audio node is an event target"); |
| - } |
| - |
| - finishJSTest(); |
| -} |
| - |
| -runTest(); |
| +let audit = Audit.createTaskRunner(); |
| + |
| +let context = 0; |
| +let context2 = 0; |
| +let context3 = 0; |
| + |
| +audit.define('test', function(task, should) { |
| + task.describe('Basic tests for AudioNode API.'); |
| + |
| + context = new AudioContext(); |
| + window.audioNode = context.createBufferSource(); |
| + |
| + // Check input and output numbers of AudioSourceNode. |
| + should(audioNode.numberOfInputs, 'AudioBufferSource.numberOfInputs') |
| + .beEqualTo(0); |
| + should(audioNode.numberOfOutputs, 'AudioBufferSource.numberOfOutputs') |
| + .beEqualTo(1); |
| + |
| + // Check input and output numbers of AudioDestinationNode |
| + should( |
| + context.destination.numberOfInputs, |
| + 'AudioContext.destination.numberOfInputs') |
| + .beEqualTo(1); |
| + should( |
| + context.destination.numberOfOutputs, |
| + 'AudioContext.destination.numberOfOutputs') |
| + .beEqualTo(0); |
| + |
| + // Try calling connect() method with illegal values. |
| + should(() = > audioNode.connect(0, 0, 0), 'audioNode.connect(0, 0, 0)') |
|
hongchan
2017/01/23 23:12:58
Hmm. Is this okay? |() = >|
Does it run by V8 wit
|
| + .throw('TypeError'); |
| + should(() = > audioNode.connect(null, 0, 0), 'audioNode.connect(null, 0, 0)') |
| + .throw('TypeError'); |
| + should( |
| + () = > audioNode.connect(context.destination, 5, 0), |
| + 'audioNode.connect(context.destination, 5, 0)') |
| + .throw('IndexSizeError'); |
| + should( |
| + () = > audioNode.connect(context.destination, 0, 5), |
| + 'audioNode.connect(context.destination, 0, 5)') |
| + .throw('IndexSizeError'); |
| + |
| + should( |
| + () = > audioNode.connect(context.destination, 0, 0), |
| + 'audioNode.connect(context.destination, 0, 0)') |
| + .notThrow(); |
| + |
| + // Create a new context and try to connect the other context's node to this |
| + // one. |
| + context2 = new AudioContext(); |
| + should( |
| + () = > window.audioNode.connect(context2.destination), |
| + 'Connecting a node to a different context') |
| + .throw('InvalidAccessError'); |
| + |
| + should( |
| + () = > context3 = new AudioContext(1, 44100, 44100), |
| + 'context3 = new AudioContext(1, 44100, 44100)') |
| + .notThrow(); |
| + should( |
| + context3 instanceof OfflineAudioContext, |
| + 'context3 instanceof OfflineAudioContext') |
| + .beFalse(); |
| + |
| + // Ensure it is an EventTarget |
| + should(audioNode instanceof EventTarget, 'AudioNode is an EventTarget') |
| + .beTrue(); |
| + |
| + task.done(); |
| +}); |
| + |
| +audit.run(); |
| </script> |