[go: nahoru, domu]

blob: 69aaa318ae2a95123d474e578c3eb9bb878262be [file] [log] [blame]
//
// This file was generated by base/android/jni_generator/jni_generator.py
//
package org.chromium.example.jni_generator;
import org.chromium.build.annotations.CheckDiscard;
import org.chromium.base.JniStaticTestMocker;
import org.chromium.base.NativeLibraryLoadedStatus;
import org.chromium.base.natives.module_GEN_JNI;
import org.chromium.base.annotations.NativeMethods;
@CheckDiscard("crbug.com/993421")
class SampleModuleJni implements SampleModule.Natives {
private static SampleModule.Natives testInstance;
public static final JniStaticTestMocker<SampleModule.Natives> TEST_HOOKS =
new JniStaticTestMocker<SampleModule.Natives>() {
@Override
public void setInstanceForTesting(SampleModule.Natives instance) {
if (!org.chromium.base.natives.GEN_JNI.TESTING_ENABLED) {
throw new RuntimeException(
"Tried to set a JNI mock when mocks aren't enabled!");
}
testInstance = instance;
}
};
@Override
public void foo() {
GEN_JNI.org_chromium_example_jni_1generator_SampleModule_foo();
}
@Override
public boolean bar(int a) {
return (boolean) GEN_JNI.org_chromium_example_jni_1generator_SampleModule_bar(a);
}
public static SampleModule.Natives get() {
if (GEN_JNI.TESTING_ENABLED) {
if (testInstance != null) {
return testInstance;
}
if (GEN_JNI.REQUIRE_MOCK) {
throw new UnsupportedOperationException(
"No mock found for the native implementation of SampleModule.Natives. "
+ "The current configuration requires implementations be mocked.");
}
}
NativeLibraryLoadedStatus.checkLoaded();
return new SampleModuleJni();
}
}