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

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

Issue 979513002: pkg/unittest: Add a server for serving test assets to browsers. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Fix libDir. Created 5 years, 10 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 | « lib/src/runner/browser/static/host.dart.js.map ('k') | lib/src/util/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/loader.dart
diff --git a/lib/src/runner/loader.dart b/lib/src/runner/loader.dart
index a68e63edbb00ff5f3bee744b813738848415708b..79a2fbfd683cfa14e0eb729862f7704f6e5152a9 100644
--- a/lib/src/runner/loader.dart
+++ b/lib/src/runner/loader.dart
@@ -55,14 +55,7 @@ class Loader {
/// This will throw a [LoadException] if the file fails to load.
Future<Suite> loadFile(String path) {
// TODO(nweiz): Support browser tests.
- var packageRoot = _packageRoot == null
- ? p.join(p.dirname(path), 'packages')
- : _packageRoot;
-
- if (!new Directory(packageRoot).existsSync()) {
- throw new LoadException(path, "Directory $packageRoot does not exist.");
- }
-
+ var packageRoot = packageRootFor(path, _packageRoot);
var receivePort = new ReceivePort();
return runInIsolate('''
import "package:unittest/src/runner/vm/isolate_listener.dart";
@@ -75,7 +68,8 @@ void main(_, Map message) {
}
''', {
'reply': receivePort.sendPort
- }, packageRoot: packageRoot).catchError((error, stackTrace) {
+ }, packageRoot: packageRoot)
+ .catchError((error, stackTrace) {
receivePort.close();
return new Future.error(new LoadException(path, error), stackTrace);
}).then((isolate) {
« no previous file with comments | « lib/src/runner/browser/static/host.dart.js.map ('k') | lib/src/util/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698