Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/chromium_commit_unittest.py

Issue 2583723002: Use LocalWPT.test_patch when filtering exportable commits (Closed)
Patch Set: Add missing constant Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 from webkitpy.common.host_mock import MockHost 6 from webkitpy.common.host_mock import MockHost
7 from webkitpy.common.system.executive_mock import MockExecutive2 7 from webkitpy.common.system.executive_mock import MockExecutive2
8 from webkitpy.w3c.chromium_commit import ChromiumCommit 8 from webkitpy.w3c.chromium_commit import ChromiumCommit
9 from webkitpy.w3c.test_exporter_unittest import mock_command_exec
10
11 CHROMIUM_WPT_DIR = 'third_party/WebKit/LayoutTests/imported/wpt/'
9 12
10 13
11 class ChromiumCommitTest(unittest.TestCase): 14 class ChromiumCommitTest(unittest.TestCase):
12 15
13 def test_accepts_sha(self): 16 def test_accepts_sha(self):
14 chromium_commit = ChromiumCommit(MockHost(), sha='deadbeefcafe') 17 chromium_commit = ChromiumCommit(MockHost(), sha='deadbeefcafe')
15 18
16 self.assertEqual(chromium_commit.sha, 'deadbeefcafe') 19 self.assertEqual(chromium_commit.sha, 'deadbeefcafe')
17 self.assertIsNone(chromium_commit.position) 20 self.assertIsNone(chromium_commit.position)
18 21
19 def test_derives_sha_from_position(self): 22 def test_derives_sha_from_position(self):
20 host = MockHost() 23 host = MockHost()
21 host.executive = MockExecutive2(output='deadbeefcafe') 24 host.executive = MockExecutive2(output='deadbeefcafe')
22 pos = 'Cr-Commit-Position: refs/heads/master@{#789}' 25 pos = 'Cr-Commit-Position: refs/heads/master@{#789}'
23 chromium_commit = ChromiumCommit(host, position=pos) 26 chromium_commit = ChromiumCommit(host, position=pos)
24 27
25 self.assertEqual(chromium_commit.position, 'refs/heads/master@{#789}') 28 self.assertEqual(chromium_commit.position, 'refs/heads/master@{#789}')
26 self.assertEqual(chromium_commit.sha, 'deadbeefcafe') 29 self.assertEqual(chromium_commit.sha, 'deadbeefcafe')
30
31 def test_filtered_changed_files_blacklist(self):
32 host = MockHost()
33
34 fake_files = ['file1', 'MANIFEST.json', 'file3']
35 qualified_fake_files = [CHROMIUM_WPT_DIR + f for f in fake_files]
36
37 host.executive = mock_command_exec({
38 'diff-tree': '\n'.join(qualified_fake_files),
39 'crrev-parse': 'fake rev',
40 })
41
42 position_footer = 'Cr-Commit-Position: refs/heads/master@{#789}'
43 chromium_commit = ChromiumCommit(host, position=position_footer)
44
45 files = chromium_commit.filtered_changed_files()
46
47 expected_files = ['file1', 'file3']
48 qualified_expected_files = [CHROMIUM_WPT_DIR + f for f in expected_files ]
49
50 self.assertEqual(files, qualified_expected_files)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698