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

Unified Diff: tests/lib/async/catch_errors.dart

Issue 17098007: Reapply "Zone support for Futures, Timer, Streams." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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/isolate.status ('k') | tests/lib/async/catch_errors10_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/catch_errors.dart
diff --git a/tests/lib/async/catch_errors.dart b/tests/lib/async/catch_errors.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c289690eb1741570891668144f9f222ab04e4b66
--- /dev/null
+++ b/tests/lib/async/catch_errors.dart
@@ -0,0 +1,29 @@
+library catch_errors;
+
+import 'dart:async';
+
+Stream catchErrors(void body()) {
+ StreamController controller;
+
+ bool onError(e) {
+ controller.add(e);
+ return true;
+ }
+
+ void onDone() {
+ controller.close();
+ }
+
+ void onListen() {
+ runZonedExperimental(body, onError: onError, onDone: onDone);
+ }
+
+ controller = new StreamController(onListen: onListen);
+ return controller.stream;
+}
+
+Future waitForCompletion(void body()) {
+ Completer completer = new Completer.sync();
+ runZonedExperimental(body, onDone: completer.complete);
+ return completer.future;
+}
« no previous file with comments | « tests/isolate/isolate.status ('k') | tests/lib/async/catch_errors10_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698