Add testing hooks to classes generated by the JniProcessor

Adds an interface JniStaticTestMocker and an anonymous implementation
in each generated class created by the JniProcessor. The TEST_HOOKS
field contains a method that will set the mock that is used when
testing is enabled.

When testing is disabled, TEST_HOOKS will never be called and
should be optimized away by proguard/R8.

This should allow for generic JUnit rules that work with all
static mockable 'proxy' natives.

Bug: 898261
Change-Id: I026858957e7f98cbbe16da0772dc3e68d38717bb
Reviewed-on: https://chromium-review.googlesource.com/c/1342805
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@{#609855}
4 files changed