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

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

Issue 23875032: Expose Zones. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 3 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_errors20_test.dart ('k') | tests/lib/async/catch_errors22_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/catch_errors21_test.dart
diff --git a/tests/lib/async/catch_errors21_test.dart b/tests/lib/async/catch_errors21_test.dart
index 932a80b2822c1ec51b82ded2b5221faa1dd0db9e..8b220f5957d0477e41822b7e0bf932df96104d44 100644
--- a/tests/lib/async/catch_errors21_test.dart
+++ b/tests/lib/async/catch_errors21_test.dart
@@ -9,6 +9,8 @@ import 'catch_errors.dart';
main() {
asyncStart();
+ Completer done = new Completer();
+
var events = [];
var controller = new StreamController();
// Test that stream errors, as a result of bad user-code (`map`) are correctly
@@ -21,19 +23,27 @@ main() {
// Should not happen.
events.add("bad: $x");
});
- }).listen((x) { events.add("caught: $x"); },
- onDone: () { events.add("done"); });
+ }).listen((x) {
+ events.add("caught: $x");
+ if (x == 4) done.complete(true);
+ },
+ onDone: () { Expect.fail("Unexpected callback"); });
}).listen((x) { events.add("outer: $x"); },
- onDone: () {
- Expect.listEquals(["caught: 1",
- "caught: 2",
- "caught: 3",
- "caught: 4",
- "done",
- ],
- events);
- asyncEnd();
- });
+ onDone: () { Expect.fail("Unexpected callback"); });
+
+ done.future.whenComplete(() {
+ // Give handlers time to run.
+ Timer.run(() {
+ Expect.listEquals(["caught: 1",
+ "caught: 2",
+ "caught: 3",
+ "caught: 4",
+ ],
+ events);
+ asyncEnd();
+ });
+ });
+
[1, 2, 3, 4].forEach(controller.add);
controller.close();
}
« no previous file with comments | « tests/lib/async/catch_errors20_test.dart ('k') | tests/lib/async/catch_errors22_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698