OLD | NEW |
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:async"; | 10 import "dart:async"; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 response.done.then((_) => server.close()); | 81 response.done.then((_) => server.close()); |
82 }); | 82 }); |
83 controller.close(); | 83 controller.close(); |
84 }, bytes: 0); | 84 }, bytes: 0); |
85 } | 85 } |
86 | 86 |
87 void testBadResponseAdd() { | 87 void testBadResponseAdd() { |
88 testServerRequest((server, request) { | 88 testServerRequest((server, request) { |
89 request.response.contentLength = 0; | 89 request.response.contentLength = 0; |
90 request.response.writeBytes([0]); | 90 request.response.writeBytes([0]); |
| 91 request.response.close(); |
91 request.response.done.catchError((error) { | 92 request.response.done.catchError((error) { |
92 server.close(); | 93 server.close(); |
93 }, test: (e) => e is HttpException); | 94 }, test: (e) => e is HttpException); |
94 }); | 95 }); |
95 | 96 |
96 testServerRequest((server, request) { | 97 testServerRequest((server, request) { |
97 request.response.contentLength = 5; | 98 request.response.contentLength = 5; |
98 request.response.writeBytes([0, 0, 0]); | 99 request.response.writeBytes([0, 0, 0]); |
99 request.response.writeBytes([0, 0, 0]); | 100 request.response.writeBytes([0, 0, 0]); |
| 101 request.response.close(); |
100 request.response.done.catchError((error) { | 102 request.response.done.catchError((error) { |
101 server.close(); | 103 server.close(); |
102 }, test: (e) => e is HttpException); | 104 }, test: (e) => e is HttpException); |
103 }); | 105 }); |
104 | 106 |
105 testServerRequest((server, request) { | 107 testServerRequest((server, request) { |
106 request.response.contentLength = 0; | 108 request.response.contentLength = 0; |
107 request.response.writeBytes(new Uint8List(64 * 1024)); | 109 request.response.writeBytes(new Uint8List(64 * 1024)); |
108 request.response.writeBytes(new Uint8List(64 * 1024)); | 110 request.response.writeBytes(new Uint8List(64 * 1024)); |
109 request.response.writeBytes(new Uint8List(64 * 1024)); | 111 request.response.writeBytes(new Uint8List(64 * 1024)); |
| 112 request.response.close(); |
110 request.response.done.catchError((error) { | 113 request.response.done.catchError((error) { |
111 server.close(); | 114 server.close(); |
112 }, test: (e) => e is HttpException); | 115 }, test: (e) => e is HttpException); |
113 }); | 116 }); |
114 } | 117 } |
115 | 118 |
116 void testBadResponseClose() { | 119 void testBadResponseClose() { |
117 testServerRequest((server, request) { | 120 testServerRequest((server, request) { |
118 request.response.contentLength = 5; | 121 request.response.contentLength = 5; |
119 request.response.close(); | 122 request.response.close(); |
(...skipping 11 matching lines...) Expand all Loading... |
131 }, test: (e) => e is HttpException); | 134 }, test: (e) => e is HttpException); |
132 }); | 135 }); |
133 } | 136 } |
134 | 137 |
135 void main() { | 138 void main() { |
136 testResponseDone(); | 139 testResponseDone(); |
137 testResponseAddStream(); | 140 testResponseAddStream(); |
138 testBadResponseAdd(); | 141 testBadResponseAdd(); |
139 testBadResponseClose(); | 142 testBadResponseClose(); |
140 } | 143 } |
OLD | NEW |