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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

Issue 2878873002: webkitpy: Rename WebKitFinder to PathFinder (Closed)
Patch Set: Created 3 years, 7 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 15 matching lines...) Expand all
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 """A helper class for reading in and dealing with tests expectations for layout tests.""" 29 """A helper class for reading in and dealing with tests expectations for layout tests."""
30 30
31 from collections import defaultdict 31 from collections import defaultdict
32 32
33 import logging 33 import logging
34 import re 34 import re
35 35
36 from webkitpy.common.webkit_finder import WebKitFinder 36 from webkitpy.common.path_finder import PathFinder
37 from webkitpy.layout_tests.models.test_configuration import TestConfigurationCon verter 37 from webkitpy.layout_tests.models.test_configuration import TestConfigurationCon verter
38 38
39 _log = logging.getLogger(__name__) 39 _log = logging.getLogger(__name__)
40 40
41 41
42 # Test expectation and specifier constants. 42 # Test expectation and specifier constants.
43 # 43 #
44 # FIXME: range() starts with 0 which makes if expectation checks harder 44 # FIXME: range() starts with 0 which makes if expectation checks harder
45 # as PASS is 0. 45 # as PASS is 0.
46 (PASS, FAIL, TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO, TIMEOUT, CRASH, LEAK, SKIP, WO NTFIX, 46 (PASS, FAIL, TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO, TIMEOUT, CRASH, LEAK, SKIP, WO NTFIX,
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 if sanitizer_is_enabled: 1089 if sanitizer_is_enabled:
1090 expected_results = self.remove_non_sanitizer_failures(expected_resul ts) 1090 expected_results = self.remove_non_sanitizer_failures(expected_resul ts)
1091 elif not pixel_tests_are_enabled: 1091 elif not pixel_tests_are_enabled:
1092 expected_results = self.remove_pixel_failures(expected_results) 1092 expected_results = self.remove_pixel_failures(expected_results)
1093 return self.result_was_expected(result, expected_results, self.is_rebase lining(test)) 1093 return self.result_was_expected(result, expected_results, self.is_rebase lining(test))
1094 1094
1095 def is_rebaselining(self, test): 1095 def is_rebaselining(self, test):
1096 return REBASELINE in self._model.get_expectations(test) 1096 return REBASELINE in self._model.get_expectations(test)
1097 1097
1098 def _shorten_filename(self, filename): 1098 def _shorten_filename(self, filename):
1099 finder = WebKitFinder(self._port.host.filesystem) 1099 finder = PathFinder(self._port.host.filesystem)
1100 if filename.startswith(finder.path_from_chromium_base()): 1100 if filename.startswith(finder.path_from_chromium_base()):
1101 return self._port.host.filesystem.relpath(filename, finder.path_from _chromium_base()) 1101 return self._port.host.filesystem.relpath(filename, finder.path_from _chromium_base())
1102 return filename 1102 return filename
1103 1103
1104 def _report_warnings(self): 1104 def _report_warnings(self):
1105 warnings = [] 1105 warnings = []
1106 for expectation in self._expectations: 1106 for expectation in self._expectations:
1107 for warning in expectation.warnings: 1107 for warning in expectation.warnings:
1108 warnings.append('%s:%s %s %s' % ( 1108 warnings.append('%s:%s %s %s' % (
1109 self._shorten_filename(expectation.filename), expectation.li ne_numbers, 1109 self._shorten_filename(expectation.filename), expectation.li ne_numbers,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 # If reconstitute_only_these is an empty list, we want to return ori ginal_string. 1213 # If reconstitute_only_these is an empty list, we want to return ori ginal_string.
1214 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey. 1214 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey.
1215 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these: 1215 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these:
1216 return expectation_line.to_string(test_configuration_converter) 1216 return expectation_line.to_string(test_configuration_converter)
1217 return expectation_line.original_string 1217 return expectation_line.original_string
1218 1218
1219 def nones_out(expectation_line): 1219 def nones_out(expectation_line):
1220 return expectation_line is not None 1220 return expectation_line is not None
1221 1221
1222 return '\n'.join(filter(nones_out, map(serialize, expectation_lines))) 1222 return '\n'.join(filter(nones_out, map(serialize, expectation_lines)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698