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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-copy-channel.html

Issue 2593083002: Convert AudioBuffer Audit tests to testharness (Closed)
Patch Set: Rebase Created 3 years, 11 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/LayoutTests/webaudio/AudioBuffer/audiobuffer-copy-channel-expected.txt » ('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 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../resources/audit-util.js"></script> 6 <script src="../resources/audit-util.js"></script>
6 <script src="../resources/audio-testing.js"></script> 7 <script src="../resources/audio-testing.js"></script>
7 <title>Test Basic Functionality of AudioBuffer.copyFromChannel and AudioBuff er.copyToChannel</title> 8 <title>Test Basic Functionality of AudioBuffer.copyFromChannel and AudioBuff er.copyToChannel</title>
8 </head> 9 </head>
9 10
10 <body> 11 <body>
11 <script> 12 <script>
12 description("Test Basic Functionality of copyFromChannel and AudioBuffer.c opyToChannel");
13 13
14 window.jsTestIsAsync = true;
15 14
16 // Define utility routines. 15 // Define utility routines.
17 16
18 // Initialize the AudioBuffer |buffer| with a ramp signal on each channel. The ramp starts at 17 // Initialize the AudioBuffer |buffer| with a ramp signal on each channel. The ramp starts at
19 // channel number + 1. 18 // channel number + 1.
20 function initializeAudioBufferRamp (buffer) { 19 function initializeAudioBufferRamp (buffer) {
21 for (var c = 0; c < buffer.numberOfChannels; ++c) { 20 for (var c = 0; c < buffer.numberOfChannels; ++c) {
22 var d = buffer.getChannelData(c); 21 var d = buffer.getChannelData(c);
23 for (var k = 0; k < d.length; ++k) { 22 for (var k = 0; k < d.length; ++k) {
24 d[k] = k + c + 1; 23 d[k] = k + c + 1;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Initialize to -1. 96 // Initialize to -1.
98 for (var k = 0; k < numberOfChannels; ++k) { 97 for (var k = 0; k < numberOfChannels; ++k) {
99 initialValues[k] = -1; 98 initialValues[k] = -1;
100 } 99 }
101 100
102 done(); 101 done();
103 }); 102 });
104 103
105 // Test that expected exceptions are signaled for copyFrom. 104 // Test that expected exceptions are signaled for copyFrom.
106 audit.defineTask("copyFrom-exceptions", function (done) { 105 audit.defineTask("copyFrom-exceptions", function (done) {
107 shouldBeDefined("AudioBuffer.prototype.copyFromChannel"); 106 Should("AudioBuffer.prototype.copyFromChannel",
107 AudioBuffer.prototype.copyFromChannel)
108 .exist();
108 109
109 Should("buffer = context.createBuffer(" + numberOfChannels + ", " + buff erLength + ", context.sampleRate)", 110 Should("buffer = context.createBuffer(" + numberOfChannels + ", " + buff erLength + ", context.sampleRate)",
110 function () { 111 function () {
111 buffer = context.createBuffer(numberOfChannels, bufferLength, contex t.sampleRate); 112 buffer = context.createBuffer(numberOfChannels, bufferLength, contex t.sampleRate);
112 }).notThrow(); 113 }).notThrow();
113 Should("buffer.copyFromChannel(null, 0)", function () { 114 Should("buffer.copyFromChannel(null, 0)", function () {
114 buffer.copyFromChannel(null, 0); 115 buffer.copyFromChannel(null, 0);
115 }).throw("TypeError"); 116 }).throw("TypeError");
116 Should("buffer.copyFromChannel(context, 0)", function () { 117 Should("buffer.copyFromChannel(context, 0)", function () {
117 buffer.copyFromChannel(context, 0); 118 buffer.copyFromChannel(context, 0);
118 }).throw("TypeError"); 119 }).throw("TypeError");
119 Should("buffer.copyFromChannel(x, -1)", function () { 120 Should("buffer.copyFromChannel(x, -1)", function () {
120 buffer.copyFromChannel(x, -1); 121 buffer.copyFromChannel(x, -1);
121 }).throw("IndexSizeError"); 122 }).throw("IndexSizeError");
122 Should("buffer.copyFromChannel(x, " + numberOfChannels + ")", function ( ) { 123 Should("buffer.copyFromChannel(x, " + numberOfChannels + ")", function ( ) {
123 buffer.copyFromChannel(x, numberOfChannels); 124 buffer.copyFromChannel(x, numberOfChannels);
124 }).throw("IndexSizeError");; 125 }).throw("IndexSizeError");;
125 Should("buffer.copyFromChannel(x, 0, -1)", function () { 126 Should("buffer.copyFromChannel(x, 0, -1)", function () {
126 buffer.copyFromChannel(x, 0, -1); 127 buffer.copyFromChannel(x, 0, -1);
127 }).throw("IndexSizeError"); 128 }).throw("IndexSizeError");
128 Should("buffer.copyFromChannel(x, 0, " + bufferLength + ")", function () { 129 Should("buffer.copyFromChannel(x, 0, " + bufferLength + ")", function () {
129 buffer.copyFromChannel(x, 0, bufferLength); 130 buffer.copyFromChannel(x, 0, bufferLength);
130 }).throw("IndexSizeError"); 131 }).throw("IndexSizeError");
131 132
132 shouldThrow("buffer.copyFromChannel(x, 3)"); 133 Should("buffer.copyFromChannel(x, 3)", function () {
134 buffer.copyFromChannel(x, 3);
135 }).throw("IndexSizeError");
133 136
134 done(); 137 done();
135 }); 138 });
136 139
137 // Test that expected exceptions are signaled for copyTo. 140 // Test that expected exceptions are signaled for copyTo.
138 audit.defineTask("copyTo-exceptions", function (done) { 141 audit.defineTask("copyTo-exceptions", function (done) {
139 shouldBeDefined("AudioBuffer.prototype.copyToChannel"); 142 Should("AudioBuffer.prototype.copyToChannel",
143 AudioBuffer.prototype.copyToChannel)
144 .exist();
140 Should("buffer.copyToChannel(null, 0)", function () { 145 Should("buffer.copyToChannel(null, 0)", function () {
141 buffer.copyToChannel(null, 0); 146 buffer.copyToChannel(null, 0);
142 }).throw("TypeError"); 147 }).throw("TypeError");
143 Should("buffer.copyToChannel(context, 0)", function () { 148 Should("buffer.copyToChannel(context, 0)", function () {
144 buffer.copyToChannel(context, 0); 149 buffer.copyToChannel(context, 0);
145 }).throw("TypeError"); 150 }).throw("TypeError");
146 Should("buffer.copyToChannel(x, -1)", function () { 151 Should("buffer.copyToChannel(x, -1)", function () {
147 buffer.copyToChannel(x, -1); 152 buffer.copyToChannel(x, -1);
148 }).throw("IndexSizeError"); 153 }).throw("IndexSizeError");
149 Should("buffer.copyToChannel(x, " + numberOfChannels + ")", function () { 154 Should("buffer.copyToChannel(x, " + numberOfChannels + ")", function () {
150 buffer.copyToChannel(x, numberOfChannels); 155 buffer.copyToChannel(x, numberOfChannels);
151 }).throw("IndexSizeError"); 156 }).throw("IndexSizeError");
152 Should("buffer.copyToChannel(x, 0, -1)", function () { 157 Should("buffer.copyToChannel(x, 0, -1)", function () {
153 buffer.copyToChannel(x, 0, -1); 158 buffer.copyToChannel(x, 0, -1);
154 }).throw("IndexSizeError"); 159 }).throw("IndexSizeError");
155 Should("buffer.copyToChannel(x, 0, " + bufferLength + ")", function () { 160 Should("buffer.copyToChannel(x, 0, " + bufferLength + ")", function () {
156 buffer.copyToChannel(x, 0, bufferLength); 161 buffer.copyToChannel(x, 0, bufferLength);
157 }).throw("IndexSizeError"); 162 }).throw("IndexSizeError");
158 163
159 shouldThrow("buffer.copyToChannel(x, 3)"); 164 Should("buffer.copyToChannel(x, 3)", function () {
165 buffer.copyToChannel(x, 3);
166 }).throw("IndexSizeError");
160 167
161 done(); 168 done();
162 }); 169 });
163 170
164 // Test copyFromChannel 171 // Test copyFromChannel
165 audit.defineTask("copyFrom-validate", function (done) { 172 audit.defineTask("copyFrom-validate", function (done) {
166 // Initialize the AudioBuffer to a ramp for testing copyFrom. 173 // Initialize the AudioBuffer to a ramp for testing copyFrom.
167 initializeAudioBufferRamp(buffer); 174 initializeAudioBufferRamp(buffer);
168 175
169 // Test copyFrom operation with a short destination array, filling the d estination completely. 176 // Test copyFrom operation with a short destination array, filling the d estination completely.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 buffer.copyToChannel(src10, c, startInChannel); 244 buffer.copyToChannel(src10, c, startInChannel);
238 245
239 shouldBeRamp("buffer.copyToChannel(src10, " + c + ", " + startInChanne l + ")", 246 shouldBeRamp("buffer.copyToChannel(src10, " + c + ", " + startInChanne l + ")",
240 buffer.getChannelData(c), 1, src10.length, startInChannel); 247 buffer.getChannelData(c), 1, src10.length, startInChannel);
241 } 248 }
242 249
243 done(); 250 done();
244 }); 251 });
245 252
246 audit.defineTask("finish", function (done) { 253 audit.defineTask("finish", function (done) {
247 finishJSTest();
248 done(); 254 done();
249 }); 255 });
250 256
251 audit.runTasks( 257 audit.runTasks(
252 "initialize", 258 "initialize",
253 "copyFrom-exceptions", 259 "copyFrom-exceptions",
254 "copyTo-exceptions", 260 "copyTo-exceptions",
255 "copyFrom-validate", 261 "copyFrom-validate",
256 "copyTo-validate", 262 "copyTo-validate",
257 "finish" 263 "finish"
258 ); 264 );
259 265
260 successfullyParsed = true; 266 successfullyParsed = true;
261 267
262 </script> 268 </script>
263 269
264 </body> 270 </body>
265 </html> 271 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/AudioBuffer/audiobuffer-copy-channel-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698