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

Unified Diff: tests/lib/async/catch_errors27_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: Add a new test. Created 6 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
Index: tests/lib/async/catch_errors27_test.dart
diff --git a/tests/lib/async/catch_errors27_test.dart b/tests/lib/async/catch_errors27_test.dart
index 9a8ab8b734357ecb1e078218d8aaecebd39017cf..db889cbf7f84b493560e2bfada8d736904426e2b 100644
--- a/tests/lib/async/catch_errors27_test.dart
+++ b/tests/lib/async/catch_errors27_test.dart
@@ -14,10 +14,9 @@ main() {
var events = [];
StreamController controller;
Stream stream;
- // Test that the first listen on a `asBroadcastStream` determines the
- // zone the subscription lives in. The inner listen happens first, and
- // the outer listener must not see the error since it would cross a
- // zone boundary. It is therefore given to the inner `catchErrors`.
+ // Test that streams live in the zone they have been listened too.
+ // It doesn't matter how many zone-boundaries the stream traverses. What
+ // counts is the zone where `listen` was invoked.
catchErrors(() {
catchErrors(() {
controller = new StreamController();
@@ -33,15 +32,13 @@ main() {
.listen((x) { events.add("stream $x"); });
scheduleMicrotask(() {
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.close();
+ new Future.error("done");
});
}).listen((x) {
events.add(x);
Lasse Reichstein Nielsen 2014/07/10 09:45:17 Consider putting a prefix on the event here, like
floitsch 2014/07/10 13:50:42 Done.
- if (x == 2) done.complete(true);
+ if (x == "done") done.complete(true);
})
.asFuture().then((_) { Expect.fail("Unexpected callback"); });
stream.listen((x) { events.add("stream2 $x"); });
@@ -55,7 +52,8 @@ main() {
"stream 101",
Lasse Reichstein Nielsen 2014/07/10 09:45:17 Unindent (deindent? exdent?) by 1.
floitsch 2014/07/10 13:50:42 Done.
"stream2 101",
"stream error 2",
- 2, // Caught by the inner `catchErrors`.
+ "done",
+ "outer: 2",
],
events);
asyncEnd();

Powered by Google App Engine
This is Rietveld 408576698