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

Unified Diff: pkg/http_server/test/virtual_directory_test.dart

Issue 47513008: Expose 'serveFile' on VirtualDirectory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Expand documentation Created 7 years, 2 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_server/lib/src/virtual_directory.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http_server/test/virtual_directory_test.dart
diff --git a/pkg/http_server/test/virtual_directory_test.dart b/pkg/http_server/test/virtual_directory_test.dart
index a368c73ea4027fdfb3ee87bd1780f90f53ba85da..027f04495086790b5416256d3da1f76787fd8d56 100644
--- a/pkg/http_server/test/virtual_directory_test.dart
+++ b/pkg/http_server/test/virtual_directory_test.dart
@@ -669,5 +669,28 @@ void main() {
testEncoding('%2f', HttpStatus.NOT_FOUND, false);
testEncoding('%2f', HttpStatus.OK, true);
});
+
+ group('serve-file', () {
+ test('from-dir-handler', () {
+ expect(HttpServer.bind('localhost', 0).then((server) {
+ var dir = Directory.systemTemp.createTempSync('http_server_virtual_');
+ new File('${dir.path}/file')..writeAsStringSync('file contents');
+ var virDir = new VirtualDirectory(dir.path);
+ virDir.allowDirectoryListing = true;
+ virDir.directoryHandler = (d, request) {
+ expect(FileSystemEntity.identicalSync(dir.path, d.path), isTrue);
+ virDir.serveFile(new File('${d.path}/file'), request);
+ };
+
+ virDir.serve(server);
+
+ return getAsString(server.port, '/')
+ .whenComplete(() {
+ server.close();
+ dir.deleteSync(recursive: true);
+ });
+ }), completion(equals('file contents')));
+ });
+ });
}
« no previous file with comments | « pkg/http_server/lib/src/virtual_directory.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698