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

Unified Diff: pkg/http/test/io/multipart_test.dart

Issue 261763002: Rip out the last dart:io dependency from pkg/http. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http/test/io/http_test.dart ('k') | pkg/http/test/io/request_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/test/io/multipart_test.dart
diff --git a/pkg/http/test/io/multipart_test.dart b/pkg/http/test/io/multipart_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6b5c5233bad9ea2a9be5d5394f9f461426fc73bf
--- /dev/null
+++ b/pkg/http/test/io/multipart_test.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library http.test.io.multipart_test;
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:http/http.dart' as http;
+import 'package:path/path.dart' as path;
+import 'package:unittest/unittest.dart';
+
+import 'utils.dart';
+
+void main() {
+ var tempDir;
+ setUp(() {
+ tempDir = Directory.systemTemp.createTempSync('http_test_');
+ });
+
+ tearDown(() => tempDir.deleteSync(recursive: true));
+
+ test('with a file from disk', () {
+ expect(new Future.sync(() {
+ var filePath = path.join(tempDir.path, 'test-file');
+ new File(filePath).writeAsStringSync('hello');
+ return http.MultipartFile.fromPath('file', filePath);
+ }).then((file) {
+ var request = new http.MultipartRequest('POST', dummyUrl);
+ request.files.add(file);
+
+ expect(request, bodyMatches('''
+ --{{boundary}}
+ content-type: application/octet-stream
+ content-disposition: form-data; name="file"; filename="test-file"
+
+ hello
+ --{{boundary}}--
+ '''));
+ }), completes);
+ });
+}
« no previous file with comments | « pkg/http/test/io/http_test.dart ('k') | pkg/http/test/io/request_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698