| 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 17 matching lines...) Expand all Loading... |
| 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.filesystem_mock import MockFileSystem | 32 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 33 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError | 33 from webkitpy.common.system.executive_mock import MockExecutive2, ScriptError |
| 34 from webkitpy.common.system.outputcapture import OutputCapture | 34 from webkitpy.common.system.outputcapture import OutputCapture |
| 35 from webkitpy.w3c.test_importer import TestImporter | 35 from webkitpy.w3c.test_importer import TestImporter |
| 36 | 36 |
| 37 | 37 |
| 38 FAKE_SOURCE_REPO_DIR = '/blink' | 38 FAKE_SOURCE_DIR = '/blink/w3c' |
| 39 FAKE_REPO_DIR = '/blink' |
| 39 | 40 |
| 40 FAKE_FILES = {'/mock-checkout/third_party/Webkit/LayoutTests/w3c/OWNERS': '', | 41 FAKE_FILES = {'/mock-checkout/third_party/Webkit/LayoutTests/w3c/OWNERS': '', |
| 41 '/blink/w3c/dir/README.txt': '', | 42 '/blink/w3c/dir/README.txt': '', |
| 42 '/blink/w3c/dir/OWNERS': '', | 43 '/blink/w3c/dir/OWNERS': '', |
| 43 '/blink/w3c/dir1/OWNERS': '', | 44 '/blink/w3c/dir1/OWNERS': '', |
| 44 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': ''
, | 45 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': ''
, |
| 45 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectatio
ns': ''} | 46 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectatio
ns': ''} |
| 46 | 47 |
| 47 | 48 |
| 48 | 49 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 59 } | 60 } |
| 60 options.update(kwargs) | 61 options.update(kwargs) |
| 61 return optparse.Values(options) | 62 return optparse.Values(options) |
| 62 | 63 |
| 63 def test_import_dir_with_no_tests(self): | 64 def test_import_dir_with_no_tests(self): |
| 64 host = MockHost() | 65 host = MockHost() |
| 65 host.executive = MockExecutive2(exception=ScriptError( | 66 host.executive = MockExecutive2(exception=ScriptError( |
| 66 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts
/webkitpy/w3c'")) | 67 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts
/webkitpy/w3c'")) |
| 67 host.filesystem = MockFileSystem(files=FAKE_FILES) | 68 host.filesystem = MockFileSystem(files=FAKE_FILES) |
| 68 | 69 |
| 69 importer = TestImporter(host, FAKE_SOURCE_REPO_DIR, self.options()) | 70 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio
ns()) |
| 70 | 71 |
| 71 oc = OutputCapture() | 72 oc = OutputCapture() |
| 72 oc.capture_output() | 73 oc.capture_output() |
| 73 try: | 74 try: |
| 74 importer.do_import() | 75 importer.do_import() |
| 75 finally: | 76 finally: |
| 76 oc.restore_output() | 77 oc.restore_output() |
| 77 | 78 |
| 78 def test_path_too_long_true(self): | 79 def test_path_too_long_true(self): |
| 79 importer = TestImporter(MockHost(), FAKE_SOURCE_REPO_DIR, self.options()
) | 80 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self
.options()) |
| 80 self.assertTrue(importer.path_too_long(FAKE_SOURCE_REPO_DIR + '/' + ('x'
* 150) + '.html')) | 81 self.assertTrue(importer.path_too_long(FAKE_REPO_DIR + '/' + ('x' * 150)
+ '.html')) |
| 81 | 82 |
| 82 def test_path_too_long_false(self): | 83 def test_path_too_long_false(self): |
| 83 importer = TestImporter(MockHost(), FAKE_SOURCE_REPO_DIR, self.options()
) | 84 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self
.options()) |
| 84 self.assertFalse(importer.path_too_long(FAKE_SOURCE_REPO_DIR + '/x.html'
)) | 85 self.assertFalse(importer.path_too_long(FAKE_REPO_DIR + '/x.html')) |
| 85 | 86 |
| 86 def test_does_not_import_owner_files(self): | 87 def test_does_not_import_owner_files(self): |
| 87 host = MockHost() | 88 host = MockHost() |
| 88 host.filesystem = MockFileSystem(files=FAKE_FILES) | 89 host.filesystem = MockFileSystem(files=FAKE_FILES) |
| 89 importer = TestImporter(host, FAKE_SOURCE_REPO_DIR, self.options()) | 90 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio
ns()) |
| 90 importer.find_importable_tests() | 91 importer.find_importable_tests(FAKE_REPO_DIR) |
| 91 self.assertEqual(importer.import_list, | 92 self.assertEqual(importer.import_list, |
| 92 [{'copy_list': [{'dest': 'README.txt', 'src': '/blink/w
3c/dir/README.txt'}], | 93 [{'copy_list': [{'dest': 'README.txt', 'src': '/blink/w
3c/dir/README.txt'}], |
| 93 'dirname': '/blink/w3c/dir', | 94 'dirname': '/blink/w3c/dir', |
| 94 'jstests': 0, | 95 'jstests': 0, |
| 95 'reftests': 0, | 96 'reftests': 0, |
| 96 'total_tests': 0}]) | 97 'total_tests': 0}]) |
| OLD | NEW |