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

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

Issue 10447060: Handle native paths in test wrappers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tools/testing/dart/browser_test.dart
diff --git a/dart/tools/testing/dart/browser_test.dart b/dart/tools/testing/dart/browser_test.dart
index b429b061511b047a522f9c2ad5bd24741b75f550..e87b30e9f02dd233a4e8dc2913e373ac64031bf8 100644
--- a/dart/tools/testing/dart/browser_test.dart
+++ b/dart/tools/testing/dart/browser_test.dart
@@ -51,14 +51,31 @@ String GetHtmlContents(String title,
</html>
""";
+/**
+ * Returns the native [path] converted for use in a URI.
+ */
+nativePathToUri(String path) {
+ // This regexp matches Windows-like file names. Strictly speaking,
+ // this prevents us from having a file named a:something on Linux,
+ // but since this wrapping is a hack in the first place, it seems
+ // better to exercise this path on all architectures.
+ final re = const RegExp('^[a-z]:', ignoreCase: true);
+ if (re.hasMatch(path)) {
+ path = '/$path';
+ }
+ return path.replaceAll('\\', '/');
+}
+
String WrapDartTestInLibrary(String test) =>
"""
#library('libraryWrapper');
-#source('$test');
+#source('${nativePathToUri(test)}');
""";
-String DartTestWrapper(String dartHome, String library) =>
-"""
+String DartTestWrapper(String dartHome, String library) {
+ dartHome = nativePathToUri(dartHome);
+ library = nativePathToUri(library);
+return """
#library('test');
#import('${dartHome}/lib/unittest/unittest.dart', prefix: 'unittest');
@@ -77,3 +94,4 @@ main() {
}
}
""";
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698