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

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

Issue 1164243002: W3C Test: Import web-platform-tests/html/syntax. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/imported/web-platform-tests/html/syntax/writing/text/contains.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions 6 # modification, are permitted provided that the following conditions
7 # are met: 7 # are met:
8 # 8 #
9 # 1. Redistributions of source code must retain the above 9 # 1. Redistributions of source code must retain the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 28 matching lines...) Expand all
39 _log = logging.getLogger(__name__) 39 _log = logging.getLogger(__name__)
40 40
41 41
42 def convert_for_webkit(new_path, filename, reference_support_info, host=Host()): 42 def convert_for_webkit(new_path, filename, reference_support_info, host=Host()):
43 """ Converts a file's |contents| so it will function correctly in its |new_p ath| in Webkit. 43 """ Converts a file's |contents| so it will function correctly in its |new_p ath| in Webkit.
44 44
45 Returns the list of modified properties and the modified text if the file wa s modifed, None otherwise.""" 45 Returns the list of modified properties and the modified text if the file wa s modifed, None otherwise."""
46 contents = host.filesystem.read_binary_file(filename) 46 contents = host.filesystem.read_binary_file(filename)
47 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho st) 47 converter = _W3CTestConverter(new_path, filename, reference_support_info, ho st)
48 if filename.endswith('.css'): 48 if filename.endswith('.css'):
49 return converter.add_webkit_prefix_to_unprefixed_properties(contents) 49 return converter.add_webkit_prefix_to_unprefixed_properties(contents.dec ode('utf-8'))
50 else: 50 else:
51 converter.feed(contents.decode('utf-8')) 51 converter.feed(contents.decode('utf-8'))
52 converter.close() 52 converter.close()
53 return converter.output() 53 return converter.output()
54 54
55 55
56 class _W3CTestConverter(HTMLParser): 56 class _W3CTestConverter(HTMLParser):
57 def __init__(self, new_path, filename, reference_support_info, host=Host()): 57 def __init__(self, new_path, filename, reference_support_info, host=Host()):
58 HTMLParser.__init__(self) 58 HTMLParser.__init__(self)
59 59
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 self.converted_data.extend(['&#', name, ';']) 254 self.converted_data.extend(['&#', name, ';'])
255 255
256 def handle_comment(self, data): 256 def handle_comment(self, data):
257 self.converted_data.extend(['<!-- ', data, ' -->']) 257 self.converted_data.extend(['<!-- ', data, ' -->'])
258 258
259 def handle_decl(self, decl): 259 def handle_decl(self, decl):
260 self.converted_data.extend(['<!', decl, '>']) 260 self.converted_data.extend(['<!', decl, '>'])
261 261
262 def handle_pi(self, data): 262 def handle_pi(self, data):
263 self.converted_data.extend(['<?', data, '>']) 263 self.converted_data.extend(['<?', data, '>'])
OLDNEW
« no previous file with comments | « LayoutTests/imported/web-platform-tests/html/syntax/writing/text/contains.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698