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

Unified Diff: tests/lib/async/catch_errors26_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_errors25_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 8ac5431ce8a80360ffb4960e325f60c25cccaeaf..e2894f80eeaef0509fd71007451799445dba7ae0 100644
--- a/tests/lib/async/catch_errors26_test.dart
+++ b/tests/lib/async/catch_errors26_test.dart
@@ -9,6 +9,8 @@ import 'catch_errors.dart';
main() {
asyncStart();
+ Completer done = new Completer();
+
var events = [];
StreamController controller;
Stream stream;
@@ -26,7 +28,7 @@ main() {
handleError: (e, sink) => sink.add("error $e")))
.listen((x) { events.add("stream $x"); });
}).listen((x) { events.add(x); })
- .asFuture().then((_) { events.add("inner done"); });
+ .asFuture().then((_) { Expect.fail("Unexpected callback"); });
controller.stream.listen((x) { events.add("stream2 $x"); },
onError: (x) { events.add("stream2 error $x"); });
controller.add(1);
@@ -35,16 +37,23 @@ main() {
// this should work.
controller.addError(2);
controller.close();
- }).listen((x) { events.add("outer: $x"); },
- onDone: () {
- Expect.listEquals(["map 1",
- "stream 101",
- "stream2 1",
- "stream2 error 2",
- "outer: 2",
- "inner done",
- ],
- events);
- asyncEnd();
- });
+ }).listen((x) {
+ events.add("outer: $x");
+ if (x == 2) done.complete(true);
+ },
+ onDone: () { Expect.fail("Unexpected callback"); });
+
+ done.future.whenComplete(() {
+ // Give handlers time to run.
+ Timer.run(() {
+ Expect.listEquals(["map 1",
+ "stream 101",
+ "stream2 1",
+ "stream2 error 2",
+ "outer: 2",
+ ],
+ events);
+ asyncEnd();
+ });
+ });
}
« no previous file with comments | « tests/lib/async/catch_errors25_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