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

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

Issue 415463002: [Android] Configurable instrumentation test runner + test SDK levels. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/test_runner.py
diff --git a/build/android/pylib/instrumentation/test_runner.py b/build/android/pylib/instrumentation/test_runner.py
index d9ccb2676e9a3856ff2133b438194800f0ec43b0..3f9ac68511dfc3475c86e4f1c7ffdc6f67023e57 100644
--- a/build/android/pylib/instrumentation/test_runner.py
+++ b/build/android/pylib/instrumentation/test_runner.py
@@ -334,9 +334,34 @@ class TestRunner(base_test_runner.BaseTestRunner):
"1 minute for timeout.").format(test))
return 1 * 60
+ def RunInstrumentationTest(self, test, test_package, instr_args, timeout):
+ """Runs a single instrumentation test.
+
+ Args:
+ test: Test class/method.
+ test_package: Package name of test apk.
+ instr_args: Extra key/value to pass to am instrument.
+ timeout: Timeout time in seconds.
+
+ Returns:
+ An instance of am_instrument_parser.TestResult object.
+ """
+ instrumentation_path = (
+ '%s/%s' % (test_package, self.options.test_runner))
+ args_with_filter = dict(instr_args)
+ args_with_filter['class'] = test
+ logging.info(args_with_filter)
+ (raw_results, _) = self.device.old_interface.Adb().StartInstrumentation(
+ instrumentation_path=instrumentation_path,
+ instrumentation_args=args_with_filter,
+ timeout_time=timeout)
+ assert len(raw_results) == 1
+ return raw_results[0]
+
+
def _RunTest(self, test, timeout):
try:
- return self.device.old_interface.RunInstrumentationTest(
+ return self.RunInstrumentationTest(
test, self.test_pkg.GetPackageName(),
self._GetInstrumentationArgs(), timeout)
except (device_errors.CommandTimeoutError,

Powered by Google App Engine
This is Rietveld 408576698