| OLD | NEW |
| 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 return test_port | 866 return test_port |
| 867 return original_get(port_name, options, **kwargs) | 867 return original_get(port_name, options, **kwargs) |
| 868 # Need to make sure all the ports grabbed use the test checkout path ins
tead of the mock checkout path. | 868 # Need to make sure all the ports grabbed use the test checkout path ins
tead of the mock checkout path. |
| 869 # FIXME: crbug.com/279494 - we shouldn't be doing this. | 869 # FIXME: crbug.com/279494 - we shouldn't be doing this. |
| 870 self.tool.port_factory.get = get_test_port | 870 self.tool.port_factory.get = get_test_port |
| 871 | 871 |
| 872 return test_port | 872 return test_port |
| 873 | 873 |
| 874 def setUp(self): | 874 def setUp(self): |
| 875 super(TestAutoRebaseline, self).setUp() | 875 super(TestAutoRebaseline, self).setUp() |
| 876 self.command.latest_revision_processed_on_all_bots = lambda log_server:
9000 | 876 self.command.latest_revision_processed_on_all_bots = lambda: 9000 |
| 877 self.command.bot_revision_data = lambda log_server: [{"builder": "Mock b
uilder", "revision": "9000"}] | 877 self.command.bot_revision_data = lambda: [{"builder": "Mock builder", "r
evision": "9000"}] |
| 878 | 878 |
| 879 def test_release_builders(self): | 879 def test_release_builders(self): |
| 880 old_exact_matches = builders._exact_matches | 880 old_exact_matches = builders._exact_matches |
| 881 try: | 881 try: |
| 882 builders._exact_matches = { | 882 builders._exact_matches = { |
| 883 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, | 883 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, |
| 884 "MOCK Leopard Debug": {"port_name": "test-mac-snowleopard", "spe
cifiers": set(["mock-specifier"])}, | 884 "MOCK Leopard Debug": {"port_name": "test-mac-snowleopard", "spe
cifiers": set(["mock-specifier"])}, |
| 885 "MOCK Leopard ASAN": {"port_name": "test-mac-snowleopard", "spec
ifiers": set(["mock-specifier"])}, | 885 "MOCK Leopard ASAN": {"port_name": "test-mac-snowleopard", "spec
ifiers": set(["mock-specifier"])}, |
| 886 } | 886 } |
| 887 self.assertEqual(self.command._release_builders(), ['MOCK Leopard']) | 887 self.assertEqual(self.command._release_builders(), ['MOCK Leopard']) |
| 888 finally: | 888 finally: |
| 889 builders._exact_matches = old_exact_matches | 889 builders._exact_matches = old_exact_matches |
| 890 | 890 |
| 891 def test_tests_to_rebaseline(self): | 891 def test_tests_to_rebaseline(self): |
| 892 def blame(path): | 892 def blame(path): |
| 893 return """ | 893 return """ |
| 894 624c3081c0 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht
ml [ ImageOnlyFailure ] | 894 624c3081c0 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht
ml [ ImageOnlyFailure ] |
| 895 624c3081c0 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 13) Bug(foo) path/to/rebaseline-without-bug-number.ht
ml [ NeedsRebaseline ] | 895 624c3081c0 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 13) Bug(foo) path/to/rebaseline-without-bug-number.ht
ml [ NeedsRebaseline ] |
| 896 624c3081c0 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/rebaseline-with
-modifiers.html [ NeedsRebaseline ] | 896 624c3081c0 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/rebaseline-with
-modifiers.html [ NeedsRebaseline ] |
| 897 624c3081c0 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 crbug.com/234 path/to/rebaseline-
without-modifiers.html [ NeedsRebaseline ] | 897 624c3081c0 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 crbug.com/234 path/to/rebaseline-
without-modifiers.html [ NeedsRebaseline ] |
| 898 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/rebaseline-new-revision.h
tml [ NeedsRebaseline ] | 898 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/rebaseline-new-revision.h
tml [ NeedsRebaseline ] |
| 899 624caaaaaa path/to/TestExpectations (foo@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots.h
tml [ NeedsRebaseline ] | 899 624caaaaaa path/to/TestExpectations (foo@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots.h
tml [ NeedsRebaseline ] |
| 900 0000000000 path/to/TestExpectations (foo@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/locally-changed-lined.htm
l [ NeedsRebaseline ] | 900 0000000000 path/to/TestExpectations (foo@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/locally-changed-lined.htm
l [ NeedsRebaseline ] |
| 901 """ | 901 """ |
| 902 self.tool.scm().blame = blame | 902 self.tool.scm().blame = blame |
| 903 | 903 |
| 904 min_revision = 9000 | 904 min_revision = 9000 |
| 905 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio
n, print_revisions=False, log_server=None), ( | 905 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio
n, print_revisions=False), ( |
| 906 set(['path/to/rebaseline-without-bug-number.html', 'path/to/reba
seline-with-modifiers.html', 'path/to/rebaseline-without-modifiers.html']), | 906 set(['path/to/rebaseline-without-bug-number.html', 'path/to/reba
seline-with-modifiers.html', 'path/to/rebaseline-without-modifiers.html']), |
| 907 5678, | 907 5678, |
| 908 'foobarbaz1@chromium.org', | 908 'foobarbaz1@chromium.org', |
| 909 set(['24182', '234']), | 909 set(['24182', '234']), |
| 910 True)) | 910 True)) |
| 911 | 911 |
| 912 def test_tests_to_rebaseline_over_limit(self): | 912 def test_tests_to_rebaseline_over_limit(self): |
| 913 def blame(path): | 913 def blame(path): |
| 914 result = "" | 914 result = "" |
| 915 for i in range(0, self.command.MAX_LINES_TO_REBASELINE + 1): | 915 for i in range(0, self.command.MAX_LINES_TO_REBASELINE + 1): |
| 916 result += "624c3081c0 path/to/TestExpectations
(foobarbaz1@chromium.org 2013-04-28 04:52:41 +0000 13) crbug.com/24182 path/t
o/rebaseline-%s.html [ NeedsRebaseline ]\n" % i | 916 result += "624c3081c0 path/to/TestExpectations
(foobarbaz1@chromium.org 2013-04-28 04:52:41 +0000 13) crbug.com/24182 path/t
o/rebaseline-%s.html [ NeedsRebaseline ]\n" % i |
| 917 return result | 917 return result |
| 918 self.tool.scm().blame = blame | 918 self.tool.scm().blame = blame |
| 919 | 919 |
| 920 expected_list_of_tests = [] | 920 expected_list_of_tests = [] |
| 921 for i in range(0, self.command.MAX_LINES_TO_REBASELINE): | 921 for i in range(0, self.command.MAX_LINES_TO_REBASELINE): |
| 922 expected_list_of_tests.append("path/to/rebaseline-%s.html" % i) | 922 expected_list_of_tests.append("path/to/rebaseline-%s.html" % i) |
| 923 | 923 |
| 924 min_revision = 9000 | 924 min_revision = 9000 |
| 925 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio
n, print_revisions=False, log_server=None), ( | 925 self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revisio
n, print_revisions=False), ( |
| 926 set(expected_list_of_tests), | 926 set(expected_list_of_tests), |
| 927 5678, | 927 5678, |
| 928 'foobarbaz1@chromium.org', | 928 'foobarbaz1@chromium.org', |
| 929 set(['24182']), | 929 set(['24182']), |
| 930 True)) | 930 True)) |
| 931 | 931 |
| 932 def test_commit_message(self): | 932 def test_commit_message(self): |
| 933 author = "foo@chromium.org" | 933 author = "foo@chromium.org" |
| 934 revision = 1234 | 934 revision = 1234 |
| 935 bugs = set() | 935 bugs = set() |
| (...skipping 15 matching lines...) Expand all Loading... |
| 951 TBR=foo@chromium.org | 951 TBR=foo@chromium.org |
| 952 """) | 952 """) |
| 953 | 953 |
| 954 def test_no_needs_rebaseline_lines(self): | 954 def test_no_needs_rebaseline_lines(self): |
| 955 def blame(path): | 955 def blame(path): |
| 956 return """ | 956 return """ |
| 957 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht
ml [ ImageOnlyFailure ] | 957 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht
ml [ ImageOnlyFailure ] |
| 958 """ | 958 """ |
| 959 self.tool.scm().blame = blame | 959 self.tool.scm().blame = blame |
| 960 | 960 |
| 961 self.command.execute(MockOptions(optimize=True, verbose=False, move_over
written_baselines=False, results_directory=False, log_server=None), [], self.too
l) | 961 self.command.execute(MockOptions(optimize=True, verbose=False, move_over
written_baselines=False, results_directory=False), [], self.tool) |
| 962 self.assertEqual(self.tool.executive.calls, []) | 962 self.assertEqual(self.tool.executive.calls, []) |
| 963 | 963 |
| 964 def test_execute(self): | 964 def test_execute(self): |
| 965 def blame(path): | 965 def blame(path): |
| 966 return """ | 966 return """ |
| 967 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) # Test NeedsRebaseline being in a comment doesn't
bork parsing. | 967 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) # Test NeedsRebaseline being in a comment doesn't
bork parsing. |
| 968 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht
ml [ ImageOnlyFailure ] | 968 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Debug ] path/to/norebaseline.ht
ml [ ImageOnlyFailure ] |
| 969 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsReba
seline ] | 969 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsReba
seline ] |
| 970 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ SnowLeopard ] fast/dom/prototyp
e-strawberry.html [ NeedsRebaseline ] | 970 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-06-14 20:18:46 +0000 11) crbug.com/24182 [ SnowLeopard ] fast/dom/prototyp
e-strawberry.html [ NeedsRebaseline ] |
| 971 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 fast/dom/prototype-chocolate.html
[ NeedsRebaseline ] | 971 6469e754a1 path/to/TestExpectations (foobarbaz1@chromium.org 2
013-04-28 04:52:41 +0000 12) crbug.com/24182 fast/dom/prototype-chocolate.html
[ NeedsRebaseline ] |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 self.tool.executive = MockLineRemovingExecutive() | 1023 self.tool.executive = MockLineRemovingExecutive() |
| 1024 | 1024 |
| 1025 old_exact_matches = builders._exact_matches | 1025 old_exact_matches = builders._exact_matches |
| 1026 try: | 1026 try: |
| 1027 builders._exact_matches = { | 1027 builders._exact_matches = { |
| 1028 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, | 1028 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, |
| 1029 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci
fiers": set(["mock-specifier"])}, | 1029 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci
fiers": set(["mock-specifier"])}, |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 self.command.tree_status = lambda: 'closed' | 1032 self.command.tree_status = lambda: 'closed' |
| 1033 self.command.execute(MockOptions(optimize=True, verbose=False, move_
overwritten_baselines=False, results_directory=False, log_server=None), [], self
.tool) | 1033 self.command.execute(MockOptions(optimize=True, verbose=False, move_
overwritten_baselines=False, results_directory=False), [], self.tool) |
| 1034 self.assertEqual(self.tool.executive.calls, []) | 1034 self.assertEqual(self.tool.executive.calls, []) |
| 1035 | 1035 |
| 1036 self.command.tree_status = lambda: 'open' | 1036 self.command.tree_status = lambda: 'open' |
| 1037 self.tool.executive.calls = [] | 1037 self.tool.executive.calls = [] |
| 1038 self.command.execute(MockOptions(optimize=True, verbose=False, move_
overwritten_baselines=False, results_directory=False, log_server=None), [], self
.tool) | 1038 self.command.execute(MockOptions(optimize=True, verbose=False, move_
overwritten_baselines=False, results_directory=False), [], self.tool) |
| 1039 | 1039 |
| 1040 self.assertEqual(self.tool.executive.calls, [ | 1040 self.assertEqual(self.tool.executive.calls, [ |
| 1041 [ | 1041 [ |
| 1042 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate.h
tml'], | 1042 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate.h
tml'], |
| 1043 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
png', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-strawberry.
html'], | 1043 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
png', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-strawberry.
html'], |
| 1044 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
txt', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-taco.html'], | 1044 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
txt', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-taco.html'], |
| 1045 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html']
, | 1045 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html']
, |
| 1046 ], | 1046 ], |
| 1047 [ | 1047 [ |
| 1048 ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png'
, '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate.html'], | 1048 ['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png'
, '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate.html'], |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 | 1111 |
| 1112 old_exact_matches = builders._exact_matches | 1112 old_exact_matches = builders._exact_matches |
| 1113 try: | 1113 try: |
| 1114 builders._exact_matches = { | 1114 builders._exact_matches = { |
| 1115 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci
fiers": set(["mock-specifier"])}, | 1115 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci
fiers": set(["mock-specifier"])}, |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 self.command.SECONDS_BEFORE_GIVING_UP = 0 | 1118 self.command.SECONDS_BEFORE_GIVING_UP = 0 |
| 1119 self.command.tree_status = lambda: 'open' | 1119 self.command.tree_status = lambda: 'open' |
| 1120 self.tool.executive.calls = [] | 1120 self.tool.executive.calls = [] |
| 1121 self.command.execute(MockOptions(optimize=True, verbose=False, move_
overwritten_baselines=False, results_directory=False, log_server=None), [], self
.tool) | 1121 self.command.execute(MockOptions(optimize=True, verbose=False, move_
overwritten_baselines=False, results_directory=False), [], self.tool) |
| 1122 | 1122 |
| 1123 self.assertEqual(self.tool.executive.calls, [ | 1123 self.assertEqual(self.tool.executive.calls, [ |
| 1124 [ | 1124 [ |
| 1125 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html']
, | 1125 ['echo', 'copy-existing-baselines-internal', '--suffixes', '
txt', '--builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html']
, |
| 1126 ], | 1126 ], |
| 1127 [ | 1127 [ |
| 1128 ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '-
-builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html'], | 1128 ['echo', 'rebaseline-test-internal', '--suffixes', 'txt', '-
-builder', 'MOCK SnowLeopard', '--test', 'fast/dom/prototype-taco.html'], |
| 1129 ], | 1129 ], |
| 1130 [['echo', 'optimize-baselines', '--no-modify-scm', '--suffixes',
'txt', 'fast/dom/prototype-taco.html']], | 1130 [['echo', 'optimize-baselines', '--no-modify-scm', '--suffixes',
'txt', 'fast/dom/prototype-taco.html']], |
| 1131 ['git', 'cl', 'upload', '-f'], | 1131 ['git', 'cl', 'upload', '-f'], |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 self.tool.executive = MockLineRemovingExecutive() | 1172 self.tool.executive = MockLineRemovingExecutive() |
| 1173 | 1173 |
| 1174 old_exact_matches = builders._exact_matches | 1174 old_exact_matches = builders._exact_matches |
| 1175 try: | 1175 try: |
| 1176 builders._exact_matches = { | 1176 builders._exact_matches = { |
| 1177 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, | 1177 "MOCK Leopard": {"port_name": "test-mac-leopard", "specifiers":
set(["mock-specifier"])}, |
| 1178 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci
fiers": set(["mock-specifier"])}, | 1178 "MOCK SnowLeopard": {"port_name": "test-mac-snowleopard", "speci
fiers": set(["mock-specifier"])}, |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 self.command.tree_status = lambda: 'open' | 1181 self.command.tree_status = lambda: 'open' |
| 1182 self.command.execute(MockOptions(optimize=True, verbose=False, move_
overwritten_baselines=False, results_directory=False, log_server=None), [], self
.tool) | 1182 self.command.execute(MockOptions(optimize=True, verbose=False, move_
overwritten_baselines=False, results_directory=False), [], self.tool) |
| 1183 self.assertEqual(self.tool.executive.calls, [ | 1183 self.assertEqual(self.tool.executive.calls, [ |
| 1184 [['echo', 'optimize-baselines', '--no-modify-scm', '--suffixes',
'', 'fast/dom/prototype-taco.html']], | 1184 [['echo', 'optimize-baselines', '--no-modify-scm', '--suffixes',
'', 'fast/dom/prototype-taco.html']], |
| 1185 ['git', 'cl', 'upload', '-f'], | 1185 ['git', 'cl', 'upload', '-f'], |
| 1186 ['git', 'pull'], | 1186 ['git', 'pull'], |
| 1187 ['git', 'cl', 'dcommit', '-f'], | 1187 ['git', 'cl', 'dcommit', '-f'], |
| 1188 ['git', 'cl', 'set_close'], | 1188 ['git', 'cl', 'set_close'], |
| 1189 ]) | 1189 ]) |
| 1190 | 1190 |
| 1191 # The mac ports should both be removed since they're the only ones i
n builders._exact_matches. | 1191 # The mac ports should both be removed since they're the only ones i
n builders._exact_matches. |
| 1192 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ | 1192 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_
to_generic_test_expectations_file()), """ |
| 1193 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] | 1193 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ NeedsRebaseline ] |
| 1194 """) | 1194 """) |
| 1195 finally: | 1195 finally: |
| 1196 builders._exact_matches = old_exact_matches | 1196 builders._exact_matches = old_exact_matches |
| 1197 |
| 1198 |
| 1199 class TestRebaselineOMatic(_BaseTestCase): |
| 1200 command_constructor = RebaselineOMatic |
| 1201 |
| 1202 def setUp(self): |
| 1203 super(TestRebaselineOMatic, self).setUp() |
| 1204 self._logs = [] |
| 1205 |
| 1206 def _mock_log_to_server(self, log='', is_new_entry=False): |
| 1207 self._logs.append({'log': log, 'newentry': is_new_entry}) |
| 1208 |
| 1209 def test_run_logging_command(self): |
| 1210 self.command._log_to_server = self._mock_log_to_server |
| 1211 self.command._run_logging_command(['echo', 'foo']) |
| 1212 self.assertEqual(self.tool.executive.calls, [['echo', 'foo']]) |
| 1213 self.assertEqual(self._logs, [{'log': 'MOCK STDOUT\n', 'newentry': False
}]) |
| 1214 |
| 1215 def test_do_one_rebaseline(self): |
| 1216 self.command._log_to_server = self._mock_log_to_server |
| 1217 self.command._do_one_rebaseline(verbose=False) |
| 1218 self.assertEqual(self.tool.executive.calls, [ |
| 1219 ['git', 'pull'], |
| 1220 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au
to-rebaseline'], |
| 1221 ]) |
| 1222 self.assertEqual(self._logs, [ |
| 1223 {'log': '', 'newentry': True}, |
| 1224 {'log': 'MOCK STDOUT\n', 'newentry': False}, |
| 1225 ]) |
| 1226 |
| 1227 def test_do_one_rebaseline_verbose(self): |
| 1228 self.command._log_to_server = self._mock_log_to_server |
| 1229 self.command._do_one_rebaseline(verbose=True) |
| 1230 self.assertEqual(self.tool.executive.calls, [ |
| 1231 ['git', 'pull'], |
| 1232 ['/mock-checkout/third_party/WebKit/Tools/Scripts/webkit-patch', 'au
to-rebaseline', '--verbose'], |
| 1233 ]) |
| 1234 self.assertEqual(self._logs, [ |
| 1235 {'log': '', 'newentry': True}, |
| 1236 {'log': 'MOCK STDOUT\n', 'newentry': False}, |
| 1237 ]) |
| OLD | NEW |