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

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

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Regression test for http://code.google.com/p/dart/issues/detail?id=6393. 5 // Regression test for http://code.google.com/p/dart/issues/detail?id=6393.
6 6
7 import "dart:io"; 7 import "dart:io";
8 import "dart:uri"; 8 import "dart:uri";
9 9
10 var client = new HttpClient(); 10 var client = new HttpClient();
11 var clientRequest; 11 var clientRequest;
12 12
13 void main() { 13 void main() {
14 var server = new HttpServer(); 14 HttpServer.bind("127.0.0.1", 0)
15 server.listen("127.0.0.1", 0); 15 .then((server) {
16 server.defaultRequestHandler = (req, rsp) { 16 server.listen(
17 req.inputStream.onData = () { 17 (req) {
18 req.inputStream.read(); 18 req.pipe(req.response);
19 rsp.outputStream.close(); 19 });
20 };
21 };
22 20
23 var connection = client.openUrl( 21 client.openUrl("POST", Uri.parse("http://localhost:${server.port}/"))
24 "POST", 22 .then((request) {
25 Uri.parse("http://localhost:${server.port}/")); 23 // Keep a reference to the client request object.
26 connection.onRequest = (request) { 24 clientRequest = request;
27 // Keep a reference to the client request object. 25 request.add([0]);
28 clientRequest = request; 26 return request.response;
29 request.outputStream.write([0]); 27 })
30 }; 28 .then((response) {
31 connection.onResponse = (response) { 29 // Wait with closing the client request until the response headers
32 response.inputStream.onClosed = () { 30 // are done.
33 // Wait with closing the client request until the response is done. 31 clientRequest.close();
34 clientRequest.outputStream.close(); 32 response.listen(
35 client.shutdown(); 33 (_) {},
36 server.close(); 34 onDone: () {
37 }; 35 client.close();
38 }; 36 server.close();
37 });
38 });
39 });
39 } 40 }
OLDNEW
« no previous file with comments | « tests/standalone/io/read_into_const_list_test.dart ('k') | tests/standalone/io/regress_7097_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698