| OLD | NEW |
| 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # | 6 # |
| 7 # 1. Redistributions of source code must retain the above | 7 # 1. Redistributions of source code must retain the above |
| 8 # copyright notice, this list of conditions and the following | 8 # copyright notice, this list of conditions and the following |
| 9 # disclaimer. | 9 # disclaimer. |
| 10 # 2. Redistributions in binary form must reproduce the above | 10 # 2. Redistributions in binary form must reproduce the above |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 from webkitpy.common.webkit_finder import WebKitFinder | 32 from webkitpy.common.webkit_finder import WebKitFinder |
| 33 from HTMLParser import HTMLParser | 33 from HTMLParser import HTMLParser |
| 34 | 34 |
| 35 | 35 |
| 36 _log = logging.getLogger(__name__) | 36 _log = logging.getLogger(__name__) |
| 37 | 37 |
| 38 | 38 |
| 39 def convert_for_webkit(new_path, filename, reference_support_info, host=Host()): | 39 def convert_for_webkit(new_path, filename, reference_support_info, host=Host()): |
| 40 """Converts a file's contents so the Blink layout test runner can run it. | 40 """Converts a file's contents so the Blink layout test runner can run it. |
| 41 | 41 |
| 42 Args: |
| 43 new_path: Absolute path where file will be copied to in the Chromium rep
o. |
| 44 filename: Absolute path to where the file is. |
| 45 reference_support_info: Dict of information about a related reference HT
ML, if any. |
| 46 |
| 42 Returns: | 47 Returns: |
| 43 A pair: the list of modified properties, and the modified text if the file
was modified, None otherwise. | 48 A pair of (list of modified CSS properties, modified text) if the file |
| 49 should be modified; None, if the file is not modified. |
| 44 """ | 50 """ |
| 51 # Conversion is not necessary for any tests in wpt now; see http://crbug.com
/654081. |
| 52 if re.search(r'[/\\]imported[/\\]wpt[/\\]', new_path): |
| 53 return None |
| 54 |
| 45 contents = host.filesystem.read_binary_file(filename) | 55 contents = host.filesystem.read_binary_file(filename) |
| 46 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho
st) | 56 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho
st) |
| 47 if filename.endswith('.css'): | 57 if filename.endswith('.css'): |
| 48 return converter.add_webkit_prefix_to_unprefixed_properties(contents.dec
ode('utf-8')) | 58 return converter.add_webkit_prefix_to_unprefixed_properties(contents.dec
ode('utf-8')) |
| 49 else: | 59 else: |
| 50 try: | 60 try: |
| 51 converter.feed(contents.decode('utf-8')) | 61 converter.feed(contents.decode('utf-8')) |
| 52 except UnicodeDecodeError: | 62 except UnicodeDecodeError: |
| 53 converter.feed(contents.decode('utf-16')) | 63 converter.feed(contents.decode('utf-16')) |
| 54 converter.close() | 64 converter.close() |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 self.converted_data.extend(['&#', name, ';']) | 223 self.converted_data.extend(['&#', name, ';']) |
| 214 | 224 |
| 215 def handle_comment(self, data): | 225 def handle_comment(self, data): |
| 216 self.converted_data.extend(['<!--', data, '-->']) | 226 self.converted_data.extend(['<!--', data, '-->']) |
| 217 | 227 |
| 218 def handle_decl(self, decl): | 228 def handle_decl(self, decl): |
| 219 self.converted_data.extend(['<!', decl, '>']) | 229 self.converted_data.extend(['<!', decl, '>']) |
| 220 | 230 |
| 221 def handle_pi(self, data): | 231 def handle_pi(self, data): |
| 222 self.converted_data.extend(['<?', data, '>']) | 232 self.converted_data.extend(['<?', data, '>']) |
| OLD | NEW |