Chromium Code Reviews

Unified Diff: lib/src/runner/vm/isolate_listener.dart

Issue 1107743002: Support asynchronous main methods. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « lib/src/runner/browser/iframe_listener.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/vm/isolate_listener.dart
diff --git a/lib/src/runner/vm/isolate_listener.dart b/lib/src/runner/vm/isolate_listener.dart
index ed23a1d1adfeeb67d6fe2ff89e3fc56d0e1d3f09..a25c9d682401c2243d46909f1574c2e6844d1f30 100644
--- a/lib/src/runner/vm/isolate_listener.dart
+++ b/lib/src/runner/vm/isolate_listener.dart
@@ -51,19 +51,18 @@ class IsolateListener {
}
var declarer = new Declarer();
- try {
- runZoned(main, zoneValues: {#test.declarer: declarer});
- } catch (error, stackTrace) {
+ runZoned(() => new Future.sync(main), zoneValues: {
+ #test.declarer: declarer
+ }).then((_) {
+ var suite = new Suite(declarer.tests, metadata: metadata)
+ .forPlatform(TestPlatform.vm, os: currentOS);
+ new IsolateListener._(suite)._listen(sendPort);
+ }, onError: (error, stackTrace) {
sendPort.send({
"type": "error",
"error": RemoteException.serialize(error, stackTrace)
});
- return;
- }
-
- var suite = new Suite(declarer.tests, metadata: metadata)
- .forPlatform(TestPlatform.vm, os: currentOS);
- new IsolateListener._(suite)._listen(sendPort);
+ });
}
/// Sends a message over [sendPort] indicating that the tests failed to load.
« no previous file with comments | « lib/src/runner/browser/iframe_listener.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine