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

Unified Diff: build/android/pylib/remote/device/remote_device_test_run.py

Issue 833403002: [Android] Create a dummy app to upload to Appurify for gtests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add gn Created 5 years, 11 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
« no previous file with comments | « build/android/pylib/remote/device/remote_device_gtest_run.py ('k') | build/apk_test.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/remote/device/remote_device_test_run.py
diff --git a/build/android/pylib/remote/device/remote_device_test_run.py b/build/android/pylib/remote/device/remote_device_test_run.py
index e5d05d7d66fe6e66d5e3ae12ee6dc4d4e8dcc4bf..b9d06be955730b4a7f163ee1b90f660c273fd458 100644
--- a/build/android/pylib/remote/device/remote_device_test_run.py
+++ b/build/android/pylib/remote/device/remote_device_test_run.py
@@ -138,28 +138,37 @@ class RemoteDeviceTestRun(test_run.TestRun):
logging.info('Test status: %s' % self._results['detailed_status'])
return self._results['status']
- def _UploadAppToDevice(self, apk_path):
+ def _AmInstrumentTestSetup(self, app_path, test_path, runner_package):
+ config = {'runner': runner_package}
+
+ self._app_id = self._UploadAppToDevice(app_path)
+ self._test_id = self._UploadTestToDevice('robotium', test_path)
+
+ logging.info('Setting config: %s' % config)
+ self._SetTestConfig('robotium', config)
+
+ def _UploadAppToDevice(self, app_path):
"""Upload app to device."""
- logging.info('Upload %s to remote service.' % apk_path)
- apk_name = os.path.basename(apk_path)
- with open(apk_path, 'rb') as apk_src:
- upload_results = appurify_sanitized.api.apps_upload(self._env.token,
- apk_src, 'raw', name=apk_name)
+ logging.info('Upload %s to remote service.' % app_path)
+ apk_name = os.path.basename(app_path)
+ with open(app_path, 'rb') as apk_src:
+ upload_results = appurify_sanitized.api.apps_upload(
+ self._env.token, apk_src, 'raw', name=apk_name)
remote_device_helper.TestHttpResponse(
- upload_results, 'Unable to upload %s.' %(apk_path))
+ upload_results, 'Unable to upload %s.' % app_path)
return upload_results.json()['response']['app_id']
- def _UploadTestToDevice(self, test_type):
+ def _UploadTestToDevice(self, test_type, test_path):
"""Upload test to device
Args:
test_type: Type of test that is being uploaded. Ex. uirobot, gtest..
"""
- logging.info('Uploading %s to remote service.' % self._test_instance.apk)
- with open(self._test_instance.apk, 'rb') as test_src:
+ logging.info('Uploading %s to remote service.' % test_path)
+ with open(test_path, 'rb') as test_src:
upload_results = appurify_sanitized.api.tests_upload(
- self._env.token, test_src, 'raw', test_type, app_id=self._app_id)
+ self._env.token, test_src, 'raw', test_type)
remote_device_helper.TestHttpResponse(upload_results,
- 'Unable to upload %s.' %(self._test_instance.apk))
+ 'Unable to upload %s.' % test_path)
return upload_results.json()['response']['test_id']
def _SetTestConfig(self, runner_type, body):
@@ -174,7 +183,7 @@ class RemoteDeviceTestRun(test_run.TestRun):
config.write(''.join('%s\n' % l for l in config_data))
config.flush()
config.seek(0)
- config_response = appurify_sanitized.api.config_upload(self._env.token,
- config, self._test_id)
- remote_device_helper.TestHttpResponse(config_response,
- 'Unable to upload test config.')
+ config_response = appurify_sanitized.api.config_upload(
+ self._env.token, config, self._test_id)
+ remote_device_helper.TestHttpResponse(
+ config_response, 'Unable to upload test config.')
« no previous file with comments | « build/android/pylib/remote/device/remote_device_gtest_run.py ('k') | build/apk_test.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698