Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /** 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.
| |
| 2 List includeFilters; | |
| 3 List excludeFilters; | |
| 4 | |
| 5 class LayoutTestConfiguration extends unittest.Configuration { | |
| 6 get autoStart => false; | |
| 7 void onTestResult(unittest.TestCase testCase) { | |
| 8 window.postMessage('done', '*'); // Unblock DRT | |
| 9 } | |
| 10 } | |
| 11 | |
| 12 filterTest(t) { | |
| 13 var name = t.description.replaceAll("###", " "); | |
| 14 if (includeFilters.length > 0) { | |
| 15 for (var f in includeFilters) { | |
| 16 if (name.indexOf(f) >= 0) return true; | |
| 17 } | |
| 18 return false; | |
| 19 } else if (excludeFilters.length > 0) { | |
| 20 for (var f in excludeFilters) { | |
| 21 if (name.indexOf(f) >= 0) return false; | |
| 22 } | |
| 23 return true; | |
| 24 } else { | |
| 25 return true; | |
| 26 } | |
| 27 } | |
| 28 | |
| 29 runTests(testMain) { | |
| 30 unittest.groupSep = '###'; | |
| 31 unittest.configure(new LayoutTestConfiguration()); | |
| 32 // 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.
| |
| 33 unittest.group('', testMain); | |
| 34 // Do any user-specified test filtering. | |
| 35 unittest.filterTests(filterTest); | |
| 36 // Filter to the test number in the search query. | |
| 37 var testNum = int.parse(window.location.search.substring(6)); | |
| 38 if (testNum < 0 || testNum >= unittest.testCases.length) { | |
| 39 print('#TEST NONEXISTENT'); | |
| 40 window.postMessage('done', '*'); // Unblock DRT | |
| 41 } else { | |
| 42 var name = unittest.testCases[testNum].description; | |
| 43 print('#TEST $name'); | |
| 44 unittest.filterTests(name); | |
| 45 // Run the test. | |
| 46 print('Tests - ${unittest.testCases.length}'); | |
| 47 unittest.runTests(); | |
| 48 } | |
| 49 } | |
| 50 | |
|
Siggi Cherem (dart-lang)
2012/09/20 17:37:27
nit: remove empty line
gram
2012/09/20 18:58:03
Done.
| |
| OLD | NEW |