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

Unified Diff: utils/testrunner/layout_test_runner.dart

Issue 10909240: Support for pixel layout tests. (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
Index: utils/testrunner/layout_test_runner.dart
===================================================================
--- utils/testrunner/layout_test_runner.dart (revision 0)
+++ utils/testrunner/layout_test_runner.dart (revision 0)
@@ -0,0 +1,50 @@
+/** The filters must be set by the caller. */
Siggi Cherem (dart-lang) 2012/09/20 17:37:27 + copyright + library since this comment is not a
gram 2012/09/20 18:58:03 Done.
+List includeFilters;
+List excludeFilters;
+
+class LayoutTestConfiguration extends unittest.Configuration {
+ get autoStart => false;
+ void onTestResult(unittest.TestCase testCase) {
+ window.postMessage('done', '*'); // Unblock DRT
+ }
+}
+
+filterTest(t) {
+ var name = t.description.replaceAll("###", " ");
+ if (includeFilters.length > 0) {
+ for (var f in includeFilters) {
+ if (name.indexOf(f) >= 0) return true;
+ }
+ return false;
+ } else if (excludeFilters.length > 0) {
+ for (var f in excludeFilters) {
+ if (name.indexOf(f) >= 0) return false;
+ }
+ return true;
+ } else {
+ return true;
+ }
+}
+
+runTests(testMain) {
+ unittest.groupSep = '###';
+ unittest.configure(new LayoutTestConfiguration());
+ // Create the set of test cases.
Siggi Cherem (dart-lang) 2012/09/20 17:37:27 nit: always add an empty line before a line commen
gram 2012/09/20 18:58:03 Done.
+ unittest.group('', testMain);
+ // Do any user-specified test filtering.
+ unittest.filterTests(filterTest);
+ // Filter to the test number in the search query.
+ var testNum = int.parse(window.location.search.substring(6));
+ if (testNum < 0 || testNum >= unittest.testCases.length) {
+ print('#TEST NONEXISTENT');
+ window.postMessage('done', '*'); // Unblock DRT
+ } else {
+ var name = unittest.testCases[testNum].description;
+ print('#TEST $name');
+ unittest.filterTests(name);
+ // Run the test.
+ print('Tests - ${unittest.testCases.length}');
+ unittest.runTests();
+ }
+}
+
Siggi Cherem (dart-lang) 2012/09/20 17:37:27 nit: remove empty line
gram 2012/09/20 18:58:03 Done.

Powered by Google App Engine
This is Rietveld 408576698