• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-2023 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("//build/test.gni")
15import("../../../time.gni")
16
17config("module_private_config") {
18  visibility = [ ":*" ]
19
20  include_dirs = [
21    "${api_path}/include",
22    "include",
23    "${time_utils_path}/native/include",
24    "${time_service_path}/time/include",
25    "${time_service_path}",
26    "${time_service_path}/dfx/include",
27    "${time_service_path}/ipc/stub",
28    "${time_service_path}/ipc/base",
29    "${time_service_path}/timer/include",
30  ]
31  cflags = [ "-fvisibility=hidden" ]
32  cflags_cc = [ "-fvisibility-inlines-hidden" ]
33
34  if (time_service_hidumper_able) {
35    defines = [ "HIDUMPER_ENABLE" ]
36  }
37}
38
39module_output_path = "time_service/native"
40
41ohos_unittest("TimeServiceTest") {
42  module_out_path = module_output_path
43
44  sources = [ "src/time_service_test.cpp" ]
45
46  configs = [ ":module_private_config" ]
47
48  deps = [
49    "${api_path}:time_client",
50    "${time_service_path}:time_system_ability_static",
51    "//third_party/googletest:gtest_main",
52  ]
53  branch_protector_ret = "pac_ret"
54  sanitize = {
55    cfi = true
56    cfi_cross_dso = true
57    debug = false
58  }
59  defines = []
60  if (time_service_set_auto_reboot) {
61    defines += [ "SET_AUTO_REBOOT_ENABLE" ]
62  }
63  external_deps = [
64    "ability_base:want",
65    "ability_runtime:runtime",
66    "ability_runtime:wantagent_innerkits",
67    "access_token:libaccesstoken_sdk",
68    "access_token:libnativetoken",
69    "access_token:libtoken_setproc",
70    "cJSON:cjson",
71    "c_utils:utils",
72    "common_event_service:cesfwk_innerkits",
73    "hilog:libhilog",
74    "init:libbegetutil",
75    "ipc:ipc_single",
76    "power_manager:powermgr_client",
77    "safwk:system_ability_fwk",
78    "samgr:samgr_proxy",
79  ]
80  if (time_service_rdb_enable) {
81    defines += [ "RDB_ENABLE" ]
82    external_deps += [
83      "relational_store:native_dataability",
84      "relational_store:native_rdb",
85    ]
86  }
87  if (time_service_multi_account) {
88    defines += [ "MULTI_ACCOUNT_ENABLE" ]
89    external_deps += [ "os_account:os_account_innerkits" ]
90  }
91}
92
93ohos_unittest("TimeClientTest") {
94  module_out_path = module_output_path
95
96  sources = [ "src/time_client_test.cpp" ]
97
98  configs = [ ":module_private_config" ]
99
100  deps = [
101    "${api_path}:time_client",
102    "${time_service_path}:time_system_ability_static",
103    "//third_party/googletest:gtest_main",
104  ]
105  branch_protector_ret = "pac_ret"
106  sanitize = {
107    cfi = true
108    cfi_cross_dso = true
109    debug = false
110  }
111  external_deps = [
112    "ability_base:want",
113    "ability_runtime:runtime",
114    "ability_runtime:wantagent_innerkits",
115    "access_token:libaccesstoken_sdk",
116    "access_token:libnativetoken",
117    "access_token:libtoken_setproc",
118    "cJSON:cjson",
119    "c_utils:utils",
120    "hilog:libhilog",
121    "init:libbegetutil",
122    "ipc:ipc_single",
123    "power_manager:powermgr_client",
124    "safwk:system_ability_fwk",
125    "samgr:samgr_proxy",
126  ]
127}
128
129ohos_unittest("TimeDfxTest") {
130  module_out_path = module_output_path
131
132  sources = [ "src/time_dfx_test.cpp" ]
133
134  configs = [ ":module_private_config" ]
135
136  deps = [
137    "${api_path}:time_client",
138    "${time_service_path}:time_system_ability_static",
139    "//third_party/googletest:gtest_main",
140  ]
141  branch_protector_ret = "pac_ret"
142  sanitize = {
143    cfi = true
144    cfi_cross_dso = true
145    debug = false
146  }
147  external_deps = [
148    "ability_base:want",
149    "ability_runtime:runtime",
150    "ability_runtime:wantagent_innerkits",
151    "access_token:libaccesstoken_sdk",
152    "access_token:libnativetoken",
153    "access_token:libtoken_setproc",
154    "bundle_framework:appexecfwk_core",
155    "cJSON:cjson",
156    "c_utils:utils",
157    "hilog:libhilog",
158    "init:libbegetutil",
159    "ipc:ipc_single",
160    "power_manager:powermgr_client",
161    "safwk:system_ability_fwk",
162    "samgr:samgr_proxy",
163  ]
164}
165
166ohos_unittest("TimePermissionTest") {
167  module_out_path = module_output_path
168
169  sources = [ "src/time_permission_test.cpp" ]
170
171  configs = [ ":module_private_config" ]
172
173  deps = [
174    "${time_utils_path}:time_utils",
175    "//third_party/googletest:gtest_main",
176  ]
177  branch_protector_ret = "pac_ret"
178  sanitize = {
179    cfi = true
180    cfi_cross_dso = true
181    debug = false
182  }
183  external_deps = [
184    "ability_base:want",
185    "ability_runtime:runtime",
186    "ability_runtime:wantagent_innerkits",
187    "c_utils:utils",
188    "hilog:libhilog",
189    "ipc:ipc_single",
190    "safwk:system_ability_fwk",
191    "samgr:samgr_proxy",
192  ]
193}
194
195ohos_unittest("TimeProxyTest") {
196  module_out_path = module_output_path
197
198  sources = [ "src/time_proxy_test.cpp" ]
199
200  configs = [ ":module_private_config" ]
201
202  deps = [
203    "${api_path}:time_client",
204    "${time_service_path}:time_system_ability_static",
205    "//third_party/googletest:gtest_main",
206  ]
207  branch_protector_ret = "pac_ret"
208  sanitize = {
209    cfi = true
210    cfi_cross_dso = true
211    debug = false
212  }
213  external_deps = [
214    "ability_base:want",
215    "ability_runtime:runtime",
216    "ability_runtime:wantagent_innerkits",
217    "access_token:libaccesstoken_sdk",
218    "access_token:libnativetoken",
219    "access_token:libtoken_setproc",
220    "c_utils:utils",
221    "common_event_service:cesfwk_innerkits",
222    "hilog:libhilog",
223    "init:libbegetutil",
224    "ipc:ipc_single",
225    "safwk:system_ability_fwk",
226    "samgr:samgr_proxy",
227  ]
228}
229
230group("unittest") {
231  testonly = true
232
233  deps = [
234    ":TimeClientTest",
235    ":TimeDfxTest",
236    ":TimePermissionTest",
237    ":TimeProxyTest",
238    ":TimeServiceTest",
239  ]
240}
241