OLD | NEW |
---|---|
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 15 matching lines...) Expand all Loading... | |
26 # SUCH DAMAGE. | 26 # SUCH DAMAGE. |
27 | 27 |
28 import os | 28 import os |
29 import re | 29 import re |
30 import unittest | 30 import unittest |
31 | 31 |
32 from webkitpy.common.host import Host | 32 from webkitpy.common.host import Host |
33 from webkitpy.common.system.outputcapture import OutputCapture | 33 from webkitpy.common.system.outputcapture import OutputCapture |
34 from webkitpy.common.webkit_finder import WebKitFinder | 34 from webkitpy.common.webkit_finder import WebKitFinder |
35 from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup | 35 from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup |
36 from webkitpy.w3c.test_converter import _W3CTestConverter | 36 from webkitpy.w3c.test_converter import _W3CTestConverter, convert_for_webkit |
37 from webkitpy.common.system.systemhost_mock import MockSystemHost | |
38 from webkitpy.common.system.filesystem_mock import MockFileSystem | |
37 | 39 |
38 DUMMY_FILENAME = 'dummy.html' | 40 DUMMY_FILENAME = 'dummy.html' |
39 DUMMY_PATH = 'dummy/testharness/path' | 41 DUMMY_PATH = 'dummy/testharness/path' |
40 | 42 |
41 | 43 |
42 class W3CTestConverterTest(unittest.TestCase): | 44 class W3CTestConverterTest(unittest.TestCase): |
43 | 45 |
44 # FIXME: When we move to using a MockHost, this method should be removed, si nce | 46 # FIXME: When we move to using a MockHost, this method should be removed, si nce |
45 # then we can just pass in a dummy dir path | 47 # then we can just pass in a dummy dir path |
46 def fake_dir_path(self, dirname): | 48 def fake_dir_path(self, dirname): |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 # through the list to replace the double-digit tokens first | 305 # through the list to replace the double-digit tokens first |
304 index = len(test_properties) - 1 | 306 index = len(test_properties) - 1 |
305 while index >= 0: | 307 while index >= 0: |
306 # Use the unprefixed version | 308 # Use the unprefixed version |
307 test_prop = test_properties[index].replace('-webkit-', '') | 309 test_prop = test_properties[index].replace('-webkit-', '') |
308 # Replace the token | 310 # Replace the token |
309 html = html.replace('@test' + str(index) + '@', test_prop) | 311 html = html.replace('@test' + str(index) + '@', test_prop) |
310 index -= 1 | 312 index -= 1 |
311 | 313 |
312 return (test_properties, html) | 314 return (test_properties, html) |
315 | |
316 # Test for convert_for_webkit; determing if 'utf-16' decodes correctly | |
qyearsley
2016/06/02 21:05:17
I think this comment (and the similar one below) i
| |
317 def test_convert_for_webkit_with_non_utf8(self): | |
318 files = {'/file': 'e\x87[P', | |
319 '/mock-checkout/third_party/WebKit/Source/core/css/CSSPropertie s.in': '', } | |
320 host = MockSystemHost(filesystem=MockFileSystem(files=files)) | |
321 convert_for_webkit('', '/file', '', host) | |
qyearsley
2016/06/02 21:05:17
Optionally, you could add a comment that this test
| |
322 | |
323 # Test for convert_for_webkit; determing if 'utf-8' decodes correctly | |
324 def test_convert_for_webkit_with_utf8(self): | |
325 files = {'/file': 'foo', | |
326 '/mock-checkout/third_party/WebKit/Source/core/css/CSSPropertie s.in': '', } | |
327 host = MockSystemHost(filesystem=MockFileSystem(files=files)) | |
328 convert_for_webkit('', '/file', '', host) | |
OLD | NEW |