| 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 11 matching lines...) Expand all Loading... |
| 22 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 22 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 23 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | 23 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
| 24 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | 24 # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
| 25 # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 # SUCH DAMAGE. | 26 # SUCH DAMAGE. |
| 27 | 27 |
| 28 import optparse | 28 import optparse |
| 29 import unittest | 29 import unittest |
| 30 | 30 |
| 31 from webkitpy.common.host_mock import MockHost | 31 from webkitpy.common.host_mock import MockHost |
| 32 from webkitpy.common.system.executive_mock import MockExecutive, ScriptError |
| 32 from webkitpy.common.system.filesystem_mock import MockFileSystem | 33 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 33 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError | |
| 34 from webkitpy.w3c.test_importer import TestImporter | 34 from webkitpy.w3c.test_importer import TestImporter |
| 35 | 35 |
| 36 | 36 |
| 37 FAKE_SOURCE_REPO_DIR = '/blink' | 37 FAKE_SOURCE_REPO_DIR = '/blink' |
| 38 | 38 |
| 39 FAKE_FILES = { | 39 FAKE_FILES = { |
| 40 '/mock-checkout/third_party/Webkit/LayoutTests/w3c/OWNERS': '', | 40 '/mock-checkout/third_party/Webkit/LayoutTests/w3c/OWNERS': '', |
| 41 '/blink/w3c/dir/has_shebang.txt': '#!', | 41 '/blink/w3c/dir/has_shebang.txt': '#!', |
| 42 '/blink/w3c/dir/README.txt': '', | 42 '/blink/w3c/dir/README.txt': '', |
| 43 '/blink/w3c/dir/OWNERS': '', | 43 '/blink/w3c/dir/OWNERS': '', |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 "overwrite": False, | 58 "overwrite": False, |
| 59 "destination": "w3c", | 59 "destination": "w3c", |
| 60 "ignore_expectations": False, | 60 "ignore_expectations": False, |
| 61 "dry_run": False, | 61 "dry_run": False, |
| 62 } | 62 } |
| 63 options.update(kwargs) | 63 options.update(kwargs) |
| 64 return optparse.Values(options) | 64 return optparse.Values(options) |
| 65 | 65 |
| 66 def test_import_dir_with_no_tests(self): | 66 def test_import_dir_with_no_tests(self): |
| 67 host = MockHost() | 67 host = MockHost() |
| 68 host.executive = MockExecutive2(exception=ScriptError( | 68 host.executive = MockExecutive(exception=ScriptError( |
| 69 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts
/webkitpy/w3c'")) | 69 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts
/webkitpy/w3c'")) |
| 70 host.filesystem = MockFileSystem(files=FAKE_FILES) | 70 host.filesystem = MockFileSystem(files=FAKE_FILES) |
| 71 importer = TestImporter(host, FAKE_SOURCE_REPO_DIR, self.options()) | 71 importer = TestImporter(host, FAKE_SOURCE_REPO_DIR, self.options()) |
| 72 importer.do_import() # No exception raised. | 72 importer.do_import() # No exception raised. |
| 73 | 73 |
| 74 def test_path_too_long_true(self): | 74 def test_path_too_long_true(self): |
| 75 importer = TestImporter(MockHost(), FAKE_SOURCE_REPO_DIR, self.options()
) | 75 importer = TestImporter(MockHost(), FAKE_SOURCE_REPO_DIR, self.options()
) |
| 76 self.assertTrue(importer.path_too_long(FAKE_SOURCE_REPO_DIR + '/' + ('x'
* 150) + '.html')) | 76 self.assertTrue(importer.path_too_long(FAKE_SOURCE_REPO_DIR + '/' + ('x'
* 150) + '.html')) |
| 77 | 77 |
| 78 def test_path_too_long_false(self): | 78 def test_path_too_long_false(self): |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 def test_should_not_try_to_convert_test_in_wpt(self): | 178 def test_should_not_try_to_convert_test_in_wpt(self): |
| 179 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.html', 'Lay
outTests/imported/wpt/foo')) | 179 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.html', 'Lay
outTests/imported/wpt/foo')) |
| 180 | 180 |
| 181 def test_should_not_try_to_convert_other_file_types(self): | 181 def test_should_not_try_to_convert_other_file_types(self): |
| 182 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.bar', 'Layo
utTests/imported/csswg-test/x')) | 182 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.bar', 'Layo
utTests/imported/csswg-test/x')) |
| 183 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.js', 'Layou
tTests/imported/csswg-test/x')) | 183 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.js', 'Layou
tTests/imported/csswg-test/x')) |
| 184 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.md', 'Layou
tTests/imported/csswg-test/x')) | 184 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.md', 'Layou
tTests/imported/csswg-test/x')) |
| 185 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.png', 'Layo
utTests/imported/csswg-test/x')) | 185 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.png', 'Layo
utTests/imported/csswg-test/x')) |
| 186 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.svg', 'Layo
utTests/imported/csswg-test/x')) | 186 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.svg', 'Layo
utTests/imported/csswg-test/x')) |
| 187 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.svgz', 'Lay
outTests/imported/csswg-test/x')) | 187 self.assertFalse(TestImporter.should_try_to_convert({}, 'foo.svgz', 'Lay
outTests/imported/csswg-test/x')) |
| OLD | NEW |