Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html b/third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html |
| index 2b28607fa70e9cad6d03cfe724da65d0a598a45a..48f0c8773e488f6e1b406d25bd24d254fc4ab4cd 100644 |
| --- a/third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html |
| +++ b/third_party/WebKit/LayoutTests/webaudio/Panner/panner-automation-basic.html |
| @@ -4,7 +4,7 @@ |
| <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> |
| <script src="../resources/panner-formulas.js"></script> |
| <title>Test Basic PannerNode with Automation Position Properties</title> |
| </head> |
| @@ -35,23 +35,23 @@ |
| var config = testConfig[k]; |
| // Function to create the test to define the test. |
| var tester = function (config, channelCount) { |
| - return function (done) { |
| + return (task, should) => { |
| var nodes = createGraph(channelCount); |
| var {context, source, panner} = nodes; |
| var message = channelCount == 1 ? "Mono" : "Stereo"; |
| message += " panner." + config.setter; |
| - testPositionSetter({ |
| + testPositionSetter(should, { |
| nodes: nodes, |
| pannerSetter: panner[config.setter], |
| message: message |
| - }).then(done); |
| + }).then(() => task.done()); |
| } |
| } |
| - audit.defineTask("Stereo panner." + config.setter, tester(config, 2)); |
| - audit.defineTask("Mono panner." + config.setter, tester(config, 1)); |
| + audit.define("Stereo panner." + config.setter, tester(config, 2)); |
| + audit.define("Mono panner." + config.setter, tester(config, 1)); |
| } |
| // Create tests for the listener position setters. Both mono and steroe sources are tested. |
| @@ -59,7 +59,7 @@ |
| var config = testConfig[k]; |
| // Function to create the test to define the test. |
| var tester = function (config, channelCount) { |
| - return function (done) { |
| + return (task, should) => { |
| var nodes = createGraph(channelCount); |
| var {context, source, panner} = nodes; |
| @@ -69,20 +69,20 @@ |
| // Some relatively arbitrary (non-default) position for the source location. |
| panner.setPosition(1,0,1); |
| - testPositionSetter({ |
| + testPositionSetter(should, { |
| nodes: nodes, |
| pannerSetter: context.listener[config.setter], |
| message: message |
| - }).then(done); |
| + }).then(() => task.done()); |
| } |
| } |
| - audit.defineTask("Stereo listener." + config.setter, tester(config, 2)); |
| - audit.defineTask("Mono listener." + config.setter, tester(config, 1)); |
| + audit.define("Stereo listener." + config.setter, tester(config, 2)); |
| + audit.define("Mono listener." + config.setter, tester(config, 1)); |
| } |
| // Test setPosition method. |
| - audit.defineTask("setPosition", function (done) { |
| + audit.define("setPosition", (task, should) => { |
| var {context, panner, source} = createGraph(2); |
| // Initialize source position (values don't really matter). |
| @@ -95,11 +95,15 @@ |
| }).then(context.resume.bind(context)); |
| context.startRendering().then(function (resultBuffer) { |
| - verifyPannerOutputChanged(resultBuffer, {message: "setPosition", suspendFrame: suspendFrame}); |
| - }).then(done); |
| + verifyPannerOutputChanged(should, resultBuffer, { |
| + message: "setPosition", |
| + suspendFrame: suspendFrame |
| + }); |
| + }) |
| + .then(() => task.done()); |
| }); |
| - audit.defineTask("orientation setter", function (done) { |
| + audit.define("orientation setter", (task, should) => { |
| var {context, panner, source} = createGraph(2); |
| // For orientation to matter, we need to make the source directional, and also move away |
| @@ -119,11 +123,15 @@ |
| }).then(context.resume.bind(context)); |
| context.startRendering().then(function (resultBuffer) { |
| - verifyPannerOutputChanged(resultBuffer, {message: "panner.orientation{XYZ}", suspendFrame: suspendFrame}); |
| - }).then(done); |
| + verifyPannerOutputChanged(should, resultBuffer, { |
|
hongchan
2017/05/02 16:46:31
Is this done by clang-format? Why is the indentati
Raymond Toy
2017/05/02 19:04:29
Reindented everything with clang-format.
|
| + message: "panner.orientation{XYZ}", |
| + suspendFrame: suspendFrame |
| + }); |
| + }) |
| + .then(() => task.done()); |
| }); |
| - audit.defineTask("forward setter", function (done) { |
| + audit.define("forward setter", (task, should) => { |
| var {context, panner, source} = createGraph(2); |
| // For orientation to matter, we need to make the source directional, and also move away |
| @@ -143,11 +151,15 @@ |
| }).then(context.resume.bind(context)); |
| context.startRendering().then(function (resultBuffer) { |
| - verifyPannerOutputChanged(resultBuffer, {message: "listener.forward{XYZ}", suspendFrame: suspendFrame}); |
| - }).then(done); |
| + verifyPannerOutputChanged(should, resultBuffer, { |
| + message: "listener.forward{XYZ}", |
| + suspendFrame: suspendFrame |
| + }); |
| + }) |
| + .then(() => task.done()); |
| }); |
| - audit.defineTask("up setter", function (done) { |
| + audit.define("up setter", (task, should) => { |
| var {context, panner, source} = createGraph(2); |
| // For orientation to matter, we need to make the source directional, and also move away |
| @@ -168,11 +180,15 @@ |
| }).then(context.resume.bind(context)); |
| context.startRendering().then(function (resultBuffer) { |
| - verifyPannerOutputChanged(resultBuffer, {message: "listener.up{XYZ}", suspendFrame: suspendFrame}); |
| - }).then(done); |
| + verifyPannerOutputChanged(should, resultBuffer, { |
| + message: "listener.up{XYZ}", |
| + suspendFrame: suspendFrame |
| + }); |
| + }) |
| + .then(() => task.done()); |
| }); |
| - audit.runTasks(); |
| + audit.run(); |
| function createGraph(channelCount) { |
| var context = new OfflineAudioContext(2, renderFrames, sampleRate); |
| @@ -192,7 +208,7 @@ |
| }; |
| } |
| - function testPositionSetter(options) { |
| + function testPositionSetter(should, options) { |
| var {nodes, pannerSetter, message} = options; |
| var {context, source, panner} = nodes; |
| @@ -207,11 +223,14 @@ |
| }).then(context.resume.bind(context)); |
| return context.startRendering().then(function (resultBuffer) { |
| - verifyPannerOutputChanged(resultBuffer, {message: message, suspendFrame: suspendFrame}); |
| + verifyPannerOutputChanged(should, resultBuffer, { |
| + message: message, |
| + suspendFrame: suspendFrame |
| + }); |
| }); |
| } |
| - function verifyPannerOutputChanged(resultBuffer, options) { |
| + function verifyPannerOutputChanged(should, resultBuffer, options) { |
| var {message, suspendFrame} = options; |
| // Verify that the first part of output is constant. (Doesn't matter what.) |
| var success = true; |
| @@ -219,27 +238,28 @@ |
| var data1 = resultBuffer.getChannelData(1); |
| var middle = "[0, " + suspendFrame + ") "; |
| - success = Should(message + ".value frame " + middle + "channel 0", data0.slice(0, suspendFrame)) |
| - .beConstantValueOf(data0[0]) && success; |
| - success = Should(message + ".value frame " + middle + "channel 1", data1.slice(0, suspendFrame)) |
| - .beConstantValueOf(data1[0]) && success; |
| + should(data0.slice(0, suspendFrame), |
|
hongchan
2017/05/02 16:46:30
Please revise the indentation of this area.
|
| + message + ".value frame " + middle + "channel 0") |
| + .beConstantValueOf(data0[0]); |
| + should(data1.slice(0, suspendFrame), |
| + message + ".value frame " + middle + "channel 1") |
| + .beConstantValueOf(data1[0]); |
| // The rest after suspendTime should be constant and different from the first part. |
| middle = "[" + suspendFrame + ", " + renderFrames + ") "; |
| - success = Should(message + ".value frame " + middle + "channel 0", |
| - data0.slice(suspendFrame)) |
| - .beConstantValueOf(data0[suspendFrame]) && success; |
| - success = Should(message + ".value frame " + middle + "channel 1", |
| - data1.slice(suspendFrame)) |
| - .beConstantValueOf(data1[suspendFrame]) && success; |
| - success = Should(message + ": Output at frame " + suspendFrame + " channel 0", data0[suspendFrame]) |
| - .notBeEqualTo(data0[0]) && success; |
| - success = Should(message + ": Output at frame " + suspendFrame + " channel 1", data1[suspendFrame]) |
| - .notBeEqualTo(data1[0]) && success; |
| - |
| - var prefix = "Directly setting " + message + ".value"; |
| - Should(prefix, success) |
| - .summarize("worked", "failed"); |
| + should(data0.slice(suspendFrame), |
|
hongchan
2017/05/02 16:46:31
Ditto.
|
| + message + ".value frame " + middle + "channel 0") |
| + .beConstantValueOf(data0[suspendFrame]); |
| + should(data1.slice(suspendFrame), |
| + message + ".value frame " + middle + "channel 1") |
| + .beConstantValueOf(data1[suspendFrame]); |
| + should(data0[suspendFrame], |
| + message + ": Output at frame " + suspendFrame + " channel 0") |
| + .notBeEqualTo(data0[0]); |
| + should(data1[suspendFrame], |
| + message + ": Output at frame " + suspendFrame + " channel 1") |
| + .notBeEqualTo(data1[0]); |
| + |
| } |
| </script> |
| </body> |