• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2025 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/cleaner/include",
27    "$native_hiappevent_path/libhiappevent/include",
28    "$native_hiappevent_path/libhiappevent/observer/include",
29    "$native_hiappevent_path/ndk/include",
30    "$hiappevent_interfaces/native/kits/include",
31  ]
32}
33
34ohos_unittest("HiAppEventNativeTest") {
35  module_out_path = native_module_output_path
36
37  configs = [ ":hiappevent_config_test" ]
38
39  sources = [ "unittest/common/native/hiappevent_native_test.cpp" ]
40
41  deps = [
42    "$native_hiappevent_path/libhiappevent:libhiappevent_base",
43    "$native_hiappevent_path/libhiappevent/utility:hiappevent_utility",
44    "$native_hiappevent_path/ndk:hiappevent_ndk",
45    "processor:test_processor",
46  ]
47
48  resource_config_file = "resource/ohos_test.xml"
49
50  external_deps = [
51    "ability_runtime:app_context",
52    "googletest:gtest_main",
53    "hiappevent:hiappevent_innerapi",
54  ]
55}
56
57ohos_unittest("HiAppEventCacheTest") {
58  module_out_path = native_module_output_path
59
60  configs = [ ":hiappevent_config_test" ]
61
62  sources = [ "unittest/common/native/hiappevent_cache_test.cpp" ]
63
64  deps = [
65    "$native_hiappevent_path/libhiappevent:libhiappevent_base",
66    "$native_hiappevent_path/libhiappevent/cache:hiappevent_cache",
67    "$native_hiappevent_path/libhiappevent/utility:hiappevent_utility",
68    "$native_hiappevent_path/ndk:hiappevent_ndk",
69  ]
70
71  external_deps = [
72    "googletest:gtest_main",
73    "hilog:libhilog",
74    "relational_store:native_rdb",
75  ]
76}
77
78ohos_unittest("HiAppEventWatcherTest") {
79  module_out_path = native_module_output_path
80
81  configs = [ ":hiappevent_config_test" ]
82
83  sources = [ "unittest/common/native/hiappevent_watcher_test.cpp" ]
84
85  deps = [
86    "$native_hiappevent_path/libhiappevent:libhiappevent_base",
87    "$native_hiappevent_path/libhiappevent/cache:hiappevent_cache",
88    "$native_hiappevent_path/libhiappevent/observer:hiappevent_observer",
89  ]
90
91  external_deps = [
92    "eventhandler:libeventhandler",
93    "googletest:gtest_main",
94    "hilog:libhilog",
95    "relational_store:native_rdb",
96  ]
97}
98
99ohos_unittest("HiAppEventInnerApiTest") {
100  module_out_path = native_module_output_path
101
102  configs = [ ":hiappevent_config_test" ]
103
104  sources = [ "unittest/common/native/hiappevent_inner_api_test.cpp" ]
105
106  deps = [ "$native_hiappevent_path/libhiappevent:libhiappevent_base" ]
107
108  external_deps = [
109    "ability_runtime:app_context",
110    "googletest:gtest_main",
111    "hiappevent:hiappevent_innerapi",
112  ]
113}
114
115ohos_unittest("HiAppEventUserInfoTest") {
116  module_out_path = native_module_output_path
117
118  configs = [ ":hiappevent_config_test" ]
119
120  sources = [ "unittest/common/native/hiappevent_userinfo_test.cpp" ]
121
122  deps = [
123    "$native_hiappevent_path/libhiappevent:libhiappevent_base",
124    "$native_hiappevent_path/libhiappevent/cache:hiappevent_cache",
125  ]
126
127  external_deps = [
128    "eventhandler:libeventhandler",
129    "googletest:gtest_main",
130    "hilog:libhilog",
131    "relational_store:native_rdb",
132  ]
133}
134
135ohos_unittest("HiAppEventAppEventTest") {
136  module_out_path = native_module_output_path
137
138  configs = [ ":hiappevent_config_test" ]
139
140  sources = [ "unittest/common/native/hiappevent_app_event_test.cpp" ]
141
142  deps = [ "$native_hiappevent_path/libhiappevent:libhiappevent_base" ]
143
144  external_deps = [
145    "ability_runtime:app_context",
146    "googletest:gtest_main",
147    "hiappevent:hiappevent_innerapi",
148  ]
149}
150
151ohos_unittest("HiAppEventUtilityTest") {
152  module_out_path = native_module_output_path
153
154  configs = [ ":hiappevent_config_test" ]
155
156  sources = [ "unittest/common/native/hiappevent_utility_test.cpp" ]
157
158  deps = [
159    "$native_hiappevent_path/libhiappevent:libhiappevent_base",
160    "$native_hiappevent_path/libhiappevent/utility:hiappevent_utility",
161  ]
162
163  external_deps = [ "googletest:gtest_main" ]
164}
165
166ohos_unittest("HiAppEventVerifyTest") {
167  module_out_path = native_module_output_path
168
169  configs = [ ":hiappevent_config_test" ]
170
171  sources = [ "unittest/common/native/hiappevent_verify_test.cpp" ]
172
173  deps = [ "$native_hiappevent_path/libhiappevent:libhiappevent_base" ]
174
175  external_deps = [ "googletest:gtest_main" ]
176}
177
178group("unittest") {
179  testonly = true
180  deps = [
181    ":HiAppEventAppEventTest",
182    ":HiAppEventCacheTest",
183    ":HiAppEventInnerApiTest",
184    ":HiAppEventNativeTest",
185    ":HiAppEventUserInfoTest",
186    ":HiAppEventUtilityTest",
187    ":HiAppEventVerifyTest",
188    ":HiAppEventWatcherTest",
189    "unittest/common/napi:unittest",
190  ]
191}
192