1# Copyright (c) 2021-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("ams_mgr_scheduler_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  cflags_cc = []
29  include_dirs = [
30    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper",
31    "${ability_runtime_services_path}/appmgr/include",
32    "${ability_runtime_test_path}/mock/mock_sa_call",
33    "${distributedschedule_path}/samgr/interfaces/innerkits/samgr_proxy/include",
34    "mock/include",
35  ]
36
37  sources = [
38    "${ability_runtime_services_path}/appmgr/src/ams_mgr_scheduler.cpp",
39    "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp",
40    "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp",
41    "mock/src/mock_my_flag.cpp",
42    "mock/src/mock_permission_verification.cpp",
43  ]
44
45  sources += [ "ams_mgr_scheduler_test.cpp" ]
46
47  configs = [ "${ability_runtime_test_path}/unittest:appmgr_test_config" ]
48  cflags = []
49  if (target_cpu == "arm") {
50    cflags += [ "-DBINDER_IPC_32BIT" ]
51  }
52  deps = [
53    "${ability_runtime_innerkits_path}/app_manager:app_manager",
54    "${ability_runtime_native_path}/appkit:appkit_manager_helper",
55    "${ability_runtime_path}/utils/server/startup:startup_util",
56    "${ability_runtime_services_path}/appmgr:libappms",
57    "${ability_runtime_services_path}/common:perm_verification",
58    "${ability_runtime_services_path}/common:task_handler_wrap",
59    "${ability_runtime_test_path}/unittest:appmgr_test_source",
60  ]
61
62  external_deps = [
63    "access_token:libaccesstoken_sdk",
64    "access_token:libnativetoken",
65    "access_token:libtoken_setproc",
66    "appspawn:appspawn_client",
67    "bundle_framework:appexecfwk_core",
68    "ffrt:libffrt",
69    "hilog:libhilog",
70    "ipc:ipc_core",
71  ]
72
73  defines = [ "AMS_LOG_TAG = \"AppMgrService\"" ]
74
75  if (ability_command_for_test) {
76    defines += [ "ABILITY_COMMAND_FOR_TEST" ]
77  }
78
79  if (ability_runtime_graphics) {
80    defines += [ "SUPPORT_GRAPHICS" ]
81    deps += []
82    external_deps += [
83      "i18n:intl_util",
84      "window_manager:libwm",
85    ]
86  }
87  cflags_cc = []
88  if (os_dlp_part_enabled) {
89    cflags_cc += [ "-DWITH_DLP" ]
90  }
91}
92
93group("unittest") {
94  testonly = true
95  deps = [ ":ams_mgr_scheduler_test" ]
96}
97