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

Side by Side Diff: pkg/unittest/lib/src/test_case.dart

Issue 19841002: Remove calls to [new Future] work around issue 11911. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review change. Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of unittest; 5 part of unittest;
6 6
7 /** 7 /**
8 * Represents the state for an individual unit test. 8 * Represents the state for an individual unit test.
9 * 9 *
10 * Create by calling [test] or [solo_test]. 10 * Create by calling [test] or [solo_test].
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 * a [Future] that can be used to schedule the next test. If the test runs 83 * a [Future] that can be used to schedule the next test. If the test runs
84 * to completion synchronously, or is disabled, null is returned, to 84 * to completion synchronously, or is disabled, null is returned, to
85 * tell unittest to schedule the next test immediately. 85 * tell unittest to schedule the next test immediately.
86 */ 86 */
87 Future _run() { 87 Future _run() {
88 if (!enabled) return new Future.value(); 88 if (!enabled) return new Future.value();
89 89
90 _result = _stackTrace = null; 90 _result = _stackTrace = null;
91 _message = ''; 91 _message = '';
92 92
93 var f = (setUp == null) ? new Future.value() : new Future(setUp); 93 // Avoid calling [new Future] to avoid issue 11911.
94 return f.catchError(_errorHandler('Setup')) 94 return new Future.value().then((_) {
95 if (setUp != null) return setUp();
96 }).catchError(_errorHandler('Setup'))
95 .then((_) { 97 .then((_) {
96 // Skip the test if setup failed. 98 // Skip the test if setup failed.
97 if (result != null) return new Future.value(); 99 if (result != null) return new Future.value();
98 _config.onTestStart(this); 100 _config.onTestStart(this);
99 _startTime = new DateTime.now(); 101 _startTime = new DateTime.now();
100 _runningTime = null; 102 _runningTime = null;
101 ++_callbackFunctionsOutstanding; 103 ++_callbackFunctionsOutstanding;
102 return testFunction(); 104 return testFunction();
103 }) 105 })
104 .catchError(_errorHandler('Test')) 106 .catchError(_errorHandler('Test'))
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void error(String messageText, [stack]) { 172 void error(String messageText, [stack]) {
171 _complete(ERROR, messageText, stack); 173 _complete(ERROR, messageText, stack);
172 } 174 }
173 175
174 void _markCallbackComplete() { 176 void _markCallbackComplete() {
175 if (--_callbackFunctionsOutstanding == 0 && !isComplete) { 177 if (--_callbackFunctionsOutstanding == 0 && !isComplete) {
176 pass(); 178 pass();
177 } 179 }
178 } 180 }
179 } 181 }
OLDNEW
« no previous file with comments | « pkg/barback/test/utils.dart ('k') | sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698