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 20 matching lines...) Expand all Loading... |
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_DIR = '/blink/w3c' | 38 FAKE_SOURCE_DIR = '/blink/w3c' |
39 FAKE_REPO_DIR = '/blink' | 39 FAKE_REPO_DIR = '/blink' |
40 | 40 |
41 FAKE_FILES = { | 41 FAKE_FILES = {'/mock-checkout/third_party/Webkit/LayoutTests/w3c/OWNERS': '', |
42 '/blink/w3c/empty_dir/README.txt': '', | 42 '/blink/w3c/dir/README.txt': '', |
43 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': '', | 43 '/blink/w3c/dir/OWNERS': '', |
44 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations': '', | 44 '/blink/w3c/dir1/OWNERS': '', |
45 } | 45 '/mock-checkout/third_party/WebKit/LayoutTests/w3c/README.txt': ''
, |
| 46 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectatio
ns': ''} |
| 47 |
46 | 48 |
47 | 49 |
48 class TestImporterTest(unittest.TestCase): | 50 class TestImporterTest(unittest.TestCase): |
49 | 51 |
50 @staticmethod | 52 @staticmethod |
51 def options(**kwargs): | 53 def options(**kwargs): |
52 """Returns a set of option values for TestImporter.""" | 54 """Returns a set of option values for TestImporter.""" |
53 options = { | 55 options = { |
54 "overwrite": False, | 56 "overwrite": False, |
55 "destination": "w3c", | 57 "destination": "w3c", |
(...skipping 18 matching lines...) Expand all Loading... |
74 oc.restore_output() | 76 oc.restore_output() |
75 | 77 |
76 def test_path_too_long_true(self): | 78 def test_path_too_long_true(self): |
77 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self
.options()) | 79 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self
.options()) |
78 self.assertTrue(importer.path_too_long(FAKE_REPO_DIR + '/' + ('x' * 150)
+ '.html')) | 80 self.assertTrue(importer.path_too_long(FAKE_REPO_DIR + '/' + ('x' * 150)
+ '.html')) |
79 | 81 |
80 def test_path_too_long_false(self): | 82 def test_path_too_long_false(self): |
81 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self
.options()) | 83 importer = TestImporter(MockHost(), FAKE_SOURCE_DIR, FAKE_REPO_DIR, self
.options()) |
82 self.assertFalse(importer.path_too_long(FAKE_REPO_DIR + '/x.html')) | 84 self.assertFalse(importer.path_too_long(FAKE_REPO_DIR + '/x.html')) |
83 | 85 |
84 # FIXME: Needs more tests. | 86 def test_does_not_import_owner_files(self): |
| 87 host = MockHost() |
| 88 host.filesystem = MockFileSystem(files=FAKE_FILES) |
| 89 importer = TestImporter(host, FAKE_SOURCE_DIR, FAKE_REPO_DIR, self.optio
ns()) |
| 90 importer.find_importable_tests(FAKE_REPO_DIR) |
| 91 self.assertEqual(importer.import_list, |
| 92 [{'copy_list': [{'dest': 'README.txt', 'src': '/blink/w
3c/dir/README.txt'}], |
| 93 'dirname': '/blink/w3c/dir', |
| 94 'jstests': 0, |
| 95 'reftests': 0, |
| 96 'total_tests': 0}]) |
OLD | NEW |