Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/webaudio/event-constructor.html |
| diff --git a/third_party/WebKit/LayoutTests/webaudio/event-constructor.html b/third_party/WebKit/LayoutTests/webaudio/event-constructor.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b1f42eb9c3ca184e292f87dbc8ce7c36305a38e2 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/webaudio/event-constructor.html |
| @@ -0,0 +1,101 @@ |
| +<!doctype html> |
| +<html> |
| + <head> |
| + <title>Test Event Constructors</title> |
| + <script src="../resources/testharness.js"></script> |
| + <script src="../resources/testharnessreport.js"></script> |
| + <script src="resources/audio-testing.js"></script> |
|
foolip
2016/11/15 19:53:33
It looks like the test would be more compact witho
Raymond Toy
2016/11/15 22:07:42
Yeah, pretty much all newer tests are in this styl
|
| + </head> |
| + |
| + <body> |
| + <script> |
| + var audit = Audit.createTaskRunner(); |
| + |
| + audit.defineTask("offline-constructor", function (taskDone) { |
| + var event; |
|
foolip
2016/11/15 19:53:33
event is never used in this test, so you could jus
Raymond Toy
2016/11/15 22:07:42
Done.
|
| + var success = true; |
| + |
| + success = Should("new OfflineAudioCompletionEvent()", function () { |
| + event = new OfflineAudioCompletionEvent(); |
| + }).throw() && success; |
|
foolip
2016/11/15 19:53:33
I think 'TypeError' here and elsewhere would test
Raymond Toy
2016/11/15 22:07:42
Done.
I meant to do this but forgot. :-(
|
| + |
| + success = Should('new OfflineAudioCompletionEvent("complete")', function () { |
| + event = new OfflineAudioCompletionEvent("complete"); |
| + }).throw() && success; |
| + |
| + success = Should('new OfflineAudioCompletionEvent("complete", {})', function () { |
| + event = new OfflineAudioCompletionEvent("complete", {}); |
| + }).throw() && success; |
| + |
| + success = Should('new OfflineAudioCompletionEvent("complete", {foo:42 })', function () { |
| + event = new OfflineAudioCompletionEvent("complete", {foo: 42}); |
| + }).throw() && success; |
| + |
| + var context = new OfflineAudioContext(1, 100, 48000); |
| + var buffer = new AudioBuffer(context, {length: 42}); |
| + |
| + success = Should('new OfflineAudioCompletionEvent("complete")', |
|
foolip
2016/11/15 19:53:33
This doesn't match what is tested.
Raymond Toy
2016/11/15 22:07:42
Done.
|
| + function () { |
| + event = new OfflineAudioCompletionEvent("complete", {renderedBuffer: buffer}); |
| + }).notThrow() && success; |
| + |
| + Should("OfflineAudioCompletionEvent construction handled", success) |
| + .summarize("correctly", "incorrectly"); |
| + |
| + taskDone(); |
| + }); |
| + |
| + audit.defineTask("offline-event", function (taskDone) { |
| + var event; |
| + var context = new OfflineAudioContext(1, 100, 48000); |
| + var success = true; |
| + success = Should("new OfflineAudioCompletionEvent()", function () { |
| + event = new OfflineAudioCompletionEvent("foo", {renderedBuffer: new |
| + AudioBuffer(context, {length: 10})}); |
| + }).notThrow() && success; |
| + |
| + success = Should("event.renderedBuffer !== undefined", event.renderedBuffer !== undefined) |
|
foolip
2016/11/15 19:53:33
Can you assign the AudioBuffer to a variable and a
Raymond Toy
2016/11/15 22:07:42
Done.
|
| + .beEqualTo(true) && success; |
| + |
| + Should("OfflineAudioCompletionEvent constructed", success) |
| + .summarize("correctly", |
|
foolip
2016/11/15 19:53:33
Accidental newline?
Raymond Toy
2016/11/15 22:07:42
Done.
|
| + "incorrectly"); |
| + |
| + taskDone(); |
| + }); |
| + |
| + audit.defineTask("audio-processing", function (taskDone) { |
|
foolip
2016/11/15 19:53:32
For this, since all three dictionary members are r
Raymond Toy
2016/11/15 22:07:42
Done.
|
| + var event; |
| + var context = new OfflineAudioContext(1, 100, 48000); |
| + |
| + var input = new AudioBuffer(context, {length: 10}); |
| + var output = new AudioBuffer(context, {length: 20}); |
| + |
| + var success = true; |
| + success = Should("new AudioProcessingEvent()", function () { |
| + event = new AudioProcessingEvent("proc", { |
| + inputBuffer: input, |
| + outputBuffer: output, |
| + playbackTime: Math.PI}); |
| + }).notThrow() && success; |
| + |
| + success = Should("event.playbackTime !== undefined", event.playbackTime !== undefined) |
|
foolip
2016/11/15 19:53:33
Here too, assert what the attributes should be, no
Raymond Toy
2016/11/15 22:07:42
Done.
|
| + .beEqualTo(true) && success; |
| + |
| + success = Should("event.inputBuffer !== undefined", event.inputBuffer !== undefined) |
| + .beEqualTo(true) && success; |
| + |
| + success = Should("event.outputBuffer !== undefined", event.outputBuffer !== undefined) |
| + .beEqualTo(true) && success; |
| + |
| + Should("AudioProcessingEvent constructed", success) |
| + .summarize("correctly", |
| + "incorrectly"); |
| + |
| + taskDone(); |
| + }); |
| + |
| + audit.runTasks(); |
| + </script> |
| + </body> |
| +</html> |