Chromium Code Reviews| 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 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_wpt import ChromiumWPT | 8 from webkitpy.w3c.chromium_wpt import ChromiumWPT |
| 9 | 9 |
| 10 | 10 |
| 11 class ChromiumWPTTest(unittest.TestCase): | 11 class ChromiumWPTTest(unittest.TestCase): |
| 12 pass | 12 |
| 13 def test_exportable_commits_since(self): | |
| 14 host = MockHost() | |
| 15 | |
| 16 def mock_command(args): | |
| 17 git_command = args[1] | |
| 18 if git_command == 'rev-list': | |
| 19 return 'badbeef8' | |
| 20 else: | |
| 21 return '' | |
| 22 | |
| 23 host.executive = MockExecutive2(run_command_fn=mock_command) | |
| 24 | |
| 25 chromium_wpt = ChromiumWPT(host) | |
| 26 commits = chromium_wpt.exportable_commits_since('3dadcafe') | |
| 27 self.assertEqual(len(commits), 1) | |
| 28 | |
| 29 def test_ignores_commits_with_noexport_true(self): | |
| 30 host = MockHost() | |
| 31 | |
| 32 return_vals = [ | |
| 33 'Commit message\nNOEXPORT=true', # show (message) | |
|
foolip
2016/11/29 11:12:20
Also test a case with '> NOEXPORT=true' at the beg
jeffcarp
2016/11/29 19:00:48
Good catch thanks!
| |
| 34 'deadbeefcafe', # rev-list | |
| 35 'third_party/WebKit/LayoutTests/imported/wpt', # rev-parse | |
| 36 ] | |
| 37 host.executive = MockExecutive2(run_command_fn=lambda _: return_vals.pop ()) | |
| 38 | |
| 39 chromium_wpt = ChromiumWPT(host) | |
| 40 commits = chromium_wpt.exportable_commits_since('3dadcafe') | |
| 41 self.assertEqual(len(commits), 0) | |
| 42 | |
| 43 def test_ignores_commits_that_start_with_import(self): | |
| 44 host = MockHost() | |
| 45 | |
| 46 return_vals = [ | |
| 47 'Import rutabaga@deadbeef', # show (message) | |
| 48 'deadbeefcafe', # rev-list | |
| 49 'third_party/WebKit/LayoutTests/imported/wpt', # rev-parse | |
| 50 ] | |
| 51 host.executive = MockExecutive2(run_command_fn=lambda _: return_vals.pop ()) | |
| 52 | |
| 53 chromium_wpt = ChromiumWPT(host) | |
| 54 commits = chromium_wpt.exportable_commits_since('3dadcafe') | |
| 55 self.assertEqual(len(commits), 0) | |
| OLD | NEW |