xref: /aosp_15_r20/art/libnativebridge/tests/NativeBridgeTest.h (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1 /*
2  * Copyright (C) 2014 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 #ifndef ART_LIBNATIVEBRIDGE_TESTS_NATIVEBRIDGETEST_H_
18 #define ART_LIBNATIVEBRIDGE_TESTS_NATIVEBRIDGETEST_H_
19 
20 #define LOG_TAG "NativeBridge_test"
21 
22 #include <android-base/file.h>
23 #include <gtest/gtest.h>
24 #include <nativebridge/native_bridge.h>
25 
26 #include <string>
27 
28 constexpr const char* kNativeBridgeLibrary = "libnativebridge-test-case.so";
29 constexpr const char* kNativeBridgeLibrary2 = "libnativebridge2-test-case.so";
30 constexpr const char* kNativeBridgeLibrary3 = "libnativebridge3-test-case.so";
31 constexpr const char* kNativeBridgeLibrary6 = "libnativebridge6-test-case.so";
32 constexpr const char* kNativeBridgeLibrary7 = "libnativebridge7-test-case.so";
33 
34 namespace android {
35 
36 class NativeBridgeTest : public testing::Test {
37  protected:
NativeBridgeTest()38   NativeBridgeTest() : temp_dir_() {
39     app_data_dir_ = std::string(temp_dir_.path);
40     code_cache_ = app_data_dir_ + "/code_cache";
41     code_cache_stat_fail_ = code_cache_ + "/temp";
42   }
43 
AppDataDir()44   const char* AppDataDir() { return app_data_dir_.c_str(); }
45 
CodeCache()46   const char* CodeCache() { return code_cache_.c_str(); }
47 
CodeCacheStatFail()48   const char* CodeCacheStatFail() { return code_cache_stat_fail_.c_str(); }
49 
50   TemporaryDir temp_dir_;
51   std::string app_data_dir_;
52   std::string code_cache_;
53   std::string code_cache_stat_fail_;
54 };
55 
56 };  // namespace android
57 
58 #endif  // ART_LIBNATIVEBRIDGE_TESTS_NATIVEBRIDGETEST_H_
59