• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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("../../../../dlp_permission_service.gni")
16
17config("dlp_unittest_config") {
18  visibility = [ ":*" ]
19  include_dirs = [
20    "//third_party/googletest/include",
21    "${dlp_root_dir}/interfaces/inner_api/dlp_parse/include",
22    "${dlp_root_dir}/frameworks/common/include",
23  ]
24  cflags = [
25    "-D_GNU_SOURCE",
26    "-w",
27  ]
28}
29
30ohos_unittest("dlp_parse_test") {
31  subsystem_name = "security"
32  part_name = "dlp_permission_service"
33  module_out_path = part_name + "/" + part_name
34  public_configs = [ ":dlp_unittest_config" ]
35  sources = [
36    "${dlp_root_dir}/frameworks/common/src/permission_policy.cpp",
37    "${dlp_root_dir}/frameworks/test/mock/c_mock_common.cpp",
38    "${dlp_root_dir}/frameworks/test/mock/dlp_permission_kit.cpp",
39    "${dlp_root_dir}/frameworks/test/mock/file_io_mock.cpp",
40    "${dlp_root_dir}/frameworks/test/mock/openssl_mock.cpp",
41    "${dlp_root_dir}/interfaces/inner_api/dlp_parse/src/dlp_crypt.cpp",
42    "${dlp_root_dir}/interfaces/inner_api/dlp_parse/src/dlp_file.cpp",
43    "${dlp_root_dir}/interfaces/inner_api/dlp_parse/src/dlp_file_kits.cpp",
44    "${dlp_root_dir}/interfaces/inner_api/dlp_parse/src/dlp_file_manager.cpp",
45    "dlp_crypt_test.cpp",
46    "dlp_file_kits_test.cpp",
47    "dlp_file_manager_test.cpp",
48    "dlp_file_test.cpp",
49  ]
50
51  include_dirs = [
52    "//third_party/json/test/thirdparty/fifo_map",
53    "//third_party/googletest/include",
54    "${dlp_root_dir}/interfaces/inner_api/dlp_parse/include",
55    "${dlp_root_dir}/frameworks/common/include",
56    "${dlp_root_dir}/frameworks/test/mock/",
57    "${dlp_root_dir}/services/dlp_permission/sa/mock",
58    "${dlp_root_dir}/services/dlp_permission/sa/sa_common",
59  ]
60
61  deps = [
62    "${dlp_root_dir}/services/dlp_permission/sa:dlp_permission_serializer_static",
63    "//third_party/openssl:libcrypto_shared",
64  ]
65
66  external_deps = [
67    "ability_base:base",
68    "ability_base:want",
69    "ability_base:want",
70    "access_token:libaccesstoken_sdk",
71    "access_token:libtoken_setproc",
72    "c_utils:utils",
73    "hitrace:hitrace_meter",
74    "hilog:libhilog",
75    "ipc:ipc_core",
76    "os_account:libaccountkits",
77  ]
78  configs = [ "${dlp_root_dir}/config:coverage_flags" ]
79
80  cflags_cc = [ "-DHILOG_ENABLE" ]
81
82  if (current_cpu == "arm64") {
83    defines = [ "_ARM64_" ]
84  }
85}
86
87group("unittest") {
88  testonly = true
89  deps = [ ":dlp_parse_test" ]
90}
91