OLD | NEW |
1 /** | 1 /** |
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 // Helper / error handling functions. | 7 // Helper / error handling functions. |
8 | 8 |
9 /** | 9 /** |
10 * Prints a debug message. | 10 * Prints a debug message. |
(...skipping 29 matching lines...) Expand all Loading... |
40 * | 40 * |
41 * throw failTest('my reason'); | 41 * throw failTest('my reason'); |
42 * | 42 * |
43 * @return {!Error} | 43 * @return {!Error} |
44 */ | 44 */ |
45 function failTest(reason) { | 45 function failTest(reason) { |
46 var error = new Error(reason); | 46 var error = new Error(reason); |
47 returnToTest('Test failed: ' + error.stack); | 47 returnToTest('Test failed: ' + error.stack); |
48 return error; | 48 return error; |
49 } | 49 } |
| 50 |
| 51 function success(method) { |
| 52 debug(method + '(): success.'); |
| 53 } |
| 54 |
| 55 function failure(method, error) { |
| 56 throw failTest(method + '() failed: ' + JSON.stringify(error)); |
| 57 } |
OLD | NEW |