Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py |
| index 497692028877eed80ac5e1d1d147f8c07c518ee8..1a9f746efa6d67fb3e8febecb3600dbef54b874f 100644 |
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py |
| @@ -49,13 +49,23 @@ FAKE_FILES = { |
| class TestImporterTest(unittest.TestCase): |
| + @staticmethod |
| + def options(**kwargs): |
| + """Returns a set of option values for TestImporter.""" |
| + options = { |
| + "overwrite": False, |
| + "destination": "w3c", |
| + "ignore_expectations": False, |
| + } |
| + options.update(kwargs) |
| + return optparse.Values(options) |
| + |
| def test_import_dir_with_no_tests_and_no_hg(self): |
| host = MockHost() |
| host.executive = MockExecutive2(exception=OSError()) |
| host.filesystem = MockFileSystem(files=FAKE_FILES) |
| - importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.Values( |
| - {"overwrite": False, 'destination': 'w3c', 'ignore_expectations': False})) |
| + importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.options()) |
| oc = OutputCapture() |
| oc.capture_output() |
| @@ -70,8 +80,8 @@ class TestImporterTest(unittest.TestCase): |
| "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found)!")) |
| host.filesystem = MockFileSystem(files=FAKE_FILES) |
| - importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.Values( |
| - {"overwrite": False, 'destination': 'w3c', 'ignore_expectations': False})) |
| + importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.options()) |
| + |
| oc = OutputCapture() |
| oc.capture_output() |
| try: |
| @@ -79,4 +89,12 @@ class TestImporterTest(unittest.TestCase): |
| finally: |
| oc.restore_output() |
| + def test_path_too_long_true(self): |
| + importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.options()) |
| + self.assertTrue(importer.path_too_long(FAKE_REPO_DIR + '/' + ('x' * 150) + '.html')) |
| + |
| + def test_path_too_long_false(self): |
| + importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.options()) |
| + self.assertFalse(importer.path_too_long(FAKE_REPO_DIR + '/x.html')) |
| + |
|
qyearsley
2016/05/11 22:27:29
Can't yet add a test that calls do_import and chec
|
| # FIXME: Needs more tests. |