diff options
author | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-03-10 12:16:56 +0000 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-03-10 12:16:56 +0000 |
commit | 322f1fbad3b66e68048437fed0c9a42ed990d58f (patch) | |
tree | 890f0bdd9d78963ff6c83f76fb3409141dd23a19 /tests/JniInvocation_test.cpp | |
parent | 74dcb12b8087e596698624177e5af173a6ff814f (diff) | |
parent | a75fb2a636ceafac9ddfb580af614e5ef0edf977 (diff) | |
download | android_libnativehelper-cm-12.1.tar.gz android_libnativehelper-cm-12.1.tar.bz2 android_libnativehelper-cm-12.1.zip |
Merge tag 'android-5.1.0_r1' into HEADstaging/cm-12.1stable/cm-12.1-YOG7Dstable/cm-12.1-YOG4Pstable/cm-12.1-YOG3Ccm-12.1
Android 5.1.0 release 1
Diffstat (limited to 'tests/JniInvocation_test.cpp')
-rw-r--r-- | tests/JniInvocation_test.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/JniInvocation_test.cpp b/tests/JniInvocation_test.cpp index 6eb0267..b1d2b68 100644 --- a/tests/JniInvocation_test.cpp +++ b/tests/JniInvocation_test.cpp @@ -30,6 +30,9 @@ #ifdef HAVE_TEST_STUFF +// PROPERTY_VALUE_MAX. +#include "cutils/properties.h" + // Ability to have fake local system properties. #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include <sys/_system_properties.h> @@ -102,19 +105,22 @@ TEST_F(JNIInvocationTest, Debuggable) { ASSERT_EQ(0, __system_property_add(kDebuggableSystemProperty, 13, kIsDebuggableValue, 1)); ASSERT_EQ(0, __system_property_add(kLibrarySystemProperty, 27, kTestNonNull2, 11)); - const char* result = JniInvocation::GetLibrary(NULL); + char buffer[PROPERTY_VALUE_MAX]; + const char* result = JniInvocation::GetLibrary(NULL, buffer); EXPECT_FALSE(result == NULL); if (result != NULL) { EXPECT_TRUE(strcmp(result, kTestNonNull2) == 0); EXPECT_FALSE(strcmp(result, kExpected) == 0); } - result = JniInvocation::GetLibrary(kTestNonNull); + result = JniInvocation::GetLibrary(kTestNonNull, buffer); EXPECT_FALSE(result == NULL); if (result != NULL) { EXPECT_TRUE(strcmp(result, kTestNonNull) == 0); EXPECT_FALSE(strcmp(result, kTestNonNull2) == 0); } +#else + GTEST_LOG_(WARNING) << "Host testing unsupported. Please run target tests."; #endif } @@ -124,7 +130,8 @@ TEST_F(JNIInvocationTest, NonDebuggable) { ASSERT_TRUE(pa.valid); ASSERT_EQ(0, __system_property_add(kDebuggableSystemProperty, 13, kIsNotDebuggableValue, 1)); - const char* result = JniInvocation::GetLibrary(NULL); + char buffer[PROPERTY_VALUE_MAX]; + const char* result = JniInvocation::GetLibrary(NULL, buffer); EXPECT_FALSE(result == NULL); if (result != NULL) { EXPECT_TRUE(strcmp(result, kExpected) == 0); @@ -132,12 +139,14 @@ TEST_F(JNIInvocationTest, NonDebuggable) { EXPECT_FALSE(strcmp(result, kTestNonNull2) == 0); } - result = JniInvocation::GetLibrary(kTestNonNull); + result = JniInvocation::GetLibrary(kTestNonNull, buffer); EXPECT_FALSE(result == NULL); if (result != NULL) { EXPECT_TRUE(strcmp(result, kExpected) == 0); EXPECT_FALSE(strcmp(result, kTestNonNull) == 0); } +#else + GTEST_LOG_(WARNING) << "Host testing unsupported. Please run target tests."; #endif } |