Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_converter.py

Issue 2542963002: W3C Importer: Consolidate and simplify logic for deciding what not to convert. (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
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: 42 Args:
43 new_path: Absolute path where file will be copied to in the Chromium rep o. 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. 44 filename: Absolute path to where the file is.
45 reference_support_info: Dict of information about a related reference HT ML, if any. 45 reference_support_info: Dict of information about a related reference HT ML, if any.
46 46
47 Returns: 47 Returns:
48 A pair of (list of modified CSS properties, modified text) if the file 48 A pair of (list of modified CSS properties, modified text).
49 should be modified; None, if the file is not modified.
50 """ 49 """
51 # Conversion is not necessary for any tests in wpt now; see http://crbug.com /654081. 50 # 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
55 contents = host.filesystem.read_binary_file(filename) 51 contents = host.filesystem.read_binary_file(filename)
56 try: 52 try:
57 contents = contents.decode('utf-8') 53 contents = contents.decode('utf-8')
58 except UnicodeDecodeError: 54 except UnicodeDecodeError:
59 contents = contents.decode('utf-16') 55 contents = contents.decode('utf-16')
60 56
61 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho st) 57 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho st)
62 if filename.endswith('.css'): 58 if filename.endswith('.css'):
63 return converter.add_webkit_prefix_to_unprefixed_properties(contents) 59 return converter.add_webkit_prefix_to_unprefixed_properties(contents)
64 converter.feed(contents) 60 converter.feed(contents)
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 self.converted_data.extend(['&#', name, ';']) 225 self.converted_data.extend(['&#', name, ';'])
230 226
231 def handle_comment(self, data): 227 def handle_comment(self, data):
232 self.converted_data.extend(['<!--', data, '-->']) 228 self.converted_data.extend(['<!--', data, '-->'])
233 229
234 def handle_decl(self, decl): 230 def handle_decl(self, decl):
235 self.converted_data.extend(['<!', decl, '>']) 231 self.converted_data.extend(['<!', decl, '>'])
236 232
237 def handle_pi(self, data): 233 def handle_pi(self, data):
238 self.converted_data.extend(['<?', data, '>']) 234 self.converted_data.extend(['<?', data, '>'])
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/W3CImportExpectations ('k') | third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698