1// 2// This file was generated by //third_party/jni_zero/jni_zero.py 3// 4package org.jni_zero; 5 6import org.jni_zero.CheckDiscard; 7import org.jni_zero.GEN_JNI; 8import org.jni_zero.JniStaticTestMocker; 9import org.jni_zero.NativeLibraryLoadedStatus; 10 11@CheckDiscard("crbug.com/993421") 12class TinySampleJni implements TinySample.Natives { 13 private static TinySample.Natives testInstance; 14 15 public static final JniStaticTestMocker<TinySample.Natives> TEST_HOOKS = 16 new JniStaticTestMocker<TinySample.Natives>() { 17 @Override 18 public void setInstanceForTesting(TinySample.Natives instance) { 19 if (!GEN_JNI.TESTING_ENABLED) { 20 throw new RuntimeException( 21 "Tried to set a JNI mock when mocks aren't enabled!"); 22 } 23 testInstance = instance; 24 } 25 }; 26 27 @Override 28 public boolean bar(int a) { 29 return (boolean) GEN_JNI.org_jni_1zero_TinySample_bar(a); 30 } 31 32 @Override 33 public void foo() { 34 GEN_JNI.org_jni_1zero_TinySample_foo(); 35 } 36 37 public static TinySample.Natives get() { 38 if (GEN_JNI.TESTING_ENABLED) { 39 if (testInstance != null) { 40 return testInstance; 41 } 42 if (GEN_JNI.REQUIRE_MOCK) { 43 throw new UnsupportedOperationException( 44 "No mock found for the native implementation of TinySample.Natives. " 45 + "The current configuration requires implementations be mocked."); 46 } 47 } 48 NativeLibraryLoadedStatus.checkLoaded(); 49 return new TinySampleJni(); 50 } 51} 52