OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 /** | 6 /** |
7 * @fileOverview WebAudio layout test utility library. Built around W3C's | 7 * @fileOverview WebAudio layout test utility library. Built around W3C's |
8 * testharness.js. Includes asynchronous test task manager, | 8 * testharness.js. Includes asynchronous test task manager, |
9 * assertion utilities. | 9 * assertion utilities. |
10 * @dependency testharness.js | 10 * @dependency testharness.js |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 let didThrowCorrectly = false; | 281 let didThrowCorrectly = false; |
282 let passDetail, failDetail; | 282 let passDetail, failDetail; |
283 | 283 |
284 try { | 284 try { |
285 // This should throw. | 285 // This should throw. |
286 this._actual(); | 286 this._actual(); |
287 // Catch did not happen, so the test is failed. | 287 // Catch did not happen, so the test is failed. |
288 failDetail = '${actual} did not throw an exception.'; | 288 failDetail = '${actual} did not throw an exception.'; |
289 } catch (error) { | 289 } catch (error) { |
290 if (this._expected === null) { | 290 if (this._expected === null || this._expected === undefined) { |
291 // The expected error type was not given. | 291 // The expected error type was not given. |
292 didThrowCorrectly = true; | 292 didThrowCorrectly = true; |
293 passDetail = '${actual} threw ' + error.name + ': "' | 293 passDetail = '${actual} threw ' + error.name + ': "' |
294 + error.message + '".'; | 294 + error.message + '".'; |
295 } else if (error.name === this._expected) { | 295 } else if (error.name === this._expected) { |
296 // The expected error type match the actual one. | 296 // The expected error type match the actual one. |
297 didThrowCorrectly = true; | 297 didThrowCorrectly = true; |
298 passDetail = '${actual} threw ${expected}: "' | 298 passDetail = '${actual} threw ${expected}: "' |
299 + error.message + '".'; | 299 + error.message + '".'; |
300 } else { | 300 } else { |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 | 1269 |
1270 /** | 1270 /** |
1271 * Load file from a given URL and pass ArrayBuffer to the following promise. | 1271 * Load file from a given URL and pass ArrayBuffer to the following promise. |
1272 * See |loadFileFromUrl| method for the detail. | 1272 * See |loadFileFromUrl| method for the detail. |
1273 */ | 1273 */ |
1274 loadFileFromUrl: loadFileFromUrl | 1274 loadFileFromUrl: loadFileFromUrl |
1275 | 1275 |
1276 }; | 1276 }; |
1277 | 1277 |
1278 })(); | 1278 })(); |
OLD | NEW |