OLD | NEW |
1 // Copyright 2015 The Chromium 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 /** | 5 /** |
6 * Creates wrappers for callbacks and calls testDone() when all callbacks | 6 * Creates wrappers for callbacks and calls testDone() when all callbacks |
7 * have been invoked. | 7 * have been invoked. |
8 * @param {testing.Test} fixture | 8 * @param {testing.Test} fixture |
9 */ | 9 */ |
10 function CallbackHelper(fixture) { | 10 function CallbackHelper(fixture) { |
(...skipping 22 matching lines...) Expand all Loading... |
33 if (--this.pendingCallbacks_ <= 0) | 33 if (--this.pendingCallbacks_ <= 0) |
34 CallbackHelper.testDone_(); | 34 CallbackHelper.testDone_(); |
35 }.bind(this)); | 35 }.bind(this)); |
36 // runAllActionsAsync catches exceptions and puts them in the test | 36 // runAllActionsAsync catches exceptions and puts them in the test |
37 // framework's list of errors and fails the test if appropriate. | 37 // framework's list of errors and fails the test if appropriate. |
38 var runAll = runAllActionsAsync(WhenTestDone.ASSERT, completionAction); | 38 var runAll = runAllActionsAsync(WhenTestDone.ASSERT, completionAction); |
39 ++this.pendingCallbacks_; | 39 ++this.pendingCallbacks_; |
40 return function() { | 40 return function() { |
41 savedArgs.arguments = Array.prototype.slice.call(arguments); | 41 savedArgs.arguments = Array.prototype.slice.call(arguments); |
42 runAll.invoke(); | 42 runAll.invoke(); |
43 } | 43 }; |
44 } | 44 } |
45 }; | 45 }; |
46 | 46 |
47 /** | 47 /** |
48 * @private | 48 * @private |
49 */ | 49 */ |
50 CallbackHelper.testDone_ = this.testDone; | 50 CallbackHelper.testDone_ = this.testDone; |
51 // Remove testDone for public use since direclty using it conflicts with | 51 // Remove testDone for public use since direclty using it conflicts with |
52 // this callback helper. | 52 // this callback helper. |
53 delete this.testDone; | 53 delete this.testDone; |
OLD | NEW |