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

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

Issue 2633223003: Convert CSSProperties.in to JSON5 format (Closed)
Patch Set: Fix test_converter_unittest Created 3 years, 10 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
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 #missing-semicolon-in-comments { 191 #missing-semicolon-in-comments {
192 /* @test20@: propvalue */ 192 /* @test20@: propvalue */
193 @test21@: propvalue; 193 @test21@: propvalue;
194 } 194 }
195 195
196 ]]></style> 196 ]]></style>
197 </html> 197 </html>
198 """ 198 """
199 converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None) 199 converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None)
200 test_content = self.generate_test_content(converter.prefixed_properties, 22, test_html) 200 test_content = self.generate_test_content(converter.prefixed_properties, 4, test_html)
201 201
202 oc = OutputCapture() 202 oc = OutputCapture()
203 oc.capture_output() 203 oc.capture_output()
204 try: 204 try:
205 converter.feed(test_content[1]) 205 converter.feed(test_content[1])
206 converter.close() 206 converter.close()
207 converted = converter.output() 207 converted = converter.output()
208 finally: 208 finally:
209 oc.restore_output() 209 oc.restore_output()
210 210
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 while index >= 0: 278 while index >= 0:
279 # Use the unprefixed version 279 # Use the unprefixed version
280 test_prop = test_properties[index].replace('-webkit-', '') 280 test_prop = test_properties[index].replace('-webkit-', '')
281 # Replace the token 281 # Replace the token
282 html = html.replace('@test' + str(index) + '@', test_prop) 282 html = html.replace('@test' + str(index) + '@', test_prop)
283 index -= 1 283 index -= 1
284 284
285 return (test_properties, html) 285 return (test_properties, html)
286 286
287 def test_convert_for_webkit_with_non_utf8(self): 287 def test_convert_for_webkit_with_non_utf8(self):
288 files = {'/file': 'e\x87[P', 288 files = {'/file': 'e\x87[P', }
289 '/mock-checkout/third_party/WebKit/Source/core/css/CSSPropertie s.in': '', }
290 host = MockSystemHost(filesystem=MockFileSystem(files=files)) 289 host = MockSystemHost(filesystem=MockFileSystem(files=files))
291 convert_for_webkit('', '/file', '', host) 290 convert_for_webkit('', '/file', '', host)
292 291
293 # This test passes if no Exception is raised 292 # This test passes if no Exception is raised
294 def test_convert_for_webkit_with_utf8(self): 293 def test_convert_for_webkit_with_utf8(self):
295 files = {'/file': 'foo', 294 files = {'/file': 'foo', }
296 '/mock-checkout/third_party/WebKit/Source/core/css/CSSPropertie s.in': '', }
297 host = MockSystemHost(filesystem=MockFileSystem(files=files)) 295 host = MockSystemHost(filesystem=MockFileSystem(files=files))
298 convert_for_webkit('', '/file', '', host) 296 convert_for_webkit('', '/file', '', host)
299 297
300 def test_for_capital_end_tags(self): 298 def test_for_capital_end_tags(self):
301 test_html = """<FONT></FONT>""" 299 test_html = """<FONT></FONT>"""
302 converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None) 300 converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None)
303 converter.feed(test_html) 301 converter.feed(test_html)
304 self.assertEqual(converter.output(), ([], """<FONT></FONT>""")) 302 self.assertEqual(converter.output(), ([], """<FONT></FONT>"""))
305 303
306 def test_for_comments(self): 304 def test_for_comments(self):
307 test_html = """<!--abc--><!-- foo -->""" 305 test_html = """<!--abc--><!-- foo -->"""
308 converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None) 306 converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None)
309 converter.feed(test_html) 307 converter.feed(test_html)
310 self.assertEqual(converter.output(), ([], """<!--abc--><!-- foo -->""")) 308 self.assertEqual(converter.output(), ([], """<!--abc--><!-- foo -->"""))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698