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

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

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 9 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 "dart:async"; 5 import "dart:async";
6 import "dart:io"; 6 import "dart:io";
7 import "dart:isolate"; 7 import "dart:isolate";
8 8
9 void sendData(List<int> data, int port) { 9 void sendData(List<int> data, int port) {
10 Socket.connect("127.0.0.1", port).then((socket) { 10 Socket.connect("127.0.0.1", port).then((socket) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 Expect.isFalse(calledOnError); 50 Expect.isFalse(calledOnError);
51 Expect.equals(exception, e.error.message); 51 Expect.equals(exception, e.error.message);
52 Expect.equals(expectRequest, calledOnRequest); 52 Expect.equals(expectRequest, calledOnRequest);
53 calledOnError = true; 53 calledOnError = true;
54 port.close(); 54 port.close();
55 c.complete(null); 55 c.complete(null);
56 }); 56 });
57 57
58 List<int> d; 58 List<int> d;
59 if (data is List<int>) d = data; 59 if (data is List<int>) d = data;
60 if (data is String) d = data.charCodes; 60 if (data is String) d = data.codeUnits;
61 if (d == null) Expect.fail("Invalid data"); 61 if (d == null) Expect.fail("Invalid data");
62 sendData(d, server.port); 62 sendData(d, server.port);
63 63
64 return c.future; 64 return c.future;
65 } 65 }
66 66
67 final data; 67 final data;
68 final String exception; 68 final String exception;
69 final bool expectRequest; 69 final bool expectRequest;
70 } 70 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 server.listen( 109 server.listen(
110 (request) { 110 (request) {
111 String name = new Options().script; 111 String name = new Options().script;
112 new File(name).openRead().pipe(request.response); 112 new File(name).openRead().pipe(request.response);
113 }, 113 },
114 onError: (e) { /* ignore */ }); 114 onError: (e) { /* ignore */ });
115 115
116 var count = 0; 116 var count = 0;
117 makeRequest() { 117 makeRequest() {
118 Socket.connect("127.0.0.1", server.port).then((socket) { 118 Socket.connect("127.0.0.1", server.port).then((socket) {
119 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n".charCodes; 119 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n".codeUnits;
120 socket.add(data); 120 socket.add(data);
121 socket.close(); 121 socket.close();
122 socket.done.then((_) { 122 socket.done.then((_) {
123 socket.destroy(); 123 socket.destroy();
124 if (++count < 10) { 124 if (++count < 10) {
125 makeRequest(); 125 makeRequest();
126 } else { 126 } else {
127 server.close(); 127 server.close();
128 } 128 }
129 }); 129 });
130 }); 130 });
131 } 131 }
132 makeRequest(); 132 makeRequest();
133 }); 133 });
134 } 134 }
135 135
136 void main() { 136 void main() {
137 testEarlyClose1(); 137 testEarlyClose1();
138 // testEarlyClose2(); 138 // testEarlyClose2();
139 } 139 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_read_test.dart ('k') | tests/standalone/io/mime_multipart_parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698