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(), () => () { |