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

Unified Diff: pkg/unittest/lib/unittest.dart

Issue 14293015: pkg/unittest: use better async callback function (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/unittest.dart
diff --git a/pkg/unittest/lib/unittest.dart b/pkg/unittest/lib/unittest.dart
index 4f60fce86e19332dad2134d73bbf3261050a5ba3..ada00825785dc42a89b9ef5d3d48017b952a7804 100644
--- a/pkg/unittest/lib/unittest.dart
+++ b/pkg/unittest/lib/unittest.dart
@@ -688,7 +688,7 @@ void tearDown(Function teardownTest) {
/** Advance to the next test case. */
void _nextTestCase() {
- _defer(() {
+ runAsync(() {
_currentTestCaseIndex++;
_nextBatch();
});
@@ -707,19 +707,6 @@ void _reportTestError(String msg, String trace) {
}
}
-/**
- * Runs [callback] at the end of the event loop. Note that we don't wrap
- * the callback in guardAsync; this is for test framework functions which
- * should not be throwing unexpected exceptions that end up failing test
- * cases! Furthermore, we need the final exception to be thrown but not
- * caught by the test framework if any test cases failed. However, tests
- * that make use of a similar defer function *should* wrap the callback
- * (as we do in unitttest_test.dart).
- */
-_defer(void callback()) {
- (new Future.value()).then((_) => callback());
-}
-
void rerunTests() {
_uncaughtErrorMessage = null;
_initialized = true; // We don't want to reset the test array.
@@ -756,7 +743,7 @@ void runTests() {
_config.onStart();
- _defer(() {
+ runAsync(() {
_nextBatch();
});
}
@@ -876,7 +863,7 @@ void _ensureInitialized(bool configAutoStart) {
if (configAutoStart && _config.autoStart) {
// Immediately queue the suite up. It will run after a timeout (i.e. after
// main() has returned).
- _defer(runTests);
+ runAsync(runTests);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698