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

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

Issue 14640008: Change the signature for all network bind calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments by whesse@ Created 7 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 | Annotate | Revision Log
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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "dart:async"; 6 import "dart:async";
7 import "dart:io"; 7 import "dart:io";
8 import "dart:isolate"; 8 import "dart:isolate";
9 9
10 void testListenOn() { 10 void testListenOn() {
(...skipping 21 matching lines...) Expand all
32 }) 32 })
33 .catchError((e) { 33 .catchError((e) {
34 String msg = "Unexpected error in Http Client: $e"; 34 String msg = "Unexpected error in Http Client: $e";
35 var trace = getAttachedStackTrace(e); 35 var trace = getAttachedStackTrace(e);
36 if (trace != null) msg += "\nStackTrace: $trace"; 36 if (trace != null) msg += "\nStackTrace: $trace";
37 Expect.fail(msg); 37 Expect.fail(msg);
38 }); 38 });
39 } 39 }
40 40
41 // Test two connection after each other. 41 // Test two connection after each other.
42 ServerSocket.bind().then((s) { 42 ServerSocket.bind("127.0.0.1", 0).then((s) {
43 socket = s; 43 socket = s;
44 server = new HttpServer.listenOn(socket); 44 server = new HttpServer.listenOn(socket);
45 ReceivePort serverPort = new ReceivePort(); 45 ReceivePort serverPort = new ReceivePort();
46 server.listen((HttpRequest request) { 46 server.listen((HttpRequest request) {
47 request.listen( 47 request.listen(
48 (_) {}, 48 (_) {},
49 onDone: () { 49 onDone: () {
50 request.response.close(); 50 request.response.close();
51 serverPort.close(); 51 serverPort.close();
52 }); 52 });
53 }); 53 });
54 54
55 test(() { 55 test(() {
56 test(() { 56 test(() {
57 server.close(); 57 server.close();
58 Expect.throws(() => server.port); 58 Expect.throws(() => server.port);
59 socket.close(); 59 socket.close();
60 }); 60 });
61 }); 61 });
62 }); 62 });
63 } 63 }
64 64
65 void main() { 65 void main() {
66 testListenOn(); 66 testListenOn();
67 } 67 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_server_response_test.dart ('k') | tests/standalone/io/http_session_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698