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/test.gni")
15import("../../../../../os_account.gni")
16
17module_output_path = "os_account/services/common"
18
19config("app_account_service_config_mock") {
20  include_dirs = [
21    "${app_account_services_path}/test/mock/app_account",
22    "${app_account_services_path}/test/mock/common",
23    "${app_account_innerkits_native_path}/include",
24  ]
25}
26
27config("app_account_service_config_unittest") {
28  visibility = [ ":*" ]
29
30  include_dirs = []
31
32  cflags = []
33  if (target_cpu == "arm") {
34    cflags += [ "-DBINDER_IPC_32BIT" ]
35  }
36
37  defines = [
38    "ACCOUNT_LOG_TAG = \"AccountCommonMTest\"",
39    "LOG_DOMAIN = 0xD001B00",
40  ]
41}
42
43ohos_moduletest("account_permission_manager_module_test") {
44  branch_protector_ret = "pac_ret"
45
46  sanitize = {
47    cfi = true
48    cfi_cross_dso = true
49    debug = false
50  }
51
52  module_out_path = module_output_path
53
54  sources = [ "account_permission_manager_module_test.cpp" ]
55
56  deps = [
57    "${common_path}:libaccount_common",
58    "//third_party/googletest:gmock_main",
59    "//third_party/googletest:gtest_main",
60  ]
61
62  external_deps = [
63    "access_token:libaccesstoken_sdk",
64    "access_token:libtokensetproc_shared",
65    "c_utils:utils",
66    "hilog:libhilog",
67    "ipc:ipc_single",
68  ]
69
70  defines = [
71    "ACCOUNT_LOG_TAG = \"AppAccountMTest\"",
72    "LOG_DOMAIN = 0xD001B00",
73  ]
74}
75
76ohos_moduletest("bundle_manager_adapter_module_test") {
77  branch_protector_ret = "pac_ret"
78
79  sanitize = {
80    cfi = true
81    cfi_cross_dso = true
82    debug = false
83  }
84
85  module_out_path = module_output_path
86  include_dirs =
87      [ "${services_path}/accountmgr/include/bundle_manager_adapter" ]
88  sources = [
89    "${services_path}/accountmgr/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp",
90    "bundle_manager_adapter_module_test.cpp",
91  ]
92
93  configs = [ ":app_account_service_config_unittest" ]
94
95  deps = [
96    "${app_account_services_path}:accountmgr",
97    "${common_path}:libaccount_common",
98    "${innerkits_native_path}:libaccountkits",
99    "//third_party/googletest:gtest_main",
100  ]
101
102  external_deps = [
103    "ability_base:want",
104    "ability_runtime:app_manager",
105    "ability_runtime:wantagent_innerkits",
106    "bundle_framework:appexecfwk_base",
107    "bundle_framework:appexecfwk_core",
108    "c_utils:utils",
109    "hilog:libhilog",
110    "ipc:ipc_single",
111    "samgr:samgr_proxy",
112  ]
113}
114
115group("moduletest") {
116  testonly = true
117
118  deps = [
119    ":account_permission_manager_module_test",
120    ":bundle_manager_adapter_module_test",
121  ]
122}
123