| Index: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html
|
| index f1231034e7ed0f1108fb9b8fb1f982754b75bbd7..2fecbc4d58cf4689e8757ecd12d05df2e29e8f92 100644
|
| --- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html
|
| @@ -2,74 +2,66 @@
|
|
|
| <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 AudioBufferSourceNode validates AudioBuffer in .buffer attribute setter.");
|
| -
|
| -var context;
|
| -var source;
|
| +let audit = Audit.createTaskRunner();
|
| +let context;
|
| +let source;
|
|
|
| -function runTest() {
|
| - if (window.testRunner) {
|
| - testRunner.dumpAsText();
|
| - testRunner.waitUntilDone();
|
| - }
|
| -
|
| - window.jsTestIsAsync = true;
|
| -
|
| +audit.define("validate .buffer",
|
| + function(task, should) {
|
| + task.describe(
|
| + "AudioBufferSourceNode validates AudioBuffer in .buffer attribute setter"
|
| + );
|
| context = new AudioContext();
|
| source = context.createBufferSource();
|
|
|
| // Make sure we can't set to something which isn't an AudioBuffer.
|
| - shouldThrow("source.buffer = 57", '"TypeError: Failed to set the \'buffer\' property on \'AudioBufferSourceNode\': The provided value is not of type \'AudioBuffer\'."');
|
| - shouldThrow("source.buffer = null", '"TypeError: Failed to set the \'buffer\' property on \'AudioBufferSourceNode\': The provided value is not of type \'AudioBuffer\'."');
|
| + should(function() {
|
| + source.buffer = 57;
|
| + }, "source.buffer = 57")
|
| + .throw("TypeError");
|
| +
|
| + should(function() {
|
| + source.buffer = null;
|
| + }, "source.buffer = null")
|
| + .throw("TypeError");
|
|
|
| // Check that mono buffer can be set.
|
| - try {
|
| - var monoBuffer = context.createBuffer(1, 1024, context.sampleRate);
|
| - var testSource = context.createBufferSource();
|
| + should(function() {
|
| + let monoBuffer = context.createBuffer(1, 1024, context.sampleRate);
|
| + let testSource = context.createBufferSource();
|
| testSource.buffer = monoBuffer;
|
| - testPassed("Mono buffer can be set.");
|
| - } catch(e) {
|
| - testFailed("Mono buffer can not be set.");
|
| - }
|
| + }, "Setting source with mono buffer")
|
| + .notThrow();
|
|
|
| // Check that stereo buffer can be set.
|
| - try {
|
| - var stereoBuffer = context.createBuffer(2, 1024, context.sampleRate);
|
| - var testSource = context.createBufferSource();
|
| + should(function() {
|
| + let stereoBuffer = context.createBuffer(2, 1024, context.sampleRate);
|
| + let testSource = context.createBufferSource();
|
| testSource.buffer = stereoBuffer;
|
| - testPassed("Stereo buffer can be set.");
|
| - } catch(e) {
|
| - testFailed("Stereo buffer can not be set.");
|
| - }
|
| -
|
| + }, "Setting source with stereo buffer")
|
| + .notThrow();
|
| +
|
| // Check buffers with more than two channels.
|
| - for (var i = 3; i < 10; ++i) {
|
| - try {
|
| - var buffer = context.createBuffer(i, 1024, context.sampleRate);
|
| - var testSource = context.createBufferSource();
|
| - testSource.buffer = buffer;
|
| - var message = i + " channels buffer can be set.";
|
| - testPassed(message);
|
| - } catch(e) {
|
| - var message = i + " channels buffer can not be set.";
|
| - testFailed(message);
|
| - }
|
| + for (let i = 3; i < 10; ++i) {
|
| + should(function() {
|
| + let buffer = context.createBuffer(i, 1024, context.sampleRate);
|
| + let testSource = context.createBufferSource();
|
| + testSource.buffer = buffer;
|
| + }, "Setting source with " + i + " channels buffer")
|
| + .notThrow();
|
| }
|
| -
|
| - finishJSTest();
|
| -}
|
| + task.done();
|
| + });
|
|
|
| -runTest();
|
| +audit.run();
|
|
|
| </script>
|
|
|
|
|