OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Layout tests module that is necessary for the layout analyzer. | 5 """Layout tests module that is necessary for the layout analyzer. |
6 | 6 |
7 Layout tests are stored in Webkit SVN and LayoutTestCaseManager collects these | 7 Layout tests are stored in Webkit SVN and LayoutTestCaseManager collects these |
8 layout test cases (including description). | 8 layout test cases (including description). |
9 """ | 9 """ |
10 | 10 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 file_list = client.list(layouttest_root_path + parent_location, | 165 file_list = client.list(layouttest_root_path + parent_location, |
166 recurse=recursion) | 166 recurse=recursion) |
167 for file_name in file_list: | 167 for file_name in file_list: |
168 if sys.stdout.isatty(): | 168 if sys.stdout.isatty(): |
169 default_encoding = sys.stdout.encoding | 169 default_encoding = sys.stdout.encoding |
170 else: | 170 else: |
171 default_encoding = locale.getpreferredencoding() | 171 default_encoding = locale.getpreferredencoding() |
172 file_name = file_name[0].repos_path.encode(default_encoding) | 172 file_name = file_name[0].repos_path.encode(default_encoding) |
173 # Remove the word '/truck/LayoutTests'. | 173 # Remove the word '/truck/LayoutTests'. |
174 file_name = file_name.replace('/trunk/LayoutTests/', '') | 174 file_name = file_name.replace('/trunk/LayoutTests/', '') |
175 if file_name.endswith('.html') or file_name.endswith('.svg'): | 175 if file_name.endswith('.html'): |
176 name_map[file_name] = True | 176 name_map[file_name] = True |
177 return name_map | 177 return name_map |
178 | 178 |
179 @staticmethod | 179 @staticmethod |
180 def GetLayoutTestNamesFromCSV(csv_file_path): | 180 def GetLayoutTestNamesFromCSV(csv_file_path): |
181 """Get layout test names from CSV file. | 181 """Get layout test names from CSV file. |
182 | 182 |
183 Args: | 183 Args: |
184 csv_file_path: the path for the CSV file containing test names (including | 184 csv_file_path: the path for the CSV file containing test names (including |
185 regular expression patterns). The CSV file content has one column and | 185 regular expression patterns). The CSV file content has one column and |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 try: | 261 try: |
262 resp = urllib2.urlopen(url) | 262 resp = urllib2.urlopen(url) |
263 except urllib2.HTTPError: | 263 except urllib2.HTTPError: |
264 # Some files with different languages cause this exception. | 264 # Some files with different languages cause this exception. |
265 # Return an empty description in this case. | 265 # Return an empty description in this case. |
266 return '' | 266 return '' |
267 if resp.code == 200: | 267 if resp.code == 200: |
268 return LayoutTests.ExtractTestDescription(resp.read()) | 268 return LayoutTests.ExtractTestDescription(resp.read()) |
269 raise urllib2.URLError( | 269 raise urllib2.URLError( |
270 'Fail to get layout test HTML file from %s.' % url) | 270 'Fail to get layout test HTML file from %s.' % url) |
OLD | NEW |