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

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

Issue 46063010: Change dart:io Platform.script to return a Uri. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 7 years, 1 month 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 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write 7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write 8 // VMOptions=--short_socket_read --short_socket_write
9 9
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
11 import "dart:async"; 11 import "dart:async";
12 import "dart:io"; 12 import "dart:io";
13 import "dart:isolate"; 13 import "dart:isolate";
14 14
15 main() { 15 main() {
16 HttpServer.bind("127.0.0.1", 0).then((server) { 16 HttpServer.bind("127.0.0.1", 0).then((server) {
17 server.listen( 17 server.listen(
18 (request) { 18 (request) {
19 String name = Platform.script; 19 String name = Platform.script.toFilePath();
20 new File(name).openRead().pipe(request.response) 20 new File(name).openRead().pipe(request.response)
21 .catchError((e) { /* ignore */ }); 21 .catchError((e) { /* ignore */ });
22 }); 22 });
23 23
24 var count = 0; 24 var count = 0;
25 makeRequest() { 25 makeRequest() {
26 Socket.connect("127.0.0.1", server.port).then((socket) { 26 Socket.connect("127.0.0.1", server.port).then((socket) {
27 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; 27 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n";
28 socket.write(data); 28 socket.write(data);
29 socket.close(); 29 socket.close();
30 socket.done.then((_) { 30 socket.done.then((_) {
31 socket.destroy(); 31 socket.destroy();
32 if (++count < 10) { 32 if (++count < 10) {
33 makeRequest(); 33 makeRequest();
34 } else { 34 } else {
35 server.close(); 35 server.close();
36 } 36 }
37 }); 37 });
38 }); 38 });
39 } 39 }
40 makeRequest(); 40 makeRequest();
41 }); 41 });
42 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698