Add the condition variable to System.loadLibrary and implement UnregisterNatives.
Also change PrettyDescriptor now descriptors are String*s rather than StringPiece&s.
Change-Id: Id07affb26038f5f4a3bee4396c65f71d7bc38be3
diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc
index 53b8334..81fda42 100644
--- a/src/jni_internal_test.cc
+++ b/src/jni_internal_test.cc
@@ -14,6 +14,10 @@
protected:
virtual void SetUp() {
CommonTest::SetUp();
+
+ // Turn on -verbose:jni for the JNI tests.
+ Runtime::Current()->GetJavaVM()->verbose_jni = true;
+
env_ = Thread::Current()->GetJniEnv();
aioobe_ = env_->FindClass("java/lang/ArrayIndexOutOfBoundsException");
CHECK(aioobe_ != NULL);
@@ -233,6 +237,10 @@
ASSERT_TRUE(mid2 != NULL);
}
+void BogusMethod() {
+ // You can't pass NULL function pointers to RegisterNatives.
+}
+
TEST_F(JniInternalTest, RegisterNatives) {
jclass jlobject = env_->FindClass("java/lang/Object");
jclass jlnsme = env_->FindClass("java/lang/NoSuchMethodError");
@@ -257,10 +265,12 @@
// Check that registering native methods is successful
{
- JNINativeMethod methods[] = {{"hashCode", "()I", NULL}};
+ JNINativeMethod methods[] = {{"hashCode", "()I", reinterpret_cast<void*>(BogusMethod)}};
env_->RegisterNatives(jlobject, methods, 1);
}
EXPECT_FALSE(env_->ExceptionCheck());
+
+ env_->UnregisterNatives(jlobject);
}
#define EXPECT_PRIMITIVE_ARRAY(new_fn, get_region_fn, set_region_fn, scalar_type, expected_class_descriptor) \