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

Unified Diff: tests/isolate/issue_24243_parent_isolate_test.dart

Issue 1343213002: Fix for issue 24243 (allow objects of dart:core and dart:collections to be passed in for now, we ne… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix-comment Created 5 years, 3 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
Index: tests/isolate/issue_24243_parent_isolate_test.dart
diff --git a/tests/isolate/issue_24243_parent_isolate_test.dart b/tests/isolate/issue_24243_parent_isolate_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..3020c15e913783d4f8603100d80feb79ea3f22b1
--- /dev/null
+++ b/tests/isolate/issue_24243_parent_isolate_test.dart
@@ -0,0 +1,65 @@
+// 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.
+
+// Note: the following comment is used by test.dart to additionally compile the
+// other isolate's code.
+// OtherScripts=issue_24243_child1_isolate.dart
+// OtherScripts=issue_24243_child2_isolate.dart
+// VMOptions=--checked
+
+import 'dart:isolate';
+import 'dart:async';
koda 2015/09/16 17:41:26 Sort imports.
siva 2015/09/16 18:24:45 Removed dart:async as it is not needed.
+import "package:expect/expect.dart";
+
+main() {
+ var receive1 = new ReceivePort();
+
+ // First spawn an isolate using spawnURI and have it
+ // send back a "literal" like list object.
+ Isolate.spawnUri(Uri.parse('issue_24243_child1_isolate.dart'),
+ [],
+ receive1.sendPort).then(
+ (isolate) {
+ receive1.listen(
+ (msg) {
+ var l0 = <int>[1, 2, 3];
+ var l1 = <int>[4, 5, 6];
+ var l2 = <int>[7, 8, 9];
+ Expect.isTrue(msg is List<List<int>>);
+ Expect.listEquals(msg[0], l0);
+ Expect.listEquals(msg[1], l1);
+ Expect.listEquals(msg[2], l2);
+ Expect.throws(() => msg[0] = "throw an exception");
+ receive1.close();
+ },
+ onError: (e) => print('$e')
+ );
+ }
+ );
+
+ var receive2 = new ReceivePort();
+
+ // Now spawn an isolate using spawnURI and have it
+ // send back a "literal" like map object.
+ Isolate.spawnUri(Uri.parse('issue_24243_child2_isolate.dart'),
+ [],
+ receive2.sendPort).then(
+ (isolate) {
+ receive2.listen(
+ (msg) {
+ var m0 = <int, String>{1:'one', 2:'two', 3:'three'};
+ var m1 = <int, String>{4:'four', 5:'five', 6:'six'};
+ var m2 = <int, String>{7:'seven', 8:'eight', 9:'nine'};
+ Expect.isTrue(msg is Map<int, Map<int, String>>);
+ Expect.mapEquals(msg[0], m0);
+ Expect.mapEquals(msg[1], m1);
+ Expect.mapEquals(msg[2], m2);
+ Expect.throws(() => msg[0] = "throw an exception");
+ receive2.close();
+ },
+ onError: (e) => print('$e')
+ );
+ }
+ );
+}

Powered by Google App Engine
This is Rietveld 408576698