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

Unified Diff: utils/testrunner/dart_wrap_task.dart

Issue 10914049: Added support for layout render tests. These use expected values for the text render output from Du… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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
« no previous file with comments | « utils/testrunner/configuration.dart ('k') | utils/testrunner/drt_task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/testrunner/dart_wrap_task.dart
===================================================================
--- utils/testrunner/dart_wrap_task.dart (revision 11963)
+++ utils/testrunner/dart_wrap_task.dart (working copy)
@@ -20,11 +20,17 @@
// Get the destination file.
var destFile = expandMacros(_tempDartFileTemplate, testfile);
+ var p = new Path(sourceName);
+ if (isLayoutRenderTest(sourceName) || config.generateRenders) {
+ makeLayoutTestWrapper(sourceName, destFile, p.filenameWithoutExtension);
+ exitHandler(0);
+ return;
+ }
+
// Working buffer for the Dart wrapper.
StringBuffer sbuf = new StringBuffer();
// Add the common header stuff.
- var p = new Path(sourceName);
sbuf.add(directives(p.filenameWithoutExtension,
config.unittestPath,
sourceName));
@@ -100,6 +106,41 @@
deleteFiles([_tempDartFileTemplate], testfile, logging, keepFiles, stdout);
}
+ void makeLayoutTestWrapper(String sourceName, String destFile,
+ String libraryName) {
+ StringBuffer sbuf = new StringBuffer();
+ var cfg = config.unittestPath.
+ replaceAll('unittest.dart', 'html_layout_config.dart');
+ sbuf.add("""
+#library('$libraryName');
+#import('dart:math');
+#import('dart:isolate');
+#import('dart:html');
+#import('${config.unittestPath}', prefix:'unittest');
+#import('$cfg', prefix:'unittest');
+#import('$sourceName', prefix: 'test');
+""");
+ // Add the filter, if applicable.
+ if (config.filtering) {
+ if (config.includeFilter.length > 0) {
+ sbuf.add(filterTestFunction(config.includeFilter, 'true'));
+ } else {
+ sbuf.add(filterTestFunction(config.excludeFilter, 'false'));
+ }
+ }
+ sbuf.add("""
+main() {
+unittest.groupSep = '###';
+unittest.useHtmlLayoutConfiguration();
+unittest.group('', test.main);
+${config.filtering ? 'unittest.filterTests(filterTest);' : ''}
+if (window.location.search == '') unittest.runTests();
+}
+""");
+ // Save the Dart file.
+ createFile(destFile, sbuf.toString());
+ }
+
String directives(String library, String unittest, String sourceName) {
return """
#library('$library');
@@ -441,4 +482,5 @@
unittest.runTests();
}
""";
+
}
« no previous file with comments | « utils/testrunner/configuration.dart ('k') | utils/testrunner/drt_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698