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

Unified Diff: lib/src/backend/invoker.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/backend/invoker.dart
diff --git a/lib/src/backend/invoker.dart b/lib/src/backend/invoker.dart
index 221c52a06a3667638c1ec85ea2efda388906d061..564dddad30a2951e786f9195461a38f7dfae0b5a 100644
--- a/lib/src/backend/invoker.dart
+++ b/lib/src/backend/invoker.dart
@@ -144,10 +144,7 @@ class Invoker {
}
/// Notifies the invoker of an asynchronous error.
- ///
- /// Note that calling this explicitly is rarely necessary, since any
- /// otherwise-uncaught errors will be forwarded to the invoker anyway.
- void handleError(error, [StackTrace stackTrace]) {
+ void _handleError(error, [StackTrace stackTrace]) {
if (stackTrace == null) stackTrace = new Chain.current();
var afterSuccess = liveTest.isComplete &&
@@ -165,7 +162,7 @@ class Invoker {
// If a test was marked as success but then had an error, that indicates
// that it was poorly-written and could be flaky.
if (!afterSuccess) return;
- handleError(
+ _handleError(
"This test failed after it had already completed. Make sure to use "
"[expectAsync]\n"
"or the [completes] matcher when testing async code.",
@@ -187,7 +184,7 @@ class Invoker {
var timeout = metadata.timeout.apply(new Duration(seconds: 30));
var timer = new Timer(timeout, () {
if (liveTest.isComplete) return;
- handleError(
+ _handleError(
new TimeoutException(
"Test timed out after ${niceDuration(timeout)}.", timeout));
});
@@ -207,7 +204,7 @@ class Invoker {
// Reset the outstanding callback counter to wait for callbacks from
// the test's `tearDown` to complete.
return waitForOutstandingCallbacks(() =>
- runZoned(_test._tearDown, onError: handleError));
+ runZoned(_test._tearDown, onError: _handleError));
}).then((_) {
timer.cancel();
_controller.setState(
@@ -225,7 +222,7 @@ class Invoker {
},
zoneSpecification: new ZoneSpecification(
print: (self, parent, zone, line) => _controller.print(line)),
- onError: handleError);
+ onError: _handleError);
});
}
}
« CHANGELOG.md ('K') | « CHANGELOG.md ('k') | lib/src/frontend/expect_async.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698