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 "ffrt:libffrt", 65 "hilog:libhilog", 66 "relational_store:native_rdb", 67 ] 68} 69 70ohos_unittest("HiAppEventWatcherTest") { 71 module_out_path = native_module_output_path 72 73 configs = [ ":hiappevent_config_test" ] 74 75 sources = [ "unittest/common/native/hiappevent_watcher_test.cpp" ] 76 77 deps = [ 78 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 79 "$native_hiappevent_path/libhiappevent/cache:hiappevent_cache", 80 "$native_hiappevent_path/libhiappevent/observer:hiappevent_observer", 81 "//third_party/googletest:gtest_main", 82 ] 83 84 external_deps = [ 85 "eventhandler:libeventhandler", 86 "ffrt:libffrt", 87 "hilog:libhilog", 88 "relational_store:native_rdb", 89 ] 90} 91 92ohos_unittest("HiAppEventInnerApiTest") { 93 module_out_path = native_module_output_path 94 95 configs = [ ":hiappevent_config_test" ] 96 97 sources = [ "unittest/common/native/hiappevent_inner_api_test.cpp" ] 98 99 deps = [ 100 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 101 "processor:test_processor", 102 "//third_party/googletest:gtest_main", 103 ] 104 105 resource_config_file = "resource/ohos_test.xml" 106 107 external_deps = [ 108 "ffrt:libffrt", 109 "hiappevent:hiappevent_innerapi", 110 ] 111} 112 113ohos_unittest("HiAppEventUserInfoTest") { 114 module_out_path = native_module_output_path 115 116 configs = [ ":hiappevent_config_test" ] 117 118 sources = [ "unittest/common/native/hiappevent_userinfo_test.cpp" ] 119 120 deps = [ 121 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 122 "$native_hiappevent_path/libhiappevent/cache:hiappevent_cache", 123 "//third_party/googletest:gtest_main", 124 ] 125 126 external_deps = [ 127 "eventhandler:libeventhandler", 128 "ffrt:libffrt", 129 "hilog:libhilog", 130 "relational_store:native_rdb", 131 ] 132} 133 134ohos_unittest("HiAppEventAppEventTest") { 135 module_out_path = native_module_output_path 136 137 configs = [ ":hiappevent_config_test" ] 138 139 sources = [ "unittest/common/native/hiappevent_app_event_test.cpp" ] 140 141 deps = [ 142 "$native_hiappevent_path/libhiappevent:libhiappevent_base", 143 "//third_party/googletest:gtest_main", 144 ] 145 146 external_deps = [ "hiappevent:hiappevent_innerapi" ] 147} 148 149group("unittest") { 150 testonly = true 151 deps = [ 152 ":HiAppEventAppEventTest", 153 ":HiAppEventCacheTest", 154 ":HiAppEventInnerApiTest", 155 ":HiAppEventNativeTest", 156 ":HiAppEventUserInfoTest", 157 ":HiAppEventWatcherTest", 158 "unittest/common/napi:unittest", 159 ] 160} 161