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

Unified Diff: tests/isolate/count_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
Index: tests/isolate/count_stream_test.dart
diff --git a/tests/isolate/count_stream_test.dart b/tests/isolate/count_stream_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..50119ae47d48b53c1e2e089ead688b644ec2e2bb
--- /dev/null
+++ b/tests/isolate/count_stream_test.dart
@@ -0,0 +1,46 @@
+// 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.
+
+library CountTest;
+import '../../pkg/unittest/lib/unittest.dart';
+import 'dart:isolate';
+
+void countMessages() {
+ int count = 0;
+ IsolateSink replySink;
+ bool isFirst = true;
+ stream.listen((msg) {
+ if (isFirst) {
+ replySink = msg;
+ isFirst = false;
+ return;
+ }
+ replySink.add(count);
+ count++;
+ }, onDone: () {
+ expect(count, 10);
+ replySink.close();
+ });
+}
+
+void main() {
+ test("count 10 consecutive stream messages", () {
+ int count = 0;
+ MessageBox box = new MessageBox();
+ IsolateSink remote = streamSpawnFunction(countMessages);
+ remote.add(box.sink);
+ box.stream.listen(expectAsync1((remoteCount) {
+ expect(remoteCount, count);
+ count++;
+ if (count < 10) {
+ remote.add(null);
+ } else {
+ remote.close();
+ }
+ }, count: 10), onDone: expectAsync0(() {
+ expect(count, 10);
+ }));
+ remote.add(null);
+ });
+}
« no previous file with comments | « tests/isolate/compute_this_script_browser_stream_test.dart ('k') | tests/isolate/cross_isolate_message_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698