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

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

Issue 12225109: Revert "Change the location of the output directory" plus one other fix. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « tools/test-runtime.dart ('k') | tools/testing/dart/http_server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/browser_test.dart
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index ad9f972cb3ed4e1e9ee455bb5343dfd273d65334..6bfc93af5e715e9c1dcf3f80e3ea6d62203d3f7e 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -5,6 +5,8 @@
part of test_suite;
String getHtmlContents(String title,
+ Path controllerScript,
+ Path dartJsScript,
String scriptType,
Path sourceScript) =>
"""
@@ -22,11 +24,10 @@ String getHtmlContents(String title,
</head>
<body>
<h1> Running $title </h1>
- <script type="text/javascript" src="/pkg/unittest/lib/test_controller.js">
- </script>
+ <script type="text/javascript" src="$controllerScript"></script>
<script type="$scriptType" src="$sourceScript" onerror="externalError(null)">
</script>
- <script type="text/javascript" src="/pkg/browser/lib/dart.js"></script>
+ <script type="text/javascript" src="$dartJsScript"></script>
</body>
</html>
""";
@@ -47,27 +48,37 @@ String getHtmlLayoutContents(String scriptType, String sourceScript) =>
</html>
""";
-String wrapDartTestInLibrary(Path testRelativeToDart) =>
+String wrapDartTestInLibrary(Path test, String testPath) =>
"""
library libraryWrapper;
-part '/$testRelativeToDart';
+part '${pathLib.relative(test.toNativePath(),
+ from: pathLib.dirname(testPath)).replaceAll('\\', '\\\\')}';
""";
-String dartTestWrapper(bool usePackageImport, String libraryPathComponent) {
+String dartTestWrapper(Path dartHome, String testPath, Path library) {
+ var testPathDir = pathLib.dirname(testPath);
+ var dartHomePath = dartHome.toNativePath();
+ // TODO(efortuna): Unify path libraries used in test.dart.
+ var unitTest = pathLib.relative(pathLib.join(dartHomePath,
+ 'pkg/unittest/lib'), from: testPathDir).replaceAll('\\', '\\\\');
+
+ var libString = library.toNativePath();
+ if (!pathLib.isAbsolute(libString)) {
+ libString = pathLib.join(dartHome.toNativePath(), libString);
+ }
// Tests inside "pkg" import unittest using "package:". All others use a
// relative path. The imports need to agree, so use a matching form here.
- var unitTest;
- if (usePackageImport) {
+ if (pathLib.split(pathLib.relative(libString,
+ from: dartHome.toNativePath())).contains("pkg")) {
unitTest = 'package:unittest';
- } else {
- unitTest = '/pkg/unittest/lib';
}
return """
library test;
import '$unitTest/unittest.dart' as unittest;
import '$unitTest/html_config.dart' as config;
-import '$libraryPathComponent' as Test;
+import '${pathLib.relative(libString, from: testPathDir).replaceAll(
+ '\\', '\\\\')}' as Test;
main() {
config.useHtmlConfiguration();
« no previous file with comments | « tools/test-runtime.dart ('k') | tools/testing/dart/http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698