Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 1034053002: [Android] Add an out-of-app instrumentation driver APK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/instrumentation/instrumentation_test_instance.py
diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance.py b/build/android/pylib/instrumentation/instrumentation_test_instance.py
index 3f56e6d99f90007caf457e5eb3fde6b608afbecf..3b5d016b51be8b0fefab22149c05e3c8de0fc221 100644
--- a/build/android/pylib/instrumentation/instrumentation_test_instance.py
+++ b/build/android/pylib/instrumentation/instrumentation_test_instance.py
@@ -30,6 +30,17 @@ _ACTIVITY_RESULT_OK = -1
_DEFAULT_ANNOTATIONS = [
'Smoke', 'SmallTest', 'MediumTest', 'LargeTest',
'EnormousTest', 'IntegrationTest']
+_EXTRA_ENABLE_HTTP_SERVER = (
+ 'org.chromium.chrome.test.ChromeInstrumentationTestRunner.'
+ + 'EnableTestHttpServer')
+_EXTRA_OUTSTRUMENTATION_TEST_LIST = (
+ 'org.chromium.test.outstrumentation.master.Outstrumentation.TestList')
+_EXTRA_OUTSTRUMENTATION_TEST_LIST_FILE = (
+ 'org.chromium.test.outstrumentation.master.Outstrumentation.TestListFile')
+_EXTRA_OUTSTRUMENTATION_TARGET_PACKAGE = (
+ 'org.chromium.test.outstrumentation.master.Outstrumentation.TargetPackage')
+_EXTRA_OUTSTRUMENTATION_TARGET_CLASS = (
+ 'org.chromium.test.outstrumentation.master.Outstrumentation.TargetClass')
_NATIVE_CRASH_RE = re.compile('native crash', re.IGNORECASE)
_PICKLE_FORMAT_VERSION = 10
@@ -130,6 +141,7 @@ class InstrumentationTestInstance(test_instance.TestInstance):
self._apk_under_test = None
self._package_info = None
+ self._suite = None
self._test_apk = None
self._test_jar = None
self._test_package = None
@@ -164,20 +176,20 @@ class InstrumentationTestInstance(test_instance.TestInstance):
error_func('Unable to find APK under test: %s' % self._apk_under_test)
if args.test_apk.endswith('.apk'):
- test_apk_root = os.path.splitext(os.path.basename(args.test_apk))[0]
+ self._suite = os.path.splitext(os.path.basename(args.test_apk))[0]
self._test_apk = args.test_apk
else:
- test_apk_root = args.test_apk
+ self._suite = args.test_apk
self._test_apk = os.path.join(
constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR,
'%s.apk' % args.test_apk)
self._test_jar = os.path.join(
constants.GetOutDirectory(), constants.SDK_BUILD_TEST_JAVALIB_DIR,
- '%s.jar' % test_apk_root)
+ '%s.jar' % self._suite)
self._test_support_apk = os.path.join(
constants.GetOutDirectory(), constants.SDK_BUILD_TEST_JAVALIB_DIR,
- '%sSupport.apk' % test_apk_root)
+ '%sSupport.apk' % self._suite)
if not os.path.exists(self._test_apk):
error_func('Unable to find test APK: %s' % self._test_apk)
@@ -254,7 +266,7 @@ class InstrumentationTestInstance(test_instance.TestInstance):
@property
def suite(self):
- return 'instrumentation'
+ return self._suite
@property
def apk_under_test(self):
@@ -446,6 +458,28 @@ class InstrumentationTestInstance(test_instance.TestInstance):
return inflated_tests
@staticmethod
+ def GetHttpServerEnvironmentVars():
+ return {
+ _EXTRA_ENABLE_HTTP_SERVER: None,
+ }
+
+ def GetOutstrumentationEnvironmentVars(
+ self, test_list=None, test_list_file_path=None):
+ env = {
+ _EXTRA_OUTSTRUMENTATION_TARGET_PACKAGE: self.test_package,
+ _EXTRA_OUTSTRUMENTATION_TARGET_CLASS: self.test_runner,
+ }
+
+ if test_list:
+ env[_EXTRA_OUTSTRUMENTATION_TEST_LIST] = ','.join(test_list)
+
+ if test_list_file_path:
+ env[_EXTRA_OUTSTRUMENTATION_TEST_LIST_FILE] = (
+ os.path.basename(test_list_file_path))
+
+ return env
+
+ @staticmethod
def ParseAmInstrumentRawOutput(raw_output):
return ParseAmInstrumentRawOutput(raw_output)

Powered by Google App Engine
This is Rietveld 408576698