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

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

Issue 700033003: Enable dart2js compilation for new HTML tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « tests/html/html.status ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « tests/html/html.status ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698