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

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

Issue 311153003: Add Observatory test of io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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/standalone/io/raw_socket_test.dart ('k') | tests/standalone/io/socket_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 // Tests socket exceptions. 5 // Tests socket exceptions.
6 6
7 import "dart:async"; 7 import "dart:async";
8 import "dart:io"; 8 import "dart:io";
9 9
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 ServerSocket.bind("127.0.0.1", 0).then((server) { 200 ServerSocket.bind("127.0.0.1", 0).then((server) {
201 var completer = new Completer(); 201 var completer = new Completer();
202 server.listen((socket) { 202 server.listen((socket) {
203 completer.future.then((_) => socket.destroy()); 203 completer.future.then((_) => socket.destroy());
204 }); 204 });
205 Socket.connect("127.0.0.1", server.port).then((client) { 205 Socket.connect("127.0.0.1", server.port).then((client) {
206 const int SIZE = 1024 * 1024; 206 const int SIZE = 1024 * 1024;
207 int errors = 0; 207 int errors = 0;
208 client.add(new List.filled(SIZE, 0)); 208 client.add(new List.filled(SIZE, 0));
209 client.close(); 209 client.close();
210 client.done.catchError((error) { 210 client.done
211 server.close(); 211 .catchError((_) {})
212 }); 212 .whenComplete(() {
213 server.close();
214 });
213 // Destroy other socket now. 215 // Destroy other socket now.
214 completer.complete(null); 216 completer.complete(null);
215 }); 217 });
216 }); 218 });
217 } 219 }
218 220
219 static void unknownHostTest() { 221 static void unknownHostTest() {
220 asyncStart(); 222 asyncStart();
221 Socket.connect("hede.hule.hest", 1234) 223 Socket.connect("hede.hule.hest", 1234)
222 .then((socket) => Expect.fail("Connection completed")) 224 .then((socket) => Expect.fail("Connection completed"))
(...skipping 14 matching lines...) Expand all
237 unknownHostTest(); 239 unknownHostTest();
238 } 240 }
239 } 241 }
240 242
241 main() { 243 main() {
242 asyncStart(); 244 asyncStart();
243 SocketExceptionTest.testMain(); 245 SocketExceptionTest.testMain();
244 asyncEnd(); 246 asyncEnd();
245 } 247 }
246 248
OLDNEW
« no previous file with comments | « tests/standalone/io/raw_socket_test.dart ('k') | tests/standalone/io/socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698