summaryrefslogtreecommitdiffstats
path: root/libnativebridge/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libnativebridge/tests')
-rw-r--r--libnativebridge/tests/InvalidCharsNativeBridge_test.cpp2
-rw-r--r--libnativebridge/tests/ReSetupNativeBridge_test.cpp6
-rw-r--r--libnativebridge/tests/UnavailableNativeBridge_test.cpp5
-rw-r--r--libnativebridge/tests/ValidNameNativeBridge_test.cpp12
4 files changed, 13 insertions, 12 deletions
diff --git a/libnativebridge/tests/InvalidCharsNativeBridge_test.cpp b/libnativebridge/tests/InvalidCharsNativeBridge_test.cpp
index f37e9c1..8f7973d 100644
--- a/libnativebridge/tests/InvalidCharsNativeBridge_test.cpp
+++ b/libnativebridge/tests/InvalidCharsNativeBridge_test.cpp
@@ -23,7 +23,7 @@ static const char* kTestName = "../librandom$@-bridge_not.existing.so";
TEST_F(NativeBridgeTest, InvalidChars) {
// Do one test actually calling setup.
EXPECT_EQ(false, NativeBridgeError());
- SetupNativeBridge(kTestName, nullptr);
+ LoadNativeBridge(kTestName, nullptr);
// This should lead to an error for invalid characters.
EXPECT_EQ(true, NativeBridgeError());
diff --git a/libnativebridge/tests/ReSetupNativeBridge_test.cpp b/libnativebridge/tests/ReSetupNativeBridge_test.cpp
index ef5bfce..944e5d7 100644
--- a/libnativebridge/tests/ReSetupNativeBridge_test.cpp
+++ b/libnativebridge/tests/ReSetupNativeBridge_test.cpp
@@ -18,13 +18,11 @@
namespace android {
-static const char* kTestName = "librandom-bridge_not.existing.so";
-
TEST_F(NativeBridgeTest, ReSetup) {
EXPECT_EQ(false, NativeBridgeError());
- SetupNativeBridge(kTestName, nullptr);
+ LoadNativeBridge("", nullptr);
EXPECT_EQ(false, NativeBridgeError());
- SetupNativeBridge(kTestName, nullptr);
+ LoadNativeBridge("", nullptr);
// This should lead to an error for trying to re-setup a native bridge.
EXPECT_EQ(true, NativeBridgeError());
}
diff --git a/libnativebridge/tests/UnavailableNativeBridge_test.cpp b/libnativebridge/tests/UnavailableNativeBridge_test.cpp
index 27d1233..ec96c32 100644
--- a/libnativebridge/tests/UnavailableNativeBridge_test.cpp
+++ b/libnativebridge/tests/UnavailableNativeBridge_test.cpp
@@ -20,9 +20,10 @@ namespace android {
TEST_F(NativeBridgeTest, NoNativeBridge) {
EXPECT_EQ(false, NativeBridgeAvailable());
- // This should lead to an error for trying to initialize a not-setup
- // native bridge.
+ // Try to initialize. This should fail as we are not set up.
+ EXPECT_EQ(false, InitializeNativeBridge());
EXPECT_EQ(true, NativeBridgeError());
+ EXPECT_EQ(false, NativeBridgeAvailable());
}
} // namespace android
diff --git a/libnativebridge/tests/ValidNameNativeBridge_test.cpp b/libnativebridge/tests/ValidNameNativeBridge_test.cpp
index 3e01923..690be4a 100644
--- a/libnativebridge/tests/ValidNameNativeBridge_test.cpp
+++ b/libnativebridge/tests/ValidNameNativeBridge_test.cpp
@@ -21,13 +21,15 @@ namespace android {
static const char* kTestName = "librandom-bridge_not.existing.so";
TEST_F(NativeBridgeTest, ValidName) {
+ // Check that the name is acceptable.
+ EXPECT_EQ(true, NativeBridgeNameAcceptable(kTestName));
+
+ // Now check what happens on LoadNativeBridge.
EXPECT_EQ(false, NativeBridgeError());
- SetupNativeBridge(kTestName, nullptr);
- EXPECT_EQ(false, NativeBridgeError());
- EXPECT_EQ(false, NativeBridgeAvailable());
- // This should lead to an error for trying to initialize a not-existing
- // native bridge.
+ LoadNativeBridge(kTestName, nullptr);
+ // This will lead to an error as the library doesn't exist.
EXPECT_EQ(true, NativeBridgeError());
+ EXPECT_EQ(false, NativeBridgeAvailable());
}
} // namespace android