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

Unified Diff: tools/testing/dart/http_server.dart

Issue 2994073002: Remove support for "packages" URL from testing server. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/testing/dart/configuration.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/http_server.dart
diff --git a/tools/testing/dart/http_server.dart b/tools/testing/dart/http_server.dart
index d76aa4fd40d9a9a9347abdfbc997375001a324eb..ede8f1e9e70bb67bf4a6623f0c8f0f67dd816d7c 100644
--- a/tools/testing/dart/http_server.dart
+++ b/tools/testing/dart/http_server.dart
@@ -6,8 +6,6 @@ import 'dart:async';
import 'dart:convert' show HtmlEscape;
import 'dart:io';
-import 'package:package_resolver/package_resolver.dart';
-
import 'configuration.dart';
import 'vendored_pkg/args/args.dart';
import 'utils.dart';
@@ -47,10 +45,6 @@ class DispatchingServer {
/// directory (i.e. '$DartDirectory/X').
/// /root_build/X: This will serve the corresponding file from the build
/// directory (i.e. '$BuildDirectory/X').
-/// /FOO/packages/PAZ/BAR: This will serve files from the packages listed in
-/// the package spec .packages. Supports a package
-/// root or custom package spec, and uses [dart_dir]/.packages
-/// as the default. This will serve file lib/BAR from the package PAZ.
/// /ws: This will upgrade the connection to a WebSocket connection and echo
/// all data back to the client.
///
@@ -76,8 +70,8 @@ void main(List<String> arguments) {
parser.addFlag('help',
abbr: 'h', negatable: false, help: 'Print this usage information.');
parser.addOption('build-directory', help: 'The build directory to use.');
- parser.addOption('package-root', help: 'The package root to use.');
- parser.addOption('packages', help: 'The package spec file to use.');
+ parser.addOption('package-root', help: 'Obsolete unsupported option');
+ parser.addOption('packages', help: 'Obsolete unsupported option');
parser.addOption('network',
help: 'The network interface to use.', defaultsTo: '0.0.0.0');
parser.addFlag('csp',
@@ -89,13 +83,8 @@ void main(List<String> arguments) {
if (args['help'] as bool) {
print(parser.getUsage());
} else {
- var servers = new TestingServers(
- args['build-directory'] as String,
- args['csp'] as bool,
- Runtime.find(args['runtime'] as String),
- null,
- args['package-root'] as String,
- args['packages'] as String);
+ var servers = new TestingServers(args['build-directory'] as String,
+ args['csp'] as bool, Runtime.find(args['runtime'] as String), null);
var port = int.parse(args['port'] as String);
var crossOriginPort = int.parse(args['crossOriginPort'] as String);
servers
@@ -110,7 +99,7 @@ void main(List<String> arguments) {
/**
* Runs a set of servers that are initialized specifically for the needs of our
- * test framework, such as dealing with package-root.
+ * test framework.
*/
class TestingServers {
static final _CACHE_EXPIRATION_IN_SECONDS = 30;
@@ -127,33 +116,18 @@ class TestingServers {
final List<HttpServer> _serverList = [];
Uri _buildDirectory;
Uri _dartDirectory;
- Uri _packageRoot;
- Uri _packages;
final bool useContentSecurityPolicy;
final Runtime runtime;
DispatchingServer _server;
- SyncPackageResolver _resolver;
TestingServers(String buildDirectory, this.useContentSecurityPolicy,
- [this.runtime = Runtime.none,
- String dartDirectory,
- String packageRoot,
- String packages]) {
+ [this.runtime = Runtime.none, String dartDirectory]) {
_buildDirectory = Uri.base.resolveUri(new Uri.directory(buildDirectory));
if (dartDirectory == null) {
_dartDirectory = TestUtils.dartDirUri;
} else {
_dartDirectory = Uri.base.resolveUri(new Uri.directory(dartDirectory));
}
- if (packageRoot == null) {
- if (packages == null) {
- _packages = _dartDirectory.resolve('.packages');
- } else {
- _packages = new Uri.file(packages);
- }
- } else {
- _packageRoot = new Uri.directory(packageRoot);
- }
}
int get port => _serverList[0].port;
@@ -170,11 +144,6 @@ class TestingServers {
*/
Future startServers(String host,
{int port: 0, int crossOriginPort: 0}) async {
- if (_packages != null) {
- _resolver = await SyncPackageResolver.loadConfig(_packages);
- } else {
- _resolver = new SyncPackageResolver.root(_packageRoot);
- }
_server = await _startHttpServer(host, port: port);
await _startHttpServer(host,
port: crossOriginPort, allowedPort: _serverList[0].port);
@@ -197,11 +166,6 @@ class TestingServers {
if (useContentSecurityPolicy) {
command.add('--csp');
}
- if (_packages != null) {
- command.add('--packages=${_packages.toFilePath()}');
- } else if (_packageRoot != null) {
- command.add('--package-root=${_packageRoot.toFilePath()}');
- }
return command.join(' ');
}
@@ -227,7 +191,6 @@ class TestingServers {
server.addHandler('/$PREFIX_BUILDDIR', fileHandler);
server.addHandler('/$PREFIX_DARTDIR', fileHandler);
- server.addHandler('/packages', fileHandler);
_serverList.add(httpServer);
return server;
});
@@ -300,13 +263,6 @@ class TestingServers {
// Go to the top of the file to see an explanation of the URL path scheme.
List<String> pathSegments = request.normalizePath().pathSegments;
if (pathSegments.length == 0) return null;
- int packagesIndex = pathSegments.indexOf('packages');
- if (packagesIndex != -1) {
- var packageUri = new Uri(
- scheme: 'package',
- pathSegments: pathSegments.skip(packagesIndex + 1));
- return _resolver.resolveUri(packageUri);
- }
if (pathSegments[0] == PREFIX_BUILDDIR) {
return _buildDirectory.resolve(pathSegments.skip(1).join('/'));
}
« no previous file with comments | « tools/testing/dart/configuration.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698