1# Copyright (c) 2022 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("//foundation/ability/ability_runtime/ability_runtime.gni")
16
17module_output_path = "ability_runtime/appmgr"
18
19ohos_unittest("app_mgr_service_test") {
20  sanitize = {
21    cfi = true
22    cfi_cross_dso = true
23    debug = false
24    blocklist = "../../cfi_blocklist.txt"
25  }
26  branch_protector_ret = "pac_ret"
27  module_out_path = module_output_path
28
29  include_dirs = [
30    "${ability_runtime_test_path}/mock/mock_appmgr_service/include",
31    "${ability_runtime_test_path}/mock/common/include",
32    "${ability_runtime_test_path}/mock/mock_sa_call",
33  ]
34
35  sources = [
36    "${ability_runtime_test_path}/mock/common/src/mock_native_token.cpp",
37    "app_mgr_service_test.cpp",
38  ]
39
40  configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ]
41
42  deps = [
43    "${ability_runtime_native_path}/appkit:appkit_native",
44    "${ability_runtime_path}/utils/server/startup:startup_util",
45    "${ability_runtime_services_path}/appmgr:libappms",
46    "${ability_runtime_services_path}/common:app_util",
47    "${ability_runtime_services_path}/common:task_handler_wrap",
48    "//third_party/googletest:gmock_main",
49    "//third_party/googletest:gtest_main",
50  ]
51
52  external_deps = [
53    "ability_base:configuration",
54    "ability_base:want",
55    "ability_runtime:app_manager",
56    "access_token:libaccesstoken_sdk",
57    "access_token:libnativetoken",
58    "access_token:libtoken_setproc",
59    "appspawn:appspawn_client",
60    "bundle_framework:appexecfwk_base",
61    "bundle_framework:appexecfwk_core",
62    "c_utils:utils",
63    "ffrt:libffrt",
64    "hilog:libhilog",
65    "hitrace:hitrace_meter",
66    "init:libbeget_proxy",
67    "init:libbegetutil",
68    "ipc:ipc_core",
69    "napi:ace_napi",
70    "safwk:system_ability_fwk",
71    "samgr:samgr_proxy",
72    "window_manager:libwm",
73  ]
74
75  defines = []
76  if (background_task_mgr_continuous_task_enable) {
77    defines += [ "BGTASKMGR_CONTINUOUS_TASK_ENABLE" ]
78  }
79
80  if (ability_command_for_test) {
81    defines += [ "ABILITY_COMMAND_FOR_TEST" ]
82  }
83}
84
85group("unittest") {
86  testonly = true
87
88  deps = [ ":app_mgr_service_test" ]
89}
90