mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
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:
parent
c5a9af1d62
commit
1f30b8b82e
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue