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

Unified Diff: tests/lib/async/catch_errors13_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_errors12_test.dart ('k') | tests/lib/async/catch_errors14_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/catch_errors13_test.dart
diff --git a/tests/lib/async/catch_errors13_test.dart b/tests/lib/async/catch_errors13_test.dart
index 1e3a8dbaf2de5d91e42c67c004460b5a295cf96d..284dee91d98387ce0490e156fafe9c7fada44c94 100644
--- a/tests/lib/async/catch_errors13_test.dart
+++ b/tests/lib/async/catch_errors13_test.dart
@@ -9,6 +9,8 @@ import 'catch_errors.dart';
main() {
asyncStart();
+ Completer done = new Completer();
+
var events = [];
// Work around bug that makes runAsync use Timers. By invoking `runAsync` here
// we make sure that asynchronous non-timer events are executed before any
@@ -27,17 +29,24 @@ main() {
runAsync(() { throw "runAsync"; });
throw "delayed error";
});
- }).listen((x) { events.add(x); })
- .asFuture()
- .then((_) => events.add("inner done"))
- .then((_) { throw "inner done throw"; });
+ }).listen((x) {
+ events.add(x);
+ if (x == "runAsync") {
+ throw "inner done throw";
+ }
+ });
events.add("after inner");
Timer.run(() { throw "timer outer"; });
throw "inner throw";
}).listen((x) {
events.add(x);
+ if (x == "inner done throw") done.complete(true);
},
- onDone: () {
+ onDone: () { Expect.fail("Unexpected callback"); });
+
+ done.future.whenComplete(() {
+ // Give callbacks time to run.
+ Timer.run(() {
Expect.listEquals([
"catch error entry",
"catch error entry2",
@@ -48,11 +57,11 @@ main() {
"timer outer",
"delayed error",
"runAsync",
- "inner done",
"inner done throw"
],
events);
asyncEnd();
});
+ });
events.add("main exit");
}
« no previous file with comments | « tests/lib/async/catch_errors12_test.dart ('k') | tests/lib/async/catch_errors14_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698