Chromium Code Reviews| 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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 suffixes = set() | 962 suffixes = set() |
| 963 if IMAGE in expectations: | 963 if IMAGE in expectations: |
| 964 suffixes.add('png') | 964 suffixes.add('png') |
| 965 if FAIL in expectations: | 965 if FAIL in expectations: |
| 966 suffixes.add('txt') | 966 suffixes.add('txt') |
| 967 suffixes.add('png') | 967 suffixes.add('png') |
| 968 suffixes.add('wav') | 968 suffixes.add('wav') |
| 969 return set(suffixes) | 969 return set(suffixes) |
| 970 | 970 |
| 971 @staticmethod | 971 @staticmethod |
| 972 def suffixes_for_actual_expectations_string(expectations): | 972 # test_result is an instance of webkitpy.common.net.layouttestresults.Layout TestResult |
| 973 def suffixes_for_test_result(test_result): | |
|
wkorman
2016/06/14 19:09:19
Could potentially add unit tests for this and buil
| |
| 973 suffixes = set() | 974 suffixes = set() |
| 974 if 'TEXT' in expectations: | 975 actual_results = test_result.actual_results() |
| 976 if 'TEXT' in actual_results: | |
| 975 suffixes.add('txt') | 977 suffixes.add('txt') |
| 976 if 'IMAGE' in expectations: | 978 if 'IMAGE' in actual_results: |
| 977 suffixes.add('png') | 979 suffixes.add('png') |
| 978 if 'AUDIO' in expectations: | 980 if 'AUDIO' in actual_results: |
| 979 suffixes.add('wav') | 981 suffixes.add('wav') |
| 980 if 'MISSING' in expectations: | 982 if 'MISSING' in actual_results: |
| 981 suffixes.add('txt') | 983 if test_result.is_missing_text(): |
| 982 suffixes.add('png') | 984 suffixes.add('txt') |
| 983 suffixes.add('wav') | 985 if test_result.is_missing_image(): |
| 986 suffixes.add('png') | |
| 987 if test_result.is_missing_audio(): | |
| 988 suffixes.add('wav') | |
| 984 return suffixes | 989 return suffixes |
| 985 | 990 |
| 986 # FIXME: This constructor does too much work. We should move the actual pars ing of | 991 # FIXME: This constructor does too much work. We should move the actual pars ing of |
| 987 # the expectations into separate routines so that linting and handling overr ides | 992 # the expectations into separate routines so that linting and handling overr ides |
| 988 # can be controlled separately, and the constructor can be more of a no-op. | 993 # can be controlled separately, and the constructor can be more of a no-op. |
| 989 def __init__(self, port, tests=None, include_overrides=True, expectations_di ct=None, | 994 def __init__(self, port, tests=None, include_overrides=True, expectations_di ct=None, |
| 990 model_all_expectations=False, is_lint_mode=False): | 995 model_all_expectations=False, is_lint_mode=False): |
| 991 self._full_test_list = tests | 996 self._full_test_list = tests |
| 992 self._test_config = port.test_configuration() | 997 self._test_config = port.test_configuration() |
| 993 self._is_lint_mode = is_lint_mode | 998 self._is_lint_mode = is_lint_mode |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1177 # If reconstitute_only_these is an empty list, we want to return ori ginal_string. | 1182 # If reconstitute_only_these is an empty list, we want to return ori ginal_string. |
| 1178 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey. | 1183 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey. |
| 1179 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these: | 1184 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these: |
| 1180 return expectation_line.to_string(test_configuration_converter) | 1185 return expectation_line.to_string(test_configuration_converter) |
| 1181 return expectation_line.original_string | 1186 return expectation_line.original_string |
| 1182 | 1187 |
| 1183 def nones_out(expectation_line): | 1188 def nones_out(expectation_line): |
| 1184 return expectation_line is not None | 1189 return expectation_line is not None |
| 1185 | 1190 |
| 1186 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) | 1191 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) |
| OLD | NEW |