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

Side by Side Diff: pkg/http_server/test/http_multipart_test.dart

Issue 18438005: Move MimeMultipartTransformer and HttpBodyHandler to mime and http_server packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove import. Created 7 years, 5 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_server/test/http_body_test.dart ('k') | pkg/mime/lib/mime.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) 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 //
5 // VMOptions=
6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write
9 4
10 import "package:expect/expect.dart"; 5 import "package:http_server/http_server.dart";
6 import "package:mime/mime.dart";
7 import "package:unittest/unittest.dart";
11 import 'dart:async'; 8 import 'dart:async';
12 import 'dart:io'; 9 import 'dart:io';
13 10
14 class FormField { 11 class FormField {
15 final String name; 12 final String name;
16 final value; 13 final value;
17 final String contentType; 14 final String contentType;
18 final String filename; 15 final String filename;
19 16
20 FormField(String this.name, 17 FormField(String this.name,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 multipart.contentDisposition.parameters['name'], 66 multipart.contentDisposition.parameters['name'],
70 data, 67 data,
71 contentType: contentType, 68 contentType: contentType,
72 filename: 69 filename:
73 multipart.contentDisposition.parameters['filename']); 70 multipart.contentDisposition.parameters['filename']);
74 }); 71 });
75 }) 72 })
76 .fold([], (l, f) => l..add(f)) 73 .fold([], (l, f) => l..add(f))
77 .then(Future.wait) 74 .then(Future.wait)
78 .then((fields) { 75 .then((fields) {
79 Expect.listEquals(expectedFields, fields); 76 expect(fields, equals(expectedFields));
80 request.response.close().then((_) => server.close()); 77 request.response.close().then((_) => server.close());
81 }); 78 });
82 }); 79 });
83 var client = new HttpClient(); 80 var client = new HttpClient();
84 client.post('127.0.0.1', server.port, '/') 81 client.post('127.0.0.1', server.port, '/')
85 .then((request) { 82 .then((request) {
86 request.headers.set('content-type', 83 request.headers.set('content-type',
87 'multipart/form-data; boundary=$boundary'); 84 'multipart/form-data; boundary=$boundary');
88 request.add(message); 85 request.add(message);
89 return request.close(); 86 return request.close();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 postDataTest(message, 188 postDataTest(message,
192 'multipart/form-data', 189 'multipart/form-data',
193 '----WebKitFormBoundaryfe0EzV1aNysD1bPh', 190 '----WebKitFormBoundaryfe0EzV1aNysD1bPh',
194 [new FormField('name', 'øv')]); 191 [new FormField('name', 'øv')]);
195 } 192 }
196 193
197 194
198 void main() { 195 void main() {
199 testPostData(); 196 testPostData();
200 } 197 }
OLDNEW
« no previous file with comments | « pkg/http_server/test/http_body_test.dart ('k') | pkg/mime/lib/mime.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698