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

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

Issue 1968033002: Implement everything in test Future-class to avoid analyzer warnings. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | 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
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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 // An evil future that completes with another future. 1128 // An evil future that completes with another future.
1129 class UglyFuture implements Future<dynamic> { 1129 class UglyFuture implements Future<dynamic> {
1130 final _result; 1130 final _result;
1131 UglyFuture(int badness) : 1131 UglyFuture(int badness) :
1132 _result = (badness == 0) ? 42 : new UglyFuture(badness - 1); 1132 _result = (badness == 0) ? 42 : new UglyFuture(badness - 1);
1133 Future then(action(value), {onError(error, StackTrace stack)}) { 1133 Future then(action(value), {onError(error, StackTrace stack)}) {
1134 var c = new Completer(); 1134 var c = new Completer();
1135 c.complete(new Future.microtask(() => action(_result))); 1135 c.complete(new Future.microtask(() => action(_result)));
1136 return c.future; 1136 return c.future;
1137 } 1137 }
1138 Future catchError(onError, {test}) {} // Never an error. 1138 Future catchError(onError, {test}) => this; // Never an error.
1139 Future whenComplete(action()) { 1139 Future whenComplete(action()) {
1140 return new Future.microtask(action).then((_) => this); 1140 return new Future.microtask(action).then((_) => this);
1141 } 1141 }
1142 Stream asStream() {
1143 return (new StreamController()..add(_result)..close()).stream;
1144 }
1145 Future timeout(Duration duration, {onTimeout()}) {
1146 return this;
1147 }
1142 } 1148 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698