Chromium Code Reviews| Index: dart/pkg/unittest/config.dart |
| diff --git a/dart/pkg/unittest/config.dart b/dart/pkg/unittest/config.dart |
| index 34693dde24f6b99fea5b0c1e0c69527979deaec2..5a8b4bcce5c5814b8fd2f5ef45be2087575945bc 100644 |
| --- a/dart/pkg/unittest/config.dart |
| +++ b/dart/pkg/unittest/config.dart |
| @@ -37,7 +37,9 @@ class Configuration { |
| * tell the vm or browser that tests are still running and the process should |
| * wait until they are done. |
| */ |
| - void onStart() {} |
| + void onStart() { |
| + _postMessage('unittest-suite-wait-for-done'); |
| + } |
| /** |
| * Called when each test starts. Useful to show intermediate progress on |
| @@ -121,8 +123,11 @@ class Configuration { |
| print('$passed PASSED, $failed FAILED, $errors ERRORS'); |
| } |
| - // An exception is used by the test infrastructure to detect failure. |
| - if (!success) throw new Exception("Some tests failed."); |
| + if (success) { |
| + _postMessage('unittest-suite-success'); |
| + } else { |
| + throw new Exception('Some tests failed.'); |
| + } |
| } |
| String _indent(String str) { |
| @@ -137,4 +142,10 @@ class Configuration { |
| // Currently e.message works in dartium, but not in dartc. |
| handleExternalError(e, String message) => |
| _reportTestError('$message\nCaught $e', ''); |
| + |
| + _postMessage(String message) { |
| + // In dart2js browser tests, the JavaScript-based test controller |
| + // intercepts calls to print and listens for "secret" messages. |
| + print(message); |
|
kasperl
2012/09/10 10:46:30
Would it make sense to add a prefix to these messa
ahe
2012/09/10 10:48:05
There is already a prefix, "unittest-". I'm not su
|
| + } |
| } |