New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 693573 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Feature



Sign in to add a comment

Expose resources in Robolectric/JUnit tests

Project Member Reported by dgn@chromium.org, Feb 17 2017

Issue description

Currently, running code that involves resources is very hard to write unit tests for.

A common error is ContextUtils not having an application context set, but just calling ContextUtils#initApplicationContext fixes it easily enough. Still a bit irritating to hit it.

What is harder is when values, drawables etc are loaded. Robolectric is supposed to allow loading resources, but I think it has issues with some paths and it fails. Sample trace:

[ RUN      ] org.chromium.chrome.browser.suggestions.TileGridTest.testInitialisation
android.content.res.Resources$NotFoundException: unknown resource 2131427652
	at org.robolectric.shadows.ShadowAssetManager.getAndResolve(ShadowAssetManager.java:351)
	at org.robolectric.shadows.ShadowAssetManager.getResourceValue(ShadowAssetManager.java:102)
	at android.content.res.AssetManager.getResourceValue(AssetManager.java)
	at android.content.res.Resources.getValue(Resources.java:1229)
	at android.content.res.Resources.getDimensionPixelSize(Resources.java:648)
	at org.chromium.chrome.browser.suggestions.TileGroup.<init>(TileGroup.java:134)
	at org.chromium.chrome.browser.suggestions.TileGrid.<init>(TileGrid.java:27)
	at org.chromium.chrome.browser.suggestions.TileGridTest.testInitialisation(TileGridTest.java:71)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:52)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:238)
	at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:175)
	at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:53)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:139)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.chromium.testing.local.GtestComputer$GtestSuiteRunner.run(GtestComputer.java:46)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at org.chromium.testing.local.JunitTestMain.main(JunitTestMain.java:105)


It would be nice if LocalRobolectricTestRunner or some base test class handled all that.
 
Cc: mikec...@chromium.org

Comment 2 by dgn@chromium.org, Mar 16 2017

Bump for attention. I'm running into that again. I currently have the choice between instrumentation tests and a ridiculous amount of manual mocking to recreate a custom view because Robolectric can't find the resource to inflate.
Labels: -Type-Bug Type-Feature
Owner: mikec...@chromium.org
Status: Assigned (was: Untriaged)
Got this working locally with this CL.
https://codereview.chromium.org/2767613002

Will clean up and send out for review.
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3

commit 0d81d90a4b60f8dbcf75f92405cb441db3d08cd3
Author: mikecase <mikecase@chromium.org>
Date: Thu Apr 13 15:53:05 2017

Expose resources in Robolectric/JUnit tests.

BUG= 693573 

Review-Url: https://codereview.chromium.org/2767613002
Cr-Commit-Position: refs/heads/master@{#464422}

[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/build/android/gyp/create_test_runner_script.py
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/build/android/gyp/write_build_config.py
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/build/android/pylib/junit/junit_test_instance.py
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/build/android/pylib/local/machine/local_machine_junit_test_run.py
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/build/android/test_runner.py
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/build/android/test_runner.pydeps
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/build/config/android/internal_rules.gni
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/build/config/android/rules.gni
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/chrome/android/BUILD.gn
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupTest.java
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/testing/android/OWNERS
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
[modify] https://crrev.com/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3/third_party/robolectric/README.chromium

Status: Fixed (was: Assigned)
This should be fixed. Just be sure you run the junit tests with the out/Debug/bin/run_<testname> scripts from now on.

Ill look to add some more documentation about this in testing/android/docs
Project Member

Comment 7 by bugdroid1@chromium.org, Apr 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9

commit b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9
Author: mikecase <mikecase@chromium.org>
Date: Thu Apr 13 18:59:45 2017

Revert of Expose resources in Robolectric/JUnit tests. (patchset #12 id:220001 of https://codereview.chromium.org/2767613002/ )

Reason for revert:
crbug/711372

Original issue's description:
> Expose resources in Robolectric/JUnit tests.
>
> BUG= 693573 
>
> Review-Url: https://codereview.chromium.org/2767613002
> Cr-Commit-Position: refs/heads/master@{#464422}
> Committed: https://chromium.googlesource.com/chromium/src/+/0d81d90a4b60f8dbcf75f92405cb441db3d08cd3

TBR=agrieve@chromium.org,dgn@chromium.org,jbudorick@chromium.org,nyquist@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 693573 

Review-Url: https://codereview.chromium.org/2819593002
Cr-Commit-Position: refs/heads/master@{#464486}

[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/build/android/gyp/create_test_runner_script.py
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/build/android/gyp/write_build_config.py
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/build/android/pylib/junit/junit_test_instance.py
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/build/android/pylib/local/machine/local_machine_junit_test_run.py
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/build/android/test_runner.py
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/build/android/test_runner.pydeps
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/build/config/android/internal_rules.gni
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/build/config/android/rules.gni
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/chrome/android/BUILD.gn
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupTest.java
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/testing/android/OWNERS
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
[modify] https://crrev.com/b67ca3636e3ec5dc8f38a1ffd9db79a1208620e9/third_party/robolectric/README.chromium

Project Member

Comment 8 by bugdroid1@chromium.org, Apr 17 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/30bba37e58b51483b1ec77bc3f697deb8e4033c1

commit 30bba37e58b51483b1ec77bc3f697deb8e4033c1
Author: mikecase <mikecase@chromium.org>
Date: Mon Apr 17 19:22:01 2017

(Reland) Expose resources in Robolectric/JUnit tests.

Will let people use Android resources in Robolectric tests.
To use, specify package_name GN variable in junit_binary
targets with your apps package name.

This change will also (basically) require that you use the
generated wrappers from out_dir/bin/run_<suite name> to run
the tests since GN will be generating many arguments to
pass along to the test runner.

BUG= 693573 

Review-Url: https://codereview.chromium.org/2819983002
Cr-Commit-Position: refs/heads/master@{#464973}

[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/build/android/gyp/create_test_runner_script.py
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/build/android/gyp/write_build_config.py
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/build/android/pylib/junit/junit_test_instance.py
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/build/android/pylib/local/machine/local_machine_junit_test_run.py
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/build/android/test_runner.py
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/build/android/test_runner.pydeps
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/build/config/android/internal_rules.gni
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/build/config/android/rules.gni
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/chrome/android/BUILD.gn
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupTest.java
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/testing/android/OWNERS
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
[modify] https://crrev.com/30bba37e58b51483b1ec77bc3f697deb8e4033c1/third_party/robolectric/README.chromium

Project Member

Comment 9 by bugdroid1@chromium.org, Apr 17 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3781c029a68e4ea22f3e36db45a561723b610667

commit 3781c029a68e4ea22f3e36db45a561723b610667
Author: alexmos <alexmos@chromium.org>
Date: Mon Apr 17 21:30:47 2017

Revert of (Reland) Expose resources in Robolectric/JUnit tests. (patchset #2 id:20001 of https://codereview.chromium.org/2819983002/ )

Reason for revert:
Appears to be breaking chrome_junit_tests: https://build.chromium.org/p/chromium.linux/builders/Android%20Tests/builds/40695

Stack trace from failed tests:
android.content.res.Resources$NotFoundException: Resource ID #0x7f0a0153
	at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190)
	at android.content.res.Resources.getDimensionPixelSize(Resources.java:667)
	at org.chromium.chrome.browser.suggestions.TileGroup.<init>(TileGroup.java:192)
	at org.chromium.chrome.browser.suggestions.TileGroupTest.testReceiveNewTilesWithoutChanges(TileGroupTest.java:110)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:52)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:515)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:316)
	at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:236)
	at org.robolectric.RobolectricTestRunner.runChild(RobolectricTestRunner.java:41)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:176)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.chromium.testing.local.GtestComputer$GtestSuiteRunner.run(GtestComputer.java:46)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at org.chromium.testing.local.JunitTestMain.main(JunitTestMain.java:105)

Original issue's description:
> (Reland) Expose resources in Robolectric/JUnit tests.
>
> Will let people use Android resources in Robolectric tests.
> To use, specify package_name GN variable in junit_binary
> targets with your apps package name.
>
> This change will also (basically) require that you use the
> generated wrappers from out_dir/bin/run_<suite name> to run
> the tests since GN will be generating many arguments to
> pass along to the test runner.
>
> BUG= 693573 
>
> Review-Url: https://codereview.chromium.org/2819983002
> Cr-Commit-Position: refs/heads/master@{#464973}
> Committed: https://chromium.googlesource.com/chromium/src/+/30bba37e58b51483b1ec77bc3f697deb8e4033c1

TBR=jbudorick@chromium.org,nyquist@chromium.org,mikecase@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 693573 

Review-Url: https://codereview.chromium.org/2824863002
Cr-Commit-Position: refs/heads/master@{#465027}

[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/build/android/gyp/create_test_runner_script.py
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/build/android/gyp/write_build_config.py
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/build/android/pylib/junit/junit_test_instance.py
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/build/android/pylib/local/machine/local_machine_junit_test_run.py
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/build/android/test_runner.py
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/build/android/test_runner.pydeps
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/build/config/android/internal_rules.gni
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/build/config/android/rules.gni
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/chrome/android/BUILD.gn
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupTest.java
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/testing/android/OWNERS
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
[modify] https://crrev.com/3781c029a68e4ea22f3e36db45a561723b610667/third_party/robolectric/README.chromium

Project Member

Comment 10 by bugdroid1@chromium.org, May 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7

commit bc26a6f5b4ed9ee2b84878c17e8f4149db815db7
Author: mikecase <mikecase@chromium.org>
Date: Tue May 02 23:47:35 2017

(Reland x2) Expose resources in Robolectric/JUnit tests.

Will let people use Android resources in Robolectric tests.
To use, specify package_name GN variable in junit_binary
targets with your apps package name.

This change will also (basically) require that you use the
generated wrappers from out_dir/bin/run_<suite name> to run
the tests since GN will be generating many arguments to
pass along to the test runner.

BUG= 693573 

Review-Url: https://codereview.chromium.org/2842603002
Cr-Commit-Position: refs/heads/master@{#468822}

[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/android/gyp/create_test_runner_script.py
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/android/gyp/write_build_config.py
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/android/lint/suppressions.xml
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/android/pylib/junit/junit_test_instance.py
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/android/pylib/local/machine/local_machine_junit_test_run.py
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/android/test_runner.py
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/android/test_runner.pydeps
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/config/android/internal_rules.gni
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/build/config/android/rules.gni
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/chrome/android/BUILD.gn
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupTest.java
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/testing/android/OWNERS
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
[modify] https://crrev.com/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7/third_party/robolectric/README.chromium

Project Member

Comment 11 by bugdroid1@chromium.org, May 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a0f8ac5d596602275b1820e3f63d4966430f0de7

commit a0f8ac5d596602275b1820e3f63d4966430f0de7
Author: aelias <aelias@chromium.org>
Date: Wed May 03 02:03:01 2017

Revert of (Reland x2) Expose resources in Robolectric/JUnit tests. (patchset #4 id:60001 of https://codereview.chromium.org/2842603002/ )

Reason for revert:
TileGroupTest failing on waterfall, see  http://crbug.com/717820 

BUG= 717820 

Original issue's description:
> (Reland x2) Expose resources in Robolectric/JUnit tests.
>
> Will let people use Android resources in Robolectric tests.
> To use, specify package_name GN variable in junit_binary
> targets with your apps package name.
>
> This change will also (basically) require that you use the
> generated wrappers from out_dir/bin/run_<suite name> to run
> the tests since GN will be generating many arguments to
> pass along to the test runner.
>
> BUG= 693573 
>
> Review-Url: https://codereview.chromium.org/2842603002
> Cr-Commit-Position: refs/heads/master@{#468822}
> Committed: https://chromium.googlesource.com/chromium/src/+/bc26a6f5b4ed9ee2b84878c17e8f4149db815db7

TBR=agrieve@chromium.org,jbudorick@chromium.org,nyquist@chromium.org,mikecase@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 693573 

Review-Url: https://codereview.chromium.org/2859583004
Cr-Commit-Position: refs/heads/master@{#468871}

[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/android/gyp/create_test_runner_script.py
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/android/gyp/write_build_config.py
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/android/lint/suppressions.xml
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/android/pylib/junit/junit_test_instance.py
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/android/pylib/local/machine/local_machine_junit_test_run.py
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/android/test_runner.py
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/android/test_runner.pydeps
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/config/android/internal_rules.gni
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/build/config/android/rules.gni
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/chrome/android/BUILD.gn
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupTest.java
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/testing/android/OWNERS
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
[modify] https://crrev.com/a0f8ac5d596602275b1820e3f63d4966430f0de7/third_party/robolectric/README.chromium

Project Member

Comment 12 by bugdroid1@chromium.org, May 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/54c8a0f1de1a3cf8599dde9efb7bc61f08fef03f

commit 54c8a0f1de1a3cf8599dde9efb7bc61f08fef03f
Author: mikecase <mikecase@chromium.org>
Date: Wed May 03 23:18:56 2017

Move Android resource_zip files into own build subdir.

Want to move resources.zip files out of gen/ directory since they
won't get packaged by several of the Builder bots. We will need
these resources.zip files for JUnit tests.

BUG= 693573 

Review-Url: https://codereview.chromium.org/2862603002
Cr-Commit-Position: refs/heads/master@{#469191}

[modify] https://crrev.com/54c8a0f1de1a3cf8599dde9efb7bc61f08fef03f/build/android/lint/suppressions.xml
[modify] https://crrev.com/54c8a0f1de1a3cf8599dde9efb7bc61f08fef03f/build/config/android/rules.gni

Project Member

Comment 13 by bugdroid1@chromium.org, May 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0b6b35f669cfd191e369832a9385d939650c244b

commit 0b6b35f669cfd191e369832a9385d939650c244b
Author: mikecase <mikecase@chromium.org>
Date: Sat May 13 01:13:00 2017

(Reland x3) Expose resources in Robolectric/JUnit tests.

Will let people use Android resources in Robolectric tests.
To use, specify package_name GN variable in junit_binary
targets with your apps package name.

This change will also (basically) require that you use the
generated wrappers from out_dir/bin/run_<suite name> to run
the tests since GN will be generating many arguments to
pass along to the test runner.

BUG= 693573 

Review-Url: https://codereview.chromium.org/2864693002
Cr-Commit-Position: refs/heads/master@{#471523}

[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/build/android/gyp/create_test_runner_script.py
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/build/android/gyp/write_build_config.py
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/build/android/pylib/junit/junit_test_instance.py
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/build/android/pylib/local/machine/local_machine_junit_test_run.py
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/build/android/test_runner.py
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/build/config/android/internal_rules.gni
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/build/config/android/rules.gni
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/chrome/android/BUILD.gn
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/chrome/android/junit/src/org/chromium/chrome/browser/suggestions/TileGroupTest.java
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/testing/android/OWNERS
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/testing/android/junit/java/src/org/chromium/testing/local/GNManifestFactory.java
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/testing/android/junit/java/src/org/chromium/testing/local/LocalRobolectricTestRunner.java
[modify] https://crrev.com/0b6b35f669cfd191e369832a9385d939650c244b/third_party/robolectric/README.chromium

Sign in to add a comment