1# Copyright (c) 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("//base/security/security_guard/security_guard.gni")
15import("//build/test.gni")
16
17ohos_unittest("risk_collect_test") {
18  install_enable = true
19  part_name = "security_guard"
20  subsystem_name = "security"
21  module_out_path = "${part_name}/${part_name}"
22
23  include_dirs = [
24    "include",
25    "${sg_root_dir}/frameworks/common/task_handler/include",
26    "${sg_root_dir}/frameworks/common/utils/include",
27    "${sg_root_dir}/frameworks/common/interfaces",
28    "${sg_root_dir}/frameworks/common/log/include",
29    "${sg_root_dir}/frameworks/common/constants/include",
30    "${sg_root_dir}/frameworks/common/json/include",
31    "${sg_root_dir}/test/unittest/mock/accesstoken",
32    "${sg_root_dir}/test/unittest/mock/account_manager",
33    "${sg_root_dir}/test/unittest/mock/collector_manager",
34    "${sg_root_dir}/test/unittest/mock/config_manager",
35    "${sg_root_dir}/test/unittest/mock/data_collect",
36    "${sg_root_dir}/test/unittest/mock/data_collection",
37    "${sg_root_dir}/test/unittest/mock/database_manager",
38    "${sg_root_dir}/test/unittest/mock/device_manager",
39    "${sg_root_dir}/test/unittest/mock/preferences",
40    "${sg_root_dir}/test/unittest/mock/preferences_wrapper",
41    "${sg_root_dir}/test/unittest/mock/rdb",
42  ]
43
44  sources = [
45    "${sg_root_dir}/frameworks/common/utils/src/security_guard_utils.cpp",
46    "${sg_root_dir}/services/risk_collect/src/data_format.cpp",
47    "${sg_root_dir}/services/risk_collect/src/kernel_interface_adapter.cpp",
48    "${sg_root_dir}/services/risk_collect/src/uevent_listener.cpp",
49    "${sg_root_dir}/services/risk_collect/src/uevent_listener_impl.cpp",
50    "${sg_root_dir}/services/risk_collect/src/uevent_notify.cpp",
51    "src/risk_collect_test.cpp",
52  ]
53
54  deps = [ "${sg_root_dir}/frameworks/common/task_handler:sg_task_stamp" ]
55
56  external_deps = [
57    "c_utils:utils",
58    "googletest:gmock",
59    "hilog:libhilog",
60    "init:libbegetutil",
61    "json:nlohmann_json_static",
62  ]
63}
64
65group("unittest") {
66  testonly = true
67  deps = [ ":risk_collect_test" ]
68}
69