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

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

Issue 12594021: Android: fixes jni_generator for @CalledByNative with generics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b8044741f12ffca373ea34fe78b4689086227e1a..6d539ad9ee4f52488ca83ac6961743de45261798 100755
--- a/base/android/jni_generator/jni_generator_tests.py
+++ b/base/android/jni_generator/jni_generator_tests.py
@@ -723,6 +723,7 @@ static bool RegisterNativesImpl(JNIEnv* env) {
import android.graphics.Bitmap;
import android.view.View;
import java.io.InputStream;
+ import java.util.List;
class InnerClass {}
@@ -799,6 +800,9 @@ static bool RegisterNativesImpl(JNIEnv* env) {
@CalledByNative
public Bitmap.CompressFormat getCompressFormat();
+
+ @CalledByNative
+ public List<Bitmap.CompressFormat> getCompressFormatList();
"""
jni_generator.JniParams.SetFullyQualifiedClass('org/chromium/Foo')
jni_generator.JniParams.ExtractImportsAndInnerClasses(test_data)
@@ -1006,6 +1010,17 @@ static bool RegisterNativesImpl(JNIEnv* env) {
env_call=('Void', ''),
unchecked=False,
),
+ CalledByNative(
+ return_type='List<Bitmap.CompressFormat>',
+ system_class=False,
+ static=False,
+ name='getCompressFormatList',
+ method_id_var_name='getCompressFormatList',
+ java_class_name='',
+ params=[],
+ env_call=('Void', ''),
+ unchecked=False,
+ ),
]
self.assertListEquals(golden_called_by_natives, called_by_natives)
h = jni_generator.InlHeaderFileGenerator('', 'org/chromium/TestJni',
@@ -1054,7 +1069,7 @@ static ScopedJavaLocalRef<jobject> Java_TestJni_showConfirmInfoBar(JNIEnv* env,
/* Must call RegisterNativesImpl() */
DCHECK(g_TestJni_clazz);
jmethodID method_id =
- base::android::MethodID::LazyGet<
+ base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_TestJni_clazz,
"showConfirmInfoBar",
@@ -1085,7 +1100,7 @@ static ScopedJavaLocalRef<jobject> Java_TestJni_showAutoLoginInfoBar(JNIEnv*
/* Must call RegisterNativesImpl() */
DCHECK(g_TestJni_clazz);
jmethodID method_id =
- base::android::MethodID::LazyGet<
+ base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_TestJni_clazz,
"showAutoLoginInfoBar",
@@ -1111,7 +1126,7 @@ static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) {
/* Must call RegisterNativesImpl() */
DCHECK(g_InfoBar_clazz);
jmethodID method_id =
- base::android::MethodID::LazyGet<
+ base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_InfoBar_clazz,
"dismiss",
@@ -1135,7 +1150,7 @@ static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view,
/* Must call RegisterNativesImpl() */
DCHECK(g_TestJni_clazz);
jmethodID method_id =
- base::android::MethodID::LazyGet<
+ base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_STATIC>(
env, g_TestJni_clazz,
"shouldShowAutoLogin",
@@ -1162,7 +1177,7 @@ static ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* env, jstring
/* Must call RegisterNativesImpl() */
DCHECK(g_TestJni_clazz);
jmethodID method_id =
- base::android::MethodID::LazyGet<
+ base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_STATIC>(
env, g_TestJni_clazz,
"openUrl",
@@ -1190,7 +1205,7 @@ static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj,
/* Must call RegisterNativesImpl() */
DCHECK(g_TestJni_clazz);
jmethodID method_id =
- base::android::MethodID::LazyGet<
+ base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_TestJni_clazz,
"activateHardwareAcceleration",
@@ -1216,7 +1231,7 @@ static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, jint iParam) {
/* Must call RegisterNativesImpl() */
DCHECK(g_TestJni_clazz);
jmethodID method_id =
- base::android::MethodID::LazyGet<
+ base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_TestJni_clazz,
"uncheckedCall",
@@ -1418,7 +1433,7 @@ static ScopedJavaLocalRef<jobjectArray> Java_TestJni_returnObjectArray(JNIEnv*
static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0;
static ScopedJavaLocalRef<jobjectArray>
-Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) {
+ Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) {
/* Must call RegisterNativesImpl() */
DCHECK(g_TestJni_clazz);
jmethodID method_id =
@@ -1462,6 +1477,29 @@ static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormat(JNIEnv* env,
return ScopedJavaLocalRef<jobject>(env, ret);
}
+static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0;
+static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormatList(JNIEnv*
+ env, jobject obj) {
+ /* Must call RegisterNativesImpl() */
+ DCHECK(g_TestJni_clazz);
+ jmethodID method_id =
+ base::android::MethodID::LazyGet<
+ base::android::MethodID::TYPE_INSTANCE>(
+ env, g_TestJni_clazz,
+ "getCompressFormatList",
+
+"("
+")"
+"Ljava/util/List;",
+ &g_TestJni_getCompressFormatList);
+
+ jobject ret =
+ env->CallObjectMethod(obj,
+ method_id);
+ base::android::CheckException(env);
+ return ScopedJavaLocalRef<jobject>(env, ret);
+}
+
// Step 3: RegisterNatives.
static bool RegisterNativesImpl(JNIEnv* env) {
« no previous file with comments | « base/android/jni_generator/jni_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698