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

Side by Side Diff: tests/standalone/io/async_catch_errors_test.dart

Issue 23886004: Update dart:io tests to use asyncStart/asyncEnd (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments 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 | « no previous file | tests/standalone/io/delete_symlink_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:async';
6 import 'dart:io';
7
8 import "package:async_helper/async_helper.dart";
5 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
6 import 'dart:async';
7 import 'dart:isolate';
8 import 'dart:io';
9 10
10 var events = []; 11 var events = [];
11 12
12 Future testSocketException() { 13 Future testSocketException() {
13 var completer = new Completer(); 14 var completer = new Completer();
14 runZonedExperimental(() { 15 runZonedExperimental(() {
15 Socket.connect("4", 1).then((Socket s) { 16 Socket.connect("4", 1).then((Socket s) {
16 Expect.fail("Socket should not be able to connect"); 17 Expect.fail("Socket should not be able to connect");
17 }); 18 });
18 }, onError: (err) { 19 }, onError: (err) {
(...skipping 12 matching lines...) Expand all
31 if (err is! FileException) Expect.fail("Not expected error: $err"); 32 if (err is! FileException) Expect.fail("Not expected error: $err");
32 completer.complete("file test, ok."); 33 completer.complete("file test, ok.");
33 events.add("FileException"); 34 events.add("FileException");
34 }); 35 });
35 return completer.future; 36 return completer.future;
36 } 37 }
37 38
38 main() { 39 main() {
39 // We keep a ReceivePort open until all tests are done. This way the VM will 40 // We keep a ReceivePort open until all tests are done. This way the VM will
40 // hang if the callbacks are not invoked and the test will time out. 41 // hang if the callbacks are not invoked and the test will time out.
41 var timeOutPort = new ReceivePort(); 42 asyncStart();
42 testSocketException() 43 testSocketException()
43 .then((_) => testFileException()) 44 .then((_) => testFileException())
44 .then((_) { 45 .then((_) {
45 timeOutPort.close(); 46 asyncEnd();
46 Expect.listEquals(["SocketException", "FileException"], 47 Expect.listEquals(["SocketException", "FileException"],
47 events); 48 events);
48 }); 49 });
49 } 50 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/delete_symlink_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698