| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Gathers information about APKs.""" | 5 """Gathers information about APKs.""" |
| 6 | 6 |
| 7 import collections | 7 import collections |
| 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 | 12 |
| 13 import cmd_helper | 13 from pylib import cmd_helper |
| 14 |
| 14 | 15 |
| 15 # If you change the cached output of proguard, increment this number | 16 # If you change the cached output of proguard, increment this number |
| 16 PICKLE_FORMAT_VERSION = 1 | 17 PICKLE_FORMAT_VERSION = 1 |
| 17 | 18 |
| 18 def GetPackageNameForApk(apk_path): | 19 def GetPackageNameForApk(apk_path): |
| 19 """Returns the package name of the apk file.""" | 20 """Returns the package name of the apk file.""" |
| 20 aapt_output = cmd_helper.GetCmdOutput( | 21 aapt_output = cmd_helper.GetCmdOutput( |
| 21 ['aapt', 'dump', 'badging', apk_path]).split('\n') | 22 ['aapt', 'dump', 'badging', apk_path]).split('\n') |
| 22 package_name_re = re.compile(r'package: .*name=\'(\S*)\'') | 23 package_name_re = re.compile(r'package: .*name=\'(\S*)\'') |
| 23 for line in aapt_output: | 24 for line in aapt_output: |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if self._IsTestMethod(test) and self._AnnotationsMatchFilters( | 178 if self._IsTestMethod(test) and self._AnnotationsMatchFilters( |
| 178 annotation_filter_list, annotations)] | 179 annotation_filter_list, annotations)] |
| 179 | 180 |
| 180 def GetTestMethods(self): | 181 def GetTestMethods(self): |
| 181 """Returns a list of all test methods in this apk as Class#testMethod.""" | 182 """Returns a list of all test methods in this apk as Class#testMethod.""" |
| 182 return self._test_methods | 183 return self._test_methods |
| 183 | 184 |
| 184 @staticmethod | 185 @staticmethod |
| 185 def IsPythonDrivenTest(test): | 186 def IsPythonDrivenTest(test): |
| 186 return 'pythonDrivenTests' in test | 187 return 'pythonDrivenTests' in test |
| OLD | NEW |