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

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

Issue 11641005: Add cross-origin test with credentials. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 12 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: tools/testing/dart/browser_test.dart
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index b47bbf8ed1faefbd0dbe5688cee465c19b686262..6ef2a01d26fe884f9943da40398527cdb628dc7e 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -54,25 +54,27 @@ library libraryWrapper;
part '$test';
""";
-String dartTestWrapper(Path dartHome, Path library) {
+String dartTestWrapper(Path dartHome, String testPath, Path library) {
+ var testPathDir = pathLib.dirname(testPath);
Mads Ager (google) 2013/01/07 07:15:52 Can you pass in a Path here, please? I don't like
Emily Fortuna 2013/01/07 18:01:32 Unfortunately the relativeTo method in the main Pa
+ var dartHomePath = dartHome.toString();
+ var unitTest = pathLib.relative(pathLib.join(dartHomePath,
+ 'pkg/unittest/lib'), from: testPathDir);
+
+ var libString = library.toString();
+ if (!pathLib.isAbsolute(libString)) {
+ libString = pathLib.join(dartHome.toString(), 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 = dartHome.append("pkg/unittest/lib").toString();
-
- // TODO(rnystrom): Looking in the entire path here is wrong. It should only
- // consider the relative path within dartHome. Unfortunately,
- // Path.relativeTo() does not handle cases where library is already a relative
- // path, and Path.isAbsolute does not work on Windows.
- if (library.segments().contains("pkg")) {
+ if (pathLib.relative(libString, from: dartHome.toString()).contains("pkg")) {
unitTest = 'package:unittest';
}
-
return """
library test;
import '$unitTest/unittest.dart' as unittest;
import '$unitTest/html_config.dart' as config;
-import '${library}' as Test;
+import '${pathLib.relative(libString, from: testPathDir)}' as Test;
main() {
config.useHtmlConfiguration();

Powered by Google App Engine
This is Rietveld 408576698