| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Helper class for instrumenation test jar.""" | 5 """Helper class for instrumenation test jar.""" |
| 6 # pylint: disable=W0702 | 6 # pylint: disable=W0702 |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import pickle | 10 import pickle |
| 11 import re | 11 import re |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 from devil.android import device_utils | 14 from devil.android import device_utils |
| 15 from devil.android import md5sum | 15 from devil.android import md5sum |
| 16 from devil.utils import cmd_helper | |
| 17 from pylib import constants | 16 from pylib import constants |
| 18 from pylib.utils import proguard | 17 from pylib.utils import proguard |
| 19 | 18 |
| 20 sys.path.insert(0, | 19 sys.path.insert(0, |
| 21 os.path.join(constants.DIR_SOURCE_ROOT, | 20 os.path.join(constants.DIR_SOURCE_ROOT, |
| 22 'build', 'util', 'lib', 'common')) | 21 'build', 'util', 'lib', 'common')) |
| 23 | 22 |
| 24 import unittest_util # pylint: disable=F0401 | 23 import unittest_util # pylint: disable=F0401 |
| 25 | 24 |
| 26 # If you change the cached output of proguard, increment this number | 25 # If you change the cached output of proguard, increment this number |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 f.write(pickle.dumps(d)) | 112 f.write(pickle.dumps(d)) |
| 114 | 113 |
| 115 @staticmethod | 114 @staticmethod |
| 116 def _IsTestMethod(test): | 115 def _IsTestMethod(test): |
| 117 class_name, method = test.split('#') | 116 class_name, method = test.split('#') |
| 118 return class_name.endswith('Test') and method.startswith('test') | 117 return class_name.endswith('Test') and method.startswith('test') |
| 119 | 118 |
| 120 def GetTestAnnotations(self, test): | 119 def GetTestAnnotations(self, test): |
| 121 """Returns a list of all annotations for the given |test|. May be empty.""" | 120 """Returns a list of all annotations for the given |test|. May be empty.""" |
| 122 if not self._IsTestMethod(test) or not test in self._test_methods: | 121 if not self._IsTestMethod(test) or not test in self._test_methods: |
| 123 return [] | 122 return {} |
| 124 return self._test_methods[test]['annotations'] | 123 return self._test_methods[test]['annotations'] |
| 125 | 124 |
| 126 @staticmethod | 125 @staticmethod |
| 127 def _AnnotationsMatchFilters(annotation_filter_list, annotations): | 126 def _AnnotationsMatchFilters(annotation_filter_list, annotations): |
| 128 """Checks if annotations match any of the filters.""" | 127 """Checks if annotations match any of the filters.""" |
| 129 if not annotation_filter_list: | 128 if not annotation_filter_list: |
| 130 return True | 129 return True |
| 131 for annotation_filter in annotation_filter_list: | 130 for annotation_filter in annotation_filter_list: |
| 132 filters = annotation_filter.split('=') | 131 filters = annotation_filter.split('=') |
| 133 if len(filters) == 2: | 132 if len(filters) == 2: |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 devices = device_utils.DeviceUtils.parallel(devices) | 221 devices = device_utils.DeviceUtils.parallel(devices) |
| 223 min_sdk_version = min(devices.build_version_sdk.pGet(None)) | 222 min_sdk_version = min(devices.build_version_sdk.pGet(None)) |
| 224 tests = [t for t in tests | 223 tests = [t for t in tests |
| 225 if self._IsTestValidForSdkRange(t, min_sdk_version)] | 224 if self._IsTestValidForSdkRange(t, min_sdk_version)] |
| 226 | 225 |
| 227 return tests | 226 return tests |
| 228 | 227 |
| 229 @staticmethod | 228 @staticmethod |
| 230 def IsHostDrivenTest(test): | 229 def IsHostDrivenTest(test): |
| 231 return 'pythonDrivenTests' in test | 230 return 'pythonDrivenTests' in test |
| OLD | NEW |