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

Unified Diff: lib/src/frontend/expect_async.dart

Issue 1159923010: Use the Zone API for registerException. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: more changes Created 5 years, 7 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
Index: lib/src/frontend/expect_async.dart
diff --git a/lib/src/frontend/expect_async.dart b/lib/src/frontend/expect_async.dart
index 7a6f7cc445f4cc89fe8d050cbc27ecb51330ade8..05c9c2e7fe65037fc2501f76c48d7b063fdae555 100644
--- a/lib/src/frontend/expect_async.dart
+++ b/lib/src/frontend/expect_async.dart
@@ -4,6 +4,8 @@
library test.frontend.expect_async;
+import 'dart:async';
+
import '../backend/invoker.dart';
import '../backend/state.dart';
import 'expect.dart';
@@ -66,7 +68,10 @@ class _ExpectedFunction {
int _actualCalls = 0;
/// The test invoker in which this function was wrapped.
- final Invoker _invoker;
+ Invoker get _invoker => _zone[#test.invoker];
+
+ /// The zone in which this function was wrapped.
+ final Zone _zone;
/// Whether this function has been called the requisite number of times.
bool _complete;
@@ -86,7 +91,7 @@ class _ExpectedFunction {
: maxExpected,
this._isDone = isDone,
this._reason = reason == null ? '' : '\n$reason',
- this._invoker = Invoker.current,
+ this._zone = Zone.current,
this._id = _makeCallbackId(id, callback) {
if (_invoker == null) {
throw new StateError("[expectAsync] was called outside of a test.");
@@ -178,7 +183,7 @@ class _ExpectedFunction {
return Function.apply(_callback, args.toList());
} catch (error, stackTrace) {
- _invoker.handleError(error, stackTrace);
+ _zone.handleUncaughtError(error, stackTrace);
return null;
} finally {
_afterRun();

Powered by Google App Engine
This is Rietveld 408576698