From 1f30b8b82efd108f19eeb5d1580c4bd9d62f90e6 Mon Sep 17 00:00:00 2001 From: "ahe@google.com" Date: Tue, 27 May 2014 13:32:20 +0000 Subject: [PATCH] Tweak isolate/spawn_uri_missing*test.dart R=lrn@google.com Review URL: https://codereview.chromium.org//306523002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36676 260f80e4-7a28-3924-810f-c04153c831b5 --- tests/isolate/spawn_uri_missing_from_isolate_test.dart | 3 +-- tests/isolate/spawn_uri_missing_test.dart | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/isolate/spawn_uri_missing_from_isolate_test.dart b/tests/isolate/spawn_uri_missing_from_isolate_test.dart index daefc46e381..c7551d2b08f 100644 --- a/tests/isolate/spawn_uri_missing_from_isolate_test.dart +++ b/tests/isolate/spawn_uri_missing_from_isolate_test.dart @@ -30,13 +30,12 @@ main() { ReceivePort port = new ReceivePort(); Isolate.spawn(isolate, port.sendPort); Completer completer = new Completer(); - port.listen((message) { + port.first.then((message) { if (message == SUCCESS) { completer.complete(null); } else { completer.completeError(message); } - port.close(); }); asyncTest(() => completer.future); diff --git a/tests/isolate/spawn_uri_missing_test.dart b/tests/isolate/spawn_uri_missing_test.dart index c3dd4d32f4a..f342fe216bd 100644 --- a/tests/isolate/spawn_uri_missing_test.dart +++ b/tests/isolate/spawn_uri_missing_test.dart @@ -12,11 +12,14 @@ import 'dart:async'; import 'package:async_helper/async_helper.dart'; +const UNEXPECTED_MESSAGE = 'Created isolate from missing file.'; + Future doTest() { return Isolate.spawnUri(Uri.base.resolve('no_such_file'), [], null) .then((Isolate isolate) { - throw 'Created isolate from missing file'; + throw UNEXPECTED_MESSAGE; }).catchError((error) { + if (error == UNEXPECTED_MESSAGE) throw error; print('An error was thrown as expected'); return null; });