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

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

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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 (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 44
45 class _BaseTestCase(unittest.TestCase): 45 class _BaseTestCase(unittest.TestCase):
46 MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True' 46 MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True'
47 WEB_PREFIX = 'http://example.com/f/builders/WebKit Mac10.11/results/layout-t est-results' 47 WEB_PREFIX = 'http://example.com/f/builders/WebKit Mac10.11/results/layout-t est-results'
48 48
49 command_constructor = None 49 command_constructor = None
50 50
51 def setUp(self): 51 def setUp(self):
52 self.tool = MockTool() 52 self.tool = MockTool()
53 self.command = self.command_constructor() # lint warns that command_con structor might not be set, but this is intentional; pylint: disable=E1102 53 # lint warns that command_constructor might not be set, but this is inte ntional; pylint: disable=E1102
54 self.command = self.command_constructor()
54 self.command.bind_to_tool(self.tool) 55 self.command.bind_to_tool(self.tool)
55 self.mac_port = self.tool.port_factory.get_from_builder_name("WebKit Mac 10.11") 56 self.mac_port = self.tool.port_factory.get_from_builder_name("WebKit Mac 10.11")
56 self.mac_expectations_path = self.mac_port.path_to_generic_test_expectat ions_file() 57 self.mac_expectations_path = self.mac_port.path_to_generic_test_expectat ions_file()
57 self.tool.filesystem.write_text_file(self.tool.filesystem.join(self.mac_ port.layout_tests_dir(), "VirtualTestSuites"), 58 self.tool.filesystem.write_text_file(self.tool.filesystem.join(self.mac_ port.layout_tests_dir(), "VirtualTestSuites"),
58 '[]') 59 '[]')
59 60
60 # FIXME: crbug.com/279494. We should override builders._exact_matches 61 # FIXME: crbug.com/279494. We should override builders._exact_matches
61 # here to point to a set of test ports and restore the value in 62 # here to point to a set of test ports and restore the value in
62 # tearDown(), and that way the individual tests wouldn't have to worry 63 # tearDown(), and that way the individual tests wouldn't have to worry
63 # about it. 64 # about it.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(), 199 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(),
199 'platform /test-win-win7/failures/expected/image-expected.txt')), 'original win7 result') 200 'platform /test-win-win7/failures/expected/image-expected.txt')), 'original win7 result')
200 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( 201 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
201 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano ther-test-expected.txt'))) 202 port.layout_tests_dir(), 'platform/test-mac-mac10.10/userscripts/ano ther-test-expected.txt')))
202 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete" : []}\n') 203 self.assertMultiLineEqual(out, '{"add": [], "remove-lines": [], "delete" : []}\n')
203 204
204 def test_no_copy_skipped_test(self): 205 def test_no_copy_skipped_test(self):
205 self.tool.executive = MockExecutive2() 206 self.tool.executive = MockExecutive2()
206 port = self.tool.port_factory.get('test-win-win7') 207 port = self.tool.port_factory.get('test-win-win7')
207 fs = self.tool.filesystem 208 fs = self.tool.filesystem
208 self._write(fs.join(port.layout_tests_dir(), 'platform/test-win-win7/fai lures/expected/image-expected.txt'), 'original win7 result') 209 self._write(
210 fs.join(
211 port.layout_tests_dir(),
212 'platform/test-win-win7/failures/expected/image-expected.txt'),
213 'original win7 result')
209 expectations_path = fs.join(port.path_to_generic_test_expectations_file( )) 214 expectations_path = fs.join(port.path_to_generic_test_expectations_file( ))
210 self._write(expectations_path, ( 215 self._write(expectations_path, (
211 "[ Win ] failures/expected/image.html [ Failure ]\n" 216 "[ Win ] failures/expected/image.html [ Failure ]\n"
212 "[ Linux ] failures/expected/image.html [ Skip ]\n")) 217 "[ Linux ] failures/expected/image.html [ Skip ]\n"))
213 self.tool.builders = BuilderList({ 218 self.tool.builders = BuilderList({
214 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se t(["mock-specifier"])}, 219 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": se t(["mock-specifier"])},
215 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set( ["mock-specifier"])}, 220 "MOCK Trusty": {"port_name": "test-linux-trusty", "specifiers": set( ["mock-specifier"])},
216 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": se t(["mock-specifier"])}, 221 "MOCK Precise": {"port_name": "test-linux-precise", "specifiers": se t(["mock-specifier"])},
217 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock -specifier"])}, 222 "MOCK Win7": {"port_name": "test-win-win7", "specifiers": set(["mock -specifier"])},
218 }) 223 })
219 oc = OutputCapture() 224 oc = OutputCapture()
220 try: 225 try:
221 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue, 226 options = MockOptions(builder="MOCK Win7", suffixes="txt", verbose=T rue,
222 test="failures/expected/image.html", results_d irectory=None) 227 test="failures/expected/image.html", results_d irectory=None)
223 228
224 oc.capture_output() 229 oc.capture_output()
225 self.command.execute(options, [], self.tool) 230 self.command.execute(options, [], self.tool)
226 finally: 231 finally:
227 out, _, _ = oc.restore_output() 232 out, _, _ = oc.restore_output()
228 233
229 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-mac-mac10.10/failures/expected/image-expected.txt'))) 234 self.assertFalse(
230 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-linux-trusty/failures/expected/image-expected.txt'))) 235 fs.exists(
236 fs.join(
237 port.layout_tests_dir(),
238 'platform/test-mac-mac10.10/failures/expected/image-expected .txt')))
239 self.assertFalse(
240 fs.exists(
241 fs.join(
242 port.layout_tests_dir(),
243 'platform/test-linux-trusty/failures/expected/image-expected .txt')))
231 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 244 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(),
232 'platform/test-linux-precise/failures /expected/image-expected.txt'))) 245 'platform/test-linux-precise/failures /expected/image-expected.txt')))
233 self.assertEqual(self._read(fs.join(port.layout_tests_dir(), 'platform/t est-win-win7/failures/expected/image-expected.txt')), 246 self.assertEqual(self._read(fs.join(port.layout_tests_dir(), 'platform/t est-win-win7/failures/expected/image-expected.txt')),
234 'original win7 result') 247 'original win7 result')
235 248
236 249
237 class TestRebaselineTest(_BaseTestCase): 250 class TestRebaselineTest(_BaseTestCase):
238 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal 251 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal
239 252
240 def setUp(self): 253 def setUp(self):
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 }) 930 })
918 try: 931 try:
919 oc = OutputCapture() 932 oc = OutputCapture()
920 oc.capture_output() 933 oc.capture_output()
921 self.command.execute(MockOptions(suffixes='txt,wav,png', no_modify_s cm=True, platform='test-mac-mac10.10'), 934 self.command.execute(MockOptions(suffixes='txt,wav,png', no_modify_s cm=True, platform='test-mac-mac10.10'),
922 ['another/test.html'], 935 ['another/test.html'],
923 self.tool) 936 self.tool)
924 finally: 937 finally:
925 out, err, logs = oc.restore_output() 938 out, err, logs = oc.restore_output()
926 939
927 self.assertEquals(out, '{"add": [], "remove-lines": [], "delete": ["/moc k-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-exp ected.txt", "/mock-checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10 /another/test-expected.png"]}\n') 940 self.assertEquals(
941 out,
942 '{"add": [], "remove-lines": [], "delete": ["/mock-checkout/third_pa rty/WebKit/LayoutTests/platform/mac-mac10.10/another/test-expected.txt", "/mock- checkout/third_party/WebKit/LayoutTests/platform/mac-mac10.10/another/test-expec ted.png"]}\n')
928 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( 943 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
929 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx t'))) 944 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx t')))
930 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( 945 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
931 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.pn g'))) 946 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.pn g')))
932 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( 947 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(
933 test_port.layout_tests_dir(), 'another/test-expected.txt'))) 948 test_port.layout_tests_dir(), 'another/test-expected.txt')))
934 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( 949 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(
935 test_port.layout_tests_dir(), 'another/test-expected.png'))) 950 test_port.layout_tests_dir(), 'another/test-expected.png')))
936 951
937 952
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV ELD_REFRESH_TOKEN], 1503 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV ELD_REFRESH_TOKEN],
1489 ['git', 'pull'], 1504 ['git', 'pull'],
1490 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R IETVELD_REFRESH_TOKEN], 1505 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R IETVELD_REFRESH_TOKEN],
1491 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'], 1506 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'],
1492 ], 1507 ],
1493 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN) 1508 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN)
1494 1509
1495 def test_execute_with_dry_run(self): 1510 def test_execute_with_dry_run(self):
1496 self._basic_execute_test([], dry_run=True) 1511 self._basic_execute_test([], dry_run=True)
1497 self.assertEqual(self.tool.scm().local_commits(), []) 1512 self.assertEqual(self.tool.scm().local_commits(), [])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698