Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import collections | 5 import collections |
| 6 import copy | 6 import copy |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import pickle | 9 import pickle |
| 10 import re | 10 import re |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 if not self._annotations: | 581 if not self._annotations: |
| 582 return True | 582 return True |
| 583 return any_annotation_matches(self._annotations, all_annotations) | 583 return any_annotation_matches(self._annotations, all_annotations) |
| 584 | 584 |
| 585 def excluded_annotation_filter(all_annotations): | 585 def excluded_annotation_filter(all_annotations): |
| 586 if not self._excluded_annotations: | 586 if not self._excluded_annotations: |
| 587 return True | 587 return True |
| 588 return not any_annotation_matches(self._excluded_annotations, | 588 return not any_annotation_matches(self._excluded_annotations, |
| 589 all_annotations) | 589 all_annotations) |
| 590 | 590 |
| 591 def any_annotation_matches(annotations, all_annotations): | 591 def any_annotation_matches(filter_annotations, all_annotations): |
| 592 return any( | 592 return any( |
| 593 ak in all_annotations and (av is None or av == all_annotations[ak]) | 593 ak in all_annotations |
|
rnephew (Reviews Here)
2016/06/24 14:22:43
These variables could probably be a little more de
jbudorick
2016/06/24 14:24:56
In a comprehension, I'd strongly prefer keeping th
| |
| 594 for ak, av in annotations.iteritems()) | 594 and annotation_value_matches(av, all_annotations[ak]) |
| 595 for ak, av in filter_annotations.iteritems()) | |
| 596 | |
| 597 def annotation_value_matches(filter_av, av): | |
| 598 if filter_av is None: | |
| 599 return True | |
| 600 elif isinstance(av, dict): | |
| 601 return filter_av in av['value'] | |
| 602 elif isinstance(av, list): | |
| 603 return filter_av in av | |
| 604 return filter_av == av | |
| 595 | 605 |
| 596 filtered_classes = [] | 606 filtered_classes = [] |
| 597 for c in tests: | 607 for c in tests: |
| 598 filtered_methods = [] | 608 filtered_methods = [] |
| 599 for m in c['methods']: | 609 for m in c['methods']: |
| 600 # Gtest filtering | 610 # Gtest filtering |
| 601 if not gtest_filter(c, m): | 611 if not gtest_filter(c, m): |
| 602 continue | 612 continue |
| 603 | 613 |
| 604 all_annotations = dict(c['annotations']) | 614 all_annotations = dict(c['annotations']) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 671 def GenerateTestResults( | 681 def GenerateTestResults( |
| 672 result_code, result_bundle, statuses, start_ms, duration_ms): | 682 result_code, result_bundle, statuses, start_ms, duration_ms): |
| 673 return GenerateTestResults(result_code, result_bundle, statuses, | 683 return GenerateTestResults(result_code, result_bundle, statuses, |
| 674 start_ms, duration_ms) | 684 start_ms, duration_ms) |
| 675 | 685 |
| 676 #override | 686 #override |
| 677 def TearDown(self): | 687 def TearDown(self): |
| 678 if self._isolate_delegate: | 688 if self._isolate_delegate: |
| 679 self._isolate_delegate.Clear() | 689 self._isolate_delegate.Clear() |
| 680 | 690 |
| OLD | NEW |