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 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 | 10 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 801 |
802 /// A Future that isn't recognizable as a _Future. | 802 /// A Future that isn't recognizable as a _Future. |
803 class CustomFuture<T> implements Future<T> { | 803 class CustomFuture<T> implements Future<T> { |
804 Future _realFuture; | 804 Future _realFuture; |
805 CustomFuture(this._realFuture); | 805 CustomFuture(this._realFuture); |
806 Future then(action(result), {Function onError}) => | 806 Future then(action(result), {Function onError}) => |
807 _realFuture.then(action, onError: onError); | 807 _realFuture.then(action, onError: onError); |
808 Future catchError(Function onError, {bool test(e)}) => | 808 Future catchError(Function onError, {bool test(e)}) => |
809 _realFuture.catchError(onError, test: test); | 809 _realFuture.catchError(onError, test: test); |
810 Future whenComplete(action()) => _realFuture.whenComplete(action); | 810 Future whenComplete(action()) => _realFuture.whenComplete(action); |
811 Future timeout(Duration timeLimit, [void onTimeout()]) => | 811 Future timeout(Duration timeLimit, {void onTimeout()}) => |
812 _realFuture.timeout(timeLimit, onTimeout); | 812 _realFuture.timeout(timeLimit, onTimeout: onTimeout); |
813 Stream asStream() => _realFuture.asStream(); | 813 Stream asStream() => _realFuture.asStream(); |
814 String toString() => "CustomFuture@${_realFuture.hashCode}"; | 814 String toString() => "CustomFuture@${_realFuture.hashCode}"; |
815 int get hashCode => _realFuture.hashCode; | 815 int get hashCode => _realFuture.hashCode; |
816 } | 816 } |
OLD | NEW |