| Index: third_party/WebKit/LayoutTests/webaudio/panner-distance-clamping.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/panner-distance-clamping.html b/third_party/WebKit/LayoutTests/webaudio/panner-distance-clamping.html
|
| index c3f21923e3d55d6206f9a2a30a99a647dbe9fef5..6f456936180eb94f4e45e65cbba3d959568136d2 100644
|
| --- a/third_party/WebKit/LayoutTests/webaudio/panner-distance-clamping.html
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/panner-distance-clamping.html
|
| @@ -15,6 +15,64 @@
|
|
|
| var audit = Audit.createTaskRunner();
|
|
|
| + audit.defineTask("ref-distance-error", function (taskDone) {
|
| + testDistanceLimits({name: "refDistance"});
|
| + taskDone();
|
| + });
|
| +
|
| + audit.defineTask("max-distance-error", function (taskDone) {
|
| + testDistanceLimits({name: "maxDistance"});
|
| + taskDone();
|
| + });
|
| +
|
| + function testDistanceLimits(options) {
|
| + // Verify that exceptions are thrown for invalid values of refDistance.
|
| + var context = new OfflineAudioContext(1, renderFrames, sampleRate);
|
| +
|
| + var attrName = options.name;
|
| + var prefix = "new PannerNode(c, {" + attrName + ": ";
|
| +
|
| + success = Should(prefix + "-1})", function () {
|
| + var nodeOptions = {};
|
| + nodeOptions[attrName] = -1;
|
| + new PannerNode(context, nodeOptions);
|
| + }).throw("RangeError");
|
| +
|
| + success = Should(prefix + "0})", function () {
|
| + var nodeOptions = {};
|
| + nodeOptions[attrName] = 0;
|
| + new PannerNode(context, nodeOptions);
|
| + }).throw("RangeError") && success;
|
| +
|
| + // The smallest representable positive single float.
|
| + var leastPositiveDoubleFloat = 4.9406564584124654e-324;
|
| +
|
| + success = Should(prefix + leastPositiveDoubleFloat + "})",
|
| + function () {
|
| + var nodeOptions = {};
|
| + nodeOptions[attrName] = leastPositiveDoubleFloat;
|
| + new PannerNode(context, nodeOptions);
|
| + }).notThrow() && success;
|
| +
|
| + prefix = "panner." + attrName + " = ";
|
| + panner = new PannerNode(context);
|
| + success = Should(prefix + "-1", function () {
|
| + panner[attrName] = -1;
|
| + }).throw("RangeError") && success;
|
| +
|
| + success = Should(prefix + "0", function () {
|
| + panner[attrName] = 0;
|
| + }).throw("RangeError") && success;
|
| +
|
| + success = Should(prefix + leastPositiveDoubleFloat, function () {
|
| + panner[attrName] = leastPositiveDoubleFloat;
|
| + }).notThrow() && success;
|
| +
|
| + Should("Invalid " + attrName + " values handled", success)
|
| + .summarize("correctly", "incorrectly");
|
| +
|
| + }
|
| +
|
| audit.defineTask("min-distance", function (taskDone) {
|
| // Test clamping of panner distance to refDistance for all of the
|
| // distance models. The actual distance is arbitrary as long as it's
|
|
|