commit | d0d0a00bf1faaea1edb957ac87e64eac9753962f | [log] [tgz] |
---|---|---|
author | Aiden Benner <abenner@google.com> | Wed Nov 21 23:36:49 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Wed Nov 21 23:36:49 2018 |
tree | 756ffa70c47ad1581165c83a81be44176eeb9599 | |
parent | b517d445c5fa0451e7ff701dff299aaf710eff52 [diff] |
JNI: Add flags to enable/disable/require mocks in GEN_JNI Adds the REQUIRE_MOCKS flag to GEN_JNI. If both the REQUIRE_MOCKS and TESTING_ENABLED flags are set, calls to native implementations must have had a mock instance set first through TEST_HOOKS, otherwise an UnsupportedOperationException will be thrown. If only TESTING_ENABLED is set, calls to the native implementation will use a test mock if it is provided, and otherwise fallback to the native implementation. This is used for instrumentation tests that may want to mock out some native implementations but not all. In the annotation processor version of GEN_JNI both these flags are mutable and so they can be set by a JNI test rule for unit tests. Instrumentation tests that want to mock a native implementation can pass flags to JNI registration generator to set the corresponding GEN_JNI flags. Bug: 898261 Change-Id: I6a90e91a29368df692d458f35c9ea92f8898064b Reviewed-on: https://chromium-review.googlesource.com/c/1344554 Commit-Queue: Aiden Benner <abenner@google.com> Reviewed-by: Eric Stevenson <estevenson@chromium.org> Reviewed-by: agrieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#610263}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .