Revert "Android: Prevent new Robolectric shadows via an allowlist"
This reverts commit 2392f37108
.
Reason for revert: Missed @WrappedPath, breaking running tests
from non-output-directory CWD.
Original change's description:
> Android: Prevent new Robolectric shadows via an allowlist
>
> Bug: b/341267427
> Change-Id: I7e02f3ef4ef69930579727735acdb40b0581622c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545930
> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1303784}
Bug: b/341267427
Change-Id: I9a9eb119e8b6bb8aff845b9234741ddd9b56239f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5554933
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1303949}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
d07c744c16
commit
ac9decf100
build
android
config
android
styleguide/java
testing/android/junit
@ -345,13 +345,11 @@ In summary:
|
||||
* Use real dependencies when feasible and fast. Use Mockito’s `@Mock` most
|
||||
of the time, but write fakes for frequently used dependencies.
|
||||
|
||||
* Do not use Robolectric Shadows for Chromium code.
|
||||
* Shadows make code harder to refactor.
|
||||
* Prefer to refactor code to make it more testable.
|
||||
* When you really need to use a test double for a static method, add a
|
||||
`setFooForTesting() [...]` method to make the test contract explicit.
|
||||
* Use [`ResettersForTesting.register()`] from within `ForTesting()`
|
||||
methods to ensure that state is reset between tests.
|
||||
* Do not use Robolectric Shadows for Chromium code. Instead, use
|
||||
`setForTesting()` methods so that it is clear that test hooks exist.
|
||||
* When `setForTesting()` methods alter global state, use
|
||||
[`ResettersForTesting.register()`] to ensure that the state is reset
|
||||
between tests. Omit resetting them via `@After` methods.
|
||||
|
||||
* Use Robolectric when possible (when tests do not require native). Other
|
||||
times, use on-device tests with one of the following annotations:
|
||||
|
Reference in New Issue
Block a user