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.
13import("//base/hiviewdfx/hiview/hiview.gni")
14import("//build/test.gni")
15
16module_output_path = "hiview/base/event_store"
17
18group("unittest") {
19  testonly = true
20  deps = [
21    ":SysEventBackupTest",
22    ":SysEventDaoTest",
23    ":SysEventDatabaseTest",
24    ":SysEventDocTest",
25    ":SysEventRepeatTest",
26    ":SysEventSequenceMgrTest",
27    ":SysEventStoreUtilityTest",
28  ]
29}
30
31config("sys_event_dao_config_test") {
32  visibility = [ ":*" ]
33
34  include_dirs = [
35    "unittest/common",
36    "$hiview_base/event_store/store/include",
37  ]
38
39  cflags = []
40}
41
42ohos_unittest("SysEventDaoTest") {
43  module_out_path = module_output_path
44  configs = [ ":sys_event_dao_config_test" ]
45
46  sources = [ "unittest/common/sys_event_dao_test.cpp" ]
47
48  deps = [
49    "$hiview_base:hiviewbase_static_lib_for_tdd",
50    "$hiview_core:hiview_core_for_test",
51  ]
52
53  external_deps = [
54    "ffrt:libffrt",
55    "googletest:gmock",
56    "googletest:gtest_main",
57    "hilog:libhilog",
58  ]
59
60  resource_config_file =
61      "//base/hiviewdfx/hiview/base/event_store/test/resource/ohos_test.xml"
62}
63
64ohos_unittest("SysEventRepeatTest") {
65  module_out_path = module_output_path
66  configs = [ ":sys_event_dao_config_test" ]
67
68  sources = [ "unittest/common/sys_event_repeat_test.cpp" ]
69
70  deps = [
71    "$hiview_base:hiviewbase_static_lib_for_tdd",
72    "$hiview_base/event_store:event_store_source",
73  ]
74
75  external_deps = [
76    "googletest:gmock",
77    "googletest:gtest_main",
78    "hilog:libhilog",
79    "relational_store:native_rdb",
80  ]
81}
82
83ohos_unittest("SysEventDatabaseTest") {
84  module_out_path = module_output_path
85  configs = [ ":sys_event_dao_config_test" ]
86
87  sources = [ "unittest/common/sys_event_database_test.cpp" ]
88
89  deps = [
90    "$hiview_base:hiviewbase_static_lib_for_tdd",
91    "$hiview_base/event_store:event_store_source",
92    "$hiview_base/event_store/utility:event_store_utility_source",
93  ]
94
95  external_deps = [
96    "googletest:gmock",
97    "googletest:gtest_main",
98    "hilog:libhilog",
99    "relational_store:native_rdb",
100  ]
101}
102
103config("sys_event_store_utility_test_config_test") {
104  visibility = [ ":*" ]
105
106  include_dirs = [ "unittest/common" ]
107
108  cflags = []
109}
110
111ohos_unittest("SysEventStoreUtilityTest") {
112  module_out_path = module_output_path
113  configs = [ ":sys_event_store_utility_test_config_test" ]
114
115  sources = [ "unittest/common/sys_event_store_utility_test.cpp" ]
116
117  deps = [
118    "$hiview_base:hiviewbase_static_lib_for_tdd",
119    "$hiview_core:hiview_core",
120    "//base/hiviewdfx/hiview/base/event_store/utility:event_store_utility_source",
121  ]
122
123  external_deps = [
124    "ffrt:libffrt",
125    "googletest:gmock",
126    "googletest:gtest_main",
127    "hilog:libhilog",
128  ]
129
130  resource_config_file =
131      "//base/hiviewdfx/hiview/base/event_store/test/resource/ohos_test.xml"
132}
133
134ohos_unittest("SysEventDocTest") {
135  module_out_path = module_output_path
136  configs = [ ":sys_event_dao_config_test" ]
137
138  sources = [ "unittest/common/sys_event_doc_test.cpp" ]
139
140  deps = [
141    "$hiview_base:hiviewbase_static_lib_for_tdd",
142    "$hiview_base/event_store:event_store_source",
143    "//base/hiviewdfx/hiview/base/event_store/utility:event_store_utility_source",
144  ]
145
146  external_deps = [
147    "googletest:gmock",
148    "googletest:gtest_main",
149    "hilog:libhilog",
150  ]
151
152  resource_config_file =
153      "//base/hiviewdfx/hiview/base/event_store/test/resource/ohos_test.xml"
154}
155
156ohos_unittest("SysEventSequenceMgrTest") {
157  module_out_path = module_output_path
158  configs = [ ":sys_event_dao_config_test" ]
159
160  sources = [ "unittest/common/sys_event_sequence_mgr_test.cpp" ]
161
162  deps = [ "$hiview_base:hiviewbase_static_lib_for_tdd" ]
163
164  external_deps = [
165    "ffrt:libffrt",
166    "googletest:gmock",
167    "googletest:gtest_main",
168    "hilog:libhilog",
169  ]
170
171  resource_config_file =
172      "//base/hiviewdfx/hiview/base/event_store/test/resource/ohos_test.xml"
173}
174
175config("sys_event_backup_test_config") {
176  visibility = [ ":*" ]
177  include_dirs = [ "$hiview_base/event_store/store/include" ]
178  cflags = []
179}
180
181ohos_unittest("SysEventBackupTest") {
182  module_out_path = module_output_path
183  configs = [ ":sys_event_backup_test_config" ]
184
185  sources = [ "unittest/common/sys_event_backup_test.cpp" ]
186
187  deps = [
188    "$hiview_base:hiviewbase_static_lib_for_tdd",
189    "$hiview_base/event_store:event_store_source",
190    "$hiview_core:hiview_core_for_test",
191  ]
192
193  external_deps = [
194    "ffrt:libffrt",
195    "googletest:gmock",
196    "googletest:gtest_main",
197    "hilog:libhilog",
198  ]
199
200  resource_config_file =
201      "//base/hiviewdfx/hiview/base/event_store/test/resource/ohos_test.xml"
202}
203