| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 def actual_results(self): | 65 def actual_results(self): |
| 66 return self._result_dict['actual'] | 66 return self._result_dict['actual'] |
| 67 | 67 |
| 68 def expected_results(self): | 68 def expected_results(self): |
| 69 return self._result_dict['expected'] | 69 return self._result_dict['expected'] |
| 70 | 70 |
| 71 def has_mismatch_result(self): | 71 def has_mismatch_result(self): |
| 72 last_retry_result = self.actual_results().split()[-1] | 72 last_retry_result = self.actual_results().split()[-1] |
| 73 return last_retry_result in ('TEXT', 'IMAGE', 'IMAGE+TEXT', 'AUDIO') | 73 return last_retry_result in ('TEXT', 'IMAGE', 'IMAGE+TEXT', 'AUDIO') |
| 74 | 74 |
| 75 def is_missing_baseline(self): |
| 76 return self._result_dict['actual'] == 'MISSING' |
| 77 |
| 75 | 78 |
| 76 # FIXME: This should be unified with ResultsSummary or other NRWT layout tests c
ode | 79 # FIXME: This should be unified with ResultsSummary or other NRWT layout tests c
ode |
| 77 # in the layout_tests package. | 80 # in the layout_tests package. |
| 78 # This doesn't belong in common.net, but we don't have a better place for it yet
. | 81 # This doesn't belong in common.net, but we don't have a better place for it yet
. |
| 79 class LayoutTestResults(object): | 82 class LayoutTestResults(object): |
| 80 | 83 |
| 81 @classmethod | 84 @classmethod |
| 82 def results_from_string(cls, string, chromium_revision=None): | 85 def results_from_string(cls, string, chromium_revision=None): |
| 83 """Creates a LayoutTestResults object from a test result JSON string. | 86 """Creates a LayoutTestResults object from a test result JSON string. |
| 84 | 87 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 def add_if_passes(result): | 153 def add_if_passes(result): |
| 151 if result_filter(result): | 154 if result_filter(result): |
| 152 results.append(result) | 155 results.append(result) |
| 153 | 156 |
| 154 LayoutTestResults._for_each_test(self._test_result_tree(), add_if_passes
) | 157 LayoutTestResults._for_each_test(self._test_result_tree(), add_if_passes
) |
| 155 return sorted(results, key=lambda r: r.test_name()) | 158 return sorted(results, key=lambda r: r.test_name()) |
| 156 | 159 |
| 157 def unexpected_mismatch_results(self): | 160 def unexpected_mismatch_results(self): |
| 158 return self._filter_tests(lambda r: r.has_mismatch_result() and not r.di
d_run_as_expected()) | 161 return self._filter_tests(lambda r: r.has_mismatch_result() and not r.di
d_run_as_expected()) |
| 159 | 162 |
| 163 def missing_results(self): |
| 164 return self._filter_tests(lambda r: r.is_missing_baseline()) |
| 165 |
| 160 def didnt_run_as_expected_results(self): | 166 def didnt_run_as_expected_results(self): |
| 161 return self._filter_tests(lambda r: not r.did_run_as_expected()) | 167 return self._filter_tests(lambda r: not r.did_run_as_expected()) |
| OLD | NEW |