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

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: Address comments. 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
« no previous file with comments | « tools/testing/dart/html_test.dart ('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..4a7c65a206072292f19701b95aebf37fa0631daf 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -1166,21 +1166,51 @@ class StandardTestSuite extends TestSuite {
final String runtime = configuration['runtime'];
if (info is HtmlTestInformation) {
- if (compiler != 'none' || runtime != 'dartium') {
- // TODO(whesse): Enable compilation of scripts to dart2js, and
- // 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));
+
+ void createFailingTest(String message) {
+ var msg = "$message: ${info.filePath}";
+ DebugLogger.warning(msg);
+ new File.fromUri(htmlFile).writeAsStringSync(
+ htmlTest.makeFailingHtmlFile(msg));
}
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')) {
+ createFailingTest(
+ 'HTML test scripts must be dart or javascript: $scriptPath');
+ break;
+ }
+ Uri uri = Uri.parse(scriptPath);
+ if (uri.isAbsolute) {
+ createFailingTest(
+ 'HTML test scripts must have relative paths: $scriptPath');
+ break;
+ }
+ if (uri.pathSegments.length > 1) {
+ createFailingTest(
+ 'HTML test scripts must be in test directory: $scriptPath');
+ break;
+ }
+ Uri script = testUri.resolveUri(uri);
+ if (compiler == 'none' || scriptPath.endsWith('.js')) {
+ Uri copiedScript = tempUri.resolveUri(uri);
+ new File.fromUri(copiedScript).writeAsStringSync(
+ new File.fromUri(script).readAsStringSync());
+ } else {
+ // TODO(21514): Compile scripts into output directory.
+ createFailingTest('HTML test scripts don\'t support dart2js yet');
+ break;
+ }
+ }
}
- final String tempDir = createOutputDirectory(info.filePath, '');
- final String htmlFile = '$tempDir/${filePath.filename}';
- new File(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(
« no previous file with comments | « tools/testing/dart/html_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698