| 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 |
| 11 from webkitpy.w3c.test_importer import TestImporter | 11 from webkitpy.w3c.test_importer import TestImporter |
| 12 | 12 |
| 13 | 13 |
| 14 MockChromiumCommit = collections.namedtuple('ChromiumCommit', ('sha', 'position'
)) | 14 MockChromiumCommit = collections.namedtuple('ChromiumCommit', ('sha', 'position'
)) |
| 15 | 15 |
| 16 | 16 |
| 17 class TestImporterTest(LoggingTestCase): | 17 class TestImporterTest(LoggingTestCase): |
| 18 | 18 |
| 19 def test_abort_on_exportable_commits(self): | 19 def test_abort_on_exportable_commits(self): |
| 20 importer = TestImporter(MockHost()) | 20 importer = TestImporter(MockHost()) |
| 21 importer.exportable_but_not_exported_commits = lambda _: [ | 21 importer.exportable_but_not_exported_commits = lambda _: [ |
| 22 MockChromiumCommit(sha='deadbeef', position=123)] | 22 MockChromiumCommit(sha='deadbeef', position=123)] |
| 23 importer.checkout_is_okay = lambda _: True | 23 importer.checkout_is_okay = lambda _: True |
| 24 return_code = importer.main(['wpt']) | 24 return_code = importer.main(['wpt']) |
| 25 self.assertEqual(return_code, 0) | 25 self.assertEqual(return_code, 0) |
| 26 self.assertLog([ | 26 self.assertLog([ |
| 27 'INFO: Cloning repo: https://chromium.googlesource.com/external/w3c/
web-platform-tests.git\n', | 27 'INFO: Cloning repo: https://chromium.googlesource.com/external/w3c/
web-platform-tests.git\n', |
| 28 'INFO: Local path: /mock-checkout/third_party/WebKit/wpt\n', | 28 'INFO: Local path: /mock-checkout/third_party/WebKit/LayoutTests/wpt
\n', |
| 29 'INFO: There were exportable but not-yet-exported commits:\n', | 29 'INFO: There were exportable but not-yet-exported commits:\n', |
| 30 'INFO: https://chromium.googlesource.com/chromium/src/+/deadbeef\n
', | 30 'INFO: https://chromium.googlesource.com/chromium/src/+/deadbeef\n
', |
| 31 'INFO: Aborting import to prevent clobbering these commits.\n', | 31 'INFO: Aborting import to prevent clobbering these commits.\n', |
| 32 'INFO: Deleting temp repo directory /mock-checkout/third_party/WebKi
t/wpt.\n', | 32 'INFO: Deleting temp repo directory /mock-checkout/third_party/WebKi
t/LayoutTests/wpt.\n', |
| 33 ]) | 33 ]) |
| 34 | 34 |
| 35 def test_update_test_expectations(self): | 35 def test_update_test_expectations(self): |
| 36 host = MockHost() | 36 host = MockHost() |
| 37 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Tes
tExpectations'] = ( | 37 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Tes
tExpectations'] = ( |
| 38 'Bug(test) some/test/a.html [ Failure ]\n' | 38 'Bug(test) some/test/a.html [ Failure ]\n' |
| 39 'Bug(test) some/test/b.html [ Failure ]\n' | 39 'Bug(test) some/test/b.html [ Failure ]\n' |
| 40 'Bug(test) some/test/c.html [ Failure ]\n') | 40 'Bug(test) some/test/c.html [ Failure ]\n') |
| 41 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Vir
tualTestSuites'] = '[]' | 41 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Vir
tualTestSuites'] = '[]' |
| 42 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'] = '' |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |