• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-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("libprivacy_sdk_test") {
18  subsystem_name = "security"
19  part_name = "access_token"
20  module_out_path = part_name + "/" + part_name
21
22  include_dirs = [
23    "../src",
24    "${access_token_path}/frameworks/privacy/include",
25    "${access_token_path}/interfaces/innerkits/accesstoken/include",
26    "${access_token_path}/interfaces/innerkits/nativetoken/include",
27    "${access_token_path}/interfaces/innerkits/privacy/include",
28    "${access_token_path}/interfaces/innerkits/token_setproc/include",
29    "//third_party/googletest/include",
30  ]
31
32  sources = [
33    "unittest/src/permission_deny_test.cpp",
34    "unittest/src/privacy_kit_test.cpp",
35  ]
36
37  cflags_cc = [ "-DHILOG_ENABLE" ]
38
39  if (security_component_enhance_enable == true) {
40    cflags_cc += [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ]
41  }
42
43  configs = [ "${access_token_path}/config:coverage_flags" ]
44
45  deps = [
46    "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx",
47    "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
48    "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken",
49    "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk",
50    "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
51  ]
52  external_deps = [
53    "c_utils:utils",
54    "init:libbegetutil",
55    "ipc:ipc_core",
56  ]
57}
58
59ohos_unittest("libprivacy_mock_test") {
60  subsystem_name = "security"
61  part_name = "access_token"
62  module_out_path = part_name + "/" + part_name
63
64  include_dirs = [
65    "../include",
66    "../src",
67    "${access_token_path}/frameworks/privacy/include",
68    "${access_token_path}/frameworks/common/include",
69    "${access_token_path}/frameworks/accesstoken/include",
70    "${access_token_path}/frameworks/tokensync/include",
71    "${access_token_path}/interfaces/innerkits/accesstoken/include",
72    "${access_token_path}/interfaces/innerkits/nativetoken/include",
73    "//third_party/googletest/include",
74  ]
75
76  sources = [
77    "../src/on_permission_used_record_callback_stub.cpp",
78    "../src/perm_active_status_change_callback.cpp",
79    "../src/perm_active_status_change_callback_stub.cpp",
80    "../src/perm_active_status_customized_cbk.cpp",
81    "../src/privacy_death_recipient.cpp",
82    "../src/privacy_kit.cpp",
83    "../src/privacy_manager_client.cpp",
84    "../src/privacy_manager_proxy.cpp",
85    "../src/state_change_callback.cpp",
86    "../src/state_change_callback_stub.cpp",
87    "../src/state_customized_cbk.cpp",
88    "mock/src/iservice_registry.cpp",
89    "unittest/privacy_mock_test/privacy_kit_test.cpp",
90  ]
91
92  configs = [ "${access_token_path}/config:coverage_flags" ]
93
94  deps = [
95    "${access_token_path}/frameworks/common:accesstoken_common_cxx",
96    "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx",
97    "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
98    "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken",
99    "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc",
100    "//third_party/googletest:gmock_main",
101    "//third_party/googletest:gtest_main",
102  ]
103
104  external_deps = [
105    "c_utils:utils",
106    "eventhandler:libeventhandler",
107    "hilog:libhilog",
108    "hisysevent:libhisysevent",
109    "init:libbeget_proxy",
110    "init:libbegetutil",
111    "ipc:ipc_core",
112    "ipc:libdbinder",
113    "safwk:system_ability_fwk",
114    "samgr:samgr_proxy",
115  ]
116
117  cflags_cc = [
118    "-DHILOG_ENABLE",
119    "-DDEBUG_API_PERFORMANCE",
120  ]
121}
122
123group("unittest") {
124  testonly = true
125  deps = [
126    ":libprivacy_mock_test",
127    ":libprivacy_sdk_test",
128  ]
129}
130