1# Copyright (c) 2021-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//base/hiviewdfx/hiappevent/hiappevent.gni") 15import("//build/test.gni") 16 17native_hiappevent_path = "//base/hiviewdfx/hiappevent/frameworks/native" 18native_module_output_path = "hiappevent/native" 19 20config("hiappevent_config_test") { 21 visibility = [ ":*" ] 22 23 include_dirs = [ 24 ".", 25 "//base/hiviewdfx/hiappevent/interfaces/native/kits/include", 26 "$native_hiappevent_path/libhiappevent/include", 27 "$native_hiappevent_path/libhiappevent/observer/include", 28 "$native_hiappevent_path/ndk/include", 29 "$hiappevent_interfaces/native/kits/include", 30 ] 31} 32 33ohos_unittest("HiAppEventNativeTest") { 34 module_out_path = native_module_output_path 35 36 configs = [ ":hiappevent_config_test" ] 37 38 sources = [ "unittest/common/native/hiappevent_native_test.cpp" ] 39 40 deps = [ 41 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 42 "$native_hiappevent_path/libhiappevent/utility:hiappevent_utility", 43 "$native_hiappevent_path/ndk:hiappevent_ndk", 44 "//third_party/googletest:gtest_main", 45 ] 46} 47 48ohos_unittest("HiAppEventCacheTest") { 49 module_out_path = native_module_output_path 50 51 configs = [ ":hiappevent_config_test" ] 52 53 sources = [ "unittest/common/native/hiappevent_cache_test.cpp" ] 54 55 deps = [ 56 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 57 "$native_hiappevent_path/libhiappevent/cache:hiappevent_cache", 58 "$native_hiappevent_path/libhiappevent/utility:hiappevent_utility", 59 "$native_hiappevent_path/ndk:hiappevent_ndk", 60 "//third_party/googletest:gtest_main", 61 ] 62 63 external_deps = [ 64 "hilog:libhilog", 65 "relational_store:native_rdb", 66 ] 67} 68 69ohos_unittest("HiAppEventWatcherTest") { 70 module_out_path = native_module_output_path 71 72 configs = [ ":hiappevent_config_test" ] 73 74 sources = [ "unittest/common/native/hiappevent_watcher_test.cpp" ] 75 76 deps = [ 77 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 78 "$native_hiappevent_path/libhiappevent/cache:hiappevent_cache", 79 "$native_hiappevent_path/libhiappevent/observer:hiappevent_observer", 80 "//third_party/googletest:gtest_main", 81 ] 82 83 external_deps = [ 84 "eventhandler:libeventhandler", 85 "hilog:libhilog", 86 "relational_store:native_rdb", 87 ] 88} 89 90ohos_unittest("HiAppEventReadTest") { 91 module_out_path = native_module_output_path 92 93 configs = [ ":hiappevent_config_test" ] 94 95 sources = [ "unittest/common/native/hiappevent_read_test.cpp" ] 96 97 deps = [ 98 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 99 "$native_hiappevent_path/libhiappevent/utility:hiappevent_utility", 100 "//third_party/googletest:gtest_main", 101 ] 102} 103 104ohos_unittest("HiAppEventInnerApiTest") { 105 module_out_path = native_module_output_path 106 107 configs = [ ":hiappevent_config_test" ] 108 109 sources = [ "unittest/common/native/hiappevent_inner_api_test.cpp" ] 110 111 deps = [ 112 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 113 "processor:test_processor", 114 "//third_party/googletest:gtest_main", 115 ] 116 117 resource_config_file = "resource/ohos_test.xml" 118 119 external_deps = [ "hiappevent:hiappevent_innerapi" ] 120} 121 122ohos_unittest("HiAppEventUserInfoTest") { 123 module_out_path = native_module_output_path 124 125 configs = [ ":hiappevent_config_test" ] 126 127 sources = [ "unittest/common/native/hiappevent_userinfo_test.cpp" ] 128 129 deps = [ 130 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 131 "$native_hiappevent_path/libhiappevent/cache:hiappevent_cache", 132 "//third_party/googletest:gtest_main", 133 ] 134 135 external_deps = [ 136 "eventhandler:libeventhandler", 137 "hilog:libhilog", 138 "relational_store:native_rdb", 139 ] 140} 141 142ohos_unittest("HiAppEventAppEventTest") { 143 module_out_path = native_module_output_path 144 145 configs = [ ":hiappevent_config_test" ] 146 147 sources = [ "unittest/common/native/hiappevent_app_event_test.cpp" ] 148 149 deps = [ 150 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 151 "//third_party/googletest:gtest_main", 152 ] 153 154 external_deps = [ "hiappevent:hiappevent_innerapi" ] 155} 156 157group("unittest") { 158 testonly = true 159 deps = [ 160 ":HiAppEventAppEventTest", 161 ":HiAppEventCacheTest", 162 ":HiAppEventInnerApiTest", 163 ":HiAppEventNativeTest", 164 ":HiAppEventReadTest", 165 ":HiAppEventUserInfoTest", 166 ":HiAppEventWatcherTest", 167 "unittest/common/napi:unittest", 168 ] 169} 170