| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import unittest | |
| 6 from webkitpy.common.host_mock import MockHost | |
| 7 from webkitpy.common.system.executive_mock import MockExecutive2 | |
| 8 from webkitpy.w3c.chromium_wpt import ChromiumWPT | |
| 9 | |
| 10 | |
| 11 class ChromiumWPTTest(unittest.TestCase): | |
| 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) | |
| 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_reverted_commits_with_noexport_true(self): | |
| 44 host = MockHost() | |
| 45 | |
| 46 return_vals = [ | |
| 47 'Commit message\n> NOEXPORT=true', # 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) | |
| 56 | |
| 57 def test_ignores_commits_that_start_with_import(self): | |
| 58 host = MockHost() | |
| 59 | |
| 60 return_vals = [ | |
| 61 'Import rutabaga@deadbeef', # show (message) | |
| 62 'deadbeefcafe', # rev-list | |
| 63 'third_party/WebKit/LayoutTests/imported/wpt', # rev-parse | |
| 64 ] | |
| 65 host.executive = MockExecutive2(run_command_fn=lambda _: return_vals.pop
()) | |
| 66 | |
| 67 chromium_wpt = ChromiumWPT(host) | |
| 68 commits = chromium_wpt.exportable_commits_since('3dadcafe') | |
| 69 self.assertEqual(len(commits), 0) | |
| OLD | NEW |