| Index: third_party/WebKit/LayoutTests/webaudio/constructor/stereopanner.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/constructor/stereopanner.html b/third_party/WebKit/LayoutTests/webaudio/constructor/stereopanner.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6a31ad9f6636fe7a2b2628de39f5ef994119dfa5
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/constructor/stereopanner.html
|
| @@ -0,0 +1,204 @@
|
| +<!doctype html>
|
| +<html>
|
| + <head>
|
| + <title>Test Constructor: StereoPanner</title>
|
| + <script src="../../resources/testharness.js"></script>
|
| + <script src="../../resources/testharnessreport.js"></script>
|
| + <script src="../resources/audio-testing.js"></script>
|
| + <script src="audionodeoptions.js"></script>
|
| + </head>
|
| +
|
| + <body>
|
| + <script>
|
| + var context;
|
| +
|
| + var audit = Audit.createTaskRunner();
|
| +
|
| + audit.defineTask("initialize", function (taskDone) {
|
| + Should("context = new OfflineAudioContext(...)", function () {
|
| + context = new OfflineAudioContext(1, 1, 48000);
|
| + }).notThrow();
|
| +
|
| + taskDone();
|
| + });
|
| +
|
| + audit.defineTask("invalid constructor", function (taskDone) {
|
| + var node;
|
| + var success = true;
|
| +
|
| + success = Should("new StereoPannerNode()", function () {
|
| + node = new StereoPannerNode();
|
| + }).throw("TypeError");
|
| + success = Should("new StereoPannerNode(1)", function () {
|
| + node = new StereoPannerNode(1) && success;
|
| + }).throw("TypeError");
|
| + success = Should("new StereoPannerNode(context, 42)", function () {
|
| + node = new StereoPannerNode(context, 42) && success;
|
| + }).throw("TypeError");
|
| +
|
| + Should("Invalid constructors", success)
|
| + .summarize(
|
| + "correctly threw errors",
|
| + "did not throw errors in all cases");
|
| +
|
| + taskDone();
|
| + });
|
| +
|
| + audit.defineTask("default constructor", function (taskDone) {
|
| + var node;
|
| + var success = true;
|
| +
|
| + success = Should("node = new StereoPannerNode(context)", function () {
|
| + node = new StereoPannerNode(context);
|
| + }).notThrow();
|
| + success = Should("node instanceof StereoPannerNode", node instanceof StereoPannerNode)
|
| + .beEqualTo(true) && success;
|
| +
|
| + success = Should("node.pan.value", node.pan.value)
|
| + .beEqualTo(0) && success;
|
| +
|
| + Should("new StereoPannerNode(context)", success)
|
| + .summarize(
|
| + "constructed node with correct attributes",
|
| + "did not construct correct node correctly")
|
| +
|
| + taskDone();
|
| + });
|
| +
|
| + audit.defineTask("test AudioNodeOptions", function (taskDone) {
|
| + // Can't use testAudioNodeOptions because the constraints for this node
|
| + // are not supported there.
|
| + var node;
|
| + var success = true;
|
| +
|
| + // Test that we can set the channel count to 1 or 2.
|
| + success = Should("new StereoPannerNode(c, {channelCount: 1})",
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCount: 1
|
| + });
|
| + }).notThrow() && success;
|
| + success = Should("node.channelCount", node.channelCount)
|
| + .beEqualTo(1) && success;
|
| +
|
| + success = Should("new StereoPannerNode(c, {channelCount: 2})",
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCount: 2
|
| + });
|
| + }).notThrow() && success;
|
| + success = Should("node.channelCount", node.channelCount)
|
| + .beEqualTo(2) && success;
|
| +
|
| + // Test that other channel counts throw an error
|
| + success = Should("new StereoPannerNode(c, {channelCount: 0})",
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCount: 0
|
| + });
|
| + }).throw("NotSupportedError") && success;
|
| + success = Should("new StereoPannerNode(c, {channelCount: 3})",
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCount: 3
|
| + });
|
| + }).throw("NotSupportedError") && success;
|
| + success = Should("new StereoPannerNode(c, {channelCount: 99})",
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCount: 99
|
| + });
|
| + }).throw("NotSupportedError") && success;
|
| +
|
| + // Test channelCountMode. A mode of "max" is illegal, but others are ok.
|
| + success = Should('new StereoPannerNode(c, {channelCountMode: "clamped-max"})',
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCountMode: "clamped-max"
|
| + });
|
| + }).notThrow() && success;
|
| + success = Should("node.channelCountMode", node.channelCountMode)
|
| + .beEqualTo("clamped-max") && success;
|
| +
|
| + success = Should('new StereoPannerNode(c, {channelCountMode: "explicit"})',
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCountMode: "explicit"
|
| + });
|
| + }).notThrow() && success;
|
| + success = Should("node.channelCountMode", node.channelCountMode)
|
| + .beEqualTo("explicit") && success;
|
| +
|
| + success = Should('new StereoPannerNode(c, {channelCountMode: "max"})',
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCountMode: "max"
|
| + });
|
| + }).throw("NotSupportedError") && success;
|
| + success = Should('new StereoPannerNode(c, {channelCountMode: "foobar"})',
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelCountMode: "foobar"
|
| + });
|
| + }).throw("NotSupportedError") && success;
|
| +
|
| + // Test channelInterpretation.
|
| + success = Should('new StereoPannerNode(c, {channelInterpretation: "speakers"})',
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelInterpretation: "speakers"
|
| + });
|
| + }).notThrow() && success;
|
| + success = Should("node.channelInterpretation", node.channelInterpretation)
|
| + .beEqualTo("speakers") && success;
|
| + success = Should('new StereoPannerNode(c, {channelInterpretation: "discrete"})',
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelInterpretation: "discrete"
|
| + });
|
| + }).notThrow() && success;
|
| + success = Should("node.channelInterpretation", node.channelInterpretation)
|
| + .beEqualTo("discrete") && success;
|
| + success = Should('new StereoPannerNode(c, {channelInterpretation: "foobar"})',
|
| + function () {
|
| + node = new StereoPannerNode(context, {
|
| + channelInterpretation: "foobar"
|
| + });
|
| + }).throw("NotSupportedError") && success;
|
| +
|
| + Should("AudioNodeOptions for StereoPannerNode", success)
|
| + .summarize(
|
| + "were correctly handled",
|
| + "were not correctly handled");
|
| +
|
| + taskDone();
|
| + });
|
| +
|
| + audit.defineTask("constructor with options", function (taskDone) {
|
| + var node;
|
| + var success = true;
|
| + var options = {
|
| + pan: 0.75,
|
| + };
|
| +
|
| + success = Should("node = new StereoPannerNode(context, <options>)", function () {
|
| + node = new StereoPannerNode(context, options);
|
| + }).notThrow();
|
| + success = Should("node instanceof StereoPannerNode", node instanceof StereoPannerNode)
|
| + .beEqualTo(true) && success;
|
| +
|
| + success = Should("node.pan.value", node.pan.value)
|
| + .beEqualTo(options.pan) && success;
|
| +
|
| + Should("new StereoPannerNode() with options", success)
|
| + .summarize(
|
| + "constructed with correct attributes",
|
| + "was not constructed correctly");
|
| +
|
| + taskDone();
|
| + });
|
| +
|
| + audit.runTasks();
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|