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.filesystem_mock import MockFileSystem | |
37 | 38 |
38 DUMMY_FILENAME = 'dummy.html' | 39 DUMMY_FILENAME = 'dummy.html' |
39 DUMMY_PATH = 'dummy/testharness/path' | 40 DUMMY_PATH = 'dummy/testharness/path' |
40 | 41 |
41 | 42 |
42 class W3CTestConverterTest(unittest.TestCase): | 43 class W3CTestConverterTest(unittest.TestCase): |
43 | 44 |
44 # FIXME: When we move to using a MockHost, this method should be removed, si nce | 45 # 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 | 46 # then we can just pass in a dummy dir path |
46 def fake_dir_path(self, dirname): | 47 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 | 304 # through the list to replace the double-digit tokens first |
304 index = len(test_properties) - 1 | 305 index = len(test_properties) - 1 |
305 while index >= 0: | 306 while index >= 0: |
306 # Use the unprefixed version | 307 # Use the unprefixed version |
307 test_prop = test_properties[index].replace('-webkit-', '') | 308 test_prop = test_properties[index].replace('-webkit-', '') |
308 # Replace the token | 309 # Replace the token |
309 html = html.replace('@test' + str(index) + '@', test_prop) | 310 html = html.replace('@test' + str(index) + '@', test_prop) |
310 index -= 1 | 311 index -= 1 |
311 | 312 |
312 return (test_properties, html) | 313 return (test_properties, html) |
314 | |
315 # Test for convert_for_webkit; determing if 'utf-16' decodes correctly | |
316 def test_convert_for_webkit_with_non_utf8(self): | |
317 mock_fs = MockFileSystem() | |
318 mock_fs.files = {'/file': 'e\x87[P', | |
319 '/mock-checkout/third_party/WebKit/Source/core/css/CSSP roperties.in': '', } | |
320 host = Host() | |
321 host.filesystem = mock_fs | |
322 convert_for_webkit('', '/file', '', host) | |
323 | |
324 # Test for convert_for_webkit; determing if 'utf-8' decodes correctly | |
325 def test_convert_for_webkit_with_utf8(self): | |
326 mock_fs = MockFileSystem() | |
327 mock_fs.files = {'/file': 'foo', | |
328 '/mock-checkout/third_party/WebKit/Source/core/css/CSSP roperties.in': '', } | |
329 host = Host() | |
330 host.filesystem = mock_fs | |
331 convert_for_webkit('', '/file', '', host) | |
Dirk Pranke
2016/06/02 19:22:24
Yup, this is pretty much how I'd expect you to tes
| |
OLD | NEW |