Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3106)

Unified Diff: base/android/jni_generator/jni_generator_tests.py

Issue 454923002: Don't register JNI methods for the android_webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7db9a10391b6755663b6df0b43c74229cf18b230..a7ce537a6ccba2654fdb762167364ba3261949d3 100755
--- a/base/android/jni_generator/jni_generator_tests.py
+++ b/base/android/jni_generator/jni_generator_tests.py
@@ -42,7 +42,7 @@ class TestOptions(object):
self.eager_called_by_natives = False
self.cpp = 'cpp'
self.javap = 'javap'
-
+ self.native_exports = False
class TestGenerator(unittest.TestCase):
def assertObjEquals(self, first, second):
@@ -1005,6 +1005,45 @@ class Foo {
test_data, 'org/chromium/example/jni_generator/Test', options)
self.assertGoldenTextEquals(jni_from_java.GetContent())
+ def testNativeExportsOption(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
+ jni_from_java = jni_generator.JNIFromJavaSource(
+ test_data, 'org/chromium/example/jni_generator/SampleForTests', options)
+ self.assertGoldenTextEquals(jni_from_java.GetContent())
+
def testOuterInnerRaises(self):
test_data = """
package org.chromium.media;
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | base/android/jni_generator/testNativeExportsOption.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698