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

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

Issue 11887016: Make StreamController's unnamed constructor create a single-sub stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 11 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 }); 149 });
150 150
151 // TODO(nweiz): test creating a multipart file with a charset other than UTF-8 151 // TODO(nweiz): test creating a multipart file with a charset other than UTF-8
152 // once issue 6284 is fixed. 152 // once issue 6284 is fixed.
153 153
154 // TODO(nweiz): test creating a string with a unicode body once issue 6284 is 154 // TODO(nweiz): test creating a string with a unicode body once issue 6284 is
155 // fixed. 155 // fixed.
156 156
157 test('with a stream file', () { 157 test('with a stream file', () {
158 var request = new http.MultipartRequest('POST', dummyUrl); 158 var request = new http.MultipartRequest('POST', dummyUrl);
159 var stream = new StreamController.singleSubscription(); 159 var stream = new StreamController();
160 request.files.add(new http.MultipartFile('file', stream, 5)); 160 request.files.add(new http.MultipartFile('file', stream, 5));
161 161
162 expect(request, bodyMatches(''' 162 expect(request, bodyMatches('''
163 --{{boundary}} 163 --{{boundary}}
164 content-type: application/octet-stream 164 content-type: application/octet-stream
165 content-disposition: form-data; name="file" 165 content-disposition: form-data; name="file"
166 166
167 hello 167 hello
168 --{{boundary}}-- 168 --{{boundary}}--
169 ''')); 169 '''));
170 170
171 stream.add([104, 101, 108, 108, 111]); 171 stream.add([104, 101, 108, 108, 111]);
172 stream.close(); 172 stream.close();
173 }); 173 });
174 174
175 test('with an empty stream file', () { 175 test('with an empty stream file', () {
176 var request = new http.MultipartRequest('POST', dummyUrl); 176 var request = new http.MultipartRequest('POST', dummyUrl);
177 var stream = new StreamController.singleSubscription(); 177 var stream = new StreamController();
178 request.files.add(new http.MultipartFile('file', stream, 0)); 178 request.files.add(new http.MultipartFile('file', stream, 0));
179 179
180 expect(request, bodyMatches(''' 180 expect(request, bodyMatches('''
181 --{{boundary}} 181 --{{boundary}}
182 content-type: application/octet-stream 182 content-type: application/octet-stream
183 content-disposition: form-data; name="file" 183 content-disposition: form-data; name="file"
184 184
185 185
186 --{{boundary}}-- 186 --{{boundary}}--
187 ''')); 187 '''));
(...skipping 10 matching lines...) Expand all
198 expect(request, bodyMatches(''' 198 expect(request, bodyMatches('''
199 --{{boundary}} 199 --{{boundary}}
200 content-type: application/octet-stream 200 content-type: application/octet-stream
201 content-disposition: form-data; name="file" 201 content-disposition: form-data; name="file"
202 202
203 hello 203 hello
204 --{{boundary}}-- 204 --{{boundary}}--
205 ''')); 205 '''));
206 }); 206 });
207 } 207 }
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