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

Unified Diff: pkg/unittest/unittest.dart

Issue 11363019: Fix issue 6389; Asynchronous test failures cause cascading bugs in asynchronous tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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/unittest.dart
===================================================================
--- pkg/unittest/unittest.dart (revision 14311)
+++ pkg/unittest/unittest.dart (working copy)
@@ -377,7 +377,7 @@
_after() {
if (_isDone()) {
- _handleCallbackFunctionComplete();
+ _handleCallbackFunctionComplete(_testNum);
}
}
@@ -646,7 +646,7 @@
* Called when one of the callback functions is done with all expected
* calls.
*/
-void _handleCallbackFunctionComplete() {
+void _handleCallbackFunctionComplete(testNum) {
// TODO (gram): we defer this to give the nextBatch recursive
// stack a chance to unwind. This is a temporary hack but
// really a bunch of code here needs to be fixed. We have a
@@ -654,6 +654,12 @@
// which is recursively invoked in the case of async tests that
// run synchronously. Bad things can then happen.
_defer(() {
+ if (_currentTest != testNum) {
+ if (_tests[testNum].result == PASS) {
+ _tests[testNum].error("Unexpected extra callbacks");
+ }
+ return; // Extraneous callback.
+ }
if (_currentTest < _tests.length) {
final testCase = _tests[_currentTest];
--testCase.callbackFunctionsOutstanding;
@@ -683,7 +689,7 @@
* TODO(gram) remove this when WebKit tests are working with new framework
*/
void callbackDone() {
- _handleCallbackFunctionComplete();
+ _handleCallbackFunctionComplete(_currentTest);
}
/**
« 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