Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/constructor/mediastreamaudiosource.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/constructor/mediastreamaudiosource.html b/third_party/WebKit/LayoutTests/webaudio/constructor/mediastreamaudiosource.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f88828f400af66277d1584e93460995db523b74f |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/webaudio/constructor/mediastreamaudiosource.html |
| @@ -0,0 +1,72 @@ |
| +<!doctype html> |
| +<html> |
| + <head> |
| + <title>Test Constructor: MediaStreamAudioSource</title> |
| + <script src="../../resources/testharness.js"></script> |
| + <script src="../../resources/testharnessreport.js"></script> |
| + <script src="../resources/audio-testing.js"></script> |
| + </head> |
| + |
| + <body> |
| + <script> |
| + var context; |
| + |
| + var audit = Audit.createTaskRunner(); |
| + |
| + audit.defineTask("initialize", function (taskDone) { |
|
hongchan
2016/10/06 17:51:43
I don't think creating a context as a task is nece
Raymond Toy
2016/10/07 15:18:00
We could, but I kind of like it as an initializati
Raymond Toy
2016/10/10 15:38:33
Misunderstood the comment. Simplified as requeste
|
| + Should("context = new AudioContext()", function () { |
| + context = new AudioContext(); |
| + }).notThrow(); |
| + |
| + taskDone(); |
| + }); |
| + |
| + audit.defineTask("invalid constructor", function (taskDone) { |
| + var node; |
| + var success = true; |
| + |
| + success = Should("new MediaStreamAudioSourceNode()", function () { |
| + node = new MediaStreamAudioSourceNode(); |
| + }).throw("TypeError"); |
| + success = Should("new MediaStreamAudioSourceNode(1)", function () { |
| + node = new MediaStreamAudioSourceNode(1) && success; |
| + }).throw("TypeError"); |
| + success = Should("new MediaStreamAudioSourceNode(context, 42)", function () { |
| + node = new MediaStreamAudioSourceNode(context, 42) && success; |
| + }).throw("TypeError"); |
| + |
| + Should("Invalid constructors", success) |
| + .summarize( |
| + "correctly threw errors", |
| + "did not throw errors in all cases"); |
| + |
| + taskDone(); |
| + }); |
| + |
| + audit.defineTask("constructor options", function (taskDone) { |
| + var node; |
| + var success = true; |
| + |
| + var options = { |
| + mediaStream: new MediaStream() |
| + }; |
| + |
| + // We throw because the mediaStream has no tracks. But otherwise the |
| + // constructor worked. |
| + success = Should("node = new MediaStreamAudioSourceNode(, " + JSON.stringify(options) + ")", |
| + function () { |
| + node = new MediaStreamAudioSourceNode(context, options); |
| + }).throw("InvalidStateError") && success; |
| + |
| + Should("new MediaStreamAudioSourceNode(c, options)", success) |
| + .summarize( |
| + "constructed with correct attributes", |
| + "was not constructed correctly"); |
| + |
| + taskDone(); |
| + }); |
| + |
| + audit.runTasks(); |
| + </script> |
| + </body> |
| +</html> |