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

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

Issue 12317147: Implement addStream for HttpClientRequest/HttpResponse and propegate all write-errors from the sock… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 // 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 "dart:io"; 10 import "dart:io";
(...skipping 27 matching lines...) Expand all
38 void testResponseDone() { 38 void testResponseDone() {
39 testServerRequest((server, request) { 39 testServerRequest((server, request) {
40 request.response.close(); 40 request.response.close();
41 request.response.done.then((response) { 41 request.response.done.then((response) {
42 Expect.equals(request.response, response); 42 Expect.equals(request.response, response);
43 server.close(); 43 server.close();
44 }); 44 });
45 }); 45 });
46 } 46 }
47 47
48 void testResponseAddStream() {
Søren Gjesse 2013/02/27 15:07:43 Please add a test where you add more than one stre
Anders Johnsen 2013/02/28 11:39:02 Done.
49 testServerRequest((server, request) {
50 request.response.addStream(new File(new Options().script).openRead())
51 .then((response) {
52 response.close();
53 response.done.then((_) => server.close());
54 });
55 });
56 }
57
48 void testBadResponseAdd() { 58 void testBadResponseAdd() {
49 testServerRequest((server, request) { 59 testServerRequest((server, request) {
50 request.response.contentLength = 0; 60 request.response.contentLength = 0;
51 request.response.add([0]); 61 request.response.add([0]);
52 request.response.done.catchError((error) { 62 request.response.done.catchError((error) {
53 server.close(); 63 server.close();
54 }, test: (e) => e is HttpException); 64 }, test: (e) => e is HttpException);
55 }); 65 });
56 66
57 testServerRequest((server, request) { 67 testServerRequest((server, request) {
(...skipping 30 matching lines...) Expand all
88 request.response.add([0]); 98 request.response.add([0]);
89 request.response.close(); 99 request.response.close();
90 request.response.done.catchError((error) { 100 request.response.done.catchError((error) {
91 server.close(); 101 server.close();
92 }, test: (e) => e is HttpException); 102 }, test: (e) => e is HttpException);
93 }); 103 });
94 } 104 }
95 105
96 void main() { 106 void main() {
97 testResponseDone(); 107 testResponseDone();
108 testResponseAddStream();
98 testBadResponseAdd(); 109 testBadResponseAdd();
99 testBadResponseClose(); 110 testBadResponseClose();
100 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698