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