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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs_unittest.py

Issue 2144843003: Try to get current CL number if none given in rebaseline-from-try-jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Always use a directory inside the repo as cwd. Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs_unittest.py
index 30820fcab93c84d1a34c099522ba24ce71ae1927..b8650b6808692f2cb24c42fd4a8d921d34385b57 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs_unittest.py
@@ -11,6 +11,7 @@ from webkitpy.tool.commands.rebaseline_from_try_jobs import RebaselineFromTryJob
from webkitpy.tool.commands.rebaseline_unittest import BaseTestCase
from webkitpy.tool.mock_tool import MockOptions
from webkitpy.layout_tests.builder_list import BuilderList
+from webkitpy.common.checkout.scm.scm_mock import MockSCM
class RebaselineFromTryJobsTest(BaseTestCase):
@@ -47,16 +48,29 @@ class RebaselineFromTryJobsTest(BaseTestCase):
"is_try_builder": True,
},
})
+ self.git = MockSCM()
+ self.git.get_issue_number = lambda: 'None'
+ self.command._git = lambda: self.git
+
+ @staticmethod
+ def command_options(**kwargs):
+ options = {
+ 'issue': None,
+ 'dry_run': False,
+ 'optimize': True,
+ 'verbose': False,
+ }
+ options.update(kwargs)
+ return MockOptions(**options)
def test_execute_with_issue_number_given(self):
oc = OutputCapture()
try:
oc.capture_output()
- options = MockOptions(issue=11112222, dry_run=False, optimize=True, verbose=False)
- self.command.execute(options, [], self.tool)
+ self.command.execute(self.command_options(issue=11112222), [], self.tool)
finally:
_, _, logs = oc.restore_output()
- self.assertEqual(
+ self.assertMultiLineEqual(
logs,
('Tests to rebaseline:\n'
' svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html: MOCK Try Win\n'
@@ -70,7 +84,25 @@ class RebaselineFromTryJobsTest(BaseTestCase):
oc = OutputCapture()
try:
oc.capture_output()
- self.command.execute(MockOptions(issue=None), [], self.tool)
+ self.command.execute(self.command_options(), [], self.tool)
+ finally:
+ _, _, logs = oc.restore_output()
+ self.assertEqual(logs, 'No issue number given and no issue for current branch.\n')
+
+ def test_execute_with_issue_number_from_branch(self):
+ self.git.get_issue_number = lambda: '11112222'
+ oc = OutputCapture()
+ try:
+ oc.capture_output()
+ self.command.execute(self.command_options(), [], self.tool)
finally:
_, _, logs = oc.restore_output()
- self.assertEqual(logs, 'No issue number provided.\n')
+ self.assertMultiLineEqual(
+ logs,
+ ('Tests to rebaseline:\n'
+ ' svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html: MOCK Try Win\n'
+ ' fast/dom/prototype-inheritance.html: MOCK Try Win\n'
+ ' fast/dom/prototype-taco.html: MOCK Try Win\n'
+ 'Rebaselining fast/dom/prototype-inheritance.html\n'
+ 'Rebaselining fast/dom/prototype-taco.html\n'
+ 'Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html\n'))

Powered by Google App Engine
This is Rietveld 408576698