• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-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.
13
14import("//build/test.gni")
15import("../../../../common/config/common.gni")
16
17module_output_path = "enterprise_device_management/enterprise_device_management"
18
19config("module_private_config") {
20  visibility = [ ":*" ]
21  include_dirs = [ "../" ]
22}
23
24config("edm_config") {
25  visibility = [ ":*" ]
26  include_dirs = [
27    "../../../../services/edm/include",
28    "../../../../services/edm/include/connection",
29    "../../../../services/edm/include/database",
30    "../../../../services/edm/include/strategy",
31    "../../../../services/edm_plugin/include/utils",
32    "../../../../framework/extension/include",
33  ]
34}
35
36ohos_static_library("edmservice_static") {
37  testonly = true
38  sources = [
39    "../../../../services/edm/src/admin.cpp",
40    "../../../../services/edm/src/admin_manager.cpp",
41    "../../../../services/edm/src/admin_policies_storage_rdb.cpp",
42    "../../../../services/edm/src/application_state_observer.cpp",
43    "../../../../services/edm/src/connection/enterprise_admin_connection.cpp",
44    "../../../../services/edm/src/connection/enterprise_admin_proxy.cpp",
45    "../../../../services/edm/src/connection/enterprise_bundle_connection.cpp",
46    "../../../../services/edm/src/connection/enterprise_conn_manager.cpp",
47    "../../../../services/edm/src/connection/enterprise_update_connection.cpp",
48    "../../../../services/edm/src/database/edm_rdb_data_manager.cpp",
49    "../../../../services/edm/src/database/edm_rdb_open_callback.cpp",
50    "../../../../services/edm/src/device_policies_storage_rdb.cpp",
51    "../../../../services/edm/src/enterprise_device_mgr_ability.cpp",
52    "../../../../services/edm/src/enterprise_device_mgr_stub.cpp",
53    "../../../../services/edm/src/permission_manager.cpp",
54    "../../../../services/edm/src/plugin_manager.cpp",
55    "../../../../services/edm/src/policy_manager.cpp",
56    "../../../../services/edm/src/strategy/enhance_execute_strategy.cpp",
57    "../../../../services/edm/src/strategy/replace_execute_strategy.cpp",
58    "../../../../services/edm/src/strategy/single_execute_strategy.cpp",
59    "../../../../services/edm/src/super_admin.cpp",
60    "../../../../services/edm/src/user_policy_manager.cpp",
61    "../../../../services/edm_plugin/src/utils/clipboard_policy_serializer.cpp",
62    "../../../../services/edm_plugin/src/utils/clipboard_utils.cpp",
63    "../../../../services/edm_plugin/src/utils/password_policy_serializer.cpp",
64    "../../../../services/edm_plugin/src/utils/usb_policy_utils.cpp",
65  ]
66
67  public_configs = [
68    ":edm_config",
69    "../../../../common/config:coverage_flags",
70  ]
71
72  defines = []
73
74  if (target_cpu == "arm64") {
75    defines += [ "_ARM64_" ]
76    print("defines _ARM64_")
77  }
78
79  if (target_cpu == "x86_64") {
80    defines += [ "_X86_64_" ]
81    print("defines _X86_64_")
82  }
83
84  if (common_event_service_edm_enable) {
85    defines += [ "COMMON_EVENT_SERVICE_EDM_ENABLE" ]
86  }
87
88  external_deps = [
89    "ability_base:want",
90    "ability_runtime:app_manager",
91    "ability_runtime:extension_manager",
92    "access_token:libaccesstoken_sdk",
93    "access_token:libtokenid_sdk",
94    "bundle_framework:appexecfwk_base",
95    "cJSON:cjson",
96    "c_utils:utils",
97    "common_event_service:cesfwk_innerkits",
98    "hilog:libhilog",
99    "init:libbegetutil",
100    "ipc:ipc_core",
101    "jsoncpp:jsoncpp",
102    "pasteboard:pasteboard_client",
103    "relational_store:native_rdb",
104    "safwk:system_ability_fwk",
105    "user_auth_framework:userauth_client",
106  ]
107
108  external_deps += [
109    "drivers_interface_usb:libusb_proxy_1.0",
110    "usb_manager:usbsrv_client",
111  ]
112
113  deps = [
114    "../../../../common/external:edm_external_adapters",
115    "../../../../common/native:edm_commom",
116    "../../../../interfaces/inner_api:edmservice_kits",
117    "../../../../interfaces/inner_api/plugin_kits:plugin_kits",
118  ]
119
120  sanitize = {
121    boundary_sanitize = true
122    cfi = true
123    cfi_cross_dso = true
124    debug = false
125    integer_overflow = true
126    ubsan = true
127  }
128  branch_protector_ret = "pac_ret"
129  subsystem_name = "customization"
130  part_name = "enterprise_device_management"
131}
132
133ohos_unittest("EdmServicesUnitTest") {
134  module_out_path = module_output_path
135
136  include_dirs = [
137    "./include",
138    "./include/mock",
139    "../../common/mock/include",
140    "../../external_mock/include",
141    "../../../../interfaces/inner_api/plugin_kits/include/utils",
142  ]
143
144  sources = [
145    "./src/admin_manager_test.cpp",
146    "./src/admin_test.cpp",
147    "./src/device_policies_storage_rdb_test.cpp",
148    "./src/enterprise_admin_connection_test.cpp",
149    "./src/enterprise_bundle_connection_test.cpp",
150    "./src/enterprise_conn_manager_test.cpp",
151    "./src/enterprise_device_mgr_ability_test.cpp",
152    "./src/enterprise_update_connection_test.cpp",
153    "./src/iplugin_template_test.cpp",
154    "./src/permission_manager_test.cpp",
155    "./src/plugin_manager_test.cpp",
156    "./src/policy_manager_test.cpp",
157    "./src/user_policy_manager_test.cpp",
158  ]
159
160  defines = []
161  if (common_event_service_edm_enable) {
162    defines += [ "COMMON_EVENT_SERVICE_EDM_ENABLE" ]
163  }
164
165  configs = [
166    ":module_private_config",
167    "../../../../common/config:coverage_flags",
168  ]
169
170  deps = [
171    ":edmservice_static",
172    "../../../../common/external:edm_external_adapters",
173    "../../../../common/native:edm_commom",
174    "../../../../interfaces/inner_api:edmservice_kits",
175    "../../../../interfaces/inner_api/plugin_kits:plugin_kits",
176    "../../utils:edm_unittest_utils",
177    "//third_party/googletest:gmock_main",
178  ]
179
180  external_deps = [
181    "ability_base:want",
182    "ability_runtime:ability_manager",
183    "access_token:libaccesstoken_sdk",
184    "access_token:libnativetoken",
185    "access_token:libtoken_setproc",
186    "bundle_framework:appexecfwk_core",
187    "cJSON:cjson",
188    "c_utils:utils",
189    "common_event_service:cesfwk_innerkits",
190    "hilog:libhilog",
191    "ipc:ipc_core",
192    "jsoncpp:jsoncpp",
193    "safwk:system_ability_fwk",
194    "samgr:samgr_proxy",
195    "user_auth_framework:userauth_client",
196  ]
197
198  if (os_account_edm_enable) {
199    external_deps += [
200      "os_account:libaccountkits",
201      "os_account:os_account_innerkits",
202    ]
203    defines += [ "OS_ACCOUNT_EDM_ENABLE" ]
204  }
205
206  sanitize = {
207    boundary_sanitize = true
208    cfi = true
209    cfi_cross_dso = true
210    debug = false
211    integer_overflow = true
212    ubsan = true
213    blocklist = "../../cfi_blocklist.txt"
214  }
215  branch_protector_ret = "pac_ret"
216  subsystem_name = "customization"
217  part_name = "enterprise_device_management"
218}
219
220group("unittest") {
221  testonly = true
222
223  deps = [
224    # deps file
225    ":EdmServicesUnitTest",
226  ]
227}
228