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

Side by Side Diff: pkg/http/test/multipart_test.dart

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 6 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 | « pkg/http/test/mock_client_test.dart ('k') | pkg/http/test/response_test.dart » ('j') | 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 library multipart_test; 5 library multipart_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:utf'; 9 import 'dart:utf';
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 }); 147 });
148 148
149 // TODO(nweiz): test creating a multipart file with a charset other than UTF-8 149 // TODO(nweiz): test creating a multipart file with a charset other than UTF-8
150 // once issue 6284 is fixed. 150 // once issue 6284 is fixed.
151 151
152 // TODO(nweiz): test creating a string with a unicode body once issue 6284 is 152 // TODO(nweiz): test creating a string with a unicode body once issue 6284 is
153 // fixed. 153 // fixed.
154 154
155 test('with a stream file', () { 155 test('with a stream file', () {
156 var request = new http.MultipartRequest('POST', dummyUrl); 156 var request = new http.MultipartRequest('POST', dummyUrl);
157 var controller = new StreamController(); 157 var controller = new StreamController(sync: true);
158 request.files.add(new http.MultipartFile('file', controller.stream, 5)); 158 request.files.add(new http.MultipartFile('file', controller.stream, 5));
159 159
160 expect(request, bodyMatches(''' 160 expect(request, bodyMatches('''
161 --{{boundary}} 161 --{{boundary}}
162 content-type: application/octet-stream 162 content-type: application/octet-stream
163 content-disposition: form-data; name="file" 163 content-disposition: form-data; name="file"
164 164
165 hello 165 hello
166 --{{boundary}}-- 166 --{{boundary}}--
167 ''')); 167 '''));
168 168
169 controller.add([104, 101, 108, 108, 111]); 169 controller.add([104, 101, 108, 108, 111]);
170 controller.close(); 170 controller.close();
171 }); 171 });
172 172
173 test('with an empty stream file', () { 173 test('with an empty stream file', () {
174 var request = new http.MultipartRequest('POST', dummyUrl); 174 var request = new http.MultipartRequest('POST', dummyUrl);
175 var controller = new StreamController(); 175 var controller = new StreamController(sync: true);
176 request.files.add(new http.MultipartFile('file', controller.stream, 0)); 176 request.files.add(new http.MultipartFile('file', controller.stream, 0));
177 177
178 expect(request, bodyMatches(''' 178 expect(request, bodyMatches('''
179 --{{boundary}} 179 --{{boundary}}
180 content-type: application/octet-stream 180 content-type: application/octet-stream
181 content-disposition: form-data; name="file" 181 content-disposition: form-data; name="file"
182 182
183 183
184 --{{boundary}}-- 184 --{{boundary}}--
185 ''')); 185 '''));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 content-type: application/octet-stream 225 content-type: application/octet-stream
226 content-disposition: form-data; name="file"; filename="test-file" 226 content-disposition: form-data; name="file"; filename="test-file"
227 227
228 hello 228 hello
229 --{{boundary}}-- 229 --{{boundary}}--
230 ''')); 230 '''));
231 }), completes); 231 }), completes);
232 }); 232 });
233 }); 233 });
234 } 234 }
OLDNEW
« no previous file with comments | « pkg/http/test/mock_client_test.dart ('k') | pkg/http/test/response_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698