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

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

Issue 23522012: Replace ReceivePorts with asyncStart|End in some tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove bad comment. Created 7 years, 3 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 | « tests/lib/async/catch_errors_test.dart ('k') | tests/lib/async/future_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_delayed_error_test; 5 library future_delayed_error_test;
6 6
7 import 'package:async_helper/async_helper.dart';
7 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
8 import 'dart:async'; 9 import 'dart:async';
9 import 'dart:isolate';
10 10
11 testImmediateError() { 11 testImmediateError() {
12 // An open ReceivePort keeps the VM running. If the error-handler below is not 12 asyncStart();
13 // executed then the test will fail with a timeout.
14 var port = new ReceivePort();
15 var future = new Future.error("error"); 13 var future = new Future.error("error");
16 future.catchError((error) { 14 future.catchError((error) {
17 port.close();
18 Expect.equals(error, "error"); 15 Expect.equals(error, "error");
16 asyncEnd();
19 }); 17 });
20 } 18 }
21 19
22 Future get completedFuture { 20 Future get completedFuture {
23 var completer = new Completer(); 21 var completer = new Completer();
24 completer.completeError("foobar"); 22 completer.completeError("foobar");
25 return completer.future; 23 return completer.future;
26 } 24 }
27 25
28 testDelayedError() { 26 testDelayedError() {
29 var port = new ReceivePort(); 27 asyncStart();
30 completedFuture.catchError((error) { 28 completedFuture.catchError((error) {
31 port.close();
32 Expect.equals(error, "foobar"); 29 Expect.equals(error, "foobar");
30 asyncEnd();
33 }); 31 });
34 } 32 }
35 33
36 main() { 34 main() {
37 testImmediateError(); 35 testImmediateError();
38 testDelayedError(); 36 testDelayedError();
39 } 37 }
40 38
OLDNEW
« no previous file with comments | « tests/lib/async/catch_errors_test.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698