| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import collections | 5 import collections |
| 6 | 6 |
| 7 from webkitpy.common.checkout.git_mock import MockGit | 7 from webkitpy.common.checkout.git_mock import MockGit |
| 8 from webkitpy.common.host_mock import MockHost | 8 from webkitpy.common.host_mock import MockHost |
| 9 from webkitpy.common.system.executive_mock import MockExecutive | 9 from webkitpy.common.system.executive_mock import MockExecutive |
| 10 from webkitpy.common.system.log_testing import LoggingTestCase | 10 from webkitpy.common.system.log_testing import LoggingTestCase |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 blink_path + '/LayoutTests/external/WPT_BASE_MANIFEST.json', | 155 blink_path + '/LayoutTests/external/WPT_BASE_MANIFEST.json', |
| 156 ] | 156 ] |
| 157 ]) | 157 ]) |
| 158 | 158 |
| 159 def test_get_directory_owners(self): | 159 def test_get_directory_owners(self): |
| 160 host = MockHost() | 160 host = MockHost() |
| 161 host.filesystem.write_text_file( | 161 host.filesystem.write_text_file( |
| 162 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', | 162 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', |
| 163 '## Owners: someone@chromium.org\n' | 163 '## Owners: someone@chromium.org\n' |
| 164 '# external/wpt/foo [ Pass ]\n') | 164 '# external/wpt/foo [ Pass ]\n') |
| 165 git = MockGit() | 165 git = MockGit(filesystem=host.filesystem, executive=host.executive, plat
form=host.platform) |
| 166 git.changed_files = lambda: ['third_party/WebKit/LayoutTests/external/wp
t/foo/x.html'] | 166 git.changed_files = lambda: ['third_party/WebKit/LayoutTests/external/wp
t/foo/x.html'] |
| 167 host.git = lambda: git | 167 host.git = lambda: git |
| 168 importer = TestImporter(host) | 168 importer = TestImporter(host) |
| 169 self.assertEqual(importer.get_directory_owners(), {('someone@chromium.or
g',): ['external/wpt/foo']}) | 169 self.assertEqual(importer.get_directory_owners(), {('someone@chromium.or
g',): ['external/wpt/foo']}) |
| 170 | 170 |
| 171 def test_get_directory_owners_no_changed_files(self): | 171 def test_get_directory_owners_no_changed_files(self): |
| 172 host = MockHost() | 172 host = MockHost() |
| 173 host.filesystem.write_text_file( | 173 host.filesystem.write_text_file( |
| 174 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', | 174 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', |
| 175 '## Owners: someone@chromium.org\n' | 175 '## Owners: someone@chromium.org\n' |
| (...skipping 28 matching lines...) Expand all Loading... |
| 204 host.filesystem.write_text_file(dest_path + '/foo-test.html', '') | 204 host.filesystem.write_text_file(dest_path + '/foo-test.html', '') |
| 205 host.filesystem.write_text_file(dest_path + '/foo-test-expected.txt', ''
) | 205 host.filesystem.write_text_file(dest_path + '/foo-test-expected.txt', ''
) |
| 206 host.filesystem.write_text_file(dest_path + '/OWNERS', '') | 206 host.filesystem.write_text_file(dest_path + '/OWNERS', '') |
| 207 host.filesystem.write_text_file(dest_path + '/bar/baz/OWNERS', '') | 207 host.filesystem.write_text_file(dest_path + '/bar/baz/OWNERS', '') |
| 208 importer = TestImporter(host) | 208 importer = TestImporter(host) |
| 209 importer._clear_out_dest_path(dest_path) | 209 importer._clear_out_dest_path(dest_path) |
| 210 self.assertFalse(host.filesystem.exists(dest_path + '/foo-test.html')) | 210 self.assertFalse(host.filesystem.exists(dest_path + '/foo-test.html')) |
| 211 self.assertTrue(host.filesystem.exists(dest_path + '/foo-test-expected.t
xt')) | 211 self.assertTrue(host.filesystem.exists(dest_path + '/foo-test-expected.t
xt')) |
| 212 self.assertTrue(host.filesystem.exists(dest_path + '/OWNERS')) | 212 self.assertTrue(host.filesystem.exists(dest_path + '/OWNERS')) |
| 213 self.assertTrue(host.filesystem.exists(dest_path + '/bar/baz/OWNERS')) | 213 self.assertTrue(host.filesystem.exists(dest_path + '/bar/baz/OWNERS')) |
| OLD | NEW |