| Index: third_party/WebKit/LayoutTests/webaudio/constructor/audiobuffer.html
|
| diff --git a/third_party/WebKit/LayoutTests/webaudio/constructor/audiobuffer.html b/third_party/WebKit/LayoutTests/webaudio/constructor/audiobuffer.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b51cba5449efa1e6b14ef33c5fd42aa1f4365629
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/webaudio/constructor/audiobuffer.html
|
| @@ -0,0 +1,82 @@
|
| +<!doctype html>
|
| +<html>
|
| + <head>
|
| + <title>Test Constructor: AudioBuffer</title>
|
| + <script src="../../resources/testharness.js"></script>
|
| + <script src="../../resources/testharnessreport.js"></script>
|
| + <script src="../resources/compatibility.js"></script>
|
| + </head>
|
| +
|
| + <body>
|
| + <script>
|
| + var context;
|
| +
|
| + test(function () {
|
| + context = new OfflineAudioContext(1, 1, 48000);
|
| + assert_true(context instanceof OfflineAudioContext,
|
| + "context created successfully");
|
| + }, "Construct offline context");
|
| +
|
| + test(function () {
|
| + assert_throws(null,
|
| + function () {
|
| + var node = new AudioBuffer(context);
|
| + }, "Two arguments required");
|
| +
|
| + assert_throws(null,
|
| + function () {
|
| + return new AudioBuffer(42, {})
|
| + }, "First argument must be a context");
|
| +
|
| + assert_throws(null,
|
| + function () {
|
| + return new AudioBuffer(context, 42);
|
| + }, "Second arg must be an object");
|
| + }, "Test argument count and type");
|
| +
|
| + test(function () {
|
| + assert_throws("NotFoundError",
|
| + function () {
|
| + var buffer = new AudioBuffer(context, {});
|
| + }, "Empty options");
|
| +
|
| + assert_throws("NotFoundError",
|
| + function () {
|
| + var buffer = new AudioBuffer(context, {
|
| + numberOfChannels: 1
|
| + });
|
| + }, "Include numberOfChannels");
|
| +
|
| + assert_throws("NotFoundError",
|
| + function () {
|
| + var buffer = new AudioBuffer(context, {
|
| + length: 10
|
| + });
|
| + }, "Include numberOfChannels");
|
| +
|
| + }, "Construct AudioBuffer without required values, throwing errors");
|
| +
|
| + test(function () {
|
| + var options = {
|
| + numberOfChannels: 3,
|
| + length: 42,
|
| + sampleRate: 16000
|
| + };
|
| + var buffer = new AudioBuffer(context, options);
|
| +
|
| + assert_equals(buffer.numberOfChannels, options.numberOfChannels);
|
| + assert_equals(buffer.length, options.length);
|
| + assert_equals(buffer.sampleRate, options.sampleRate);
|
| +
|
| + buffer = new AudioBuffer(context, {
|
| + numberOfChannels: 3,
|
| + length: 42
|
| + });
|
| +
|
| + assert_equals(buffer.sampleRate, context.sampleRate);
|
| +
|
| + }, "Construct valid AudioBuffer and check values");
|
| +
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|