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

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

Issue 1162333004: W3C test_converter.py fails to prefix if previous declaration does not have ";" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
« no previous file with comments | « Tools/Scripts/webkitpy/w3c/test_converter.py ('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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 resources_dir = converter.path_from_webkit_root("LayoutTests", "resource s") 233 resources_dir = converter.path_from_webkit_root("LayoutTests", "resource s")
234 new_relpath = os.path.relpath(resources_dir, fake_dir_path) 234 new_relpath = os.path.relpath(resources_dir, fake_dir_path)
235 relpath_pattern = re.compile(new_relpath) 235 relpath_pattern = re.compile(new_relpath)
236 self.assertEquals(len(new_html.findAll(src=relpath_pattern)), 1, 'vendor -prefix.js relative path not correct') 236 self.assertEquals(len(new_html.findAll(src=relpath_pattern)), 1, 'vendor -prefix.js relative path not correct')
237 237
238 def test_convert_prefixed_properties(self): 238 def test_convert_prefixed_properties(self):
239 """ Tests convert_prefixed_properties() file that has 20 properties requ iring the -webkit- prefix: 239 """ Tests convert_prefixed_properties() file that has 20 properties requ iring the -webkit- prefix:
240 10 in one style block + 5 in another style 240 10 in one style block + 5 in another style
241 block + 5 inline styles, including one with multiple prefixed properties . 241 block + 5 inline styles, including one with multiple prefixed properties .
242 2 when prefixed properties appear in comments without ending ';'.
242 The properties in the test content are in all sorts of wack formatting. 243 The properties in the test content are in all sorts of wack formatting.
243 """ 244 """
244 245
245 test_html = """<html> 246 test_html = """<html>
246 <style type="text/css"><![CDATA[ 247 <style type="text/css"><![CDATA[
247 248
248 .block1 { 249 .block1 {
249 width: 300px; 250 width: 300px;
250 height: 300px 251 height: 300px
251 } 252 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 289
289 .block10{ @test15@: propvalue; } 290 .block10{ @test15@: propvalue; }
290 .block11{ @test16@: propvalue; } 291 .block11{ @test16@: propvalue; }
291 .block12{ @test17@: propvalue; } 292 .block12{ @test17@: propvalue; }
292 #block13:pseudo 293 #block13:pseudo
293 { 294 {
294 @test18@: propvalue; 295 @test18@: propvalue;
295 @test19@: propvalue; 296 @test19@: propvalue;
296 } 297 }
297 298
299 #missing-semicolon-in-comments {
300 /* @test20@: propvalue */
301 @test21@: propvalue;
302 }
303
298 ]]></style> 304 ]]></style>
299 </html> 305 </html>
300 """ 306 """
301 converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None) 307 converter = _W3CTestConverter(DUMMY_PATH, DUMMY_FILENAME, None)
302 test_content = self.generate_test_content(converter.prefixed_properties, 20, test_html) 308 test_content = self.generate_test_content(converter.prefixed_properties, 22, test_html)
303 309
304 oc = OutputCapture() 310 oc = OutputCapture()
305 oc.capture_output() 311 oc.capture_output()
306 try: 312 try:
307 converter.feed(test_content[1]) 313 converter.feed(test_content[1])
308 converter.close() 314 converter.close()
309 converted = converter.output() 315 converted = converter.output()
310 finally: 316 finally:
311 oc.restore_output() 317 oc.restore_output()
312 318
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 # through the list to replace the double-digit tokens first 426 # through the list to replace the double-digit tokens first
421 index = len(test_properties) - 1 427 index = len(test_properties) - 1
422 while index >= 0: 428 while index >= 0:
423 # Use the unprefixed version 429 # Use the unprefixed version
424 test_prop = test_properties[index].replace('-webkit-', '') 430 test_prop = test_properties[index].replace('-webkit-', '')
425 # Replace the token 431 # Replace the token
426 html = html.replace('@test' + str(index) + '@', test_prop) 432 html = html.replace('@test' + str(index) + '@', test_prop)
427 index -= 1 433 index -= 1
428 434
429 return (test_properties, html) 435 return (test_properties, html)
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/w3c/test_converter.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698