Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/constructor/audiobuffer.html

Issue 2397793002: AudioBuffer numberOfChannels defaults to 1 (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test Constructor: AudioBuffer</title> 4 <title>Test Constructor: AudioBuffer</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audio-testing.js"></script> 7 <script src="../resources/audio-testing.js"></script>
8 </head> 8 </head>
9 9
10 <body> 10 <body>
(...skipping 28 matching lines...) Expand all
39 .summarize( 39 .summarize(
40 "correctly threw errors", 40 "correctly threw errors",
41 "did not throw errors in all cases"); 41 "did not throw errors in all cases");
42 42
43 taskDone(); 43 taskDone();
44 }); 44 });
45 45
46 audit.defineTask("required options", function (taskDone) { 46 audit.defineTask("required options", function (taskDone) {
47 var success = true; 47 var success = true;
48 48
49 success = Should("new AudioBuffer(context, {})", function () { 49 var buffer;
50
51 // The length attribute is required; all others are optional.
52 success = Should("buffer = new AudioBuffer(context, {})", function () {
50 var buffer = new AudioBuffer(context, {}); 53 var buffer = new AudioBuffer(context, {});
51 }).throw("NotFoundError"); 54 }).throw("TypeError");
52 55
53 success = Should("new AudioBuffer(context, {numberOfChannels: 1}", 56 success = Should("buffer = new AudioBuffer(context, {numberOfChannels: 1 }",
54 function () { 57 function () {
55 var buffer = new AudioBuffer(context, { 58 buffer = new AudioBuffer(context, {
56 numberOfChannels: 1 59 numberOfChannels: 1
57 }); 60 });
58 }).throw("NotFoundError") && success; 61 }).throw("TypeError") && success;
59 62
60 // The sampleRate isn't required, but numberOfChannels and length are. 63 // Length is required, but others are optional.
61 success = Should( 64 success = Should(
62 "new AudioBuffer(context, {numberOfChannels: 1, length: 1}", 65 "buffer = new AudioBuffer(context, {length: 21}",
63 function () { 66 function () {
64 var buffer = new AudioBuffer(context, { 67 buffer = new AudioBuffer(context, {
65 numberOfChannels: 1, 68 length: 21
66 length: 1
67 }); 69 });
68 }).notThrow() && success; 70 }).notThrow() && success;
71 // Verify the buffer has the correct values.
72 success = Should("buffer.numberOfChannels", buffer.numberOfChannels)
73 .beEqualTo(1) && success;
74 success = Should("buffer.length", buffer.length)
75 .beEqualTo(21) && success;
76 success = Should("buffer.sampleRate", buffer.sampleRate)
77 .beEqualTo(context.sampleRate) && success;
69 78
70 success = Should( 79 success = Should(
71 "new AudioBuffer(context, {numberOfChannels: 1, length: 1, sampleRate: 48000}", 80 "buffer = new AudioBuffer(context, {numberOfChannels: 1, length: 1, sa mpleRate: 48000}",
72 function () { 81 function () {
73 var buffer = new AudioBuffer(context, { 82 buffer = new AudioBuffer(context, {
74 numberOfChannels: 1, 83 numberOfChannels: 1,
75 length: 1, 84 length: 1,
76 sampleRate: 48000 85 sampleRate: 48000
77 }); 86 });
78 }).notThrow() && success; 87 }).notThrow() && success;
79 88
80 Should("Missing option values handled", success) 89 Should("Missing option values handled", success)
81 .summarize("correctly", "incorrectly"); 90 .summarize("correctly", "incorrectly");
82 91
83 taskDone(); 92 taskDone();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 Should("AudioBuffer constructed", success) 205 Should("AudioBuffer constructed", success)
197 .summarize("correctly", "incorrectly"); 206 .summarize("correctly", "incorrectly");
198 207
199 taskDone(); 208 taskDone();
200 }); 209 });
201 210
202 audit.runTasks(); 211 audit.runTasks();
203 </script> 212 </script>
204 </body> 213 </body>
205 </html> 214 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webaudio/AudioBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698