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

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

Issue 2019243002: Extract analyze-baselines command out of rebaseline.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # 2 # Use of this source code is governed by a BSD-style license that can be
3 # Redistribution and use in source and binary forms, with or without 3 # found in the LICENSE file.
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
12 # distribution.
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 4
29 import unittest 5 import unittest
30 import webkitpy.tool.commands.rebaseline
31 6
32 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer 7 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
33 from webkitpy.common.checkout.scm.scm_mock import MockSCM 8 from webkitpy.common.checkout.scm.scm_mock import MockSCM
34 from webkitpy.common.host_mock import MockHost 9 from webkitpy.common.host_mock import MockHost
35 from webkitpy.common.net.buildbot_mock import MockBuilder 10 from webkitpy.common.net.buildbot_mock import MockBuilder
36 from webkitpy.common.net.layouttestresults import LayoutTestResults 11 from webkitpy.common.net.layouttestresults import LayoutTestResults
37 from webkitpy.common.system.executive_mock import MockExecutive 12 from webkitpy.common.system.executive_mock import MockExecutive
38 from webkitpy.common.system.executive_mock import MockExecutive2 13 from webkitpy.common.system.executive_mock import MockExecutive2
39 from webkitpy.common.system.outputcapture import OutputCapture 14 from webkitpy.common.system.outputcapture import OutputCapture
40 from webkitpy.layout_tests.builder_list import BuilderList 15 from webkitpy.layout_tests.builder_list import BuilderList
41 from webkitpy.tool.commands.rebaseline import * 16 from webkitpy.tool.commands.rebaseline import *
42 from webkitpy.tool.mocktool import MockTool, MockOptions 17 from webkitpy.tool.mocktool import MockTool, MockOptions
43 18
44 19
45 class _BaseTestCase(unittest.TestCase): 20 class BaseTestCase(unittest.TestCase):
46 MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True' 21 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' 22 WEB_PREFIX = 'http://example.com/f/builders/WebKit Mac10.11/results/layout-t est-results'
48 23
49 command_constructor = None 24 command_constructor = None
50 25
51 def setUp(self): 26 def setUp(self):
52 self.tool = MockTool() 27 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 28 self.command = self.command_constructor() # lint warns that command_con structor might not be set, but this is intentional; pylint: disable=E1102
54 self.command.bind_to_tool(self.tool) 29 self.command.bind_to_tool(self.tool)
55 self.mac_port = self.tool.port_factory.get_from_builder_name("WebKit Mac 10.11") 30 self.mac_port = self.tool.port_factory.get_from_builder_name("WebKit Mac 10.11")
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 "actual": "IMAGE+TEXT" 68 "actual": "IMAGE+TEXT"
94 } 69 }
95 } 70 }
96 } 71 }
97 });""") 72 });""")
98 # FIXME: crbug.com/279494 - we shouldn't be mixing mock and real builder names. 73 # FIXME: crbug.com/279494 - we shouldn't be mixing mock and real builder names.
99 for builder in ['MOCK builder', 'MOCK builder (Debug)', 'WebKit Mac10.11 ']: 74 for builder in ['MOCK builder', 'MOCK builder (Debug)', 'WebKit Mac10.11 ']:
100 self.command._builder_data[builder] = data 75 self.command._builder_data[builder] = data
101 76
102 77
103 class TestCopyExistingBaselinesInternal(_BaseTestCase): 78 class TestCopyExistingBaselinesInternal(BaseTestCase):
104 command_constructor = CopyExistingBaselinesInternal 79 command_constructor = CopyExistingBaselinesInternal
105 80
106 def setUp(self): 81 def setUp(self):
107 super(TestCopyExistingBaselinesInternal, self).setUp() 82 super(TestCopyExistingBaselinesInternal, self).setUp()
108 83
109 def test_copying_overwritten_baseline(self): 84 def test_copying_overwritten_baseline(self):
110 self.tool.executive = MockExecutive2() 85 self.tool.executive = MockExecutive2()
111 86
112 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a nd 87 # FIXME: crbug.com/279494. it's confusing that this is the test- port, a nd
113 # not the regular mac10.10 port. Really all of the tests should be using 88 # not the regular mac10.10 port. Really all of the tests should be using
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 out, _, _ = oc.restore_output() 202 out, _, _ = oc.restore_output()
228 203
229 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-mac-mac10.10/failures/expected/image-expected.txt'))) 204 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-mac-mac10.10/failures/expected/image-expected.txt')))
230 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-linux-trusty/failures/expected/image-expected.txt'))) 205 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 'platform/te st-linux-trusty/failures/expected/image-expected.txt')))
231 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(), 206 self.assertFalse(fs.exists(fs.join(port.layout_tests_dir(),
232 'platform/test-linux-precise/failures /expected/image-expected.txt'))) 207 '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')), 208 self.assertEqual(self._read(fs.join(port.layout_tests_dir(), 'platform/t est-win-win7/failures/expected/image-expected.txt')),
234 'original win7 result') 209 'original win7 result')
235 210
236 211
237 class TestRebaselineTest(_BaseTestCase): 212 class TestRebaselineTest(BaseTestCase):
238 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal 213 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal
239 214
240 def setUp(self): 215 def setUp(self):
241 super(TestRebaselineTest, self).setUp() 216 super(TestRebaselineTest, self).setUp()
242 self.options = MockOptions(builder="WebKit Mac10.11", test="userscripts/ another-test.html", 217 self.options = MockOptions(builder="WebKit Mac10.11", test="userscripts/ another-test.html",
243 suffixes="txt", results_directory=None) 218 suffixes="txt", results_directory=None)
244 219
245 def test_baseline_directory(self): 220 def test_baseline_directory(self):
246 command = self.command 221 command = self.command
247 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.11") , 222 self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.11") ,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 out, _, _ = oc.restore_output() 303 out, _, _ = oc.restore_output()
329 304
330 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir( 305 self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layo ut_tests_dir(
331 ), 'platform/test-win-win10/failures/expected/image-expected.txt')), 'MO CK Web result, convert 404 to None=True') 306 ), 'platform/test-win-win10/failures/expected/image-expected.txt')), 'MO CK Web result, convert 404 to None=True')
332 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( 307 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
333 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i mage-expected.txt'))) 308 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i mage-expected.txt')))
334 self.assertMultiLineEqual( 309 self.assertMultiLineEqual(
335 out, '{"add": [], "remove-lines": [{"test": "failures/expected/image .html", "builder": "MOCK Win10"}], "delete": []}\n') 310 out, '{"add": [], "remove-lines": [{"test": "failures/expected/image .html", "builder": "MOCK Win10"}], "delete": []}\n')
336 311
337 312
338 class TestAbstractParallelRebaselineCommand(_BaseTestCase): 313 class TestAbstractParallelRebaselineCommand(BaseTestCase):
339 command_constructor = AbstractParallelRebaselineCommand 314 command_constructor = AbstractParallelRebaselineCommand
340 315
341 def test_builders_to_fetch_from(self): 316 def test_builders_to_fetch_from(self):
342 self.tool.builders = BuilderList({ 317 self.tool.builders = BuilderList({
343 "MOCK Win10": {"port_name": "test-win-win10"}, 318 "MOCK Win10": {"port_name": "test-win-win10"},
344 "MOCK Win7": {"port_name": "test-win-win7"}, 319 "MOCK Win7": {"port_name": "test-win-win7"},
345 "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"}, 320 "MOCK Win7 (dbg)(1)": {"port_name": "test-win-win7"},
346 "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"}, 321 "MOCK Win7 (dbg)(2)": {"port_name": "test-win-win7"},
347 }) 322 })
348 323
349 builders_to_fetch = self.command._builders_to_fetch_from( 324 builders_to_fetch = self.command._builders_to_fetch_from(
350 ["MOCK Win10", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win 7"]) 325 ["MOCK Win10", "MOCK Win7 (dbg)(1)", "MOCK Win7 (dbg)(2)", "MOCK Win 7"])
351 self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"]) 326 self.assertEqual(builders_to_fetch, ["MOCK Win7", "MOCK Win10"])
352 327
353 328
354 class TestRebaselineJson(_BaseTestCase): 329 class TestRebaselineJson(BaseTestCase):
355 command_constructor = RebaselineJson 330 command_constructor = RebaselineJson
356 331
357 def setUp(self): 332 def setUp(self):
358 super(TestRebaselineJson, self).setUp() 333 super(TestRebaselineJson, self).setUp()
359 self.tool.executive = MockExecutive2() 334 self.tool.executive = MockExecutive2()
360 self.tool.builders = BuilderList({ 335 self.tool.builders = BuilderList({
361 "MOCK builder": {"port_name": "test-mac-mac10.11"}, 336 "MOCK builder": {"port_name": "test-mac-mac10.11"},
362 "MOCK builder (Debug)": {"port_name": "test-mac-mac10.11"}, 337 "MOCK builder (Debug)": {"port_name": "test-mac-mac10.11"},
363 }) 338 })
364 339
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 options = MockOptions(optimize=False, verbose=True, results_directory='/ tmp') 413 options = MockOptions(optimize=False, verbose=True, results_directory='/ tmp')
439 self._write("userscripts/first-test.html", "Dummy test contents") 414 self._write("userscripts/first-test.html", "Dummy test contents")
440 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK builder": ["txt", "png"]}}) 415 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK builder": ["txt", "png"]}})
441 416
442 # Note that we have only one run_in_parallel() call 417 # Note that we have only one run_in_parallel() call
443 self.assertEqual(self.tool.executive.calls, 418 self.assertEqual(self.tool.executive.calls,
444 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f irst-test.html', '--results-directory', '/tmp', '--verbose']], 419 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/f irst-test.html', '--results-directory', '/tmp', '--verbose']],
445 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-tes t.html', '--results-directory', '/tmp', '--verbose']]]) 420 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'userscripts/first-tes t.html', '--results-directory', '/tmp', '--verbose']]])
446 421
447 422
448 class TestRebaselineJsonUpdatesExpectationsFiles(_BaseTestCase): 423 class TestRebaselineJsonUpdatesExpectationsFiles(BaseTestCase):
449 command_constructor = RebaselineJson 424 command_constructor = RebaselineJson
450 425
451 def setUp(self): 426 def setUp(self):
452 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp() 427 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp()
453 self.tool.executive = MockExecutive2() 428 self.tool.executive = MockExecutive2()
454 429
455 def mock_run_command(args, 430 def mock_run_command(args,
456 cwd=None, 431 cwd=None,
457 input=None, 432 input=None,
458 error_handler=None, 433 error_handler=None,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 self._write("userscripts/first-test.html", "Dummy test contents") 516 self._write("userscripts/first-test.html", "Dummy test contents")
542 self._setup_mock_builder_data() 517 self._setup_mock_builder_data()
543 518
544 self.command._rebaseline(options, {"userscripts/first-test.html": {"WebK it Mac10.11": ["txt", "png"]}}) 519 self.command._rebaseline(options, {"userscripts/first-test.html": {"WebK it Mac10.11": ["txt", "png"]}})
545 520
546 new_expectations = self._read(self.mac_expectations_path) 521 new_expectations = self._read(self.mac_expectations_path)
547 self.assertMultiLineEqual( 522 self.assertMultiLineEqual(
548 new_expectations, "Bug(x) [ Linux Mac10.10 Mac10.9 Retina Win ] user scripts/first-test.html [ Failure ]\n") 523 new_expectations, "Bug(x) [ Linux Mac10.10 Mac10.9 Retina Win ] user scripts/first-test.html [ Failure ]\n")
549 524
550 525
551 class TestRebaseline(_BaseTestCase): 526 class TestRebaseline(BaseTestCase):
552 # This command shares most of its logic with RebaselineJson, so these tests just test what is different. 527 # This command shares most of its logic with RebaselineJson, so these tests just test what is different.
553 528
554 command_constructor = Rebaseline # AKA webkit-patch rebaseline 529 command_constructor = Rebaseline # AKA webkit-patch rebaseline
555 530
556 def test_rebaseline(self): 531 def test_rebaseline(self):
557 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder ')] 532 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK builder ')]
558 533
559 self._write("userscripts/first-test.html", "test data") 534 self._write("userscripts/first-test.html", "test data")
560 535
561 self._zero_out_test_expectations() 536 self._zero_out_test_expectations()
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 if 'rebaseline-test-internal' in cmd_line: 581 if 'rebaseline-test-internal' in cmd_line:
607 out = '{"add": [], "remove-lines": [{"test": "%s", "builder": "% s"}], "delete": []}\n' % (cmd_line[8], cmd_line[6]) 582 out = '{"add": [], "remove-lines": [{"test": "%s", "builder": "% s"}], "delete": []}\n' % (cmd_line[8], cmd_line[6])
608 command_outputs.append([0, out, '']) 583 command_outputs.append([0, out, ''])
609 584
610 new_calls = self.calls[num_previous_calls:] 585 new_calls = self.calls[num_previous_calls:]
611 self.calls = self.calls[:num_previous_calls] 586 self.calls = self.calls[:num_previous_calls]
612 self.calls.append(new_calls) 587 self.calls.append(new_calls)
613 return command_outputs 588 return command_outputs
614 589
615 590
616 class TestRebaselineExpectations(_BaseTestCase): 591 class TestRebaselineExpectations(BaseTestCase):
617 command_constructor = RebaselineExpectations 592 command_constructor = RebaselineExpectations
618 593
619 def setUp(self): 594 def setUp(self):
620 super(TestRebaselineExpectations, self).setUp() 595 super(TestRebaselineExpectations, self).setUp()
621 self.options = MockOptions(optimize=False, builders=None, suffixes=[ 596 self.options = MockOptions(optimize=False, builders=None, suffixes=[
622 'txt'], verbose=False, platform=None, results _directory=None) 597 'txt'], verbose=False, platform=None, results _directory=None)
623 598
624 def _write_test_file(self, port, path, contents): 599 def _write_test_file(self, port, path, contents):
625 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path) 600 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
626 self.tool.filesystem.write_text_file(abs_path, contents) 601 self.tool.filesystem.write_text_file(abs_path, contents)
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 }) 809 })
835 self.command.execute(self.options, [], self.tool) 810 self.command.execute(self.options, [], self.tool)
836 self.assertEqual(self.tool.executive.calls, []) 811 self.assertEqual(self.tool.executive.calls, [])
837 812
838 # The mac ports should both be removed since they're the only ones in bu ilders._exact_matches. 813 # The mac ports should both be removed since they're the only ones in bu ilders._exact_matches.
839 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g eneric_test_expectations_file()), """ 814 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g eneric_test_expectations_file()), """
840 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ] 815 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ]
841 """) 816 """)
842 817
843 818
844 class _FakeOptimizer(BaselineOptimizer): 819 class TestOptimizeBaselines(BaseTestCase):
845
846 def read_results_by_directory(self, baseline_name):
847 if baseline_name.endswith('txt'):
848 return {'LayoutTests/passes/text.html': '123456'}
849 return {}
850
851
852 class TestOptimizeBaselines(_BaseTestCase):
853 command_constructor = OptimizeBaselines 820 command_constructor = OptimizeBaselines
854 821
855 def _write_test_file(self, port, path, contents): 822 def _write_test_file(self, port, path, contents):
856 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path) 823 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
857 self.tool.filesystem.write_text_file(abs_path, contents) 824 self.tool.filesystem.write_text_file(abs_path, contents)
858 825
859 def setUp(self): 826 def setUp(self):
860 super(TestOptimizeBaselines, self).setUp() 827 super(TestOptimizeBaselines, self).setUp()
861 828
862 # FIXME: This is a hack to get the unittest and the BaselineOptimize to both use /mock-checkout 829 # FIXME: This is a hack to get the unittest and the BaselineOptimize to both use /mock-checkout
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( 895 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
929 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx t'))) 896 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.tx t')))
930 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( 897 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
931 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.pn g'))) 898 test_port.layout_tests_dir(), 'platform/mac/another/test-expected.pn g')))
932 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( 899 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(
933 test_port.layout_tests_dir(), 'another/test-expected.txt'))) 900 test_port.layout_tests_dir(), 'another/test-expected.txt')))
934 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join( 901 self.assertTrue(self.tool.filesystem.exists(self.tool.filesystem.join(
935 test_port.layout_tests_dir(), 'another/test-expected.png'))) 902 test_port.layout_tests_dir(), 'another/test-expected.png')))
936 903
937 904
938 class TestAnalyzeBaselines(_BaseTestCase): 905 class TestAutoRebaseline(BaseTestCase):
939 command_constructor = AnalyzeBaselines
940
941 def setUp(self):
942 super(TestAnalyzeBaselines, self).setUp()
943 self.port = self.tool.port_factory.get('test')
944 self.tool.port_factory.get = (lambda port_name=None, options=None: self. port)
945 self.lines = []
946 self.command._optimizer_class = _FakeOptimizer
947 # pylint bug warning about unnecessary lambda? pylint: disable=W0108
948 self.command._write = (lambda msg: self.lines.append(msg))
949
950 def test_default(self):
951 self.command.execute(MockOptions(suffixes='txt', missing=False, platform =None), ['passes/text.html'], self.tool)
952 self.assertEqual(self.lines,
953 ['passes/text-expected.txt:',
954 ' (generic): 123456'])
955
956 def test_missing_baselines(self):
957 self.command.execute(MockOptions(suffixes='png,txt', missing=True, platf orm=None), ['passes/text.html'], self.tool)
958 self.assertEqual(self.lines,
959 ['passes/text-expected.png: (no baselines found)',
960 'passes/text-expected.txt:',
961 ' (generic): 123456'])
962
963
964 class TestAutoRebaseline(_BaseTestCase):
965 command_constructor = AutoRebaseline 906 command_constructor = AutoRebaseline
966 907
967 def _write_test_file(self, port, path, contents): 908 def _write_test_file(self, port, path, contents):
968 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path) 909 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
969 self.tool.filesystem.write_text_file(abs_path, contents) 910 self.tool.filesystem.write_text_file(abs_path, contents)
970 911
971 def _setup_test_port(self): 912 def _setup_test_port(self):
972 test_port = self.tool.port_factory.get('test') 913 test_port = self.tool.port_factory.get('test')
973 original_get = self.tool.port_factory.get 914 original_get = self.tool.port_factory.get
974 915
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV ELD_REFRESH_TOKEN], 1429 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV ELD_REFRESH_TOKEN],
1489 ['git', 'pull'], 1430 ['git', 'pull'],
1490 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R IETVELD_REFRESH_TOKEN], 1431 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R IETVELD_REFRESH_TOKEN],
1491 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'], 1432 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'],
1492 ], 1433 ],
1493 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN) 1434 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN)
1494 1435
1495 def test_execute_with_dry_run(self): 1436 def test_execute_with_dry_run(self):
1496 self._basic_execute_test([], dry_run=True) 1437 self._basic_execute_test([], dry_run=True)
1497 self.assertEqual(self.tool.scm().local_commits(), []) 1438 self.assertEqual(self.tool.scm().local_commits(), [])
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698