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

Side by Side Diff: tests/isolate/issue_21398_parent_isolate2_test.dart

Issue 1477043002: Fix tests that don't catch asynchronous errors from isolate spawning. Update co19 status. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Note: the following comment is used by test.dart to additionally compile the 5 // Note: the following comment is used by test.dart to additionally compile the
6 // other isolate's code. 6 // other isolate's code.
7 // OtherScripts=deferred_loaded_lib.dart 7 // OtherScripts=deferred_loaded_lib.dart
8 8
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:async'; 10 import 'dart:async';
11 import "package:expect/expect.dart"; 11 import "package:expect/expect.dart";
12 import 'package:async_helper/async_helper.dart';
12 13
13 import "deferred_loaded_lib.dart" deferred as lib; 14 import "deferred_loaded_lib.dart" deferred as lib;
14 15
15 // In this test case we send an object created from a deferred library 16 // In this test case we send an object created from a deferred library
16 // that is loaded in the child isolate but not the parent isolate. The 17 // that is loaded in the child isolate but not the parent isolate. The
17 // parent isolate does not know about the type of this object and throws 18 // parent isolate does not know about the type of this object and throws
18 // an unhandled exception. 19 // an unhandled exception.
19 funcChild(args) { 20 funcChild(args) {
20 var replyPort = args[0]; 21 var replyPort = args[0];
21 // Deferred load a library, create an object from that library and send 22 // Deferred load a library, create an object from that library and send
22 // it over to the parent isolate which has not yet loaded that library. 23 // it over to the parent isolate which has not yet loaded that library.
23 lib.loadLibrary().then((_) { 24 lib.loadLibrary().then((_) {
24 replyPort.send(new lib.FromChildIsolate()); 25 replyPort.send(new lib.FromChildIsolate());
25 }); 26 });
26 } 27 }
27 28
28 void helperFunction() { 29 void helperFunction() {
29 var receivePort = new ReceivePort(); 30 var receivePort = new ReceivePort();
31 asyncStart();
30 32
31 // Spawn an isolate using spawnFunction. 33 // Spawn an isolate using spawnFunction.
32 Isolate.spawn(funcChild, [receivePort.sendPort]).then( 34 Isolate.spawn(funcChild, [receivePort.sendPort]).then(
33 (isolate) { 35 (isolate) {
34 receivePort.listen( 36 receivePort.listen(
35 (msg) { 37 (msg) {
36 // We don't expect to receive any valid messages. 38 // We don't expect to receive any valid messages.
37 Expect.fail("We don't expect to receive any valid messages"); 39 Expect.fail("We don't expect to receive any valid messages");
38 receivePort.close(); 40 receivePort.close();
41 asyncEnd();
39 }, 42 },
40 onError: (e) { 43 onError: (e) {
41 // We don't expect to receive any error messages, per spec listen 44 // We don't expect to receive any error messages, per spec listen
42 // does not receive an error object. 45 // does not receive an error object.
43 Expect.fail("We don't expect to receive any error messages"); 46 Expect.fail("We don't expect to receive any error messages");
44 receivePort.close(); 47 receivePort.close();
48 asyncEnd();
45 } 49 }
46 ); 50 );
47 } 51 }
48 ); 52 );
49 } 53 }
50 54
51 main() { 55 main() {
52 helperFunction(); /// 01: runtime error 56 helperFunction(); /// 01: runtime error
53 } 57 }
OLDNEW
« no previous file with comments | « tests/isolate/issue_21398_parent_isolate1_test.dart ('k') | tests/isolate/issue_21398_parent_isolate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698