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

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

Issue 366813005: Don't consider controller.addError to be a zone-crossing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More tests. Created 6 years, 5 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/lib/async/catch_errors24_test.dart ('k') | tests/lib/async/catch_errors27_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/catch_errors26_test.dart
diff --git a/tests/lib/async/catch_errors26_test.dart b/tests/lib/async/catch_errors26_test.dart
index 1717b24064eaa36835f36cf1511f0ed51168186a..6d471b8a75c674dbd7099514698d6335a427672e 100644
--- a/tests/lib/async/catch_errors26_test.dart
+++ b/tests/lib/async/catch_errors26_test.dart
@@ -14,11 +14,12 @@ main() {
var events = [];
StreamController controller;
Stream stream;
- // Test `StreamController.broadcast` streams. Note that the nested listener
- // doesn't see the error, but the outer one does.
+ // Test `StreamController.broadcast` streams.
catchErrors(() {
catchErrors(() {
controller = new StreamController.broadcast();
+
+ // Listen to the stream from the inner zone.
controller.stream
.map((x) {
events.add("map $x");
@@ -27,19 +28,22 @@ main() {
.transform(new StreamTransformer.fromHandlers(
handleError: (e, st, sink) { sink.add("error $e"); }))
.listen((x) { events.add("stream $x"); });
+
}).listen((x) { events.add(x); })
.asFuture().then((_) { Expect.fail("Unexpected callback"); });
+
+ // Listen to the stream from the outer zone.
controller.stream.listen((x) { events.add("stream2 $x"); },
onError: (x) { events.add("stream2 error $x"); });
+
+ // Feed the controller.
controller.add(1);
- // Errors are not allowed to traverse boundaries, but in this case the
- // first listener of the broadcast stream is in the same error-zone. So
- // this should work.
- controller.addError(2);
+ controller.addError("inner stream");
+ new Future.error("outer error");
controller.close();
}).listen((x) {
events.add("outer: $x");
- if (x == 2) done.complete(true);
+ if (x == "outer error") done.complete(true);
},
onDone: () { Expect.fail("Unexpected callback"); });
@@ -49,8 +53,9 @@ main() {
Expect.listEquals(["map 1",
"stream 101",
"stream2 1",
- "stream2 error 2",
- "outer: 2",
+ "stream error inner stream",
+ "stream2 error inner stream",
+ "outer: outer error",
],
events);
asyncEnd();
« no previous file with comments | « tests/lib/async/catch_errors24_test.dart ('k') | tests/lib/async/catch_errors27_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698