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 35module_output_path = "time_service/native" 36 37ohos_unittest("TimeServiceTest") { 38 module_out_path = module_output_path 39 40 sources = [ "src/time_service_test.cpp" ] 41 42 configs = [ ":module_private_config" ] 43 44 deps = [ 45 "${api_path}:time_client", 46 "${time_service_path}:time_system_ability_static", 47 "//third_party/googletest:gtest_main", 48 ] 49 branch_protector_ret = "pac_ret" 50 sanitize = { 51 cfi = true 52 cfi_cross_dso = true 53 debug = false 54 } 55 external_deps = [ 56 "ability_base:want", 57 "ability_runtime:runtime", 58 "ability_runtime:wantagent_innerkits", 59 "access_token:libaccesstoken_sdk", 60 "access_token:libnativetoken", 61 "access_token:libtoken_setproc", 62 "c_utils:utils", 63 "common_event_service:cesfwk_innerkits", 64 "hilog:libhilog", 65 "init:libbegetutil", 66 "ipc:ipc_single", 67 "power_manager:powermgr_client", 68 "relational_store:native_dataability", 69 "relational_store:native_rdb", 70 "safwk:system_ability_fwk", 71 "samgr:samgr_proxy", 72 ] 73} 74 75ohos_unittest("TimeClientTest") { 76 module_out_path = module_output_path 77 78 sources = [ "src/time_client_test.cpp" ] 79 80 configs = [ ":module_private_config" ] 81 82 deps = [ 83 "${api_path}:time_client", 84 "${time_service_path}:time_system_ability_static", 85 "//third_party/googletest:gtest_main", 86 ] 87 branch_protector_ret = "pac_ret" 88 sanitize = { 89 cfi = true 90 cfi_cross_dso = true 91 debug = false 92 } 93 external_deps = [ 94 "ability_base:want", 95 "ability_runtime:runtime", 96 "ability_runtime:wantagent_innerkits", 97 "access_token:libaccesstoken_sdk", 98 "access_token:libnativetoken", 99 "access_token:libtoken_setproc", 100 "c_utils:utils", 101 "hilog:libhilog", 102 "init:libbegetutil", 103 "ipc:ipc_single", 104 "power_manager:powermgr_client", 105 "relational_store:native_dataability", 106 "relational_store:native_rdb", 107 "safwk:system_ability_fwk", 108 "samgr:samgr_proxy", 109 ] 110} 111 112ohos_unittest("TimeDfxTest") { 113 module_out_path = module_output_path 114 115 sources = [ "src/time_dfx_test.cpp" ] 116 117 configs = [ ":module_private_config" ] 118 119 deps = [ 120 "${api_path}:time_client", 121 "${time_service_path}:time_system_ability_static", 122 "//third_party/googletest:gtest_main", 123 ] 124 branch_protector_ret = "pac_ret" 125 sanitize = { 126 cfi = true 127 cfi_cross_dso = true 128 debug = false 129 } 130 external_deps = [ 131 "ability_base:want", 132 "ability_runtime:runtime", 133 "ability_runtime:wantagent_innerkits", 134 "access_token:libaccesstoken_sdk", 135 "access_token:libnativetoken", 136 "access_token:libtoken_setproc", 137 "bundle_framework:appexecfwk_core", 138 "c_utils:utils", 139 "hilog:libhilog", 140 "init:libbegetutil", 141 "ipc:ipc_single", 142 "power_manager:powermgr_client", 143 "relational_store:native_dataability", 144 "relational_store:native_rdb", 145 "safwk:system_ability_fwk", 146 "samgr:samgr_proxy", 147 ] 148} 149 150ohos_unittest("TimePermissionTest") { 151 module_out_path = module_output_path 152 153 sources = [ "src/time_permission_test.cpp" ] 154 155 configs = [ ":module_private_config" ] 156 157 deps = [ 158 "${time_utils_path}:time_utils", 159 "//third_party/googletest:gtest_main", 160 ] 161 branch_protector_ret = "pac_ret" 162 sanitize = { 163 cfi = true 164 cfi_cross_dso = true 165 debug = false 166 } 167 external_deps = [ 168 "ability_base:want", 169 "ability_runtime:runtime", 170 "ability_runtime:wantagent_innerkits", 171 "c_utils:utils", 172 "hilog:libhilog", 173 "ipc:ipc_single", 174 "safwk:system_ability_fwk", 175 "samgr:samgr_proxy", 176 ] 177} 178 179ohos_unittest("TimeProxyTest") { 180 module_out_path = module_output_path 181 182 sources = [ "src/time_proxy_test.cpp" ] 183 184 configs = [ ":module_private_config" ] 185 186 deps = [ 187 "${api_path}:time_client", 188 "${time_service_path}:time_system_ability_static", 189 "//third_party/googletest:gtest_main", 190 ] 191 branch_protector_ret = "pac_ret" 192 sanitize = { 193 cfi = true 194 cfi_cross_dso = true 195 debug = false 196 } 197 external_deps = [ 198 "ability_base:want", 199 "ability_runtime:runtime", 200 "ability_runtime:wantagent_innerkits", 201 "access_token:libaccesstoken_sdk", 202 "access_token:libnativetoken", 203 "access_token:libtoken_setproc", 204 "c_utils:utils", 205 "common_event_service:cesfwk_innerkits", 206 "hilog:libhilog", 207 "init:libbegetutil", 208 "ipc:ipc_single", 209 "safwk:system_ability_fwk", 210 "samgr:samgr_proxy", 211 ] 212} 213 214group("unittest") { 215 testonly = true 216 217 deps = [ 218 ":TimeClientTest", 219 ":TimeDfxTest", 220 ":TimePermissionTest", 221 ":TimeProxyTest", 222 ":TimeServiceTest", 223 ] 224} 225