| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 FAKE_FILES = { | 41 FAKE_FILES = { |
| 42 '/blink/w3c/empty_dir/README.txt': '', | 42 '/blink/w3c/empty_dir/README.txt': '', |
| 43 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': '', | 43 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': '', |
| 44 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations': '', | 44 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations': '', |
| 45 } | 45 } |
| 46 | 46 |
| 47 | 47 |
| 48 class TestImporterTest(unittest.TestCase): | 48 class TestImporterTest(unittest.TestCase): |
| 49 | 49 |
| 50 @staticmethod |
| 51 def options(**kwargs): |
| 52 """Returns a set of option values for TestImporter.""" |
| 53 options = { |
| 54 "overwrite": False, |
| 55 "destination": "w3c", |
| 56 "ignore_expectations": False, |
| 57 } |
| 58 options.update(kwargs) |
| 59 return optparse.Values(options) |
| 60 |
| 50 def test_import_dir_with_no_tests(self): | 61 def test_import_dir_with_no_tests(self): |
| 51 host = MockHost() | 62 host = MockHost() |
| 52 host.executive = MockExecutive2(exception=ScriptError( | 63 host.executive = MockExecutive2(exception=ScriptError( |
| 53 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts
/webkitpy/w3c'")) | 64 "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts
/webkitpy/w3c'")) |
| 54 host.filesystem = MockFileSystem(files=FAKE_FILES) | 65 host.filesystem = MockFileSystem(files=FAKE_FILES) |
| 55 | 66 |
| 56 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, optparse.V
alues( | 67 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio
ns()) |
| 57 {"overwrite": False, 'destination': 'w3c', 'ignore_expectations': Fa
lse})) | 68 |
| 58 oc = OutputCapture() | 69 oc = OutputCapture() |
| 59 oc.capture_output() | 70 oc.capture_output() |
| 60 try: | 71 try: |
| 61 importer.do_import() | 72 importer.do_import() |
| 62 finally: | 73 finally: |
| 63 oc.restore_output() | 74 oc.restore_output() |
| 64 | 75 |
| 76 def test_path_too_long_true(self): |
| 77 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self
.options()) |
| 78 self.assertTrue(importer.path_too_long(FAKE_REPO_DIR + '/' + ('x' * 150)
+ '.html')) |
| 79 |
| 80 def test_path_too_long_false(self): |
| 81 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self
.options()) |
| 82 self.assertFalse(importer.path_too_long(FAKE_REPO_DIR + '/x.html')) |
| 83 |
| 65 # FIXME: Needs more tests. | 84 # FIXME: Needs more tests. |
| OLD | NEW |