| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // The filters must be set by the caller that #sources this file. |
| 6 List includeFilters; |
| 7 List excludeFilters; |
| 8 |
| 9 class LayoutTestConfiguration extends unittest.Configuration { |
| 10 get autoStart => false; |
| 11 void onTestResult(unittest.TestCase testCase) { |
| 12 window.postMessage('done', '*'); // Unblock DRT |
| 13 } |
| 14 } |
| 15 |
| 16 filterTest(t) { |
| 17 var name = t.description.replaceAll("###", " "); |
| 18 if (includeFilters.length > 0) { |
| 19 for (var f in includeFilters) { |
| 20 if (name.indexOf(f) >= 0) return true; |
| 21 } |
| 22 return false; |
| 23 } else if (excludeFilters.length > 0) { |
| 24 for (var f in excludeFilters) { |
| 25 if (name.indexOf(f) >= 0) return false; |
| 26 } |
| 27 return true; |
| 28 } else { |
| 29 return true; |
| 30 } |
| 31 } |
| 32 |
| 33 runTests(testMain) { |
| 34 unittest.groupSep = '###'; |
| 35 unittest.configure(new LayoutTestConfiguration()); |
| 36 |
| 37 // Create the set of test cases. |
| 38 unittest.group('', testMain); |
| 39 |
| 40 // Do any user-specified test filtering. |
| 41 unittest.filterTests(filterTest); |
| 42 |
| 43 // Filter to the test number in the search query. |
| 44 var testNum = int.parse(window.location.search.substring(6)); |
| 45 if (testNum < 0 || testNum >= unittest.testCases.length) { |
| 46 print('#TEST NONEXISTENT'); |
| 47 window.postMessage('done', '*'); // Unblock DRT |
| 48 } else { |
| 49 var name = unittest.testCases[testNum].description; |
| 50 print('#TEST $name'); |
| 51 unittest.filterTests(name); |
| 52 // Run the test. |
| 53 print('Tests - ${unittest.testCases.length}'); |
| 54 unittest.runTests(); |
| 55 } |
| 56 } |
| OLD | NEW |