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

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

Issue 424063002: Add 'pathPrefix' optional argument to VirtualDirectory constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Push version. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http_server/pubspec.yaml ('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 b95abdc2878ab694e8cd29640a51d6b19c790a0f..bc054622ae426a64522f2452def3aee40c45162f 100644
--- a/pkg/http_server/test/virtual_directory_test.dart
+++ b/pkg/http_server/test/virtual_directory_test.dart
@@ -305,6 +305,44 @@ void main() {
});
});
});
+
+ group('path-prefix', () {
+ testVirtualDir('simple', (dir) {
+ var virDir = new VirtualDirectory(dir.path, pathPrefix: '/path');
+ virDir.allowDirectoryListing = true;
+ virDir.directoryHandler = (d, request) {
+ expect(FileSystemEntity.identicalSync(dir.path, d.path), isTrue);
+ return request.response.close();
+ };
+
+ return getStatusCodeForVirtDir(virDir, '/path')
+ .then((result) {
+ expect(result, HttpStatus.OK);
+ });
+ });
+
+ testVirtualDir('trailing-slash', (dir) {
+ var virDir = new VirtualDirectory(dir.path, pathPrefix: '/path/');
+ virDir.allowDirectoryListing = true;
+ virDir.directoryHandler = (d, request) {
+ expect(FileSystemEntity.identicalSync(dir.path, d.path), isTrue);
+ return request.response.close();
+ };
+
+ return getStatusCodeForVirtDir(virDir, '/path')
+ .then((result) {
+ expect(result, HttpStatus.OK);
+ });
+ });
+
+ testVirtualDir('not-matching', (dir) {
+ var virDir = new VirtualDirectory(dir.path, pathPrefix: '/path/');
+ return getStatusCodeForVirtDir(virDir, '/')
+ .then((result) {
+ expect(result, HttpStatus.NOT_FOUND);
+ });
+ });
+ });
});
group('links', () {
« no previous file with comments | « pkg/http_server/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698