Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Constructor: PeriodicWave</title> | 4 <title>Test Constructor: PeriodicWave</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/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audit.js"></script> |
| 9 <script src="audionodeoptions.js"></script> | 9 <script src="new-audionodeoptions.js"></script> |
| 10 </head> | 10 </head> |
| 11 | 11 |
| 12 <body> | 12 <body> |
| 13 <script> | 13 <script> |
| 14 var context; | 14 var context; |
| 15 | 15 |
| 16 var audit = Audit.createTaskRunner(); | 16 var audit = Audit.createTaskRunner(); |
| 17 | 17 |
| 18 audit.defineTask("initialize", function (taskDone) { | 18 audit.define('initialize', (task, should) => { |
| 19 Should("context = new OfflineAudioContext(...)", function () { | 19 context = initializeContext(should); |
| 20 context = new OfflineAudioContext(1, 1, 48000); | 20 task.done(); |
| 21 }).notThrow(); | 21 }); |
| 22 | 22 |
| 23 taskDone(); | 23 audit.define('invalid constructor', (task, should) => { |
| 24 }); | 24 testInvalidConstructor(should, 'PeriodicWave', context); |
| 25 | 25 task.done(); |
| 26 audit.defineTask("invalid constructor", function (taskDone) { | 26 }); |
| 27 var node; | 27 |
| 28 var success = true; | 28 audit.define('default constructor', (task, should) => { |
| 29 | 29 should(() => { |
| 30 success = Should("new PeriodicWave()", function () { | |
| 31 node = new PeriodicWave(); | |
| 32 }).throw("TypeError"); | |
| 33 success = Should("new PeriodicWave(1)", function () { | |
| 34 node = new PeriodicWave(1) && success; | |
| 35 }).throw("TypeError"); | |
| 36 success = Should("new PeriodicWave(context, 42)", function () { | |
| 37 node = new PeriodicWave(context, 42) && success; | |
| 38 }).throw("TypeError"); | |
| 39 | |
| 40 Should("Invalid constructors", success) | |
| 41 .summarize( | |
| 42 "correctly threw errors", | |
| 43 "did not throw errors in all cases"); | |
| 44 | |
| 45 taskDone(); | |
| 46 }); | |
| 47 | |
| 48 audit.defineTask("default constructor", function (taskDone) { | |
| 49 var node; | |
| 50 var success = true; | |
| 51 | |
| 52 success = Should("node = new PeriodicWave(context)", function () { | |
| 53 node = new PeriodicWave(context); | 30 node = new PeriodicWave(context); |
| 54 }).notThrow(); | 31 }, 'node = new PeriodicWave(context)').notThrow(); |
| 55 | 32 |
| 56 taskDone(); | 33 task.done(); |
| 57 }); | 34 }); |
| 58 | 35 |
| 59 audit.defineTask("constructor with options", function (taskDone) { | 36 audit.define('constructor with options', (task, should) => { |
| 60 var node1; | 37 var node1; |
| 61 var success = true; | 38 var options = {real: [1, 1]}; |
| 62 | 39 should( |
| 63 var options = { | 40 () => { |
| 64 real: [1, 1] | 41 node1 = new PeriodicWave(context, options); |
| 65 }; | 42 }, |
| 66 success = Should("node = new PeriodicWave(context, " + JSON.stringify(op tions) + ")", | 43 'node = new PeriodicWave(context, ' + JSON.stringify(options) + ')') |
| 67 function () { | 44 .notThrow(); |
| 68 node1 = new PeriodicWave(context, options); | 45 should(node1 instanceof PeriodicWave, 'node1 instanceof PeriodicWave') |
| 69 }).notThrow(); | 46 .beEqualTo(true); |
| 70 success = Should("node1 instanceof PeriodicWave", node1 instanceof Perio dicWave) | |
| 71 .beEqualTo(true) && success; | |
| 72 | 47 |
| 73 var node2; | 48 var node2; |
| 74 options = { | 49 options = {imag: [1, 1]}; |
| 75 imag: [1, 1] | 50 should( |
| 76 }; | 51 () => { |
| 77 success = Should("node2 = new PeriodicWave(context, " + JSON.stringify(o ptions) + ")", | 52 node2 = new PeriodicWave(context, options); |
| 78 function () { | 53 }, |
| 79 node2 = new PeriodicWave(context, options); | 54 'node2 = new PeriodicWave(context, ' + JSON.stringify(options) + |
| 80 }).notThrow(); | 55 ')') |
| 81 success = Should("node2 instanceof PeriodicWave", node2 instanceof Perio dicWave) | 56 .notThrow(); |
| 82 .beEqualTo(true) && success; | 57 should(node2 instanceof PeriodicWave, 'node2 instanceof PeriodicWave') |
| 83 | 58 .beEqualTo(true); |
| 84 var node3; | 59 |
| 85 options = { | 60 var node3; |
| 86 real: [1, 2], | 61 options = {real: [1, 2], imag: [1, 1]}; |
| 87 imag: [1, 1] | 62 should( |
| 88 }; | 63 () => { |
| 89 success = Should("node3 = new PeriodicWave(context, " + JSON.stringify(o ptions) + ")", | 64 node3 = new PeriodicWave(context, options); |
| 90 function () { | 65 }, |
| 91 node3 = new PeriodicWave(context, options); | 66 'node3 = new PeriodicWave(context, ' + JSON.stringify(options) + |
| 92 }).notThrow(); | 67 ')') |
| 93 success = Should("node3 instanceof PeriodicWave", node3 instanceof Perio dicWave) | 68 .notThrow(); |
| 94 .beEqualTo(true) && success; | 69 should(node3 instanceof PeriodicWave, 'node3 instanceof PeriodicWave') |
| 95 | 70 .beEqualTo(true); |
| 96 Should("new PeriodicWave() with options", success) | 71 |
| 97 .summarize( | 72 task.done(); |
| 98 "constructed with correct attributes", | 73 }); |
| 99 "was not constructed correctly"); | 74 |
| 100 | |
| 101 taskDone(); | |
| 102 }); | |
| 103 | |
| 104 // The following test that the correct waveforms are produced when various | 75 // The following test that the correct waveforms are produced when various |
| 105 // possible PeriodicWave options are used. These are needed because it's | 76 // possible PeriodicWave options are used. These are needed because it's |
| 106 // the only way to tell if the various options were correctly applied. | 77 // the only way to tell if the various options were correctly applied. |
| 107 | 78 |
| 108 // TODO(rtoy): These functionality tests should be moved out to a separate | 79 // TODO(rtoy): These functionality tests should be moved out to a separate |
| 109 // file. | 80 // file. |
| 110 audit.defineTask("1: real periodicwave test", function (taskDone) { | 81 audit.define('1: real periodicwave test', (task, should) => { |
| 111 waveTest({ | 82 waveTest(should, {real: [0, 2]}, function(length, freq, sampleRate) { |
| 112 real: [0, 2] | 83 var expected = new Float32Array(length); |
| 113 }, function (length, freq, sampleRate) { | 84 var omega = 2 * Math.PI * freq / sampleRate; |
| 114 var expected = new Float32Array(length); | 85 var normalizationFactor = 0.5; |
| 115 var omega = 2 * Math.PI * freq / sampleRate; | 86 for (var k = 0; k < length; ++k) { |
| 116 var normalizationFactor = 0.5; | 87 expected[k] = Math.cos(omega * k); |
| 117 for (var k = 0; k < length; ++k) { | 88 } |
| 118 expected[k] = Math.cos(omega * k); | 89 return expected; |
| 119 } | 90 }, 2.7143e-5).then(() => task.done()); |
| 120 return expected; | 91 }); |
| 121 }, | 92 |
| 122 2.7143e-5).then(taskDone); | 93 audit.define( |
| 123 }); | 94 '2: real periodicwave test', |
| 124 | 95 (task, should) => { |
| 125 audit.defineTask("2: real periodicwave test", function (taskDone) { | 96 waveTest( |
| 126 waveTest({ | 97 should, {real: [0, 2], disableNormalization: false}, |
| 127 real: [0, 2], | 98 function(length, freq, sampleRate) { |
| 128 disableNormalization: false | 99 var expected = new Float32Array(length); |
| 129 }, function (length, freq, sampleRate) { | 100 var omega = 2 * Math.PI * freq / sampleRate; |
| 130 var expected = new Float32Array(length); | 101 for (var k = 0; k < length; ++k) { |
| 131 var omega = 2 * Math.PI * freq / sampleRate; | 102 expected[k] = Math.cos(omega * k); |
| 132 for (var k = 0; k < length; ++k) { | 103 } |
| 133 expected[k] = Math.cos(omega * k); | 104 return expected; |
| 134 } | 105 }, |
| 135 return expected; | 106 2.7143e-5) |
| 136 }, | 107 .then(() => task.done()); |
| 137 2.7143e-5).then(taskDone); | 108 }), |
| 138 }), | 109 |
| 139 | 110 audit.define('3: real periodicwave test', (task, should) => { |
| 140 audit.defineTask("3: real periodicwave test", function (taskDone) { | 111 waveTest( |
| 141 | 112 should, {real: [0, 2], disableNormalization: true}, |
| 142 waveTest({ | 113 function(length, freq, sampleRate) { |
| 143 real: [0, 2], | 114 var expected = new Float32Array(length); |
| 144 disableNormalization: true | 115 var omega = 2 * Math.PI * freq / sampleRate; |
| 145 }, function (length, freq, sampleRate) { | 116 for (var k = 0; k < length; ++k) { |
| 117 expected[k] = 2 * Math.cos(omega * k); | |
| 118 } | |
| 119 return expected; | |
| 120 }, | |
| 121 5.4285e-5) | |
| 122 .then(() => task.done()); | |
| 123 }); | |
| 124 | |
| 125 audit.define('1: imag periodicwave test', (task, should) => { | |
| 126 waveTest(should, {imag: [0, 2]}, function(length, freq, sampleRate) { | |
| 146 var expected = new Float32Array(length); | 127 var expected = new Float32Array(length); |
| 147 var omega = 2 * Math.PI * freq / sampleRate; | 128 var omega = 2 * Math.PI * freq / sampleRate; |
| 148 for (var k = 0; k < length; ++k) { | 129 for (var k = 0; k < length; ++k) { |
| 149 expected[k] = 2 * Math.cos(omega * k); | 130 expected[k] = Math.sin(omega * k); |
| 150 } | 131 } |
| 151 return expected; | 132 return expected; |
| 152 }, | 133 }, 2.7232e-5).then(() => task.done()); |
| 153 5.4285e-5).then(taskDone); | 134 }); |
| 154 }); | 135 |
| 155 | 136 audit.define('2: imag periodicwave test', (task, should) => { |
| 156 audit.defineTask("1: imag periodicwave test", function (taskDone) { | 137 waveTest( |
| 157 waveTest({ | 138 should, {imag: [0, 2], disableNormalization: false}, |
| 158 imag: [0, 2] | 139 function(length, freq, sampleRate) { |
|
hongchan
2017/04/28 18:38:22
These on-the-fly functions can be refactored someh
Raymond Toy
2017/05/02 18:52:41
Done.
| |
| 159 }, function (length, freq, sampleRate) { | 140 var expected = new Float32Array(length); |
| 160 var expected = new Float32Array(length); | 141 var omega = 2 * Math.PI * freq / sampleRate; |
| 161 var omega = 2 * Math.PI * freq / sampleRate; | 142 for (var k = 0; k < length; ++k) { |
| 162 for (var k = 0; k < length; ++k) { | 143 expected[k] = Math.sin(omega * k); |
| 163 expected[k] = Math.sin(omega * k); | 144 } |
| 164 } | 145 return expected; |
| 165 return expected; | 146 }, |
| 166 }, | 147 2.7232e-5) |
| 167 2.7232e-5).then(taskDone); | 148 .then(() => task.done()); |
| 168 }); | 149 }); |
| 169 | 150 |
| 170 audit.defineTask("2: imag periodicwave test", function (taskDone) { | 151 audit.define('3: imag periodicwave test', (task, should) => { |
| 171 waveTest({ | 152 waveTest( |
| 172 imag: [0, 2], | 153 should, {imag: [0, 2], disableNormalization: true}, |
| 173 disableNormalization: false | 154 function(length, freq, sampleRate) { |
| 174 }, function (length, freq, sampleRate) { | 155 var expected = new Float32Array(length); |
| 175 var expected = new Float32Array(length); | 156 var omega = 2 * Math.PI * freq / sampleRate; |
| 176 var omega = 2 * Math.PI * freq / sampleRate; | 157 for (var k = 0; k < length; ++k) { |
| 177 for (var k = 0; k < length; ++k) { | 158 expected[k] = 2 * Math.sin(omega * k); |
| 178 expected[k] = Math.sin(omega * k); | 159 } |
| 179 } | 160 return expected; |
| 180 return expected; | 161 }, |
| 181 }, | 162 5.4464e-5) |
| 182 2.7232e-5).then(taskDone); | 163 .then(() => task.done()); |
| 183 }); | 164 }); |
| 184 | 165 |
| 185 audit.defineTask("3: imag periodicwave test", function (taskDone) { | 166 audit.define('1: real/imag periodicwave test', (task, should) => { |
| 186 waveTest({ | 167 waveTest( |
| 187 imag: [0, 2], | 168 should, { |
| 188 disableNormalization: true | 169 real: [0, 1], |
| 189 }, function (length, freq, sampleRate) { | 170 imag: [0, 1], |
| 190 var expected = new Float32Array(length); | 171 }, |
| 191 var omega = 2 * Math.PI * freq / sampleRate; | 172 function(length, freq, sampleRate) { |
| 192 for (var k = 0; k < length; ++k) { | 173 var expected = new Float32Array(length); |
| 193 expected[k] = 2 * Math.sin(omega * k); | 174 var omega = 2 * Math.PI * freq / sampleRate; |
| 194 } | 175 var normalizationFactor = Math.SQRT1_2; |
| 195 return expected; | 176 for (var k = 0; k < length; ++k) { |
| 196 }, | 177 expected[k] = normalizationFactor * |
| 197 5.4464e-5).then(taskDone); | 178 (Math.sin(omega * k) + Math.cos(omega * k)); |
| 198 }); | 179 } |
| 199 | 180 return expected; |
| 200 audit.defineTask("1: real/imag periodicwave test", function (taskDone) { | 181 }, |
| 201 waveTest({ | 182 3.8371e-5) |
| 202 real: [0, 1], | 183 .then(() => task.done()); |
| 203 imag: [0, 1], | 184 }); |
| 204 }, function (length, freq, sampleRate) { | 185 |
| 205 var expected = new Float32Array(length); | 186 audit.define('2: real/imag periodicwave test', (task, should) => { |
| 206 var omega = 2 * Math.PI * freq / sampleRate; | 187 waveTest( |
| 207 var normalizationFactor = Math.SQRT1_2; | 188 should, {real: [0, 1], imag: [0, 1], disableNormalization: false}, |
| 208 for (var k = 0; k < length; ++k) { | 189 function(length, freq, sampleRate) { |
| 209 expected[k] = normalizationFactor * (Math.sin(omega * k) + Math.co s(omega * k)); | 190 var expected = new Float32Array(length); |
| 210 } | 191 var omega = 2 * Math.PI * freq / sampleRate; |
| 211 return expected; | 192 var normalizationFactor = Math.SQRT1_2; |
| 212 }, | 193 for (var k = 0; k < length; ++k) { |
| 213 3.8371e-5).then(taskDone); | 194 expected[k] = normalizationFactor * |
| 214 }); | 195 (Math.sin(omega * k) + Math.cos(omega * k)); |
| 215 | 196 } |
| 216 audit.defineTask("2: real/imag periodicwave test", function (taskDone) { | 197 return expected; |
| 217 waveTest({ | 198 }, |
| 218 real: [0, 1], | 199 2.7165e-5) |
| 219 imag: [0, 1], | 200 .then(() => task.done()); |
| 220 disableNormalization: false | 201 }); |
| 221 }, function (length, freq, sampleRate) { | 202 |
| 222 var expected = new Float32Array(length); | 203 audit.define('3: real/imag periodicwave test', (task, should) => { |
| 223 var omega = 2 * Math.PI * freq / sampleRate; | 204 waveTest( |
| 224 var normalizationFactor = Math.SQRT1_2; | 205 should, {real: [0, 1], imag: [0, 1], disableNormalization: true}, |
| 225 for (var k = 0; k < length; ++k) { | 206 function(length, freq, sampleRate) { |
| 226 expected[k] = normalizationFactor * (Math.sin(omega * k) + Math.co s(omega * k)); | 207 var expected = new Float32Array(length); |
| 227 } | 208 var omega = 2 * Math.PI * freq / sampleRate; |
| 228 return expected; | 209 for (var k = 0; k < length; ++k) { |
| 229 }, | 210 expected[k] = Math.sin(omega * k) + Math.cos(omega * k); |
| 230 2.7165e-5).then(taskDone); | 211 } |
| 231 }); | 212 return expected; |
| 232 | 213 }, |
| 233 audit.defineTask("3: real/imag periodicwave test", function (taskDone) { | 214 3.8416e-5) |
| 234 waveTest({ | 215 .then(() => task.done()); |
| 235 real: [0, 1], | 216 }); |
| 236 imag: [0, 1], | 217 |
| 237 disableNormalization: true | 218 function waveTest(should, waveOptions, expectedFunction, threshold) { |
|
hongchan
2017/04/28 18:38:22
Well the function name could be more descriptive.
Raymond Toy
2017/05/02 18:52:41
Done.
| |
| 238 }, function (length, freq, sampleRate) { | |
| 239 var expected = new Float32Array(length); | |
| 240 var omega = 2 * Math.PI * freq / sampleRate; | |
| 241 for (var k = 0; k < length; ++k) { | |
| 242 expected[k] = Math.sin(omega * k) + Math.cos(omega * k); | |
| 243 } | |
| 244 return expected; | |
| 245 }, | |
| 246 3.8416e-5).then(taskDone); | |
| 247 }); | |
| 248 | |
| 249 function waveTest(waveOptions, expectedFunction, threshold) { | |
| 250 var node; | 219 var node; |
| 251 var success = true; | |
| 252 | |
| 253 // Rather arbitrary sample rate and render length. Length doesn't have | 220 // Rather arbitrary sample rate and render length. Length doesn't have |
| 254 // to be very long. | 221 // to be very long. |
| 255 var sampleRate = 48000; | 222 var sampleRate = 48000; |
| 256 var renderLength = 0.25; | 223 var renderLength = 0.25; |
| 257 var testContext = new OfflineAudioContext(1, renderLength * sampleRate, sampleRate); | 224 var testContext = |
| 225 new OfflineAudioContext(1, renderLength * sampleRate, sampleRate); | |
| 258 | 226 |
| 259 var options = { | 227 var options = { |
| 260 periodicWave: new PeriodicWave(testContext, waveOptions) | 228 periodicWave: new PeriodicWave(testContext, waveOptions) |
| 261 }; | 229 }; |
| 262 node = new OscillatorNode(testContext, options); | 230 node = new OscillatorNode(testContext, options); |
| 263 | 231 |
| 264 // Create the graph | 232 // Create the graph |
| 265 node.connect(testContext.destination); | 233 node.connect(testContext.destination); |
| 266 node.start(); | 234 node.start(); |
| 267 | 235 |
| 268 return testContext.startRendering().then(function (resultBuffer) { | 236 return testContext.startRendering().then(function(resultBuffer) { |
| 269 var actual = resultBuffer.getChannelData(0); | 237 var actual = resultBuffer.getChannelData(0); |
| 270 var expected = expectedFunction(actual.length, | 238 var expected = expectedFunction( |
| 271 node.frequency.value, | 239 actual.length, node.frequency.value, testContext.sampleRate); |
| 272 testContext.sampleRate); | |
| 273 // Actual must match expected to within the (experimentally) | 240 // Actual must match expected to within the (experimentally) |
| 274 // determined threshold. | 241 // determined threshold. |
| 275 var message = ""; | 242 var message = ''; |
| 276 if (waveOptions.disableNormalization != undefined) | 243 if (waveOptions.disableNormalization != undefined) |
| 277 message = "disableNormalization: " + waveOptions.disableNormalizatio n; | 244 message = |
| 245 'disableNormalization: ' + waveOptions.disableNormalization; | |
| 278 if (waveOptions.real) { | 246 if (waveOptions.real) { |
| 279 if (message.length > 0) | 247 if (message.length > 0) |
| 280 message += ", " | 248 message += ', ' |
| 281 message += "real: [" + waveOptions.real + "]"; | 249 message += 'real: [' + waveOptions.real + ']'; |
| 282 } | 250 } |
| 283 if (waveOptions.imag) { | 251 if (waveOptions.imag) { |
| 284 if (message.length > 0) | 252 if (message.length > 0) |
| 285 message += ", " | 253 message += ', ' |
| 286 message += "imag: [" + waveOptions.imag + "]"; | 254 message += 'imag: [' + waveOptions.imag + ']'; |
| 287 } | 255 } |
| 288 Should("Oscillator with periodicWave {" + message + "}", actual) | 256 should(actual, 'Oscillator with periodicWave {' + message + '}') |
| 289 .beCloseToArray(expected, threshold); | 257 .beCloseToArray(expected, {absoluteThreshold: threshold}); |
| 290 }); | 258 }); |
| 291 } | 259 } |
| 292 | 260 |
| 293 function sineWaveTest(waveFun, message) { | 261 function sineWaveTest(should, waveFun, message) { |
| 294 // Verify that the default PeriodicWave produces a sine wave. Use a | 262 // Verify that the default PeriodicWave produces a sine wave. Use a |
|
hongchan
2017/04/28 18:38:22
Move this comment above the function definition.
Raymond Toy
2017/05/02 18:52:41
Done.
| |
| 295 // 2-channel context to verify this. Channel 0 is the output from the | 263 // 2-channel context to verify this. Channel 0 is the output from the |
| 296 // PeriodicWave, and channel 1 is the reference oscillator output. | 264 // PeriodicWave, and channel 1 is the reference oscillator output. |
| 297 let context = new OfflineAudioContext(2, 40000, 40000); | 265 let context = new OfflineAudioContext(2, 40000, 40000); |
| 298 let oscRef = | 266 let oscRef = |
| 299 new OscillatorNode(context, {type: 'sine', frequency: 440}); | 267 new OscillatorNode(context, {type: 'sine', frequency: 440}); |
| 300 let wave = waveFun(context); | 268 let wave = waveFun(context); |
| 301 let oscTest = | 269 let oscTest = |
| 302 new OscillatorNode(context, {frequency: 440, periodicWave: wave}); | 270 new OscillatorNode(context, {frequency: 440, periodicWave: wave}); |
| 303 | 271 |
| 304 let merger = new ChannelMergerNode(context, {numberOfInputs: 2}); | 272 let merger = new ChannelMergerNode(context, {numberOfInputs: 2}); |
| 305 | 273 |
| 306 oscRef.connect(merger, 0, 1); | 274 oscRef.connect(merger, 0, 1); |
| 307 oscTest.connect(merger, 0, 0); | 275 oscTest.connect(merger, 0, 0); |
| 308 | 276 |
| 309 merger.connect(context.destination); | 277 merger.connect(context.destination); |
| 310 | 278 |
| 311 oscRef.start(); | 279 oscRef.start(); |
| 312 oscTest.start(); | 280 oscTest.start(); |
| 313 | 281 |
| 314 return context.startRendering().then(output => { | 282 return context.startRendering().then(output => { |
| 315 // The output from the two channels MUST match exactly. | 283 // The output from the two channels MUST match exactly. |
| 316 let actual = output.getChannelData(0); | 284 let actual = output.getChannelData(0); |
| 317 let ref = output.getChannelData(1); | 285 let ref = output.getChannelData(1); |
| 318 | 286 |
| 319 Should(message, actual).beEqualToArray(ref); | 287 should(actual, message).beEqualToArray(ref); |
| 320 }); | 288 }); |
| 321 } | 289 } |
| 322 | 290 |
| 323 audit.defineTask('default wave', function(taskDone) { | 291 audit.define('default wave', (task, should) => { |
| 324 // Verify that the default PeriodicWave produces a sine wave. | 292 // Verify that the default PeriodicWave produces a sine wave. |
| 325 sineWaveTest( | 293 sineWaveTest( |
| 326 (context) => new PeriodicWave(context), | 294 should, (context) => new PeriodicWave(context), |
| 327 'new PeriodicWave(context) output') | 295 'new PeriodicWave(context) output') |
| 328 .then(taskDone); | 296 .then(() => task.done()); |
| 329 }); | 297 }); |
| 330 | 298 |
| 331 audit.defineTask('default wave (with dict)', function(taskDone) { | 299 audit.define('default wave (with dict)', (task, should) => { |
| 332 // Verify that the default PeriodicWave produces a sine wave when the | 300 // Verify that the default PeriodicWave produces a sine wave when the |
| 333 // PeriodicWaveOptions dictionary is given, but real and imag members | 301 // PeriodicWaveOptions dictionary is given, but real and imag members |
| 334 // are not set. | 302 // are not set. |
| 335 sineWaveTest( | 303 sineWaveTest( |
| 336 (context) => new PeriodicWave(context, {foo: 42}), | 304 should, (context) => new PeriodicWave(context, {foo: 42}), |
| 337 'new PeriodicWave(context, {foo: 42}) output') | 305 'new PeriodicWave(context, {foo: 42}) output') |
| 338 .then(taskDone); | 306 .then(() => task.done()); |
| 339 }); | 307 }); |
| 340 | 308 |
| 341 audit.runTasks(); | 309 audit.run(); |
| 342 </script> | 310 </script> |
| 343 </body> | 311 </body> |
| 344 </html> | 312 </html> |
| OLD | NEW |