| Index: third_party/WebKit/LayoutTests/webaudio/constructor/convolver.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/constructor/convolver.html b/third_party/WebKit/LayoutTests/webaudio/constructor/convolver.html
|
| index 410869d2afc9569ed51e4e105050407e46288c87..d4c7377546db7816e3b6fa2744898d978db5ade3 100644
|
| --- a/third_party/WebKit/LayoutTests/webaudio/constructor/convolver.html
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/constructor/convolver.html
|
| @@ -5,8 +5,8 @@
|
| <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="audionodeoptions.js"></script>
|
| + <script src="../resources/audit.js"></script>
|
| + <script src="new-audionodeoptions.js"></script>
|
| </head>
|
|
|
| <body>
|
| @@ -15,151 +15,110 @@
|
|
|
| var audit = Audit.createTaskRunner();
|
|
|
| - audit.defineTask("initialize", function (taskDone) {
|
| - Should("context = new OfflineAudioContext(...)", function () {
|
| - context = new OfflineAudioContext(1, 1, 48000);
|
| - }).notThrow();
|
| - taskDone();
|
| + audit.define('initialize', (task, should) => {
|
| + context = initializeContext(should);
|
| + task.done();
|
| });
|
|
|
| - audit.defineTask("invalid constructor", function (taskDone) {
|
| - var node;
|
| - var success = true;
|
| -
|
| - succes = Should("new ConvolverNode()", function () {
|
| - node = new ConvolverNode();
|
| - }).throw("TypeError");
|
| - success = Should("new ConvolverNode(1)", function () {
|
| - node = new ConvolverNode(1);
|
| - }).throw("TypeError") && success;
|
| - success = Should("new ConvolverNode(context, 42)", function () {
|
| - node = new ConvolverNode(context, 42);
|
| - }).throw("TypeError") && success;
|
| -
|
| - Should("Invalid constructors", success)
|
| - .summarize(
|
| - "correctly threw errors",
|
| - "did not throw errors in all cases");
|
| - taskDone();
|
| + audit.define('invalid constructor', (task, should) => {
|
| + testInvalidConstructor(should, 'ConvolverNode', context);
|
| + task.done();
|
| });
|
|
|
| - audit.defineTask("default constructor", function (taskDone) {
|
| - var node;
|
| - var success = true;
|
| -
|
| - success = Should("node0 = new ConvolverNode(context)", function () {
|
| - node = new ConvolverNode(context);
|
| - }).notThrow();
|
| - success = Should("node0 instanceOf ConvolverNode", node instanceof ConvolverNode)
|
| - .beEqualTo(true) && success;
|
| - success = Should("node0.normalize", node.normalize)
|
| - .beEqualTo(true) && success;
|
| -
|
| - success = Should("node0.channelCount", node.channelCount)
|
| - .beEqualTo(2) && success;
|
| - success = Should("node0.channelCountMode", node.channelCountMode)
|
| - .beEqualTo("clamped-max") && success;
|
| - success = Should("node0.channelInterpretation", node.channelInterpretation)
|
| - .beEqualTo("speakers") && success;
|
| -
|
| - success = Should("new ConvolverNode(context)", success)
|
| - .summarize(
|
| - "constructed node with correct attributes",
|
| - "did not construct correct node correctly")
|
| -
|
| - taskDone();
|
| + audit.define('default constructor', (task, should) => {
|
| + let prefix = 'node0';
|
| + let node = testDefaultConstructor(should, 'ConvolverNode', context, {
|
| + prefix: prefix,
|
| + numberOfInputs: 1,
|
| + numberOfOutputs: 1,
|
| + channelCount: 2,
|
| + channelCountMode: 'clamped-max',
|
| + channelInterpretation: 'speakers'
|
| + });
|
| +
|
| + testDefaultAttributes(
|
| + should, node, prefix,
|
| + [{name: 'normalize', value: true}, {name: 'buffer', value: null}]);
|
| +
|
| + task.done();
|
| });
|
|
|
| - audit.defineTask("test AudioNodeOptions", function (taskDone) {
|
| - testAudioNodeOptions(context, "ConvolverNode", {
|
| - expectedChannelCount: {
|
| - value: 2,
|
| + audit.define('test AudioNodeOptions', (task, should) => {
|
| + testAudioNodeOptions(should, context, 'ConvolverNode', {
|
| + channelCount:
|
| + {value: 2, isFixed: true, errorType: 'NotSupportedError'},
|
| + channelCountMode: {
|
| + value: 'clamped-max',
|
| isFixed: true,
|
| - errorType: "NotSupportedError"
|
| - },
|
| - expectedChannelCountMode: {
|
| - value: "clamped-max",
|
| - isFixed: true,
|
| - errorType: "NotSupportedError"
|
| + errorType: 'NotSupportedError'
|
| },
|
| });
|
| - taskDone();
|
| + task.done();
|
| });
|
|
|
| - audit.defineTask("nullable buffer", function (taskDone) {
|
| + audit.define('nullable buffer', (task, should) => {
|
| var node;
|
| - var success = true;
|
| + var options = {buffer: null};
|
|
|
| - var options = { buffer: null };
|
| -
|
| - success = Should("node1 = new ConvolverNode(c, " + JSON.stringify(options), function () {
|
| - node = new ConvolverNode(context, options);
|
| - }).notThrow();
|
| + should(
|
| + () => {
|
| + node = new ConvolverNode(context, options);
|
| + },
|
| + 'node1 = new ConvolverNode(c, ' + JSON.stringify(options))
|
| + .notThrow();
|
|
|
| - success = Should("node1.buffer", node.buffer)
|
| - .beEqualTo(null);
|
| + should(node.buffer, 'node1.buffer').beEqualTo(null);
|
|
|
| - Should("Null buffer in constructor handled", success)
|
| - .summarize(
|
| - "correctly",
|
| - "incorrectly");
|
| -
|
| - taskDone();
|
| + task.done();
|
| });
|
|
|
| - audit.defineTask("construct with options", function (taskDone) {
|
| + audit.define('construct with options', (task, should) => {
|
| var buf = context.createBuffer(1, 1, context.sampleRate);
|
| - var options = {
|
| - buffer: buf,
|
| - disableNormalization: false
|
| - };
|
| + var options = {buffer: buf, disableNormalization: false};
|
|
|
| - var message = "node = new ConvolverNode(c, " + JSON.stringify(options) + ")";
|
| + var message =
|
| + 'node = new ConvolverNode(c, ' + JSON.stringify(options) + ')';
|
|
|
| var node;
|
| - success = Should(message, function () {
|
| + should(() => {
|
| node = new ConvolverNode(context, options);
|
| - }).notThrow();
|
| + }, message).notThrow();
|
|
|
| - success = Should("node1 instanceOf ConvolverNode", node instanceof ConvolverNode)
|
| - .beEqualTo(true) && success;
|
| - success = Should("node1.buffer === <buf>", node.buffer ===
|
| - options.buffer)
|
| - .beEqualTo(true) && success;
|
| - success = Should("node1.normalize", node.normalize)
|
| - .beEqualTo(!options.disableNormalization) && success;
|
| + should(node instanceof ConvolverNode, 'node1 instanceOf ConvolverNode')
|
| + .beEqualTo(true);
|
| + should(node.buffer === options.buffer, 'node1.buffer === <buf>')
|
| + .beEqualTo(true);
|
| + should(node.normalize, 'node1.normalize')
|
| + .beEqualTo(!options.disableNormalization);
|
|
|
| options.buffer = null;
|
| options.disableNormalization = true;
|
|
|
| - message = "node2 = new ConvolverNode(, " + JSON.stringify(options) + ")";
|
| + message =
|
| + 'node2 = new ConvolverNode(, ' + JSON.stringify(options) + ')';
|
|
|
| - success = Should(message, function () {
|
| + should(() => {
|
| node = new ConvolverNode(context, options);
|
| - }).notThrow() && success;
|
| - success = Should("node2.buffer", node.buffer).beEqualTo(null) && success;
|
| - success = Should("node2.normalize", node.normalize)
|
| - .beEqualTo(!options.disableNormalization) && success;
|
| + }, message).notThrow();
|
| + should(node.buffer, 'node2.buffer').beEqualTo(null);
|
| + should(node.normalize, 'node2.normalize')
|
| + .beEqualTo(!options.disableNormalization);
|
|
|
| options.disableNormalization = false;
|
| - message = "node3 = new ConvolverNode(context, " + JSON.stringify(options) + ")";
|
| + message = 'node3 = new ConvolverNode(context, ' +
|
| + JSON.stringify(options) + ')';
|
|
|
| - success = Should(message, function () {
|
| + should(() => {
|
| node = new ConvolverNode(context, options);
|
| - }).notThrow() && success;
|
| - success = Should("node3.buffer", node.buffer).beEqualTo(null) && success;
|
| - success = Should("node3.normalize", node.normalize)
|
| - .beEqualTo(!options.disableNormalization) && success;
|
| -
|
| - Should("new ConvolverNode() with options", success)
|
| - .summarize(
|
| - "constructed with correct attributes",
|
| - "was not constructed correctly");
|
| -
|
| - taskDone();
|
| + }, message).notThrow();
|
| + should(node.buffer, 'node3.buffer').beEqualTo(null);
|
| + should(node.normalize, 'node3.normalize')
|
| + .beEqualTo(!options.disableNormalization);
|
| +
|
| + task.done();
|
| });
|
|
|
| - audit.runTasks();
|
| + audit.run();
|
| </script>
|
| </body>
|
| </html>
|
|
|