| OLD | NEW |
| 1 # Copyright (C) 2014 Google Inc. All rights reserved. | 1 # Copyright (C) 2014 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 if result == 'NOTFOUND': | 63 if result == 'NOTFOUND': |
| 64 result = self._recurse_json_object(self._old_full_results_list[i
ndex]["tests"], key_list) | 64 result = self._recurse_json_object(self._old_full_results_list[i
ndex]["tests"], key_list) |
| 65 row.append(result) | 65 row.append(result) |
| 66 return row | 66 return row |
| 67 | 67 |
| 68 def _add_archived_result(self, json_object, result): | 68 def _add_archived_result(self, json_object, result): |
| 69 json_object['archived_results'] = result | 69 json_object['archived_results'] = result |
| 70 | 70 |
| 71 def _process_json_object(self, json_object, keyList): | 71 def _process_json_object(self, json_object, keyList): |
| 72 for key, subdict in json_object.iteritems(): | 72 for key, subdict in json_object.iteritems(): |
| 73 if type(subdict) == dict: | 73 if isinstance(subdict, dict): |
| 74 self._process_json_object(subdict, keyList + [key]) | 74 self._process_json_object(subdict, keyList + [key]) |
| 75 else: | 75 else: |
| 76 row = [self._get_test_result(json_object)] | 76 row = [self._get_test_result(json_object)] |
| 77 row += self._process_previous_json_results(keyList) | 77 row += self._process_previous_json_results(keyList) |
| 78 json_object.clear() | 78 json_object.clear() |
| 79 self._add_archived_result(json_object, row) | 79 self._add_archived_result(json_object, row) |
| 80 return | 80 return |
| 81 | 81 |
| 82 def generate_archived_result(self): | 82 def generate_archived_result(self): |
| 83 for key in self._current_result_json_dict["tests"]: | 83 for key in self._current_result_json_dict["tests"]: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 # There must be at least one archived result to be processed | 145 # There must be at least one archived result to be processed |
| 146 if self._current_result_json_dict: | 146 if self._current_result_json_dict: |
| 147 process_json_data = ProcessJsonData(self._current_result_json_dict, | 147 process_json_data = ProcessJsonData(self._current_result_json_dict, |
| 148 self._old_failing_results_list,
self._old_full_results_list) | 148 self._old_failing_results_list,
self._old_full_results_list) |
| 149 self._final_result = process_json_data.generate_archived_result() | 149 self._final_result = process_json_data.generate_archived_result() |
| 150 final_json = json.dumps(self._final_result) | 150 final_json = json.dumps(self._final_result) |
| 151 final_json = 'ADD_RESULTS(' + final_json + ');' | 151 final_json = 'ADD_RESULTS(' + final_json + ');' |
| 152 archived_results_file_path = self._filesystem.join(self._results_dir
ectory, 'archived_results.json') | 152 archived_results_file_path = self._filesystem.join(self._results_dir
ectory, 'archived_results.json') |
| 153 self._filesystem.write_text_file(archived_results_file_path, final_j
son) | 153 self._filesystem.write_text_file(archived_results_file_path, final_j
son) |
| OLD | NEW |