| 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 unittest | 5 import collections |
| 6 | 6 |
| 7 from webkitpy.common.checkout.scm.git_mock import MockGit | 7 from webkitpy.common.checkout.scm.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.w3c.test_importer import TestImporter | 11 from webkitpy.w3c.test_importer import TestImporter |
| 11 | 12 |
| 12 | 13 |
| 13 class TestImporterTest(unittest.TestCase): | 14 MockChromiumCommit = collections.namedtuple('ChromiumCommit', ('sha', 'position'
)) |
| 15 |
| 16 |
| 17 class TestImporterTest(LoggingTestCase): |
| 14 | 18 |
| 15 def test_abort_on_exportable_commits(self): | 19 def test_abort_on_exportable_commits(self): |
| 16 importer = TestImporter(MockHost()) | 20 importer = TestImporter(MockHost()) |
| 17 importer.exportable_but_not_exported_commits = lambda _: ['aaaa'] | 21 importer.exportable_but_not_exported_commits = lambda _: [ |
| 22 MockChromiumCommit(sha='deadbeef', position=123)] |
| 23 importer.checkout_is_okay = lambda _: True |
| 18 return_code = importer.main(['wpt']) | 24 return_code = importer.main(['wpt']) |
| 19 self.assertEqual(return_code, 1) | 25 self.assertEqual(return_code, 1) |
| 26 self.assertLog([ |
| 27 'INFO: Noting the current Chromium commit.\n', |
| 28 ('INFO: Cloning https://chromium.googlesource.com/external/w3c/web-p
latform-tests.git ' |
| 29 'into /mock-checkout/third_party/WebKit/wpt.\n'), |
| 30 'ERROR: There were exportable but not-yet-exported commits:\n', |
| 31 'ERROR: https://chromium.googlesource.com/chromium/src/+/deadbeef\
n', |
| 32 'ERROR: Aborting import to prevent clobbering these commits.\n' |
| 33 ]) |
| 20 | 34 |
| 21 def test_update_test_expectations(self): | 35 def test_update_test_expectations(self): |
| 22 host = MockHost() | 36 host = MockHost() |
| 23 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Tes
tExpectations'] = ( | 37 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Tes
tExpectations'] = ( |
| 24 'Bug(test) some/test/a.html [ Failure ]\n' | 38 'Bug(test) some/test/a.html [ Failure ]\n' |
| 25 'Bug(test) some/test/b.html [ Failure ]\n' | 39 'Bug(test) some/test/b.html [ Failure ]\n' |
| 26 'Bug(test) some/test/c.html [ Failure ]\n') | 40 'Bug(test) some/test/c.html [ Failure ]\n') |
| 27 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Vir
tualTestSuites'] = '[]' | 41 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Vir
tualTestSuites'] = '[]' |
| 28 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/a.html'] = '' | 42 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/a.html'] = '' |
| 29 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/b.html'] = '' | 43 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/b.html'] = '' |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 self.assertEqual(importer.get_directory_owners(), {'someone@chromium.org
': 'external/wpt/foo'}) | 156 self.assertEqual(importer.get_directory_owners(), {'someone@chromium.org
': 'external/wpt/foo'}) |
| 143 | 157 |
| 144 def test_get_directory_owners_no_changed_files(self): | 158 def test_get_directory_owners_no_changed_files(self): |
| 145 host = MockHost() | 159 host = MockHost() |
| 146 host.filesystem.write_text_file( | 160 host.filesystem.write_text_file( |
| 147 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', | 161 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations
', |
| 148 '## Owners: someone@chromium.org\n' | 162 '## Owners: someone@chromium.org\n' |
| 149 '# external/wpt/foo [ Pass ]\n') | 163 '# external/wpt/foo [ Pass ]\n') |
| 150 importer = TestImporter(host) | 164 importer = TestImporter(host) |
| 151 self.assertEqual(importer.get_directory_owners(), {}) | 165 self.assertEqual(importer.get_directory_owners(), {}) |
| OLD | NEW |