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

Unified Diff: tests/isolate/nested_spawn_stream_test.dart

Issue 12919011: Remove streamSpawnUri and mangler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 9 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/nested_spawn_stream2_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/nested_spawn_stream_test.dart
diff --git a/tests/isolate/nested_spawn_stream_test.dart b/tests/isolate/nested_spawn_stream_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..bc589ac74c2132dfab3890cdce79ab819249f74d
--- /dev/null
+++ b/tests/isolate/nested_spawn_stream_test.dart
@@ -0,0 +1,61 @@
+// Copyright (c) 2012, 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.
+
+// Dart test program for testing that isolates can spawn other isolates.
+
+library NestedSpawnTest;
+import 'dart:isolate';
+import '../../pkg/unittest/lib/unittest.dart';
+
+void isolateA() {
+ IsolateSink replyTo;
+ bool isFirst = true;
+ stream.listen((msg) {
+ if (isFirst) {
+ isFirst = false;
+ replyTo = msg;
+ return;
+ }
+ expect(msg, "launch nested!");
+ IsolateSink sink = streamSpawnFunction(isolateB);
+ MessageBox box = new MessageBox();
+ sink.add(box.sink);
+ sink.add("alive?");
+ box.stream.single.then((msg) {
+ expect(msg, "and kicking");
+ replyTo.add(499);
+ replyTo.close();
+ stream.close();
+ });
+ });
+}
+
+void isolateB() {
+ IsolateSink replyTo;
+ bool isFirst = true;
+ stream.listen((msg) {
+ if (isFirst) {
+ isFirst = false;
+ replyTo = msg;
+ return;
+ }
+ expect(msg, "alive?");
+ replyTo.add("and kicking");
+ replyTo.close();
+ stream.close();
+ });
+}
+
+
+main() {
+ test("spawned isolates can spawn nested isolates", () {
+ MessageBox box = new MessageBox();
+ IsolateSink sink = streamSpawnFunction(isolateA);
+ sink.add(box.sink);
+ sink.add("launch nested!");
+ box.stream.single.then(expectAsync1((msg) {
+ expect(msg, 499);
+ }));
+ });
+}
« no previous file with comments | « tests/isolate/nested_spawn_stream2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698