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

Unified Diff: test/runner/isolate_listener_test.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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/runner/browser/loader_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/isolate_listener_test.dart
diff --git a/test/runner/isolate_listener_test.dart b/test/runner/isolate_listener_test.dart
index 0960c5a115155442bc9068580a89f648e3337013..29528323721ad8c4a943b9e0ff599f1aa695248b 100644
--- a/test/runner/isolate_listener_test.dart
+++ b/test/runner/isolate_listener_test.dart
@@ -56,6 +56,21 @@ void main() {
});
});
+ test("waits for a returned future sending a response", () {
+ return _spawnIsolate(_asyncTests).then((receivePort) {
+ return receivePort.first;
+ }).then((response) {
+ expect(response, containsPair("type", "success"));
+ expect(response, contains("tests"));
+
+ var tests = response["tests"];
+ expect(tests, hasLength(3));
+ expect(tests[0], containsPair("name", "successful 1"));
+ expect(tests[1], containsPair("name", "successful 2"));
+ expect(tests[2], containsPair("name", "successful 3"));
+ });
+ });
+
test("sends an error response if loading fails", () {
return _spawnIsolate(_loadError).then((receivePort) {
return receivePort.first;
@@ -330,6 +345,23 @@ void _successfulTests(SendPort sendPort) {
});
}
+/// An isolate entrypoint that defines three tests asynchronously.
+void _asyncTests(SendPort sendPort) {
+ IsolateListener.start(sendPort, new Metadata(), () => () {
+ return new Future(() {
+ test("successful 1", () {});
+
+ return new Future(() {
+ test("successful 2", () {});
+
+ return new Future(() {
+ test("successful 3", () {});
+ });
+ });
+ });
+ });
+}
+
/// An isolate entrypoint that defines a test that fails.
void _failingTest(SendPort sendPort) {
IsolateListener.start(sendPort, new Metadata(), () => () {
« no previous file with comments | « test/runner/browser/loader_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698