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

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

Issue 147533004: Remove unneeded JNI registrations. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebaes, added native_exports switch, don't remove empty RegisterNatives. Created 6 years, 8 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 61d76c8d016e1b356b6d659fda06fbba573ba580..5aaf725e875d40c6e3e7071e70203a8c02413092 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):
@@ -994,6 +994,33 @@ 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 nativeMethod(long nativeTest, int arg1);
bulach 2014/04/14 13:16:02 nit: how about adding a non-static method too?
ostap 2014/04/15 23:30:20 Done.
+ @CalledByNative
+ private void testMethodWithParam(int iParam);
+ @CalledByNative
+ private static int testStaticMethodWithParam(int iParam);
+ @CalledByNative
+ private static double testMethodWithNoParam();
+ @CalledByNative
+ private static String testStaticMethodWithNoParam();
+ }
+ """
+ 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/Test', options)
+ self.assertGoldenTextEquals(jni_from_java.GetContent())
+
def testOuterInnerRaises(self):
test_data = """
package org.chromium.media;

Powered by Google App Engine
This is Rietveld 408576698