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

Side by Side Diff: tests/lib/async/future_test.dart

Issue 12224081: Change Future.delayed to take a Duration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments and made argument optional. Created 7 years, 10 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
« no previous file with comments | « sdk/lib/core/duration.dart ('k') | tests/lib/async/slow_consumer_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
576 testChainedFutureValue2Delay() {
577 var port = new ReceivePort();
578
579 new Future.delayed(const Duration(milliseconds: 10))
580 .then((v) {
581 Expect.isNull(v);
582 port.close();
583 });
584 }
575 testChainedFutureError() { 585 testChainedFutureError() {
576 final completer = new Completer(); 586 final completer = new Completer();
577 final future = completer.future; 587 final future = completer.future;
578 var port = new ReceivePort(); 588 var port = new ReceivePort();
579 589
580 future.then((v) => new Future.immediateError("Fehler")) 590 future.then((v) => new Future.immediateError("Fehler"))
581 .then((v) { Expect.fail("unreachable!"); }, onError: (e) { 591 .then((v) { Expect.fail("unreachable!"); }, onError: (e) {
582 Expect.equals("Fehler", e.error); 592 Expect.equals("Fehler", e.error);
583 port.close(); 593 port.close();
584 }); 594 });
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 testFutureCatchThrowsAsync(); 632 testFutureCatchThrowsAsync();
623 testFutureWhenThrowsAsync(); 633 testFutureWhenThrowsAsync();
624 testFutureCatchRethrowsAsync(); 634 testFutureCatchRethrowsAsync();
625 635
626 testChainedFutureValue(); 636 testChainedFutureValue();
627 testChainedFutureValueDelay(); 637 testChainedFutureValueDelay();
628 testChainedFutureError(); 638 testChainedFutureError();
629 } 639 }
630 640
631 641
OLDNEW
« no previous file with comments | « sdk/lib/core/duration.dart ('k') | tests/lib/async/slow_consumer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698