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 NativeBridgeLazyTest : public ::testing::Test {};
25 
26 // The testing we can do here is limited since there's no exported API to
27 // actually load the native bridge, but we only need to test the trivial
28 // wrappers.
29 
TEST_F(NativeBridgeLazyTest,NeedsNativeBridge)30 TEST_F(NativeBridgeLazyTest, NeedsNativeBridge) {
31   EXPECT_FALSE(NeedsNativeBridge(ABI_STRING));
32 }
33 
TEST_F(NativeBridgeLazyTest,PreInitializeNativeBridge)34 TEST_F(NativeBridgeLazyTest, PreInitializeNativeBridge) {
35   EXPECT_FALSE(PreInitializeNativeBridge(nullptr, ""));
36 }
37 
TEST_F(NativeBridgeLazyTest,NativeBridgeAvailable)38 TEST_F(NativeBridgeLazyTest, NativeBridgeAvailable) {
39   EXPECT_FALSE(NativeBridgeAvailable());
40 }
41 
TEST_F(NativeBridgeLazyTest,NativeBridgeInitialized)42 TEST_F(NativeBridgeLazyTest, NativeBridgeInitialized) {
43   EXPECT_FALSE(NativeBridgeInitialized());
44 }
45 
TEST_F(NativeBridgeLazyTest,NativeBridgeGetTrampoline)46 TEST_F(NativeBridgeLazyTest, NativeBridgeGetTrampoline) {
47   EXPECT_EQ(nullptr, NativeBridgeGetTrampoline(nullptr, nullptr, nullptr, 0));
48 }
49 
TEST_F(NativeBridgeLazyTest,NativeBridgeGetError)50 TEST_F(NativeBridgeLazyTest, NativeBridgeGetError) {
51   EXPECT_STREQ("native bridge is not initialized", NativeBridgeGetError());
52 }
53 
54 };  // namespace android
55