OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of unittest; | 5 part of unittest; |
6 | 6 |
7 // A custom failure handler for [expect] that routes expect failures | 7 // A custom failure handler for [expect] that routes expect failures |
8 // to the config. | 8 // to the config. |
9 class _ExpectFailureHandler extends DefaultFailureHandler { | 9 class _ExpectFailureHandler extends DefaultFailureHandler { |
10 final SimpleConfiguration _config; | 10 final SimpleConfiguration _config; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 * If true (the default), then tests will stop after the first failed | 45 * If true (the default), then tests will stop after the first failed |
46 * [expect]. If false, failed [expect]s will not cause the test | 46 * [expect]. If false, failed [expect]s will not cause the test |
47 * to stop (other exceptions will still terminate the test). | 47 * to stop (other exceptions will still terminate the test). |
48 */ | 48 */ |
49 bool stopTestOnExpectFailure = true; | 49 bool stopTestOnExpectFailure = true; |
50 | 50 |
51 // If stopTestOnExpectFailure is false, we need to capture failures, which | 51 // If stopTestOnExpectFailure is false, we need to capture failures, which |
52 // we do with this List. | 52 // we do with this List. |
53 final _testLogBuffer = <Pair<String, Trace>>[]; | 53 final _testLogBuffer = <Pair<String, Trace>>[]; |
54 | 54 |
| 55 /// How long a [TestCase] can run before it is considered an error. |
| 56 Duration timeout = const Duration(seconds: 20); |
| 57 |
55 /** | 58 /** |
56 * The constructor sets up a failure handler for [expect] that redirects | 59 * The constructor sets up a failure handler for [expect] that redirects |
57 * [expect] failures to [onExpectFailure]. | 60 * [expect] failures to [onExpectFailure]. |
58 */ | 61 */ |
59 SimpleConfiguration() { | 62 SimpleConfiguration() { |
60 configureExpectFailureHandler(new _ExpectFailureHandler(this)); | 63 configureExpectFailureHandler(new _ExpectFailureHandler(this)); |
61 } | 64 } |
62 | 65 |
63 void onInit() { | 66 void onInit() { |
64 _receivePort = new ReceivePort(); | 67 _receivePort = new ReceivePort(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } | 210 } |
208 } | 211 } |
209 } | 212 } |
210 | 213 |
211 void _postMessage(String message) { | 214 void _postMessage(String message) { |
212 // In dart2js browser tests, the JavaScript-based test controller | 215 // In dart2js browser tests, the JavaScript-based test controller |
213 // intercepts calls to print and listens for "secret" messages. | 216 // intercepts calls to print and listens for "secret" messages. |
214 print(message); | 217 print(message); |
215 } | 218 } |
216 } | 219 } |
OLD | NEW |