• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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/account/os_account/os_account.gni")
15import("//build/test.gni")
16
17module_output_path = "os_account/frameworks/account_iam"
18
19config("account_iam_native_config_unittest") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    "include",
24    "//base/useriam/user_auth_framework/interfaces/inner_api",
25  ]
26
27  cflags = []
28  if (target_cpu == "arm") {
29    cflags += [ "-DBINDER_IPC_32BIT" ]
30  }
31
32  defines = [
33    "ACCOUNT_LOG_TAG = \"AccountIAMUTestFwk\"",
34    "LOG_DOMAIN = 0xD001B00",
35  ]
36}
37
38ohos_unittest("account_iam_client_test") {
39  module_out_path = module_output_path
40
41  sources = [
42    "src/account_iam_callback_service_test.cpp",
43    "src/account_iam_client_test.cpp",
44  ]
45
46  configs = [ ":account_iam_native_config_unittest" ]
47
48  deps = [
49    "${account_iam_framework_path}:account_iam_innerkits",
50    "${common_path}:libaccount_common",
51    "${domain_account_framework_path}:domain_account_innerkits",
52    "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
53    "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc",
54    "//third_party/googletest:gmock_main",
55    "//third_party/googletest:gtest_main",
56  ]
57
58  cflags_cc = []
59  if (has_pin_auth_part) {
60    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
61    deps += [ "//base/useriam/pin_auth/frameworks:pinauth_framework" ]
62  }
63
64  if (has_user_auth_part) {
65    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
66    deps += [ "//base/useriam/user_auth_framework/frameworks/native/client:userauth_client" ]
67  }
68
69  external_deps = [
70    "hiviewdfx_hilog_native:libhilog",
71    "ipc:ipc_core",
72  ]
73}
74
75ohos_unittest("account_iam_client_no_permission_test") {
76  module_out_path = module_output_path
77
78  sources = [ "src/account_iam_client_no_permission_test.cpp" ]
79
80  configs = [ ":account_iam_native_config_unittest" ]
81
82  deps = [
83    "${account_iam_framework_path}:account_iam_innerkits",
84    "${common_path}:libaccount_common",
85    "${domain_account_framework_path}:domain_account_innerkits",
86    "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
87    "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc",
88    "//third_party/googletest:gmock_main",
89    "//third_party/googletest:gtest_main",
90  ]
91
92  cflags_cc = []
93  if (has_pin_auth_part) {
94    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
95    deps += [ "//base/useriam/pin_auth/frameworks:pinauth_framework" ]
96  }
97
98  if (has_user_auth_part) {
99    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
100    deps += [ "//base/useriam/user_auth_framework/frameworks/native/client:userauth_client" ]
101  }
102
103  external_deps = [
104    "hiviewdfx_hilog_native:libhilog",
105    "ipc:ipc_core",
106  ]
107}
108
109group("unittest") {
110  testonly = true
111
112  deps = [
113    ":account_iam_client_no_permission_test",
114    ":account_iam_client_test",
115  ]
116}
117