| Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py
|
| index df60e5459b908240cd905b15f4d5cfcfbdb8b39e..83dcf866376660ae54767665dfa81920423ae0aa 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py
|
| @@ -7,9 +7,8 @@ import optparse
|
|
|
| from webkitpy.common.net.buildbot import Build
|
| from webkitpy.common.net.git_cl import GitCL
|
| +from webkitpy.common.checkout.git_mock import MockGit
|
| from webkitpy.common.net.layout_test_results import LayoutTestResults
|
| -from webkitpy.common.net.rietveld import Rietveld
|
| -from webkitpy.common.net.web_mock import MockWeb
|
| from webkitpy.common.system.log_testing import LoggingTestCase
|
| from webkitpy.layout_tests.builder_list import BuilderList
|
| from webkitpy.tool.commands.rebaseline_cl import RebaselineCL
|
| @@ -22,29 +21,19 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| def setUp(self):
|
| BaseTestCase.setUp(self)
|
| LoggingTestCase.setUp(self)
|
| - web = MockWeb(urls={
|
| - 'https://codereview.chromium.org/api/11112222': json.dumps({
|
| - 'patchsets': [1, 2],
|
| - }),
|
| - 'https://codereview.chromium.org/api/11112222/2': json.dumps({
|
| - 'try_job_results': [
|
| - {
|
| - 'builder': 'MOCK Try Win',
|
| - 'buildnumber': 5000,
|
| - 'result': 0,
|
| - },
|
| - {
|
| - 'builder': 'MOCK Try Mac',
|
| - 'buildnumber': 4000,
|
| - 'result': 0,
|
| - },
|
| - ],
|
| - 'files': {
|
| - 'third_party/WebKit/LayoutTests/fast/dom/prototype-inheritance.html': {'status': 'M'},
|
| - 'third_party/WebKit/LayoutTests/fast/dom/prototype-taco.html': {'status': 'M'},
|
| - },
|
| - }),
|
| - })
|
| +
|
| + git_cl = GitCL(self.tool)
|
| + git_cl.get_issue_number = lambda: '11112222'
|
| + git_cl.latest_try_jobs = lambda _: [Build('MOCK Try Win', 5000)]
|
| + self.command.git_cl = lambda: git_cl
|
| +
|
| + git = MockGit(filesystem=self.tool.filesystem, executive=self.tool.executive)
|
| + git.changed_files = lambda **_: [
|
| + 'third_party/WebKit/LayoutTests/fast/dom/prototype-inheritance.html',
|
| + 'third_party/WebKit/LayoutTests/fast/dom/prototype-taco.html',
|
| + ]
|
| + self.tool.git = lambda: git
|
| +
|
| self.tool.builders = BuilderList({
|
| "MOCK Try Win": {
|
| "port_name": "test-win-win7",
|
| @@ -57,8 +46,6 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| "is_try_builder": True,
|
| },
|
| })
|
| - self.command.rietveld = Rietveld(web)
|
| -
|
| layout_test_results = LayoutTestResults({
|
| 'tests': {
|
| 'fast': {
|
| @@ -146,7 +133,6 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| options = {
|
| 'only_changed_tests': False,
|
| 'dry_run': False,
|
| - 'issue': None,
|
| 'optimize': True,
|
| 'results_directory': None,
|
| 'verbose': False,
|
| @@ -156,7 +142,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| return optparse.Values(dict(**options))
|
|
|
| def test_execute_with_issue_number_given(self):
|
| - return_code = self.command.execute(self.command_options(issue=11112222), [], self.tool)
|
| + return_code = self.command.execute(self.command_options(), [], self.tool)
|
| self.assertEqual(return_code, 0)
|
| self.assertLog([
|
| 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n',
|
| @@ -167,17 +153,14 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| ])
|
|
|
| def test_execute_with_no_issue_number(self):
|
| + git_cl = GitCL(self.tool)
|
| + git_cl.get_issue_number = lambda: 'None'
|
| + self.command.git_cl = lambda: git_cl
|
| return_code = self.command.execute(self.command_options(), [], self.tool)
|
| self.assertEqual(return_code, 1)
|
| - self.assertLog(['ERROR: No issue number given and no issue for current branch. This tool requires a CL\n'
|
| - 'to operate on; please run `git cl upload` on this branch first, or use the --issue\n'
|
| - 'option to download baselines for another existing CL.\n'])
|
| + self.assertLog(['ERROR: No CL number for current branch.\n'])
|
|
|
| def test_execute_with_issue_number_from_branch(self):
|
| - git_cl = GitCL(self.tool)
|
| - git_cl.get_issue_number = lambda: '11112222'
|
| - git_cl.latest_try_jobs = lambda _: [Build('MOCK Try Win', 5000)]
|
| - self.command.git_cl = lambda: git_cl
|
| return_code = self.command.execute(self.command_options(), [], self.tool)
|
| self.assertEqual(return_code, 0)
|
| self.assertLog([
|
| @@ -189,7 +172,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| ])
|
|
|
| def test_execute_with_only_changed_tests_option(self):
|
| - return_code = self.command.execute(self.command_options(issue=11112222, only_changed_tests=True), [], self.tool)
|
| + return_code = self.command.execute(self.command_options(only_changed_tests=True), [], self.tool)
|
| self.assertEqual(return_code, 0)
|
| # svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html
|
| # is in the list of failed tests, but not in the list of files modified
|
| @@ -211,7 +194,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| ],
|
| 'ignored': ['svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html'],
|
| }))
|
| - return_code = self.command.execute(self.command_options(issue=11112222), [], self.tool)
|
| + return_code = self.command.execute(self.command_options(), [], self.tool)
|
| self.assertEqual(return_code, 0)
|
| self.assertLog([
|
| 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n',
|
| @@ -223,12 +206,11 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| # svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html
|
| # failed both with and without the patch in the try job, so it is not
|
| # rebaselined.
|
| - self.tool.buildbot.set_retry_sumary_json(
|
| - Build('MOCK Try Win', 5000), None)
|
| - return_code = self.command.execute(self.command_options(issue=11112222), [], self.tool)
|
| + self.tool.buildbot.set_retry_sumary_json(Build('MOCK Try Win', 5000), None)
|
| + return_code = self.command.execute(self.command_options(), [], self.tool)
|
| self.assertEqual(return_code, 0)
|
| self.assertLog([
|
| - 'WARNING: No retry summary available for build Build(builder_name=u\'MOCK Try Win\', build_number=5000).\n',
|
| + 'WARNING: No retry summary available for build Build(builder_name=\'MOCK Try Win\', build_number=5000).\n',
|
| 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n',
|
| 'INFO: Rebaselining fast/dom/prototype-newtest.html\n',
|
| 'INFO: Rebaselining fast/dom/prototype-slowtest.html\n',
|
| @@ -237,7 +219,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| ])
|
|
|
| def test_execute_with_trigger_jobs_option(self):
|
| - return_code = self.command.execute(self.command_options(issue=11112222, trigger_jobs=True), [], self.tool)
|
| + return_code = self.command.execute(self.command_options(trigger_jobs=True), [], self.tool)
|
| self.assertEqual(return_code, 1)
|
| self.assertLog([
|
| 'INFO: Triggering try jobs for:\n',
|
| @@ -258,7 +240,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| 'test contents')
|
|
|
| self.command.rebaseline(
|
| - self.command_options(issue=11112222),
|
| + self.command_options(),
|
| {"fast/dom/prototype-taco.html": {Build("MOCK Try Win", 5000): ["txt", "png"]}})
|
|
|
| self.assertEqual(
|
| @@ -309,7 +291,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
|
|
| def test_bails_when_one_build_is_missing_results(self):
|
| self.tool.buildbot.set_results(Build("MOCK Try Win", 5000), None)
|
| - return_code = self.command.execute(self.command_options(issue=11112222), [], self.tool)
|
| + return_code = self.command.execute(self.command_options(), [], self.tool)
|
| self.assertEqual(return_code, 1)
|
| self.assertLog([
|
| 'ERROR: Failed to fetch results from '
|
| @@ -321,7 +303,7 @@ class RebaselineCLTest(BaseTestCase, LoggingTestCase):
|
| def test_bails_when_there_are_unstaged_baselines(self):
|
| git = self.tool.git()
|
| git.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-expected.txt': '?'}
|
| - return_code = self.command.execute(self.command_options(issue=11112222), [], self.tool)
|
| + return_code = self.command.execute(self.command_options(), [], self.tool)
|
| self.assertEqual(return_code, 1)
|
| self.assertLog([
|
| 'ERROR: Aborting: there are unstaged baselines:\n',
|
|
|