1# Copyright (c) 2021-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("../../../../access_token.gni")
16
17ohos_unittest("libtoken_sync_service_coverage_test") {
18  subsystem_name = "security"
19  part_name = "access_token"
20  module_out_path = part_name + "/" + part_name
21  sanitize = {
22    cfi = true
23    cfi_cross_dso = true
24    debug = false
25  }
26  branch_protector_ret = "pac_ret"
27
28  sources = [
29    "../../src/command/base_remote_command.cpp",
30    "../../src/command/delete_remote_token_command.cpp",
31    "../../src/command/sync_remote_hap_token_command.cpp",
32    "../../src/command/update_remote_hap_token_command.cpp",
33    "../../src/device/device_info_manager.cpp",
34    "../../src/device/device_info_repository.cpp",
35    "../../src/remote/remote_command_executor.cpp",
36    "../../src/remote/remote_command_factory.cpp",
37    "../../src/remote/remote_command_manager.cpp",
38    "../../src/remote/soft_bus_channel.cpp",
39    "../../src/remote/soft_bus_device_connection_listener.cpp",
40    "../../src/remote/soft_bus_manager.cpp",
41    "../../src/remote/soft_bus_socket_listener.cpp",
42    "../../src/service/token_sync_manager_service.cpp",
43    "../../src/service/token_sync_manager_stub.cpp",
44    "../mock/src/constant_mock.cpp",
45    "../mock/src/soft_bus_socket_mock.cpp",
46    "token_sync_service_coverage_test.cpp",
47  ]
48
49  include_dirs = [
50    "../../include/service",
51    "../../include/remote",
52    "../../include/command",
53    "../../include/common",
54    "../../include/device",
55    "../../include/protocol",
56    "../mock/include",
57    "${access_token_path}/frameworks/common/include",
58    "${access_token_path}/frameworks/accesstoken/include",
59    "${access_token_path}/frameworks/tokensync/include",
60    "${access_token_path}/interfaces/innerkits/accesstoken/include",
61    "${access_token_path}/interfaces/innerkits/nativetoken/include",
62    "${access_token_path}/interfaces/innerkits/token_setproc/include",
63    "${access_token_path}/services/common/config_policy/include",
64    "${access_token_path}/services/common/handler/include",
65  ]
66
67  deps = [
68    "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx",
69    "${access_token_path}/frameworks/common:accesstoken_common_cxx",
70    "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
71    "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
72    "${access_token_path}/services/common:accesstoken_service_common",
73  ]
74
75  cflags_cc = [ "-DHILOG_ENABLE" ]
76
77  configs = [ "${access_token_path}/config:coverage_flags" ]
78
79  external_deps = [
80    "c_utils:utils",
81    "dsoftbus:softbus_client",
82    "hilog:libhilog",
83    "ipc:ipc_core",
84    "safwk:system_ability_fwk",
85    "zlib:libz",
86  ]
87
88  if (token_sync_enable == true) {
89    cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ]
90  }
91
92  if (eventhandler_enable == true) {
93    cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
94    external_deps += [ "eventhandler:libeventhandler" ]
95  }
96}
97