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

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

Issue 705733003: Support dart and js scripts in HTML tests, on dartium. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove stray file Created 6 years, 1 month 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
« tests/html/scripts_test_js.js ('K') | « tests/html/scripts_test_js.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_suite.dart
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index dae353a5c3773b8fe2136795fd6826df18cecb5e..5759081c690ce9b6e31703ef22da23eaa262c84c 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -1171,16 +1171,47 @@ class StandardTestSuite extends TestSuite {
// rewriting of script links in html file. Currently unimplemented.
return;
}
+ final String tempDir = createOutputDirectory(info.filePath, '');
+ final Uri tempUri = new Uri.file('$tempDir/');
+ final Uri htmlFile = tempUri.resolve(filePath.filename);
+ new File.fromUri(htmlFile).writeAsStringSync(htmlTest.getContents(info));
if (info.scripts.length > 0) {
- // TODO(whesse): Copy scripts into output directory.
- return;
+ Uri testUri = new Uri.file(filePath.toNativePath());
+ for (String scriptPath in info.scripts) {
+ if (!scriptPath.endsWith('.dart') && !scriptPath.endsWith('.js')) {
+ DebugLogger.warning('HTML test scripts must be dart or javascript: '
ricow1 2014/11/05 10:59:54 fail the test?
Bill Hesse 2014/11/05 12:51:51 Done.
+ '${info.filePath}');
+ return;
+
+ }
+ Uri uri = Uri.parse(scriptPath);
+ if (uri.isAbsolute) {
+ DebugLogger.warning('HTML test scripts must have relative paths: '
ricow1 2014/11/05 10:59:55 fail the test?
Bill Hesse 2014/11/05 12:51:51 Done.
+ '${info.filePath}');
+ return;
+ }
+ if (uri.pathSegments.length > 1) {
+ DebugLogger.warning('HTML test scripts must be in test directory: '
ricow1 2014/11/05 10:59:55 fail the test?
Bill Hesse 2014/11/05 12:51:51 Done.
+ '${info.filePath}');
+ return;
+ }
+ Uri script = testUri.resolveUri(uri);
+ if (compiler == 'none') {
+ Uri copiedScript = tempUri.resolveUri(uri);
+ new File.fromUri(copiedScript).writeAsStringSync(
+ new File.fromUri(script).readAsStringSync());
+ } else {
+ // TODO(whesse): Compile scripts into output directory.
+ DebugLogger.error('HTML test scripts don\'t support dart2js yet: '
ricow1 2014/11/05 10:59:55 so can you even land this?
Bill Hesse 2014/11/05 12:51:51 line 1169 skipped all platforms without compiler =
+ '${info.filePath}');
+ exit(1);
+ }
+ }
}
- final String tempDir = createOutputDirectory(info.filePath, '');
- final String htmlFile = '$tempDir/${filePath.filename}';
- new File(htmlFile).writeAsStringSync(htmlTest.getContents(info));
+ new File.fromUri(htmlFile).writeAsStringSync(htmlTest.getContents(info));
String testDisplayName = '$suiteName/$testName';
- var htmlPath = _createUrlPathFromFile(new Path(htmlFile));
+ var htmlPath = _createUrlPathFromFile(new Path(htmlFile.toFilePath()));
var fullHtmlPath = _getUriForBrowserTest(info, htmlPath,
null, null);
var commands = [CommandBuilder.instance.getBrowserHtmlTestCommand(
« tests/html/scripts_test_js.js ('K') | « tests/html/scripts_test_js.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698