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

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

Issue 23054008: Remove the Path class from dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed first round of review comments Created 7 years, 4 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
OLDNEW
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";
9 import "package:path/path.dart";
8 import "package:unittest/unittest.dart"; 10 import "package:unittest/unittest.dart";
9 import "package:http_server/http_server.dart";
10 11
11 import 'utils.dart'; 12 import 'utils.dart';
12 13
13 14
14 void main() { 15 void main() {
15 group('serve-root', () { 16 group('serve-root', () {
16 test('dir-exists', () { 17 test('dir-exists', () {
17 expect(HttpServer.bind('localhost', 0).then((server) { 18 expect(HttpServer.bind('localhost', 0).then((server) {
18 var dir = new Directory('').createTempSync(); 19 var dir = new Directory('').createTempSync();
19 var virDir = new VirtualDirectory(dir.path); 20 var virDir = new VirtualDirectory(dir.path);
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 .whenComplete(() { 290 .whenComplete(() {
290 server.close(); 291 server.close();
291 dir.deleteSync(recursive: true); 292 dir.deleteSync(recursive: true);
292 }); 293 });
293 }), completion(equals(HttpStatus.NOT_FOUND))); 294 }), completion(equals(HttpStatus.NOT_FOUND)));
294 }); 295 });
295 296
296 test('relative-parent-link', () { 297 test('relative-parent-link', () {
297 expect(HttpServer.bind('localhost', 0).then((server) { 298 expect(HttpServer.bind('localhost', 0).then((server) {
298 var dir = new Directory('').createTempSync(); 299 var dir = new Directory('').createTempSync();
299 var name = new Path(dir.path).filename; 300 var name = basename(dir.path);
300 var file = new File('${dir.path}/file')..createSync(); 301 var file = new File('${dir.path}/file')..createSync();
301 var link = new Link('${dir.path}/dir3') 302 var link = new Link('${dir.path}/dir3')
302 ..createSync('../$name/file'); 303 ..createSync('../$name/file');
303 var virDir = new VirtualDirectory(dir.path); 304 var virDir = new VirtualDirectory(dir.path);
304 virDir.followLinks = true; 305 virDir.followLinks = true;
305 306
306 virDir.serve(server); 307 virDir.serve(server);
307 308
308 return new HttpClient().get('localhost', 309 return new HttpClient().get('localhost',
309 server.port, 310 server.port,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 601 }
601 testEncoding('..', HttpStatus.NOT_FOUND, false); 602 testEncoding('..', HttpStatus.NOT_FOUND, false);
602 testEncoding('%2e%2e', HttpStatus.OK); 603 testEncoding('%2e%2e', HttpStatus.OK);
603 testEncoding('%252e%252e', HttpStatus.OK); 604 testEncoding('%252e%252e', HttpStatus.OK);
604 testEncoding('/', HttpStatus.OK, false); 605 testEncoding('/', HttpStatus.OK, false);
605 testEncoding('%2f', HttpStatus.NOT_FOUND, false); 606 testEncoding('%2f', HttpStatus.NOT_FOUND, false);
606 testEncoding('%2f', HttpStatus.OK, true); 607 testEncoding('%2f', HttpStatus.OK, true);
607 }); 608 });
608 } 609 }
609 610
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698