| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 Configuration _config; | 10 Configuration _config; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 configureExpectFailureHandler(new _ExpectFailureHandler(this)); | 65 configureExpectFailureHandler(new _ExpectFailureHandler(this)); |
| 66 } | 66 } |
| 67 /** | 67 /** |
| 68 * Called as soon as the unittest framework becomes initialized. This is done | 68 * Called as soon as the unittest framework becomes initialized. This is done |
| 69 * even before tests are added to the test framework. It might be used to | 69 * even before tests are added to the test framework. It might be used to |
| 70 * determine/debug errors that occur before the test harness starts executing. | 70 * determine/debug errors that occur before the test harness starts executing. |
| 71 * It is also used to tell the vm or browser that tests are going to be run | 71 * It is also used to tell the vm or browser that tests are going to be run |
| 72 * asynchronously and that the process should wait until they are done. | 72 * asynchronously and that the process should wait until they are done. |
| 73 */ | 73 */ |
| 74 void onInit() { | 74 void onInit() { |
| 75 formatStacks = false; |
| 75 _receivePort = new ReceivePort(); | 76 _receivePort = new ReceivePort(); |
| 76 _postMessage('unittest-suite-wait-for-done'); | 77 _postMessage('unittest-suite-wait-for-done'); |
| 77 } | 78 } |
| 78 | 79 |
| 79 /** Called as soon as the unittest framework starts running. */ | 80 /** Called as soon as the unittest framework starts running. */ |
| 80 void onStart() {} | 81 void onStart() {} |
| 81 | 82 |
| 82 /** | 83 /** |
| 83 * Called when each test starts. Useful to show intermediate progress on | 84 * Called when each test starts. Useful to show intermediate progress on |
| 84 * a test suite. Derived classes should call this first before their own | 85 * a test suite. Derived classes should call this first before their own |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // Currently e.message works in dartium, but not in dartc. | 235 // Currently e.message works in dartium, but not in dartc. |
| 235 void handleExternalError(e, String message, [stack]) => | 236 void handleExternalError(e, String message, [stack]) => |
| 236 _reportTestError('$message\nCaught $e', stack); | 237 _reportTestError('$message\nCaught $e', stack); |
| 237 | 238 |
| 238 _postMessage(String message) { | 239 _postMessage(String message) { |
| 239 // In dart2js browser tests, the JavaScript-based test controller | 240 // In dart2js browser tests, the JavaScript-based test controller |
| 240 // intercepts calls to print and listens for "secret" messages. | 241 // intercepts calls to print and listens for "secret" messages. |
| 241 print(message); | 242 print(message); |
| 242 } | 243 } |
| 243 } | 244 } |
| OLD | NEW |