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

Unified Diff: pkg/scheduled_test/test/value_future_test.dart

Issue 15128002: Address comments from https://codereview.chromium.org/14690009 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing `completion`. 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
« no previous file with comments | « pkg/scheduled_test/test/substitute_future_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/test/value_future_test.dart
diff --git a/pkg/scheduled_test/test/value_future_test.dart b/pkg/scheduled_test/test/value_future_test.dart
index 3cf0fb9179bcca5f7c4ee1c6ff9b7dc20a2fd724..3d730cd4e0395f84ee2140d04e84d2d55a0170c3 100644
--- a/pkg/scheduled_test/test/value_future_test.dart
+++ b/pkg/scheduled_test/test/value_future_test.dart
@@ -98,20 +98,23 @@ void main() {
});
test('.value is the result of the future', () {
- future.then(expectAsync1((_) {
- expect(future.value, equals(12));
- }));
+ // The completer calls its listeners asynchronously. We have to wait
+ // before we can access the value of the ValueFuture.
+ expect(future.then((_) => future.value), completion(equals(12)));
});
test('.hasValue is true', () {
- future.then(expectAsync1((_) {
- expect(future.hasValue, isTrue);
- }));
+ // The completer calls its listeners asynchronously. We have to wait
+ // before we can access the value of the ValueFuture.
+ expect(future.then((_) => future.hasValue), completion(isTrue));
});
});
group('after an error completion', () {
var future;
+ // Since the completer completes asynchronously we need to wait before the
+ // ValueFuture has a value. The safeFuture will execute its callback when
+ // this is the case.
var safeFuture;
setUp(() {
@@ -122,15 +125,11 @@ void main() {
});
test('.value is null', () {
- safeFuture.then(expectAsync1((_) {
- expect(future.value, isNull);
- }));
+ expect(safeFuture.then((_) => future.value), completion(isNull));
});
test('.hasValue is false', () {
- safeFuture.then(expectAsync1((_) {
- expect(future.hasValue, isFalse);
- }));
+ expect(safeFuture.then((_) => future.hasValue), completion(isFalse));
});
});
}
« no previous file with comments | « pkg/scheduled_test/test/substitute_future_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698