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

Unified Diff: build/android/pylib/gtest/local_device_gtest_run.py

Issue 1143903002: [Android] Refactor the native test wrappers. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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/gtest/gtest_test_instance.py ('k') | build/android/pylib/gtest/setup.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/gtest/local_device_gtest_run.py
diff --git a/build/android/pylib/gtest/local_device_gtest_run.py b/build/android/pylib/gtest/local_device_gtest_run.py
index 4241e8521702679fc4f71bb4760134c8ca1924d7..15a58a459f81e68f89c7fa8c62143ba5b9a2fd0c 100644
--- a/build/android/pylib/gtest/local_device_gtest_run.py
+++ b/build/android/pylib/gtest/local_device_gtest_run.py
@@ -24,6 +24,9 @@ _EXTRA_COMMAND_LINE_FILE = (
'org.chromium.native_test.NativeTestActivity.CommandLineFile')
_EXTRA_COMMAND_LINE_FLAGS = (
'org.chromium.native_test.NativeTestActivity.CommandLineFlags')
+_EXTRA_NATIVE_TEST_ACTIVITY = (
+ 'org.chromium.native_test.NativeTestInstrumentationTestRunner'
+ '.NativeTestActivity')
_MAX_SHARD_SIZE = 256
@@ -37,8 +40,11 @@ _SUITE_REQUIRES_TEST_SERVER_SPAWNER = [
class _ApkDelegate(object):
def __init__(self, apk):
self._apk = apk
- self._package = apk_helper.GetPackageName(self._apk)
- self._runner = apk_helper.GetInstrumentationName(self._apk)
+
+ helper = apk_helper.ApkHelper(self._apk)
+ self._activity = helper.GetActivityName()
+ self._package = helper.GetPackageName()
+ self._runner = helper.GetInstrumentationName()
self._component = '%s/%s' % (self._package, self._runner)
self._enable_test_server_spawner = False
@@ -51,6 +57,7 @@ class _ApkDelegate(object):
extras = {
_EXTRA_COMMAND_LINE_FILE: command_line_file.name,
+ _EXTRA_NATIVE_TEST_ACTIVITY: self._activity,
}
return device.StartInstrumentation(
@@ -132,7 +139,7 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
#override
def TestPackage(self):
- return self._test_instance._suite
+ return self._test_instance.suite
#override
def SetUp(self):
@@ -166,13 +173,16 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
#override
def _CreateShards(self, tests):
- device_count = len(self._env.devices)
- shards = []
- for i in xrange(0, device_count):
- unbounded_shard = tests[i::device_count]
- shards += [unbounded_shard[j:j+_MAX_SHARD_SIZE]
- for j in xrange(0, len(unbounded_shard), _MAX_SHARD_SIZE)]
- return [':'.join(s) for s in shards]
+ if self._test_instance.suite in gtest_test_instance.BROWSER_TEST_SUITES:
+ return tests
+ else:
+ device_count = len(self._env.devices)
+ shards = []
+ for i in xrange(0, device_count):
+ unbounded_shard = tests[i::device_count]
+ shards += [unbounded_shard[j:j+_MAX_SHARD_SIZE]
+ for j in xrange(0, len(unbounded_shard), _MAX_SHARD_SIZE)]
+ return [':'.join(s) for s in shards]
#override
def _GetTests(self):
@@ -185,8 +195,8 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
#override
def _RunTest(self, device, test):
# Run the test.
- output = self._delegate.RunWithFlags(device, '--gtest_filter=%s' % test,
- timeout=900, retries=0)
+ output = self._delegate.RunWithFlags(
+ device, '--gtest_filter=%s' % test, timeout=900, retries=0)
for s in self._servers[str(device)]:
s.Reset()
self._delegate.Clear(device)
« no previous file with comments | « build/android/pylib/gtest/gtest_test_instance.py ('k') | build/android/pylib/gtest/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698