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

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

Issue 3014593002: Use generic functions in zones. (Closed)
Patch Set: Added changes missing from patch set #2 Created 3 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/zone_root_bind_test.dart ('k') | tests/lib/async/zone_run_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/zone_run_guarded_test.dart
diff --git a/tests/lib/async/zone_run_guarded_test.dart b/tests/lib/async/zone_run_guarded_test.dart
index e7a752090e2243d449bff5750ffb5053008c0ec7..6b87bf14305f7ed253f7b32fb9360831a7323ddf 100644
--- a/tests/lib/async/zone_run_guarded_test.dart
+++ b/tests/lib/async/zone_run_guarded_test.dart
@@ -7,6 +7,8 @@ import 'package:async_helper/async_helper.dart';
import 'dart:async';
main() {
+ var result;
+
Completer done = new Completer();
List events = [];
@@ -17,7 +19,7 @@ main() {
Zone forked;
forked = Zone.current.fork(
specification: new ZoneSpecification(
- run: (Zone self, ZoneDelegate parent, Zone origin, f()) {
+ run: <R>(Zone self, ZoneDelegate parent, Zone origin, R f()) {
// The zone is still the same as when origin.run was invoked, which
// is the root zone. (The origin zone hasn't been set yet).
Expect.identical(Zone.ROOT, Zone.current);
@@ -28,19 +30,19 @@ main() {
Expect.identical(Zone.ROOT, Zone.current);
Expect.identical(forked, origin);
events.add("forked.handleUncaught $error");
- return 499;
+ result = 499;
}));
- var result = forked.runGuarded(() {
+ forked.runGuarded(() {
events.add("runGuarded 1");
Expect.identical(forked, Zone.current);
- return 42;
+ result = 42;
});
Expect.identical(Zone.ROOT, Zone.current);
Expect.equals(42, result);
events.add("after runGuarded 1");
- result = forked.runGuarded(() {
+ forked.runGuarded(() {
events.add("runGuarded 2");
Expect.identical(forked, Zone.current);
throw 42;
@@ -56,9 +58,10 @@ main() {
"forked.handleUncaught 42"
], events);
+ result = null;
events.clear();
asyncStart();
- result = forked.runGuarded(() {
+ forked.runGuarded(() {
Expect.identical(forked, Zone.current);
events.add("run closure");
forked.scheduleMicrotask(() {
« no previous file with comments | « tests/lib/async/zone_root_bind_test.dart ('k') | tests/lib/async/zone_run_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698