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

Unified Diff: tests/lib/async/future_test.dart

Issue 14690009: Make Completers asynchronous. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 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: tests/lib/async/future_test.dart
diff --git a/tests/lib/async/future_test.dart b/tests/lib/async/future_test.dart
index 078ee4aa80e3118ba478436530fd6a5bc6f414ff..7af689398d8ede777fbf74903ebc163b008d868a 100644
--- a/tests/lib/async/future_test.dart
+++ b/tests/lib/async/future_test.dart
@@ -76,15 +76,17 @@ testCompleteWithSuccessHandlerBeforeComplete() {
final completer = new Completer<int>();
final future = completer.future;
- int value;
- future.then((int v) { value = v; });
- Expect.isNull(value);
+ int after;
- Expect.isFalse(completer.isCompleted);
- completer.complete(3);
- Expect.isTrue(completer.isCompleted);
+ var port = new ReceivePort();
+ future.then((int v) { after = v; })
+ .then((_) {
+ Expect.equals(3, after);
+ port.close();
+ });
- Expect.equals(3, value);
+ completer.complete(3);
+ Expect.isNull(after);
}
testCompleteWithSuccessHandlerAfterComplete() {

Powered by Google App Engine
This is Rietveld 408576698