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

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

Issue 16801008: catchErrors and waitForCompletion now based on runZonedExperimental. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Upload 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/run_zoned7_test.dart ('k') | tests/lib/async/run_zoned9_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/run_zoned8_test.dart
diff --git a/tests/lib/async/catch_errors28_test.dart b/tests/lib/async/run_zoned8_test.dart
similarity index 59%
copy from tests/lib/async/catch_errors28_test.dart
copy to tests/lib/async/run_zoned8_test.dart
index a5ce19e1270c89291333580070da82118a7f13b2..c8ce77d9b1ea2bd4b74676453f0ba945cf96c34c 100644
--- a/tests/lib/async/catch_errors28_test.dart
+++ b/tests/lib/async/run_zoned8_test.dart
@@ -5,30 +5,32 @@
import "package:expect/expect.dart";
import 'dart:async';
import 'dart:isolate';
+import 'catch_errors.dart';
main() {
// We keep a ReceivePort open until all tests are done. This way the VM will
// hang if the callbacks are not invoked and the test will time out.
var port = new ReceivePort();
var events = [];
- // Test that periodic Timers are handled correctly by `catchErrors`.
- catchErrors(() {
+ // Test runZoned with periodic Timers.
+ runZonedExperimental(() {
int counter = 0;
new Timer.periodic(const Duration(milliseconds: 50), (timer) {
- if (counter == 5) timer.cancel();
+ if (counter == 1) timer.cancel();
counter++;
events.add(counter);
+ throw counter;
});
- }).listen((x) {
- events.add(x);
- },
- onDone: () {
- Expect.listEquals([
- "main exit",
- 1, 2, 3, 4, 5, 6,
- ],
- events);
- port.close();
- });
+ }, onError: (e) {
+ events.add("error: $e");
+ },
+ onDone: () {
+ Expect.listEquals([
+ "main exit",
+ 1, "error: 1", 2, "error: 2",
+ ],
+ events);
+ port.close();
+ });
events.add("main exit");
}
« no previous file with comments | « tests/lib/async/run_zoned7_test.dart ('k') | tests/lib/async/run_zoned9_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698