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

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

Issue 14055003: Remove HttpClientRequest.response, as it's identical to HttpClientRequest.done. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import "dart:isolate"; 7 import "dart:isolate";
8 import "dart:io"; 8 import "dart:io";
9 9
10 void test(int totalConnections, [String body]) { 10 void test(int totalConnections, [String body]) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 request.write(body); 46 request.write(body);
47 // Cannot mutate request headers when data has been sent. 47 // Cannot mutate request headers when data has been sent.
48 Expect.throws( 48 Expect.throws(
49 () => request.headers.add("X-Request-Header", "value2"), 49 () => request.headers.add("X-Request-Header", "value2"),
50 (e) => e is HttpException); 50 (e) => e is HttpException);
51 } 51 }
52 request.close(); 52 request.close();
53 // Cannot mutate request headers when data has been sent. 53 // Cannot mutate request headers when data has been sent.
54 Expect.throws(() => request.headers.add("X-Request-Header", "value3"), 54 Expect.throws(() => request.headers.add("X-Request-Header", "value3"),
55 (e) => e is HttpException); 55 (e) => e is HttpException);
56 return request.response; 56 return request.done;
57 }) 57 })
58 .then((HttpClientResponse response) { 58 .then((HttpClientResponse response) {
59 // Cannot mutate response headers. 59 // Cannot mutate response headers.
60 Expect.throws( 60 Expect.throws(
61 () => response.headers.add("X-Response-Header", "value"), 61 () => response.headers.add("X-Response-Header", "value"),
62 (e) => e is HttpException); 62 (e) => e is HttpException);
63 Expect.equals("value", response.headers.value("X-Response-Header")); 63 Expect.equals("value", response.headers.value("X-Response-Header"));
64 response.listen((_) {}, onDone: () { 64 response.listen((_) {}, onDone: () {
65 // Do not close the connections before we have read the 65 // Do not close the connections before we have read the
66 // full response bodies for all connections. 66 // full response bodies for all connections.
67 if (++count == totalConnections) { 67 if (++count == totalConnections) {
68 client.close(); 68 client.close();
69 server.close(); 69 server.close();
70 } 70 }
71 }); 71 });
72 }); 72 });
73 } 73 }
74 74
75 }); 75 });
76 } 76 }
77 77
78 void main() { 78 void main() {
79 test(5); 79 test(5);
80 test(5, "Hello and goodbye"); 80 test(5, "Hello and goodbye");
81 } 81 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_client_request_test.dart ('k') | tests/standalone/io/http_proxy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698