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

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

Issue 18050017: Don't test links on windows, for http_server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:unittest/unittest.dart"; 8 import "package:unittest/unittest.dart";
9 import "package:http_server/http_server.dart"; 9 import "package:http_server/http_server.dart";
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 virDir.serve(server); 164 virDir.serve(server);
165 165
166 return getAsString(server.port, '/') 166 return getAsString(server.port, '/')
167 .whenComplete(() { 167 .whenComplete(() {
168 server.close(); 168 server.close();
169 dir.deleteSync(recursive: true); 169 dir.deleteSync(recursive: true);
170 }); 170 });
171 }), completion(contains('Index of /'))); 171 }), completion(contains('Index of /')));
172 }); 172 });
173 173
174 test('recursive-link', () { 174 if (!Platform.isWindows) {
175 expect(HttpServer.bind('localhost', 0).then((server) { 175 test('recursive-link', () {
176 var dir = new Directory('').createTempSync(); 176 expect(HttpServer.bind('localhost', 0).then((server) {
177 var link = new Link('${dir.path}/recursive')..createSync('.'); 177 var dir = new Directory('').createTempSync();
178 var virDir = new VirtualDirectory(dir.path); 178 var link = new Link('${dir.path}/recursive')..createSync('.');
179 virDir.allowDirectoryListing = true; 179 var virDir = new VirtualDirectory(dir.path);
180 virDir.allowDirectoryListing = true;
180 181
181 virDir.serve(server); 182 virDir.serve(server);
182 183
183 return Future.wait([ 184 return Future.wait([
184 getAsString(server.port, '/').then( 185 getAsString(server.port, '/').then(
185 (s) => s.contains('recursive/')), 186 (s) => s.contains('recursive/')),
186 getAsString(server.port, '/').then( 187 getAsString(server.port, '/').then(
187 (s) => !s.contains('../')), 188 (s) => !s.contains('../')),
188 getAsString(server.port, '/').then( 189 getAsString(server.port, '/').then(
189 (s) => s.contains('Index of /')), 190 (s) => s.contains('Index of /')),
190 getAsString(server.port, '/recursive').then( 191 getAsString(server.port, '/recursive').then(
191 (s) => s.contains('recursive/')), 192 (s) => s.contains('recursive/')),
192 getAsString(server.port, '/recursive').then( 193 getAsString(server.port, '/recursive').then(
193 (s) => s.contains('../')), 194 (s) => s.contains('../')),
194 getAsString(server.port, '/recursive').then( 195 getAsString(server.port, '/recursive').then(
195 (s) => s.contains('Index of /recursive'))]) 196 (s) => s.contains('Index of /recursive'))])
196 .whenComplete(() { 197 .whenComplete(() {
197 server.close(); 198 server.close();
198 dir.deleteSync(recursive: true); 199 dir.deleteSync(recursive: true);
199 }); 200 });
200 }), completion(equals([true, true, true, true, true, true]))); 201 }), completion(equals([true, true, true, true, true, true])));
201 }); 202 });
203 }
202 }); 204 });
203 205
204 group('custom', () { 206 group('custom', () {
205 test('simple', () { 207 test('simple', () {
206 expect(HttpServer.bind('localhost', 0).then((server) { 208 expect(HttpServer.bind('localhost', 0).then((server) {
207 var dir = new Directory('').createTempSync(); 209 var dir = new Directory('').createTempSync();
208 var virDir = new VirtualDirectory(dir.path); 210 var virDir = new VirtualDirectory(dir.path);
209 virDir.allowDirectoryListing = true; 211 virDir.allowDirectoryListing = true;
210 virDir.setDirectoryHandler((dir2, request) { 212 virDir.setDirectoryHandler((dir2, request) {
211 expect(dir2, isNotNull); 213 expect(dir2, isNotNull);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 471
470 return getAsString(server.port, '/') 472 return getAsString(server.port, '/')
471 .whenComplete(() { 473 .whenComplete(() {
472 server.close(); 474 server.close();
473 }); 475 });
474 }), completion(equals('my-page 404'))); 476 }), completion(equals('my-page 404')));
475 }); 477 });
476 }); 478 });
477 } 479 }
478 480
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698