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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py

Issue 2329263002: Run format-webkitpy and fix long lines. (Closed)
Patch Set: Created 4 years, 3 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 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 optparse 5 import optparse
6 import unittest 6 import unittest
7 7
8 from webkitpy.common.net.buildbot import Build 8 from webkitpy.common.net.buildbot import Build
9 from webkitpy.common.net.layouttestresults import LayoutTestResults 9 from webkitpy.common.net.layouttestresults import LayoutTestResults
10 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 10 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 "actual": "IMAGE+TEXT" 95 "actual": "IMAGE+TEXT"
96 }, 96 },
97 "second-test.html": { 97 "second-test.html": {
98 "expected": "FAIL", 98 "expected": "FAIL",
99 "actual": "IMAGE+TEXT" 99 "actual": "IMAGE+TEXT"
100 } 100 }
101 } 101 }
102 } 102 }
103 })) 103 }))
104 104
105
105 class TestCopyExistingBaselinesInternal(BaseTestCase): 106 class TestCopyExistingBaselinesInternal(BaseTestCase):
106 command_constructor = CopyExistingBaselinesInternal 107 command_constructor = CopyExistingBaselinesInternal
107 108
108 def setUp(self): 109 def setUp(self):
109 super(TestCopyExistingBaselinesInternal, self).setUp() 110 super(TestCopyExistingBaselinesInternal, self).setUp()
110 111
111 def test_copying_overwritten_baseline(self): 112 def test_copying_overwritten_baseline(self):
112 self.tool.executive = MockExecutive2() 113 self.tool.executive = MockExecutive2()
113 114
114 port = self.tool.port_factory.get('test-mac-mac10.10') 115 port = self.tool.port_factory.get('test-mac-mac10.10')
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 self._write( 310 self._write(
310 self.mac_expectations_path, 311 self.mac_expectations_path,
311 ("Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\n" 312 ("Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\n"
312 "bug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n")) 313 "bug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n"))
313 self.command._rebaseline_test_and_update_expectations(self.options(resul ts_directory='/tmp')) 314 self.command._rebaseline_test_and_update_expectations(self.options(resul ts_directory='/tmp'))
314 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri pts/another-test-actual.txt']) 315 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri pts/another-test-actual.txt'])
315 316
316 def test_rebaseline_reftest(self): 317 def test_rebaseline_reftest(self):
317 self._write("userscripts/another-test.html", "test data") 318 self._write("userscripts/another-test.html", "test data")
318 self._write("userscripts/another-test-expected.html", "generic result") 319 self._write("userscripts/another-test-expected.html", "generic result")
319 OutputCapture().assert_outputs(self, self.command._rebaseline_test_and_u pdate_expectations, args=[self.options(suffixes='png')], 320 OutputCapture().assert_outputs(
320 expected_logs="Cannot rebaseline image re sult for reftest: userscripts/another-test.html\n") 321 self, self.command._rebaseline_test_and_update_expectations, args=[s elf.options(suffixes='png')],
322 expected_logs="Cannot rebaseline image result for reftest: userscrip ts/another-test.html\n")
321 self.assertDictEqual(self.command._scm_changes, {'add': [], 'remove-line s': [], "delete": []}) 323 self.assertDictEqual(self.command._scm_changes, {'add': [], 'remove-line s': [], "delete": []})
322 324
323 def test_rebaseline_test_and_print_scm_changes(self): 325 def test_rebaseline_test_and_print_scm_changes(self):
324 self.command._print_scm_changes = True 326 self.command._print_scm_changes = True
325 self.command._scm_changes = {'add': [], 'delete': []} 327 self.command._scm_changes = {'add': [], 'delete': []}
326 self.tool._scm.exists = lambda x: False 328 self.tool._scm.exists = lambda x: False
327 329
328 self.command._rebaseline_test("MOCK Trusty", "userscripts/another-test.h tml", "txt", None) 330 self.command._rebaseline_test("MOCK Trusty", "userscripts/another-test.h tml", "txt", None)
329 331
330 self.assertDictEqual(self.command._scm_changes, { 332 self.assertDictEqual(self.command._scm_changes, {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 ], 646 ],
645 [ 647 [
646 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', 648 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png',
647 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test .html', '--verbose'], 649 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test .html', '--verbose'],
648 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', 650 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png',
649 '--builder', 'MOCK Win7', '--test', 'userscripts/second-tes t.html', '--verbose'] 651 '--builder', 'MOCK Win7', '--test', 'userscripts/second-tes t.html', '--verbose']
650 ] 652 ]
651 ]) 653 ])
652 654
653 655
654
655 class TestRebaselineExpectations(BaseTestCase): 656 class TestRebaselineExpectations(BaseTestCase):
656 command_constructor = RebaselineExpectations 657 command_constructor = RebaselineExpectations
657 658
658 def setUp(self): 659 def setUp(self):
659 super(TestRebaselineExpectations, self).setUp() 660 super(TestRebaselineExpectations, self).setUp()
660 661
661 @staticmethod 662 @staticmethod
662 def options(): 663 def options():
663 return optparse.Values({ 664 return optparse.Values({
664 'optimize': False, 665 'optimize': False,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 for cmd_line, cwd in commands: 924 for cmd_line, cwd in commands:
924 out = self.run_command(cmd_line, cwd=cwd) 925 out = self.run_command(cmd_line, cwd=cwd)
925 if 'rebaseline-test-internal' in cmd_line: 926 if 'rebaseline-test-internal' in cmd_line:
926 out = '{"add": [], "remove-lines": [{"test": "%s", "builder": "% s"}], "delete": []}\n' % (cmd_line[8], cmd_line[6]) 927 out = '{"add": [], "remove-lines": [{"test": "%s", "builder": "% s"}], "delete": []}\n' % (cmd_line[8], cmd_line[6])
927 command_outputs.append([0, out, '']) 928 command_outputs.append([0, out, ''])
928 929
929 new_calls = self.calls[num_previous_calls:] 930 new_calls = self.calls[num_previous_calls:]
930 self.calls = self.calls[:num_previous_calls] 931 self.calls = self.calls[:num_previous_calls]
931 self.calls.append(new_calls) 932 self.calls.append(new_calls)
932 return command_outputs 933 return command_outputs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698