| Index: build/android/pylib/remote/device/remote_device_uirobot_test_run.py
|
| diff --git a/build/android/pylib/remote/device/remote_device_uirobot_test_run.py b/build/android/pylib/remote/device/remote_device_uirobot_test_run.py
|
| index f99e685084b97b21a60a00ae5f298e54c7d3deb9..c23604237ac11fc0fbed12c9464329f78940a96c 100644
|
| --- a/build/android/pylib/remote/device/remote_device_uirobot_test_run.py
|
| +++ b/build/android/pylib/remote/device/remote_device_uirobot_test_run.py
|
| @@ -15,7 +15,6 @@ from pylib.remote.device import remote_device_helper
|
| class RemoteDeviceUirobotTestRun(remote_device_test_run.RemoteDeviceTestRun):
|
| """Run uirobot tests on a remote device."""
|
|
|
| -
|
| def __init__(self, env, test_instance):
|
| """Constructor.
|
|
|
| @@ -26,60 +25,77 @@ class RemoteDeviceUirobotTestRun(remote_device_test_run.RemoteDeviceTestRun):
|
| super(RemoteDeviceUirobotTestRun, self).__init__(env, test_instance)
|
|
|
| #override
|
| - def TestPackage(self):
|
| - return self._test_instance.package_name
|
| + def _GetAdditionalApks(self):
|
| + return None
|
|
|
| #override
|
| - def _TriggerSetUp(self):
|
| - """Set up the triggering of a test run."""
|
| - logging.info('Triggering test run.')
|
| + def _GetAppPath(self):
|
| + return self._test_instance.app_under_test
|
|
|
| - if self._env.device_type == 'Android':
|
| - default_runner_type = 'android_robot'
|
| + #override
|
| + def _GetTestFramework(self):
|
| + if self._env.test_framework:
|
| + return self._env.test_framework
|
| + elif self._env.device_type == 'Android':
|
| + return 'android_robot'
|
| elif self._env.device_type == 'iOS':
|
| - default_runner_type = 'ios_robot'
|
| + return 'ios_robot'
|
| else:
|
| raise remote_device_helper.RemoteDeviceError(
|
| 'Unknown device type: %s' % self._env.device_type)
|
|
|
| - self._app_id = self._UploadAppToDevice(self._test_instance.app_under_test)
|
| - if not self._env.runner_type:
|
| - runner_type = default_runner_type
|
| - logging.info('Using default runner type: %s', default_runner_type)
|
| - else:
|
| - runner_type = self._env.runner_type
|
| + #override
|
| + def _GetTestPath(self):
|
| + return None
|
|
|
| - self._test_id = self._UploadTestToDevice(
|
| - 'android_robot', None, app_id=self._app_id)
|
| - config_body = {'duration': self._test_instance.minutes}
|
| - self._SetTestConfig(runner_type, config_body)
|
| + #override
|
| + def _GetTestRunnerName(self):
|
| + return None
|
|
|
| + #override
|
| + def _GetFrameworkConfigs(self):
|
| + return {'duration': self._test_instance.minutes}
|
|
|
| - # TODO(rnephew): Switch to base class implementation when supported.
|
| #override
|
| - def _UploadTestToDevice(self, test_type, test_path, app_id=None):
|
| - if test_path:
|
| - logging.info("Ignoring test path.")
|
| + def _GetShardEnvironmentVars(self, num_shards):
|
| + return None
|
| +
|
| + #override
|
| + def _ShouldShard(self):
|
| + return False
|
| +
|
| + #override
|
| + def TestPackage(self):
|
| + return self._test_instance.package_name
|
| +
|
| + # TODO(rnephew): Switch to base class implementation when supported.
|
| + # override
|
| + def _UploadTestToDevice(self):
|
| data = {
|
| - 'access_token':self._env.token,
|
| - 'test_type':test_type,
|
| - 'app_id':app_id,
|
| + 'access_token': self._env.token,
|
| + 'test_type': self._GetTestFramework(),
|
| + 'app_id': self._app_id,
|
| }
|
| - with appurify_sanitized.SanitizeLogging(self._env.verbose_count,
|
| - logging.WARNING):
|
| - test_upload_res = appurify_sanitized.utils.post('tests/upload',
|
| - data, None)
|
| + with appurify_sanitized.SanitizeLogging(
|
| + verbose_count=self._env.verbose_count,
|
| + level=logging.WARNING):
|
| + test_upload_response = appurify_sanitized.utils.post(
|
| + resource='tests/upload',
|
| + data=data,
|
| + files=None)
|
| remote_device_helper.TestHttpResponse(
|
| - test_upload_res, 'Unable to get UiRobot test id.')
|
| - return test_upload_res.json()['response']['test_id']
|
| + response=test_upload_response,
|
| + error_msg='Unable to get UiRobot test id.')
|
| + return test_upload_response.json()['response']['test_id']
|
|
|
| #override
|
| - def _ParseTestResults(self):
|
| + def _ParseTestResults(self, test_output, results_zip):
|
| logging.info('Parsing results from remote service.')
|
| results = base_test_result.TestRunResults()
|
| - if self._results['results']['pass']:
|
| + if test_output['results']['pass']:
|
| result_type = base_test_result.ResultType.PASS
|
| else:
|
| result_type = base_test_result.ResultType.FAIL
|
| results.AddResult(base_test_result.BaseTestResult('uirobot', result_type))
|
| + self._DetectPlatformErrors(results, test_output, results_zip)
|
| return results
|
|
|