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

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

Issue 832493005: Add Instrumentation test support to remote device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: build/android/pylib/remote/device/remote_device_instrumentation_test_run.py
diff --git a/build/android/pylib/remote/device/remote_device_instrumentation_test_run.py b/build/android/pylib/remote/device/remote_device_instrumentation_test_run.py
new file mode 100644
index 0000000000000000000000000000000000000000..5138d460899520a619c88d2aa622c6b64768a87b
--- /dev/null
+++ b/build/android/pylib/remote/device/remote_device_instrumentation_test_run.py
@@ -0,0 +1,55 @@
+# Copyright 2015 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.
+
+"""Run specific test on specific environment."""
+
+import logging
+import os
+import tempfile
+
+from pylib.base import base_test_result
+from pylib.remote.device import remote_device_test_run
+from pylib.utils import apk_helper
+
+
+class RemoteDeviceInstrumentationTestRun(
+ remote_device_test_run.RemoteDeviceTestRun):
+ """Run instrumentation tests on a remote device."""
+
+ #override
+ def TestPackage(self):
+ return self._test_instance.test_package
+
+ #override
+ def _TriggerSetUp(self):
+ """Set up the triggering of a test run."""
+ logging.info('Triggering test run.')
+ self._AmInstrumentTestSetup(
+ self._test_instance._apk_under_test, self._test_instance.test_apk,
+ self._test_instance.test_runner, environment_variables={})
+
+ #override
+ def _ParseTestResults(self):
+ logging.info('Parsing results from stdout.')
+ r = base_test_result.TestRunResults()
+
+ if self._results['results']['exception']:
+ r.AddResult(base_test_result.BaseTestResult(
+ self._results['results']['exception'],
+ base_test_result.ResultType.FAIL))
+ return r
+
+ _, errors, parsed_output = self._test_instance.ParseAmInstrumentRawOutput(
+ self._results['results']['output'].splitlines())
+ logging.debug(errors)
+ result = self._test_instance.GenerateMultiTestResult(errors, parsed_output)
+
+ if isinstance(result, base_test_result.BaseTestResult):
+ r.AddResult(result)
+ elif isinstance(result, list):
+ r.AddResults(result)
+ else:
+ raise Exception('Unexpected result type: %s' % type(result).__name__)
+
+ return r

Powered by Google App Engine
This is Rietveld 408576698