Merge "Fix libnativeloader_test"

This commit is contained in:
Treehugger Robot 2019-07-25 17:40:44 +00:00 committed by Gerrit Code Review
commit 865f6df8d4

View file

@ -85,6 +85,7 @@ static std::unordered_map<std::string, Platform::mock_namespace_handle> namespac
{"runtime", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("runtime"))},
{"sphal", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("sphal"))},
{"vndk", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("vndk"))},
{"neuralnetworks", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("neuralnetworks"))},
};
// The actual gmock object
@ -339,11 +340,13 @@ class NativeLoaderTest_Create : public NativeLoaderTest {
bool expected_link_with_sphal_ns = !vendor_public_libraries().empty();
bool expected_link_with_vndk_ns = false;
bool expected_link_with_default_ns = false;
bool expected_link_with_neuralnetworks_ns = true;
std::string expected_shared_libs_to_platform_ns = default_public_libraries();
std::string expected_shared_libs_to_runtime_ns = runtime_public_libraries();
std::string expected_shared_libs_to_sphal_ns = vendor_public_libraries();
std::string expected_shared_libs_to_vndk_ns = vndksp_libraries();
std::string expected_shared_libs_to_default_ns = default_public_libraries();
std::string expected_shared_libs_to_neuralnetworks_ns = neuralnetworks_public_libraries();
void SetExpectations() {
NativeLoaderTest::SetExpectations();
@ -394,6 +397,11 @@ class NativeLoaderTest_Create : public NativeLoaderTest {
StrEq(expected_shared_libs_to_default_ns)))
.WillOnce(Return(true));
}
if (expected_link_with_neuralnetworks_ns) {
EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("neuralnetworks"),
StrEq(expected_shared_libs_to_neuralnetworks_ns)))
.WillOnce(Return(true));
}
}
void RunTest() {