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

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

Issue 124833003: pkg/http_server: return future for VirtualDirectory serveRequest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: docs and cleanup for mock logic in tests Created 6 years, 11 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"; 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return getAsString(virDir, '/') 185 return getAsString(virDir, '/')
186 .then((result) { 186 .then((result) {
187 expect(result, 'index file'); 187 expect(result, 'index file');
188 }); 188 });
189 }); 189 });
190 190
191 testVirtualDir('index-2', (dir) { 191 testVirtualDir('index-2', (dir) {
192 new Directory('${dir.path}/dir').createSync(); 192 new Directory('${dir.path}/dir').createSync();
193 var virDir = new VirtualDirectory(dir.path); 193 var virDir = new VirtualDirectory(dir.path);
194 virDir.allowDirectoryListing = true; 194 virDir.allowDirectoryListing = true;
195 virDir.directoryHandler = (dir2, request) { 195
196 virDir.directoryHandler = protectAsync2((dir2, request) {
196 fail('not expected'); 197 fail('not expected');
197 }; 198 });
199
198 return getStatusCodeForVirtDir(virDir, '/dir', followRedirects: false) 200 return getStatusCodeForVirtDir(virDir, '/dir', followRedirects: false)
199 .then((result) { 201 .then((result) {
200 expect(result, 301); 202 expect(result, 301);
201 }); 203 });
202 }); 204 });
203 205
204 testVirtualDir('index-3', (dir) { 206 testVirtualDir('index-3', (dir) {
205 new File('${dir.path}/dir/index.html') 207 new File('${dir.path}/dir/index.html')
206 ..createSync(recursive: true) 208 ..createSync(recursive: true)
207 ..writeAsStringSync('index file'); 209 ..writeAsStringSync('index file');
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 return virDir.serveFile(new File('${d.path}/file'), request); 530 return virDir.serveFile(new File('${d.path}/file'), request);
529 }; 531 };
530 532
531 return getAsString(virDir, '/') 533 return getAsString(virDir, '/')
532 .then((result) { 534 .then((result) {
533 expect(result, 'file contents'); 535 expect(result, 'file contents');
534 }); 536 });
535 }); 537 });
536 }); 538 });
537 } 539 }
OLDNEW
« pkg/http_server/test/http_mock.dart ('K') | « pkg/http_server/test/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698