| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 description, | 109 description, |
| 110 ('Summary\n\n' | 110 ('Summary\n\n' |
| 111 'TBR=qyearsley@chromium.org\n' | 111 'TBR=qyearsley@chromium.org\n' |
| 112 'NOEXPORT=true')) | 112 'NOEXPORT=true')) |
| 113 | 113 |
| 114 def test_cl_description_with_directory_owners(self): | 114 def test_cl_description_with_directory_owners(self): |
| 115 host = MockHost() | 115 host = MockHost() |
| 116 host.executive = MockExecutive(output='Last commit message\n\n') | 116 host.executive = MockExecutive(output='Last commit message\n\n') |
| 117 importer = TestImporter(host) | 117 importer = TestImporter(host) |
| 118 description = importer._cl_description(directory_owners={ | 118 description = importer._cl_description(directory_owners={ |
| 119 'someone@chromium.org': ['external/wpt/foo', 'external/wpt/bar'], | 119 ('someone@chromium.org',): ['external/wpt/foo', 'external/wpt/bar'], |
| 120 'someone-else@chromium.org': ['external/wpt/baz'], | 120 ('x@chromium.org', 'y@chromium.org'): ['external/wpt/baz'], |
| 121 }) | 121 }) |
| 122 self.assertEqual( | 122 self.assertEqual( |
| 123 description, | 123 description, |
| 124 ('Last commit message\n\n' | 124 ('Last commit message\n\n' |
| 125 'Directory owners for changes in this CL:\n' | 125 'Directory owners for changes in this CL:\n' |
| 126 'someone-else@chromium.org:\n' | |
| 127 ' external/wpt/baz\n' | |
| 128 'someone@chromium.org:\n' | 126 'someone@chromium.org:\n' |
| 129 ' external/wpt/foo\n' | 127 ' external/wpt/foo\n' |
| 130 ' external/wpt/bar\n\n' | 128 ' external/wpt/bar\n' |
| 129 'x@chromium.org, y@chromium.org:\n' |
| 130 ' external/wpt/baz\n\n' |
| 131 'TBR=qyearsley@chromium.org\n' | 131 'TBR=qyearsley@chromium.org\n' |
| 132 'NOEXPORT=true')) | 132 'NOEXPORT=true')) |
| 133 | 133 |
| 134 def test_generate_manifest_command_not_found(self): | 134 def test_generate_manifest_command_not_found(self): |
| 135 # If we're updating csswg-test, then the manifest file won't be found. | 135 # If we're updating csswg-test, then the manifest file won't be found. |
| 136 host = MockHost() | 136 host = MockHost() |
| 137 host.filesystem.files = {} | 137 host.filesystem.files = {} |
| 138 importer = TestImporter(host) | 138 importer = TestImporter(host) |
| 139 importer._generate_manifest( | 139 importer._generate_manifest( |
| 140 '/mock-checkout/third_party/WebKit/LayoutTests/external/csswg-test') | 140 '/mock-checkout/third_party/WebKit/LayoutTests/external/csswg-test') |
| (...skipping 25 matching lines...) Expand all Loading... |
| 166 def test_get_directory_owners(self): | 166 def test_get_directory_owners(self): |
| 167 host = MockHost() | 167 host = MockHost() |
| 168 host.filesystem.write_text_file( | 168 host.filesystem.write_text_file( |
| 169 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', | 169 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', |
| 170 '## Owners: someone@chromium.org\n' | 170 '## Owners: someone@chromium.org\n' |
| 171 '# external/wpt/foo [ Pass ]\n') | 171 '# external/wpt/foo [ Pass ]\n') |
| 172 git = MockGit() | 172 git = MockGit() |
| 173 git.changed_files = lambda: ['third_party/WebKit/LayoutTests/external/wp
t/foo/x.html'] | 173 git.changed_files = lambda: ['third_party/WebKit/LayoutTests/external/wp
t/foo/x.html'] |
| 174 host.git = lambda: git | 174 host.git = lambda: git |
| 175 importer = TestImporter(host) | 175 importer = TestImporter(host) |
| 176 self.assertEqual(importer.get_directory_owners(), {'someone@chromium.org
': ['external/wpt/foo']}) | 176 self.assertEqual(importer.get_directory_owners(), {('someone@chromium.or
g',): ['external/wpt/foo']}) |
| 177 | 177 |
| 178 def test_get_directory_owners_no_changed_files(self): | 178 def test_get_directory_owners_no_changed_files(self): |
| 179 host = MockHost() | 179 host = MockHost() |
| 180 host.filesystem.write_text_file( | 180 host.filesystem.write_text_file( |
| 181 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', | 181 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', |
| 182 '## Owners: someone@chromium.org\n' | 182 '## Owners: someone@chromium.org\n' |
| 183 '# external/wpt/foo [ Pass ]\n') | 183 '# external/wpt/foo [ Pass ]\n') |
| 184 importer = TestImporter(host) | 184 importer = TestImporter(host) |
| 185 self.assertEqual(importer.get_directory_owners(), {}) | 185 self.assertEqual(importer.get_directory_owners(), {}) |
| OLD | NEW |