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

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

Issue 15764003: Add Zone support for Timers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload Created 7 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
« 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_errors8_test.dart b/tests/lib/async/catch_errors13_test.dart
similarity index 62%
copy from tests/lib/async/catch_errors8_test.dart
copy to tests/lib/async/catch_errors13_test.dart
index c24c3f96af27887286cc3ba679b5c2618e91ae6e..bac15b99bcfce825ce31f9b9ac824a875d881e5d 100644
--- a/tests/lib/async/catch_errors8_test.dart
+++ b/tests/lib/async/catch_errors13_test.dart
@@ -8,29 +8,32 @@ import 'dart:isolate';
main() {
// We keep a ReceivePort open until all tests are done. This way the VM will
- // time out if the callbacks are not invoked.
+ // hang if the callbacks are not invoked and the test will time out.
var port = new ReceivePort();
var events = [];
- // Test nested `catchErrors`.
- // The nested `catchErrors` throws all kinds of different errors (synchronous
- // and asynchronous). The body of the outer `catchErrors` furthermore has a
- // synchronous `throw`.
+ // Work around bug that makes runAsync use Timers. By invoking `runAsync` here
+ // we make sure that asynchronous non-timer events are executed before any
+ // Timer events.
+ runAsync(() { });
+
+ // Test that errors are caught by nested `catchErrors`. Also uses `runAsync`
+ // in the body of a Timer.
catchErrors(() {
events.add("catch error entry");
catchErrors(() {
events.add("catch error entry2");
- new Future.error("future error");
- new Future.error("future error2");
- new Future.value(499).then((x) => throw x);
- new Future.delayed(const Duration(milliseconds: 50), () {
- throw "delayed error";
- });
- throw "catch error";
+ Timer.run(() { throw "timer error"; });
+ new Timer(const Duration(milliseconds: 50),
+ () {
+ runAsync(() { throw "runAsync"; });
+ throw "delayed error";
+ });
}).listen((x) { events.add(x); })
.asFuture()
.then((_) => events.add("inner done"))
.then((_) { throw "inner done throw"; });
events.add("after inner");
+ Timer.run(() { throw "timer outer"; });
throw "inner throw";
}).listen((x) {
events.add(x);
@@ -41,12 +44,11 @@ main() {
"catch error entry2",
"after inner",
"main exit",
- "catch error",
"inner throw",
- "future error",
- "future error2",
- 499,
+ "timer error",
+ "timer outer",
"delayed error",
+ "runAsync",
"inner done",
"inner done throw"
],
« 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