OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Test expectation list for WebDriver Java acceptance tests. | 5 """Test expectation list for WebDriver Java acceptance tests. |
6 | 6 |
7 It is evaluated through Python. | 7 It is evaluated through Python. |
8 """ | 8 """ |
9 | 9 |
10 _REVISION_NEGATIVE_FILTER = {} | 10 _REVISION_NEGATIVE_FILTER = {} |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 Args: | 170 Args: |
171 operating_system: The operating system, one of 'linux', 'mac', 'win', or | 171 operating_system: The operating system, one of 'linux', 'mac', 'win', or |
172 'android'. | 172 'android'. |
173 chrome_version: Chrome version to test against, e.g., 'HEAD' or '26'. | 173 chrome_version: Chrome version to test against, e.g., 'HEAD' or '26'. |
174 | 174 |
175 Returns: | 175 Returns: |
176 Filter string, in Google Test (C++) format. | 176 Filter string, in Google Test (C++) format. |
177 """ | 177 """ |
178 return '*-' + ':'.join(_OS_NEGATIVE_FILTER[operating_system] + | 178 return '*-' + ':'.join(_OS_NEGATIVE_FILTER[operating_system] + |
179 _REVISION_NEGATIVE_FILTER[chrome_version]) | 179 _REVISION_NEGATIVE_FILTER[chrome_version]) |
| 180 |
| 181 def ApplyJavaTestFilter(operating_system, chrome_version, tests): |
| 182 """Applies the test filter to the given list of tests. |
| 183 |
| 184 Args: |
| 185 operating_system: The operating system, one of 'linux', 'mac', 'win', or |
| 186 'android'. |
| 187 chrome_version: Chrome version to test against, e.g., 'HEAD' or '26'. |
| 188 test: list of test names to filter. |
| 189 |
| 190 Returns: |
| 191 Set of passed test names. |
| 192 """ |
| 193 filters = (_OS_NEGATIVE_FILTER[operating_system] + |
| 194 _REVISION_NEGATIVE_FILTER[chrome_version]) |
| 195 passed = set(tests) |
| 196 for f in filters: |
| 197 passed.difference_update(set(t for t in tests if _TestMatchesFilter(t, f))) |
| 198 return passed |
| 199 |
| 200 def _TestMatchesFilter(test, filter): |
| 201 if '*' in filter: |
| 202 return test[:len(filter) - 1] == test[:-1] |
| 203 return test == filter |
OLD | NEW |