Index: tools/testing/dart/html_test.dart |
diff --git a/tools/testing/dart/html_test.dart b/tools/testing/dart/html_test.dart |
index a3a3506aebe84936a68c8bc1d95f57f0645836c9..9808cfb189fa8f282efe605a45e8eab39773025f 100644 |
--- a/tools/testing/dart/html_test.dart |
+++ b/tools/testing/dart/html_test.dart |
@@ -41,9 +41,20 @@ HtmlTestInformation getInformation(String filename) { |
annotation['scripts']); |
} |
-String getContents(HtmlTestInformation info) { |
+String getContents(HtmlTestInformation info, bool compileToJS) { |
String contents = new File(info.filePath.toNativePath()).readAsStringSync(); |
- return contents.replaceFirst(htmlAnnotation, ''); |
+ contents = contents.replaceFirst(htmlAnnotation, ''); |
+ if (compileToJS) { |
+ for (String script in info.scripts) { |
+ if (dartExtension.hasMatch(script)) { |
+ String jsScript = script.replaceFirst(dartExtension, '.js'); |
ricow1
2014/11/11 14:41:53
shouldn't that be replaceLast?
Bill Hesse
2014/11/11 15:18:38
dartExtension is a regexp ending in $.
There is no
|
+ String tag = '<script src="$script" type="application/dart">'; |
+ String jsTag = '<script src="$jsScript">'; |
+ contents = contents.replaceAll(tag, jsTag); |
+ } |
+ } |
+ } |
+ return contents; |
} |
String makeFailingHtmlFile(String message) { |