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

Side by Side Diff: tests/corelib/src/FuturesTest.dart

Issue 9108010: Futures.wait should call then, even if some(or all) of the futures are done (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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
« corelib/src/future.dart ('K') | « corelib/src/future.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4
5 Future testWaitEmpty() {
6 List<Future> futures = new List<Future>();
7 return Futures.wait(futures);
8 }
9
10 Future testCompleteAfterWait() {
11 List<Future> futures = new List<Future>();
12 Completer<Object> c = new Completer<Object>();
13 futures.add(c.future);
14 Future future = Futures.wait(futures);
15 c.complete(null);
16 return future;
17 }
18
19 Future testCompleteBeforeWait() {
20 List<Future> futures = new List<Future>();
21 Completer c = new Completer();
22 futures.add(c.future);
23 c.complete(null);
24 return Futures.wait(futures);
25 }
26
27 main() {
28 List<Future> futures = new List<Future>();
29
30 futures.add(testWaitEmpty());
31 futures.add(testCompleteAfterWait());
32 futures.add(testCompleteBeforeWait());
33
34 // Use a receive port for blocking the test.
35 // Note that if the test fails, the program will not end.
36 ReceivePort port = new ReceivePort();
37 Futures.wait(futures).then((List list) {
38 Expect.equals(3, list.length);
39 port.close();
40 });
41 }
OLDNEW
« corelib/src/future.dart ('K') | « corelib/src/future.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698