| Index: build/android/pylib/instrumentation/test_jar.py
|
| diff --git a/build/android/pylib/instrumentation/apk_info.py b/build/android/pylib/instrumentation/test_jar.py
|
| similarity index 85%
|
| copy from build/android/pylib/instrumentation/apk_info.py
|
| copy to build/android/pylib/instrumentation/test_jar.py
|
| index 5f5e0c879e99d3563f17ee7cf38350dd466afe7c..ef01656880be237cca8eaf35716f2f7e7c58a2a6 100644
|
| --- a/build/android/pylib/instrumentation/apk_info.py
|
| +++ b/build/android/pylib/instrumentation/test_jar.py
|
| @@ -1,8 +1,8 @@
|
| -# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +# Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -"""Gathers information about APKs."""
|
| +"""Helper class for instrumenation test jar."""
|
|
|
| import collections
|
| import logging
|
| @@ -17,22 +17,9 @@ from pylib import constants
|
| # If you change the cached output of proguard, increment this number
|
| PICKLE_FORMAT_VERSION = 1
|
|
|
| -def GetPackageNameForApk(apk_path):
|
| - """Returns the package name of the apk file."""
|
| - aapt_output = cmd_helper.GetCmdOutput(
|
| - ['aapt', 'dump', 'badging', apk_path]).split('\n')
|
| - package_name_re = re.compile(r'package: .*name=\'(\S*)\'')
|
| - for line in aapt_output:
|
| - m = package_name_re.match(line)
|
| - if m:
|
| - return m.group(1)
|
| - raise Exception('Failed to determine package name of %s' % apk_path)
|
|
|
| -
|
| -class ApkInfo(object):
|
| - """Helper class for inspecting APKs."""
|
| -
|
| - def __init__(self, apk_path, jar_path):
|
| +class TestJar(object):
|
| + def __init__(self, jar_path):
|
| sdk_root = os.getenv('ANDROID_SDK_ROOT', constants.ANDROID_SDK_ROOT)
|
| self._PROGUARD_PATH = os.path.join(sdk_root,
|
| 'tools/proguard/bin/proguard.sh')
|
| @@ -46,18 +33,12 @@ class ApkInfo(object):
|
| re.compile(r'\s*?- Constant element value.*$'))
|
| self._PROGUARD_ANNOTATION_VALUE_RE = re.compile(r'\s*?- \S+? \[(.*)\]$')
|
|
|
| - if not os.path.exists(apk_path):
|
| - raise Exception('%s not found, please build it' % apk_path)
|
| - self._apk_path = apk_path
|
| if not os.path.exists(jar_path):
|
| raise Exception('%s not found, please build it' % jar_path)
|
| self._jar_path = jar_path
|
| self._annotation_map = collections.defaultdict(list)
|
| self._pickled_proguard_name = self._jar_path + '-proguard.pickle'
|
| self._test_methods = []
|
| - self._Initialize()
|
| -
|
| - def _Initialize(self):
|
| if not self._GetCachedProguardData():
|
| self._GetProguardData()
|
|
|
| @@ -145,13 +126,6 @@ class ApkInfo(object):
|
| class_name, method = test.split('#')
|
| return class_name.endswith('Test') and method.startswith('test')
|
|
|
| - def GetApkPath(self):
|
| - return self._apk_path
|
| -
|
| - def GetPackageName(self):
|
| - """Returns the package name of this APK."""
|
| - return GetPackageNameForApk(self._apk_path)
|
| -
|
| def GetTestAnnotations(self, test):
|
| """Returns a list of all annotations for the given |test|. May be empty."""
|
| if not self._IsTestMethod(test):
|
|
|