| Index: testing/android/docs/junit.md
|
| diff --git a/testing/android/docs/junit.md b/testing/android/docs/junit.md
|
| index 3fc14952a2ddcf9eb5b51b40a4f2df452178d5cb..b92f153ddb668dc772b105d5fe4618f8e845cd9f 100644
|
| --- a/testing/android/docs/junit.md
|
| +++ b/testing/android/docs/junit.md
|
| @@ -52,11 +52,17 @@ code on your workstation. It does this by providing a special version of the
|
| Android SDK jar that can run in your host JVM. Some more information about
|
| Robolectric can be found [here](http://robolectric.org/).
|
|
|
| +One on the main benefits of using Robolectric framework are [shadow classes](http://robolectric.org/extending/).
|
| +Robolectric comes with many prebuilt shadow classes and also lets you define
|
| +your own. Whenever an object is instantiated within a Robolectric test,
|
| +Robolectric looks for a corresponding shadow class (marked by
|
| +`@Implements(ClassBeingShadowed.class)`). If found, any time a method is invoked
|
| +on the object, the shadow class's implementation of the method is invoked first.
|
| +This works even for static and final methods.
|
| +
|
| #### Useful Tips
|
|
|
| * Use `@RunWith(LocalRobolectricTestRunner.class)` for all Chromium Robolectric tests.
|
| -* Use `@Config(manifest = Config.NONE)` for tests.
|
| - Currently, you are unable to pass your app's AndroidManifest to Robolectric.
|
| * You can specify the Android SDK to run your test with with `@Config(sdk = ??)`.
|
|
|
| > Currently, only SDK levels 18, 21, and 25 are supported in Chromium
|
| @@ -97,6 +103,25 @@ public class MyRobolectricJUnitTest {
|
| }
|
| ```
|
|
|
| +#### Example junit_binary build template.
|
| +
|
| +```python
|
| +junit_binary("my_robolectric_tests") {
|
| +
|
| + java_files = [
|
| + "java/src/foo/bar/MyJUnitTest.java"
|
| +
|
| + deps = [
|
| + "//my/test:dependency",
|
| + ]
|
| +
|
| + # Sets app's package name in Robolectric tests. You need to specify
|
| + # this variable in order for Robolectric to be able to find your app's
|
| + # resources.
|
| + package_name = manifest_package
|
| +}
|
| +```
|
| +
|
| #### Example within Chromium
|
|
|
| See the [content_junit_tests](https://cs.chromium.org/chromium/src/content/public/android/BUILD.gn) test suite.
|
|
|