1// 2// This file was generated by third_party/jni_zero/jni_generator.py 3// 4package org.jni_zero.samples; 5 6import org.jni_zero.CheckDiscard; 7import org.jni_zero.JniStaticTestMocker; 8import org.jni_zero.NativeLibraryLoadedStatus; 9import org.jni_zero.GEN_JNI; 10import android.graphics.Rect; 11import org.jni_zero.AccessedByNative; 12import org.jni_zero.CalledByNative; 13import org.jni_zero.CalledByNativeUnchecked; 14import org.jni_zero.JNINamespace; 15import org.jni_zero.NativeClassQualifiedName; 16import org.jni_zero.NativeMethods; 17import java.util.ArrayList; 18import java.util.Iterator; 19import java.util.LinkedList; 20import java.util.List; 21import java.util.Map; 22 23@CheckDiscard("crbug.com/993421") 24public class SampleForTestsJni implements SampleForTests.Natives { 25 private static SampleForTests.Natives testInstance; 26 27 public static final JniStaticTestMocker<SampleForTests.Natives> TEST_HOOKS = 28 new JniStaticTestMocker<SampleForTests.Natives>() { 29 @Override 30 public void setInstanceForTesting(SampleForTests.Natives instance) { 31 if (!GEN_JNI.TESTING_ENABLED) { 32 throw new RuntimeException( 33 "Tried to set a JNI mock when mocks aren't enabled!"); 34 } 35 testInstance = instance; 36 } 37 }; 38 39 @Override 40 public void addStructB(long nativeCPPClass, SampleForTests caller, SampleForTests.InnerStructB b) { 41 GEN_JNI.org_jni_1zero_samples_SampleForTests_addStructB(nativeCPPClass, caller, b); 42 } 43 44 @Override 45 public void destroy(long nativeCPPClass, SampleForTests caller) { 46 GEN_JNI.org_jni_1zero_samples_SampleForTests_destroy(nativeCPPClass, caller); 47 } 48 49 @Override 50 public Class getClass(Class arg0) { 51 return (Class) GEN_JNI.org_jni_1zero_samples_SampleForTests_getClass(arg0); 52 } 53 54 @Override 55 public double getDoubleFunction(SampleForTests caller) { 56 return (double) GEN_JNI.org_jni_1zero_samples_SampleForTests_getDoubleFunction(caller); 57 } 58 59 @Override 60 public float getFloatFunction() { 61 return (float) GEN_JNI.org_jni_1zero_samples_SampleForTests_getFloatFunction(); 62 } 63 64 @Override 65 public Object getNonPODDatatype(SampleForTests caller) { 66 return (Object) GEN_JNI.org_jni_1zero_samples_SampleForTests_getNonPODDatatype(caller); 67 } 68 69 @Override 70 public Throwable getThrowable(Throwable arg0) { 71 return (Throwable) GEN_JNI.org_jni_1zero_samples_SampleForTests_getThrowable(arg0); 72 } 73 74 @Override 75 public long init(SampleForTests caller, String param) { 76 return (long) GEN_JNI.org_jni_1zero_samples_SampleForTests_init(caller, param); 77 } 78 79 @Override 80 public void iterateAndDoSomethingWithStructB(long nativeCPPClass, SampleForTests caller) { 81 GEN_JNI.org_jni_1zero_samples_SampleForTests_iterateAndDoSomethingWithStructB(nativeCPPClass, caller); 82 } 83 84 @Override 85 public int method(long nativeCPPClass, SampleForTests caller) { 86 return (int) GEN_JNI.org_jni_1zero_samples_SampleForTests_method(nativeCPPClass, caller); 87 } 88 89 @Override 90 public double methodOtherP0(long nativePtr, SampleForTests caller) { 91 return (double) GEN_JNI.org_jni_1zero_samples_SampleForTests_methodOtherP0(nativePtr, caller); 92 } 93 94 @Override 95 public String returnAString(long nativeCPPClass, SampleForTests caller) { 96 return (String) GEN_JNI.org_jni_1zero_samples_SampleForTests_returnAString(nativeCPPClass, caller); 97 } 98 99 @Override 100 public void setNonPODDatatype(SampleForTests caller, Rect rect) { 101 GEN_JNI.org_jni_1zero_samples_SampleForTests_setNonPODDatatype(caller, rect); 102 } 103 104 public static SampleForTests.Natives get() { 105 if (GEN_JNI.TESTING_ENABLED) { 106 if (testInstance != null) { 107 return testInstance; 108 } 109 if (GEN_JNI.REQUIRE_MOCK) { 110 throw new UnsupportedOperationException( 111 "No mock found for the native implementation of SampleForTests.Natives. " 112 + "The current configuration requires implementations be mocked."); 113 } 114 } 115 NativeLibraryLoadedStatus.checkLoaded(); 116 return new SampleForTestsJni(); 117 } 118} 119