| 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 unittest |
| 6 | 6 |
| 7 from webkitpy.common.host_mock import MockHost | 7 from webkitpy.common.host_mock import MockHost |
| 8 from webkitpy.common.system.executive_mock import MockExecutive, mock_git_comman
ds | 8 from webkitpy.common.system.executive_mock import MockExecutive, mock_git_comman
ds |
| 9 from webkitpy.w3c.chromium_commit import ChromiumCommit | 9 from webkitpy.w3c.chromium_commit import ChromiumCommit |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 host.executive = MockExecutive(output='c881563d734a86f7d9cd57ac509653a61
c45c240') | 24 host.executive = MockExecutive(output='c881563d734a86f7d9cd57ac509653a61
c45c240') |
| 25 pos = 'Cr-Commit-Position: refs/heads/master@{#789}' | 25 pos = 'Cr-Commit-Position: refs/heads/master@{#789}' |
| 26 chromium_commit = ChromiumCommit(host, position=pos) | 26 chromium_commit = ChromiumCommit(host, position=pos) |
| 27 | 27 |
| 28 self.assertEqual(chromium_commit.position, 'refs/heads/master@{#789}') | 28 self.assertEqual(chromium_commit.position, 'refs/heads/master@{#789}') |
| 29 self.assertEqual(chromium_commit.sha, 'c881563d734a86f7d9cd57ac509653a61
c45c240') | 29 self.assertEqual(chromium_commit.sha, 'c881563d734a86f7d9cd57ac509653a61
c45c240') |
| 30 | 30 |
| 31 def test_filtered_changed_files_blacklist(self): | 31 def test_filtered_changed_files_blacklist(self): |
| 32 host = MockHost() | 32 host = MockHost() |
| 33 | 33 |
| 34 fake_files = ['file1', 'MANIFEST.json', 'file3'] | 34 fake_files = ['file1', 'MANIFEST.json', 'file3', 'OWNERS'] |
| 35 qualified_fake_files = [CHROMIUM_WPT_DIR + f for f in fake_files] | 35 qualified_fake_files = [CHROMIUM_WPT_DIR + f for f in fake_files] |
| 36 | 36 |
| 37 host.executive = mock_git_commands({ | 37 host.executive = mock_git_commands({ |
| 38 'diff-tree': '\n'.join(qualified_fake_files), | 38 'diff-tree': '\n'.join(qualified_fake_files), |
| 39 'crrev-parse': 'c881563d734a86f7d9cd57ac509653a61c45c240', | 39 'crrev-parse': 'c881563d734a86f7d9cd57ac509653a61c45c240', |
| 40 }) | 40 }) |
| 41 | 41 |
| 42 position_footer = 'Cr-Commit-Position: refs/heads/master@{#789}' | 42 position_footer = 'Cr-Commit-Position: refs/heads/master@{#789}' |
| 43 chromium_commit = ChromiumCommit(host, position=position_footer) | 43 chromium_commit = ChromiumCommit(host, position=position_footer) |
| 44 | 44 |
| 45 files = chromium_commit.filtered_changed_files() | 45 files = chromium_commit.filtered_changed_files() |
| 46 | 46 |
| 47 expected_files = ['file1', 'file3'] | 47 expected_files = ['file1', 'file3'] |
| 48 qualified_expected_files = [CHROMIUM_WPT_DIR + f for f in expected_files
] | 48 qualified_expected_files = [CHROMIUM_WPT_DIR + f for f in expected_files
] |
| 49 | 49 |
| 50 self.assertEqual(files, qualified_expected_files) | 50 self.assertEqual(files, qualified_expected_files) |
| 51 | 51 |
| 52 def test_short_sha(self): | 52 def test_short_sha(self): |
| 53 chromium_commit = ChromiumCommit(MockHost(), sha='c881563d734a86f7d9cd57
ac509653a61c45c240') | 53 chromium_commit = ChromiumCommit(MockHost(), sha='c881563d734a86f7d9cd57
ac509653a61c45c240') |
| 54 self.assertEqual(chromium_commit.short_sha, 'c881563d73') | 54 self.assertEqual(chromium_commit.short_sha, 'c881563d73') |
| OLD | NEW |