| OLD | NEW |
| 1 // Copyright 2015 The Chromium OS Authors. All rights reserved. | 1 // Copyright 2015 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Utility functions for all tests. | 8 * Utility functions for all tests. |
| 9 */ | 9 */ |
| 10 var test_utils = { | 10 var test_utils = { |
| 11 /** | 11 /** |
| 12 * Forces failure in tests. Should be called only from 'beforeEach', | 12 * Forces failure in tests. Should be called only from 'beforeEach', |
| 13 * 'afterEach' and 'it'. Useful to force failures in promises. | 13 * 'afterEach' and 'it'. Useful to force failures in promises. |
| 14 * @param {Object|string} An error with stack trace or a string error that | 14 * @param {Object|string} An error with stack trace or a string error that |
| 15 * describes the failure reason. | 15 * describes the failure reason. |
| 16 */ | 16 */ |
| 17 forceFailure: function(error) { | 17 forceFailure: function(error) { |
| 18 console.error(error.stack || error); | 18 console.error(error.stack || error); |
| 19 setTimeout(function() { | 19 setTimeout(function() { |
| 20 expect(false).to.be.true; | 20 expect(false).to.be.true; |
| 21 }); | 21 }); |
| 22 } | 22 } |
| 23 }; | 23 }; |
| OLD | NEW |