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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/regress_6521_test.dart
diff --git a/tests/standalone/io/regress_6521_test.dart b/tests/standalone/io/regress_6521_test.dart
index cd625ee498ee4c1b476f5a2a2c2c7686fba70560..73eb67a649244786f137d28f4ffa0bc626beb478 100644
--- a/tests/standalone/io/regress_6521_test.dart
+++ b/tests/standalone/io/regress_6521_test.dart
@@ -11,29 +11,30 @@ var client = new HttpClient();
var clientRequest;
void main() {
- var server = new HttpServer();
- server.listen("127.0.0.1", 0);
- server.defaultRequestHandler = (req, rsp) {
- req.inputStream.onData = () {
- req.inputStream.read();
- rsp.outputStream.close();
- };
- };
+ HttpServer.bind("127.0.0.1", 0)
+ .then((server) {
+ server.listen(
+ (req) {
+ req.pipe(req.response);
+ });
- var connection = client.openUrl(
- "POST",
- Uri.parse("http://localhost:${server.port}/"));
- connection.onRequest = (request) {
- // Keep a reference to the client request object.
- clientRequest = request;
- request.outputStream.write([0]);
- };
- connection.onResponse = (response) {
- response.inputStream.onClosed = () {
- // Wait with closing the client request until the response is done.
- clientRequest.outputStream.close();
- client.shutdown();
- server.close();
- };
- };
+ client.openUrl("POST", Uri.parse("http://localhost:${server.port}/"))
+ .then((request) {
+ // Keep a reference to the client request object.
+ clientRequest = request;
+ request.add([0]);
+ return request.response;
+ })
+ .then((response) {
+ // Wait with closing the client request until the response headers
+ // are done.
+ clientRequest.close();
+ response.listen(
+ (_) {},
+ onDone: () {
+ client.close();
+ server.close();
+ });
+ });
+ });
}
« 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