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

Unified Diff: tests/isolate/issue_21398_parent_isolate2_test.dart

Issue 926073002: Fix crash that happens when we send an object whose type is in a defer (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/isolate/deferred_loaded_lib.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/issue_21398_parent_isolate2_test.dart
===================================================================
--- tests/isolate/issue_21398_parent_isolate2_test.dart (revision 0)
+++ tests/isolate/issue_21398_parent_isolate2_test.dart (working copy)
@@ -0,0 +1,49 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:isolate';
+import 'dart:async';
+import "package:expect/expect.dart";
+
+import "deferred_loaded_lib.dart" deferred as lib;
+
+// In this test case we send an object created from a deferred library
+// that is loaded in the child isolate but not the parent isolate. The
+// parent isolate does not know about the type of this object and throws
+// an unhandled exception.
+funcChild(args) {
+ var replyPort = args[0];
+ // Deferred load a library, create an object from that library and send
+ // it over to the parent isolate which has not yet loaded that library.
+ lib.loadLibrary().then((_) {
+ replyPort.send(new lib.FromChildIsolate());
+ });
+}
+
+void helperFunction() {
+ var receivePort = new ReceivePort();
+
+ // Spawn an isolate using spawnFunction.
+ Isolate.spawn(funcChild, [receivePort.sendPort]).then(
+ (isolate) {
+ receivePort.listen(
+ (msg) {
+ // We don't expect to receive any valid messages.
+ Expect.fail("We don't expect to receive any valid messages");
+ receivePort.close();
+ },
+ onError: (e) {
+ // We don't expect to receive any error messages, per spec listen
+ // does not receive an error object.
+ Expect.fail("We don't expect to receive any error messages");
+ receivePort.close();
+ }
+ );
+ }
+ );
+}
+
+main() {
+ helperFunction(); /// 01: runtime error
ahe 2017/04/06 15:38:18 Why is this a multi-test?
siva 2017/04/06 18:15:42 It doesn't have to be, I think I did this way so i
ahe 2017/04/07 06:14:17 Which runtime error is expected, the one one line
+}
« no previous file with comments | « tests/isolate/deferred_loaded_lib.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698