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
This commit is contained in:
ahe@google.com 2014-05-27 13:32:20 +00:00
parent c5a9af1d62
commit 1f30b8b82e
2 changed files with 5 additions and 3 deletions

View file

@ -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);

View file

@ -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;
});