1 /*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include <android-base/macros.h>
18 #include <gtest/gtest.h>
19
20 #include "nativebridge/native_bridge.h"
21
22 namespace android {
23
24 class NativeBridgeApiTest : public ::testing::Test {};
25
26 // Test the exported API in libnativebridge and libnativebridge_lazy.
27 // The testing we can do here is limited since there's no exported API to
28 // actually load the native bridge, but we only need to test the trivial
29 // wrappers.
30
TEST_F(NativeBridgeApiTest,NeedsNativeBridge)31 TEST_F(NativeBridgeApiTest, NeedsNativeBridge) {
32 EXPECT_FALSE(NeedsNativeBridge(ABI_STRING));
33 }
34
TEST_F(NativeBridgeApiTest,PreInitializeNativeBridge)35 TEST_F(NativeBridgeApiTest, PreInitializeNativeBridge) {
36 EXPECT_FALSE(PreInitializeNativeBridge(nullptr, ""));
37 }
38
TEST_F(NativeBridgeApiTest,NativeBridgeAvailable)39 TEST_F(NativeBridgeApiTest, NativeBridgeAvailable) {
40 EXPECT_FALSE(NativeBridgeAvailable());
41 }
42
TEST_F(NativeBridgeApiTest,NativeBridgeInitialized)43 TEST_F(NativeBridgeApiTest, NativeBridgeInitialized) {
44 EXPECT_FALSE(NativeBridgeInitialized());
45 }
46
TEST_F(NativeBridgeApiTest,NativeBridgeGetTrampoline)47 TEST_F(NativeBridgeApiTest, NativeBridgeGetTrampoline) {
48 EXPECT_EQ(nullptr, NativeBridgeGetTrampoline(nullptr, nullptr, nullptr, 0));
49 }
50
TEST_F(NativeBridgeApiTest,NativeBridgeGetError)51 TEST_F(NativeBridgeApiTest, NativeBridgeGetError) {
52 EXPECT_STREQ("native bridge is not initialized", NativeBridgeGetError());
53 }
54
55 }; // namespace android
56