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

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

Issue 2485493002: Try disabling test converter to see what changes it still makes. (Closed)
Patch Set: Created 4 years, 1 month 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 24 matching lines...) Expand all
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 Returns: 42 Returns:
43 A pair: the list of modified properties, and the modified text if the file was modified, None otherwise. 43 A pair: the list of modified properties, and the modified text if the file was modified, None otherwise.
44 """ 44 """
45 contents = host.filesystem.read_binary_file(filename) 45 pass
46 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho st)
47 if filename.endswith('.css'):
48 return converter.add_webkit_prefix_to_unprefixed_properties(contents.dec ode('utf-8'))
49 else:
50 try:
51 converter.feed(contents.decode('utf-8'))
52 except UnicodeDecodeError:
53 converter.feed(contents.decode('utf-16'))
54 converter.close()
55 return converter.output()
56 46
57 47
58 class _W3CTestConverter(HTMLParser): 48 class _W3CTestConverter(HTMLParser):
59 """A HTMLParser subclass which converts a HTML file as it is parsed. 49 """A HTMLParser subclass which converts a HTML file as it is parsed.
60 50
61 After the feed() method is called, the converted document will be stored 51 After the feed() method is called, the converted document will be stored
62 in converted_data, and can be retrieved with the output() method. 52 in converted_data, and can be retrieved with the output() method.
63 """ 53 """
64 54
65 def __init__(self, new_path, filename, reference_support_info, host=Host()): 55 def __init__(self, new_path, filename, reference_support_info, host=Host()):
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 self.converted_data.extend(['&#', name, ';']) 203 self.converted_data.extend(['&#', name, ';'])
214 204
215 def handle_comment(self, data): 205 def handle_comment(self, data):
216 self.converted_data.extend(['<!--', data, '-->']) 206 self.converted_data.extend(['<!--', data, '-->'])
217 207
218 def handle_decl(self, decl): 208 def handle_decl(self, decl):
219 self.converted_data.extend(['<!', decl, '>']) 209 self.converted_data.extend(['<!', decl, '>'])
220 210
221 def handle_pi(self, data): 211 def handle_pi(self, data):
222 self.converted_data.extend(['<?', data, '>']) 212 self.converted_data.extend(['<?', data, '>'])
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/wpt/html/semantics/grouping-content/the-pre-element/grouping-pre-reftest-001.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698