Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: pkg/unittest/lib/src/config.dart

Issue 11833038: Revert changes to _postMessage in r16899 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 7 /**
8 * Hooks to configure the unittest library for different platforms. This class 8 * Hooks to configure the unittest library for different platforms. This class
9 * implements the API in a platform-independent way. Tests that want to take 9 * implements the API in a platform-independent way. Tests that want to take
10 * advantage of the platform can create a subclass and override methods from 10 * advantage of the platform can create a subclass and override methods from
(...skipping 20 matching lines...) Expand all
31 31
32 /** 32 /**
33 * Called as soon as the unittest framework becomes initialized. This is done 33 * Called as soon as the unittest framework becomes initialized. This is done
34 * even before tests are added to the test framework. It might be used to 34 * even before tests are added to the test framework. It might be used to
35 * determine/debug errors that occur before the test harness starts executing. 35 * determine/debug errors that occur before the test harness starts executing.
36 * It is also used to tell the vm or browser that tests are going to be run 36 * It is also used to tell the vm or browser that tests are going to be run
37 * asynchronously and that the process should wait until they are done. 37 * asynchronously and that the process should wait until they are done.
38 */ 38 */
39 void onInit() { 39 void onInit() {
40 _receivePort = new ReceivePort(); 40 _receivePort = new ReceivePort();
41 notifyController('unittest-suite-wait-for-done'); 41 _postMessage('unittest-suite-wait-for-done');
42 } 42 }
43 43
44 /** Called as soon as the unittest framework starts running. */ 44 /** Called as soon as the unittest framework starts running. */
45 void onStart() {} 45 void onStart() {}
46 46
47 /** 47 /**
48 * Called when each test starts. Useful to show intermediate progress on 48 * Called when each test starts. Useful to show intermediate progress on
49 * a test suite. 49 * a test suite.
50 */ 50 */
51 void onTestStart(TestCase testCase) { 51 void onTestStart(TestCase testCase) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 print('$passed PASSED, $failed FAILED, $errors ERRORS'); 127 print('$passed PASSED, $failed FAILED, $errors ERRORS');
128 } 128 }
129 } 129 }
130 130
131 /** 131 /**
132 * Called when the unittest framework is done running. [success] indicates 132 * Called when the unittest framework is done running. [success] indicates
133 * whether all tests passed successfully. 133 * whether all tests passed successfully.
134 */ 134 */
135 void onDone(bool success) { 135 void onDone(bool success) {
136 if (success) { 136 if (success) {
137 notifyController('unittest-suite-success'); 137 _postMessage('unittest-suite-success');
138 _receivePort.close(); 138 _receivePort.close();
139 } else { 139 } else {
140 _receivePort.close(); 140 _receivePort.close();
141 throw new Exception('Some tests failed.'); 141 throw new Exception('Some tests failed.');
142 } 142 }
143 } 143 }
144 144
145 String _indent(String str) { 145 String _indent(String str) {
146 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. 146 // TODO(nweiz): Use this simpler code once issue 2980 is fixed.
147 // return str.replaceAll(new RegExp("^", multiLine: true), " "); 147 // return str.replaceAll(new RegExp("^", multiLine: true), " ");
(...skipping 11 matching lines...) Expand all
159 * Send messages to the test controller code (see 'test_controller.js'). This 159 * Send messages to the test controller code (see 'test_controller.js'). This
160 * is only needed to support browser tests with dart2js. Note: we could wrap 160 * is only needed to support browser tests with dart2js. Note: we could wrap
161 * tests and send the appropriate messages to the controller through the 161 * tests and send the appropriate messages to the controller through the
162 * wrapper, but using wrappers has a noticeable overhead in the testing bots, 162 * wrapper, but using wrappers has a noticeable overhead in the testing bots,
163 * so we use this approach instead. 163 * so we use this approach instead.
164 * 164 *
165 * Configurations that will not run in DRT (such as vm_config and 165 * Configurations that will not run in DRT (such as vm_config and
166 * compact_vm_config), can safely override this method to avoid printing extra 166 * compact_vm_config), can safely override this method to avoid printing extra
167 * mesages in the console. 167 * mesages in the console.
168 */ 168 */
169 // TODO(sigmund): find a way to unify notifyController and _postMessage
169 void notifyController(String message) { 170 void notifyController(String message) {
171 }
172
173 _postMessage(String message) {
170 // In dart2js browser tests, the JavaScript-based test controller 174 // In dart2js browser tests, the JavaScript-based test controller
171 // intercepts calls to print and listens for "secret" messages. 175 // intercepts calls to print and listens for "secret" messages.
172 print(message); 176 print(message);
173 } 177 }
174 } 178 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698