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

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

Issue 10244009: test rename overhaul: step 7 - corelib tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
(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 #library("FuturesTest");
6 #import("dart:isolate");
7
8 Future testWaitEmpty() {
9 List<Future> futures = new List<Future>();
10 return Futures.wait(futures);
11 }
12
13 Future testCompleteAfterWait() {
14 List<Future> futures = new List<Future>();
15 Completer<Object> c = new Completer<Object>();
16 futures.add(c.future);
17 Future future = Futures.wait(futures);
18 c.complete(null);
19 return future;
20 }
21
22 Future testCompleteBeforeWait() {
23 List<Future> futures = new List<Future>();
24 Completer c = new Completer();
25 futures.add(c.future);
26 c.complete(null);
27 return Futures.wait(futures);
28 }
29
30 main() {
31 List<Future> futures = new List<Future>();
32
33 futures.add(testWaitEmpty());
34 futures.add(testCompleteAfterWait());
35 futures.add(testCompleteBeforeWait());
36
37 // Use a receive port for blocking the test.
38 // Note that if the test fails, the program will not end.
39 ReceivePort port = new ReceivePort();
40 Futures.wait(futures).then((List list) {
41 Expect.equals(3, list.length);
42 port.close();
43 });
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698