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

Unified Diff: lib/src/runner/loader.dart

Issue 1076803003: Change the URL-space exposed by the browser server. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Changelog + pubspec Created 5 years, 8 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
Index: lib/src/runner/loader.dart
diff --git a/lib/src/runner/loader.dart b/lib/src/runner/loader.dart
index afff40a5544d3fd99a3228a7d783c15ee01628e4..475e10d5f277024a6c4a9c281b9928362d033ae5 100644
--- a/lib/src/runner/loader.dart
+++ b/lib/src/runner/loader.dart
@@ -32,6 +32,9 @@ class Loader {
/// Whether to enable colors for Dart compilation.
final bool _color;
+ /// The root directory that will be served for browser tests.
+ final String _root;
+
/// The package root to use for loading tests, or `null` to use the automatic
/// root.
final String _packageRoot;
@@ -51,6 +54,7 @@ class Loader {
if (_browserServerCompleter == null) {
_browserServerCompleter = new Completer();
BrowserServer.start(
+ root: _root,
packageRoot: _packageRoot,
pubServeUrl: _pubServeUrl,
color: _color)
@@ -63,6 +67,9 @@ class Loader {
/// Creates a new loader.
///
+ /// [root] is the root directory that will be served for browser tests. It
+ /// defaults to the working directory.
+ ///
/// If [packageRoot] is passed, it's used as the package root for all loaded
/// tests. Otherwise, the `packages/` directories next to the test entrypoints
/// will be used.
@@ -71,10 +78,11 @@ class Loader {
/// instance at that URL rather than from the filesystem.
///
/// If [color] is true, console colors will be used when compiling Dart.
- Loader(Iterable<TestPlatform> platforms, {String packageRoot,
+ Loader(Iterable<TestPlatform> platforms, {String root, String packageRoot,
Uri pubServeUrl, bool color: false})
: _platforms = platforms.toList(),
_pubServeUrl = pubServeUrl,
+ _root = root == null ? p.current : root,
_packageRoot = packageRoot,
_color = color;
@@ -154,8 +162,7 @@ class Loader {
return new Future.sync(() {
if (_pubServeUrl != null) {
var url = _pubServeUrl.resolve(
- p.withoutExtension(p.relative(path, from: 'test')) +
- '.vm_test.dart');
+ p.relative(path, from: 'test') + '.vm_test.dart');
return Isolate.spawnUri(url, [], {'reply': receivePort.sendPort})
.then((isolate) => new IsolateWrapper(isolate, () {}))
.catchError((error, stackTrace) {

Powered by Google App Engine
This is Rietveld 408576698