| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 263 |
| 264 let didThrowCorrectly = false; | 264 let didThrowCorrectly = false; |
| 265 let passDetail, failDetail; | 265 let passDetail, failDetail; |
| 266 | 266 |
| 267 try { | 267 try { |
| 268 // This should throw. | 268 // This should throw. |
| 269 this._actual(); | 269 this._actual(); |
| 270 // Catch did not happen, so the test is failed. | 270 // Catch did not happen, so the test is failed. |
| 271 failDetail = '${actual} did not throw an exception.'; | 271 failDetail = '${actual} did not throw an exception.'; |
| 272 } catch (error) { | 272 } catch (error) { |
| 273 if (this._expected === undefined) { | 273 if (this._expected === null) { |
| 274 // The expected error type was not given. |
| 274 didThrowCorrectly = true; | 275 didThrowCorrectly = true; |
| 275 passDetail = '${actual} threw an exception of ' + error.name + '.'; | 276 passDetail = '${actual} threw ' + error.name + ': "' |
| 277 + error.message + '".'; |
| 276 } else if (error.name === this._expected) { | 278 } else if (error.name === this._expected) { |
| 279 // The expected error type match the actual one. |
| 277 didThrowCorrectly = true; | 280 didThrowCorrectly = true; |
| 278 passDetail = '${actual} threw ${expected} : "' + error.message + '".'; | 281 passDetail = '${actual} threw ${expected}: "' |
| 282 + error.message + '".'; |
| 279 } else { | 283 } else { |
| 280 didThrowCorrectly = false; | 284 didThrowCorrectly = false; |
| 281 failDetail = '${actual} threw "' + error.name | 285 failDetail = '${actual} threw "' + error.name |
| 282 + '" instead of ${expected}.'; | 286 + '" instead of ${expected}.'; |
| 283 } | 287 } |
| 284 } | 288 } |
| 285 | 289 |
| 286 return this._assert(didThrowCorrectly, passDetail, failDetail); | 290 return this._assert(didThrowCorrectly, passDetail, failDetail); |
| 287 } | 291 } |
| 288 | 292 |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 _logError('this test requires the explicit comparison with the ' | 1030 _logError('this test requires the explicit comparison with the ' |
| 1027 + 'expected result when it runs with run-webkit-tests.'); | 1031 + 'expected result when it runs with run-webkit-tests.'); |
| 1028 } | 1032 } |
| 1029 | 1033 |
| 1030 return new TaskRunner(); | 1034 return new TaskRunner(); |
| 1031 } | 1035 } |
| 1032 | 1036 |
| 1033 }; | 1037 }; |
| 1034 | 1038 |
| 1035 })(); | 1039 })(); |
| OLD | NEW |