OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library future_test; | 5 library future_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:isolate'; | 8 import 'dart:isolate'; |
9 | 9 |
10 const Duration MS = const Duration(milliseconds: 1); | 10 const Duration MS = const Duration(milliseconds: 1); |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 port.close(); | 557 port.close(); |
558 }); | 558 }); |
559 completer.complete(21); | 559 completer.complete(21); |
560 } | 560 } |
561 | 561 |
562 testChainedFutureValueDelay() { | 562 testChainedFutureValueDelay() { |
563 final completer = new Completer(); | 563 final completer = new Completer(); |
564 final future = completer.future; | 564 final future = completer.future; |
565 var port = new ReceivePort(); | 565 var port = new ReceivePort(); |
566 | 566 |
567 future.then((v) => new Future.delayed(10, () => v * 2)) | 567 future.then((v) => new Future.delayed(const Duration(milliseconds: 10), |
| 568 () => v * 2)) |
568 .then((v) { | 569 .then((v) { |
569 Expect.equals(42, v); | 570 Expect.equals(42, v); |
570 port.close(); | 571 port.close(); |
571 }); | 572 }); |
572 completer.complete(21); | 573 completer.complete(21); |
573 } | 574 } |
574 | 575 |
575 testChainedFutureError() { | 576 testChainedFutureError() { |
576 final completer = new Completer(); | 577 final completer = new Completer(); |
577 final future = completer.future; | 578 final future = completer.future; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 testFutureCatchThrowsAsync(); | 623 testFutureCatchThrowsAsync(); |
623 testFutureWhenThrowsAsync(); | 624 testFutureWhenThrowsAsync(); |
624 testFutureCatchRethrowsAsync(); | 625 testFutureCatchRethrowsAsync(); |
625 | 626 |
626 testChainedFutureValue(); | 627 testChainedFutureValue(); |
627 testChainedFutureValueDelay(); | 628 testChainedFutureValueDelay(); |
628 testChainedFutureError(); | 629 testChainedFutureError(); |
629 } | 630 } |
630 | 631 |
631 | 632 |
OLD | NEW |