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

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

Issue 14113008: Add tests for IOSink.done call effect on HttpClientRequest/HttpResponse (should be none). (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 void testResponseDone() { 45 void testResponseDone() {
46 testServerRequest((server, request) { 46 testServerRequest((server, request) {
47 request.response.close(); 47 request.response.close();
48 request.response.done.then((response) { 48 request.response.done.then((response) {
49 Expect.equals(request.response, response); 49 Expect.equals(request.response, response);
50 server.close(); 50 server.close();
51 }); 51 });
52 }); 52 });
53
54 testServerRequest((server, request) {
55 new File("__not_exitsing_file_").openRead().pipe(request.response)
56 .catchError((e) {
57 server.close();
58 });
59 });
60
61 testServerRequest((server, request) {
62 request.response.done.then((_) {
63 server.close();
64 });
65 request.response.contentLength = 0;
66 request.response.close();
67 });
53 } 68 }
54 69
55 void testResponseAddStream() { 70 void testResponseAddStream() {
56 int bytes = new File(new Options().script).lengthSync(); 71 int bytes = new File(new Options().script).lengthSync();
57 72
58 testServerRequest((server, request) { 73 testServerRequest((server, request) {
59 request.response.addStream(new File(new Options().script).openRead()) 74 request.response.addStream(new File(new Options().script).openRead())
60 .then((response) { 75 .then((response) {
61 response.close(); 76 response.close();
62 response.done.then((_) => server.close()); 77 response.done.then((_) => server.close());
(...skipping 13 matching lines...) Expand all
76 91
77 testServerRequest((server, request) { 92 testServerRequest((server, request) {
78 var controller = new StreamController(); 93 var controller = new StreamController();
79 request.response.addStream(controller.stream) 94 request.response.addStream(controller.stream)
80 .then((response) { 95 .then((response) {
81 response.close(); 96 response.close();
82 response.done.then((_) => server.close()); 97 response.done.then((_) => server.close());
83 }); 98 });
84 controller.close(); 99 controller.close();
85 }, bytes: 0); 100 }, bytes: 0);
101
102 testServerRequest((server, request) {
103 request.response.addStream(new File("__not_exitsing_file_").openRead())
104 .catchError((e) {
105 server.close();
106 });
107 });
108
109 testServerRequest((server, request) {
110 new File("__not_exitsing_file_").openRead().pipe(request.response)
111 .catchError((e) {
112 server.close();
113 });
114 });
86 } 115 }
87 116
88 void testBadResponseAdd() { 117 void testBadResponseAdd() {
89 testServerRequest((server, request) { 118 testServerRequest((server, request) {
90 request.response.contentLength = 0; 119 request.response.contentLength = 0;
91 request.response.add([0]); 120 request.response.add([0]);
92 request.response.close(); 121 request.response.close();
93 request.response.done.catchError((error) { 122 request.response.done.catchError((error) {
94 server.close(); 123 server.close();
95 }, test: (e) => e is HttpException); 124 }, test: (e) => e is HttpException);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 }, test: (e) => e is HttpException); 164 }, test: (e) => e is HttpException);
136 }); 165 });
137 } 166 }
138 167
139 void main() { 168 void main() {
140 testResponseDone(); 169 testResponseDone();
141 testResponseAddStream(); 170 testResponseAddStream();
142 testBadResponseAdd(); 171 testBadResponseAdd();
143 testBadResponseClose(); 172 testBadResponseClose();
144 } 173 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698