| OLD | NEW |
| 1 // Copyright (c) 2013, 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 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import "package:http_server/http_server.dart"; | 8 import "package:http_server/http_server.dart"; |
| 9 import 'package:path/path.dart' as pathos; | 9 import 'package:path/path.dart' as pathos; |
| 10 import "package:unittest/unittest.dart"; | 10 import "package:unittest/unittest.dart"; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 (s) => s.contains('../')), | 159 (s) => s.contains('../')), |
| 160 getAsString(virDir, '/recursive').then( | 160 getAsString(virDir, '/recursive').then( |
| 161 (s) => s.contains('Index of /recursive'))]) | 161 (s) => s.contains('Index of /recursive'))]) |
| 162 .then((result) { | 162 .then((result) { |
| 163 expect(result, equals([true, true, true, true, true, true])); | 163 expect(result, equals([true, true, true, true, true, true])); |
| 164 }); | 164 }); |
| 165 }); | 165 }); |
| 166 | 166 |
| 167 testVirtualDir('encoded-path', (dir) { | 167 testVirtualDir('encoded-path', (dir) { |
| 168 var virDir = new VirtualDirectory(dir.path); | 168 var virDir = new VirtualDirectory(dir.path); |
| 169 new Directory('${dir.path}/javascript:alert(document);"').createSync()
; | 169 new Directory('${dir.path}/javascript:alert(document);"') |
| 170 .createSync(); |
| 170 virDir.allowDirectoryListing = true; | 171 virDir.allowDirectoryListing = true; |
| 171 | 172 |
| 172 return getAsString(virDir, '/') | 173 return getAsString(virDir, '/') |
| 173 .then((result) { | 174 .then((result) { |
| 174 expect(result, contains('%2Fjavascript%3Aalert(document)%3B%22')); | 175 expect(result, contains('%2Fjavascript%3Aalert(document)%3B%22')); |
| 175 }); | 176 }); |
| 176 }); | 177 }); |
| 177 | 178 |
| 178 testVirtualDir('encoded-special', (dir) { | 179 testVirtualDir('encoded-special', (dir) { |
| 179 var virDir = new VirtualDirectory(dir.path); | 180 var virDir = new VirtualDirectory(dir.path); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 return virDir.serveFile(new File('${d.path}/file'), request); | 565 return virDir.serveFile(new File('${d.path}/file'), request); |
| 565 }; | 566 }; |
| 566 | 567 |
| 567 return getAsString(virDir, '/') | 568 return getAsString(virDir, '/') |
| 568 .then((result) { | 569 .then((result) { |
| 569 expect(result, 'file contents'); | 570 expect(result, 'file contents'); |
| 570 }); | 571 }); |
| 571 }); | 572 }); |
| 572 }); | 573 }); |
| 573 } | 574 } |
| OLD | NEW |