Chromium Code Reviews| Index: base/android/jni_generator/jni_generator_tests.py |
| diff --git a/base/android/jni_generator/jni_generator_tests.py b/base/android/jni_generator/jni_generator_tests.py |
| index 7e39cda3d369f2f8b02a86e08e4747ea7662ac70..3b7131842302a449935bb60cc2f6ba150accb942 100755 |
| --- a/base/android/jni_generator/jni_generator_tests.py |
| +++ b/base/android/jni_generator/jni_generator_tests.py |
| @@ -43,6 +43,7 @@ class TestOptions(object): |
| self.cpp = 'cpp' |
| self.javap = 'javap' |
| self.native_exports = False |
| + self.native_exports_optional = False |
| class TestGenerator(unittest.TestCase): |
| def assertObjEquals(self, first, second): |
| @@ -1058,6 +1059,46 @@ class Foo { |
| test_data, 'org/chromium/example/jni_generator/SampleForTests', options) |
| self.assertGoldenTextEquals(jni_from_java.GetContent()) |
| + def testNativeExportsOptionalOption(self): |
| + test_data = """ |
| + package org.chromium.example.jni_generator; |
| + |
| + /** The pointer to the native Test. */ |
| + long nativeTest; |
| + |
| + class Test { |
| + private static native boolean nativeInitNativeClass(); |
| + private static native int nativeStaticMethod(long nativeTest, int arg1); |
| + private native int nativeMethod(long nativeTest, int arg1); |
| + @CalledByNative |
| + private void testMethodWithParam(int iParam); |
| + @CalledByNative |
| + private String testMethodWithParamAndReturn(int iParam); |
| + @CalledByNative |
| + private static int testStaticMethodWithParam(int iParam); |
| + @CalledByNative |
| + private static double testMethodWithNoParam(); |
| + @CalledByNative |
| + private static String testStaticMethodWithNoParam(); |
| + |
| + class MyInnerClass { |
| + @NativeCall("MyInnerClass") |
| + private native int nativeInit(); |
| + } |
| + class MyOtherInnerClass { |
| + @NativeCall("MyOtherInnerClass") |
| + private native int nativeInit(); |
| + } |
| + } |
| + """ |
| + options = TestOptions() |
| + options.jni_init_native_name = 'nativeInitNativeClass' |
| + options.native_exports = True |
| + options.native_exports_optional = True |
| + jni_from_java = jni_generator.JNIFromJavaSource( |
| + test_data, 'org/chromium/example/jni_generator/SampleForTests', options) |
| + self.assertGoldenTextEquals(jni_from_java.GetContent()) |
|
rmcilroy
2015/02/20 17:19:35
Could we extract the common code from testNativeEx
Torne
2015/02/20 21:53:45
Done.
|
| + |
| def testOuterInnerRaises(self): |
| test_data = """ |
| package org.chromium.media; |