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

Unified Diff: base/android/jni_registrar.h

Issue 10591005: Add a way for JNI registrars to specify methods to be registered for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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/base_jni_registrar.cc ('k') | base/android/jni_registrar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/jni_registrar.h
diff --git a/base/android/jni_registrar.h b/base/android/jni_registrar.h
index ba8f074704609e051c0df5521ee8f36dd37b2bc1..e36df3a281937b2496ef9fea84c454edea3e296d 100644
--- a/base/android/jni_registrar.h
+++ b/base/android/jni_registrar.h
@@ -6,13 +6,12 @@
#define BASE_ANDROID_JNI_REGISTRAR_H_
#include <jni.h>
+#include "base/android/jni_android.h"
#include "base/basictypes.h"
namespace base {
namespace android {
-struct RegistrationMethod;
-
// Registers the JNI bindings for the specified |method| definition containing
// |count| elements. Returns whether the registration of the given methods
// succeeded.
@@ -20,6 +19,23 @@ bool RegisterNativeMethods(JNIEnv* env,
const RegistrationMethod* method,
size_t count);
+bool RegisterAllNativeMethodsForTest(JNIEnv* env);
+
+// Helper class to append RegistrationMethods to a global list.
+// Used by the ADD_JNI_REGISTRATION_METHODS_FOR_TESTS macro.
+class AppendRegistrationMethods {
+ public:
+ AppendRegistrationMethods(const RegistrationMethod* methods, size_t count);
+};
+
+// This macro creates a AppendMultiProcessTest object whose constructor
+// does the work of adding to the global registration list.
+#define ADD_JNI_REGISTRATION_METHODS_FOR_TESTS(methods) \
+ namespace { \
+ base::android::AppendRegistrationMethods \
+ registration_methods(methods, arraysize(methods)); \
+ }
+
} // namespace android
} // namespace base
« no previous file with comments | « base/android/base_jni_registrar.cc ('k') | base/android/jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698