• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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/ohos.gni")
15import("//build/test.gni")
16import("../../../../../os_account.gni")
17
18module_output_path = "os_account/services/ohos_account"
19
20config("accountmgr_data_deal_test_config") {
21  include_dirs = [
22    "./include",
23    "${app_account_core_path}/include",
24    "${app_account_interfaces_native_path}/include",
25    "${common_path}/log/include",
26    "${innerkits_common}/include",
27    "${os_account_dfx_path}/hisysevent_adapter",
28    "${services_path}/accountmgr/include",
29    "//third_party/json/include",
30    "${innerkits_path}/include",
31  ]
32}
33
34ohos_unittest("OhosServiceTest") {
35  branch_protector_ret = "pac_ret"
36
37  sanitize = {
38    cfi = true
39    cfi_cross_dso = true
40    debug = false
41  }
42
43  module_out_path = module_output_path
44  cflags_cc = []
45  include_dirs = [
46    "${account_iam_interfaces_native_path}/include",
47    "${os_account_interfaces_native_path}/include",
48    "${os_account_core_path}/include",
49  ]
50
51  sources = [
52    "${common_path}/log/src/account_log_wrapper.cpp",
53    "${os_account_dfx_path}/hisysevent_adapter/hisysevent_adapter.cpp",
54    "${services_path}/accountmgr/src/account_event_provider.cpp",
55    "${services_path}/accountmgr/src/account_mgr_service.cpp",
56    "${services_path}/accountmgr/src/ohos_account_data_deal.cpp",
57    "${services_path}/accountmgr/src/ohos_account_manager.cpp",
58  ]
59
60  sources += [ "ohos_account_manager_test.cpp" ]
61
62  configs = [
63    ":accountmgr_data_deal_test_config",
64    "${services_path}/accountmgr:accountmgr_config",
65    "${services_path}/accountmgr/test:accountmgr_test_config",
66    "${account_coverage_config_path}:coverage_flags",
67  ]
68
69  deps = [
70    "${common_path}:libaccount_common",
71    "${os_account_innerkits_native_path}:os_account_innerkits",
72    "${services_path}/accountmgr:accountmgr",
73    "//third_party/googletest:gmock_main",
74    "//third_party/googletest:gtest_main",
75    "//third_party/mbedtls:mbedtls",
76  ]
77
78  external_deps = [
79    "ability_base:base",
80    "ability_base:want",
81    "ability_runtime:app_manager",
82    "access_token:libaccesstoken_sdk",
83    "access_token:libtokenid_sdk",
84    "c_utils:utils",
85    "hilog:libhilog",
86    "ipc:ipc_single",
87    "kv_store:distributeddata_inner",
88    "safwk:system_ability_fwk",
89  ]
90  if (has_hiviewdfx_hisysevent_part) {
91    cflags_cc += [ "-DHAS_HISYSEVENT_PART" ]
92    external_deps += [ "hisysevent:libhisysevent" ]
93  }
94  if (has_ces_part) {
95    cflags_cc += [ "-DHAS_CES_PART" ]
96    external_deps += [ "common_event_service:cesfwk_innerkits" ]
97  }
98  part_name = "os_account"
99}
100
101ohos_unittest("OhosDataDealTest") {
102  branch_protector_ret = "pac_ret"
103
104  sanitize = {
105    cfi = true
106    cfi_cross_dso = true
107    debug = false
108  }
109
110  module_out_path = module_output_path
111  cflags_cc = []
112  resource_config_file =
113      "${os_account_path}/test/resource/accountmgrservice/ohos_test.xml"
114  include_dirs = [
115    "${account_iam_interfaces_native_path}/include",
116    "${os_account_interfaces_native_path}/include",
117    "${os_account_core_path}/include",
118  ]
119
120  sources = [
121    "${common_path}/log/src/account_log_wrapper.cpp",
122    "${os_account_dfx_path}/hisysevent_adapter/hisysevent_adapter.cpp",
123    "${services_path}/accountmgr/src/ohos_account_data_deal.cpp",
124  ]
125
126  sources += [ "ohos_account_data_deal_test.cpp" ]
127
128  configs = [
129    ":accountmgr_data_deal_test_config",
130    "${services_path}/accountmgr/test:accountmgr_test_config",
131    "${account_coverage_config_path}:coverage_flags",
132  ]
133
134  deps = [
135    "${common_path}:libaccount_common",
136    "${os_account_innerkits_native_path}:os_account_innerkits",
137    "${services_path}/accountmgr:accountmgr",
138    "//third_party/googletest:gmock_main",
139    "//third_party/googletest:gtest_main",
140  ]
141
142  external_deps = [
143    "ability_base:want",
144    "c_utils:utils",
145    "hilog:libhilog",
146    "ipc:ipc_single",
147  ]
148  if (has_hiviewdfx_hisysevent_part) {
149    cflags_cc += [ "-DHAS_HISYSEVENT_PART" ]
150    external_deps += [ "hisysevent:libhisysevent" ]
151  }
152  part_name = "os_account"
153}
154
155group("unittest") {
156  testonly = true
157
158  deps = [
159    ":OhosDataDealTest",
160    ":OhosServiceTest",
161  ]
162}
163