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

Side by Side Diff: tools/testing/dart/http_server.dart

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 9 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library http_server; 5 library http_server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:uri'; 10 import 'dart:uri';
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 Path _getFilePathFromRequestPath(String urlRequestPath) { 182 Path _getFilePathFromRequestPath(String urlRequestPath) {
183 // Go to the top of the file to see an explanation of the URL path scheme. 183 // Go to the top of the file to see an explanation of the URL path scheme.
184 var requestPath = new Path(urlRequestPath.substring(1)).canonicalize(); 184 var requestPath = new Path(urlRequestPath.substring(1)).canonicalize();
185 var pathSegments = requestPath.segments(); 185 var pathSegments = requestPath.segments();
186 if (pathSegments.length > 0) { 186 if (pathSegments.length > 0) {
187 var basePath; 187 var basePath;
188 var relativePath; 188 var relativePath;
189 if (pathSegments[0] == PREFIX_BUILDDIR) { 189 if (pathSegments[0] == PREFIX_BUILDDIR) {
190 basePath = _buildDirectory; 190 basePath = _buildDirectory;
191 relativePath = new Path( 191 relativePath = new Path(
192 pathSegments.getRange(1, pathSegments.length - 1).join('/')); 192 pathSegments.skip(1).join('/'));
193 } else if (pathSegments[0] == PREFIX_DARTDIR) { 193 } else if (pathSegments[0] == PREFIX_DARTDIR) {
194 basePath = TestUtils.dartDir(); 194 basePath = TestUtils.dartDir();
195 relativePath = new Path( 195 relativePath = new Path(
196 pathSegments.getRange(1, pathSegments.length - 1).join('/')); 196 pathSegments.skip(1).join('/'));
197 } 197 }
198 var packagesDirName = 'packages'; 198 var packagesDirName = 'packages';
199 var packagesIndex = pathSegments.indexOf(packagesDirName); 199 var packagesIndex = pathSegments.indexOf(packagesDirName);
200 if (packagesIndex != -1) { 200 if (packagesIndex != -1) {
201 var start = packagesIndex + 1; 201 var start = packagesIndex + 1;
202 var length = pathSegments.length - start;
203 basePath = _buildDirectory.append(packagesDirName); 202 basePath = _buildDirectory.append(packagesDirName);
204 relativePath = new Path( 203 relativePath = new Path(pathSegments.skip(start).join('/'));
205 pathSegments.getRange(start, length).join('/'));
206 } 204 }
207 if (basePath != null && relativePath != null) { 205 if (basePath != null && relativePath != null) {
208 return basePath.join(relativePath); 206 return basePath.join(relativePath);
209 } 207 }
210 } 208 }
211 return null; 209 return null;
212 } 210 }
213 211
214 Future<List<_Entry>> _listDirectory(Directory directory) { 212 Future<List<_Entry>> _listDirectory(Directory directory) {
215 var completer = new Completer(); 213 var completer = new Completer();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 class _Entry { 321 class _Entry {
324 final String name; 322 final String name;
325 final String displayName; 323 final String displayName;
326 324
327 _Entry(this.name, this.displayName); 325 _Entry(this.name, this.displayName);
328 326
329 int compareTo(_Entry other) { 327 int compareTo(_Entry other) {
330 return name.compareTo(other.name); 328 return name.compareTo(other.name);
331 } 329 }
332 } 330 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698