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

Unified Diff: build/android/pylib/local/machine/local_machine_junit_test_run.py

Issue 2767613002: Expose resources in Robolectric/JUnit tests. (Closed)
Patch Set: Added support for multiple resource files. Created 3 years, 9 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/local/machine/local_machine_junit_test_run.py
diff --git a/build/android/pylib/local/machine/local_machine_junit_test_run.py b/build/android/pylib/local/machine/local_machine_junit_test_run.py
index ef8bef4f1aee411d0ed6e2a1cddd93926b175793..aae66d61e77f2430f6ab026b45e117c068670aa6 100644
--- a/build/android/pylib/local/machine/local_machine_junit_test_run.py
+++ b/build/android/pylib/local/machine/local_machine_junit_test_run.py
@@ -46,13 +46,21 @@ class LocalMachineJunitTestRun(test_run.TestRun):
command.extend(['--jar-args', '"%s"' % ' '.join(jar_args)])
# Add JVM arguments.
- jvm_args = []
- # TODO(mikecase): Add a --robolectric-dep-dir arg to test runner.
jbudorick 2017/03/30 19:11:44 Nice.
- # Have this arg set by GN in the generated test runner scripts.
- jvm_args += [
- '-Drobolectric.dependency.dir=%s' %
- os.path.join(constants.GetOutDirectory(),
- 'lib.java', 'third_party', 'robolectric')]
+ jvm_args = ['-Drobolectric.dependency.dir=%s' %
+ self._test_instance.robolectric_runtime_deps_dir]
+
+ if self._test_instance.android_manifest_path:
+ jvm_args += ['-Dchromium.robolectric.manifest=%s' %
+ self._test_instance.android_manifest_path]
+
+ if self._test_instance.package_name:
+ jvm_args += ['-Dchromium.robolectric.package.name=%s' %
+ self._test_instance.package_name]
+
+ if self._test_instance.resource_dirs:
+ jvm_args += ['-Dchromium.robolectric.resource.dirs=%s' %
+ ':'.join(self._test_instance.resource_dirs)]
+
if self._test_instance.coverage_dir:
if not os.path.exists(self._test_instance.coverage_dir):
os.makedirs(self._test_instance.coverage_dir)
@@ -61,6 +69,7 @@ class LocalMachineJunitTestRun(test_run.TestRun):
jvm_args.append('-Demma.coverage.out.file=%s' % os.path.join(
self._test_instance.coverage_dir,
'%s.ec' % self._test_instance.suite))
+
if jvm_args:
command.extend(['--jvm-args', '"%s"' % ' '.join(jvm_args)])

Powered by Google App Engine
This is Rietveld 408576698