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("//build/test.gni")
15import("../../../os_account.gni")
16
17module_output_path = "os_account/frameworks/test"
18
19config("account_proxy_mock_config_unittest") {
20  visibility = [ ":*" ]
21
22  include_dirs = [ "include" ]
23
24  cflags = []
25  if (target_cpu == "arm") {
26    cflags += [ "-DBINDER_IPC_32BIT" ]
27  }
28
29  defines = [
30    "ACCOUNT_LOG_TAG = \"AccountIAMUTestFwk\"",
31    "LOG_DOMAIN = 0xD001B00",
32  ]
33}
34
35ohos_unittest("account_proxy_mock_test") {
36  branch_protector_ret = "pac_ret"
37
38  sanitize = {
39    cfi = true
40    cfi_cross_dso = true
41    debug = false
42  }
43
44  module_out_path = module_output_path
45
46  sources = [
47    "${account_iam_framework_path}/src/account_iam_client.cpp",
48    "${app_account_innerkits_native_path}/src/app_account.cpp",
49    "${app_account_innerkits_native_path}/src/app_account_death_recipient.cpp",
50    "${app_account_innerkits_native_path}/src/app_account_event_listener.cpp",
51    "${app_account_innerkits_native_path}/src/app_account_manager.cpp",
52    "${app_account_innerkits_native_path}/src/app_account_subscriber.cpp",
53    "${innerkits_native_path}/src/ohos_account_kits.cpp",
54    "${innerkits_native_path}/src/ohos_account_kits_impl.cpp",
55    "${os_account_core_path}/src/os_account.cpp",
56    "${os_account_core_path}/src/os_account_death_recipient.cpp",
57    "${os_account_core_path}/src/os_account_event_listener.cpp",
58    "${os_account_core_path}/src/os_account_event_stub.cpp",
59    "${os_account_innerkits_native_path}/src/os_account_manager.cpp",
60    "${os_account_innerkits_native_path}/src/os_account_subscriber.cpp",
61    "account_iam_proxy_mock_test.cpp",
62    "account_ohosaccount_proxy_mock_test.cpp",
63    "mock/iservice_registry.cpp",
64  ]
65
66  configs = [ ":account_proxy_mock_config_unittest" ]
67
68  deps = [
69    "${account_iam_framework_path}:account_iam_innerkits",
70    "${app_account_innerkits_native_path}:app_account_innerkits",
71    "${common_path}:libaccount_common",
72    "${innerkits_native_path}:libaccountkits",
73    "${os_account_innerkits_native_path}:os_account_innerkits",
74    "//third_party/googletest:gmock_main",
75    "//third_party/googletest:gtest_main",
76  ]
77
78  external_deps = [
79    "ability_base:want",
80    "access_token:libaccesstoken_sdk",
81    "c_utils:utils",
82    "hilog:libhilog",
83    "ipc:ipc_single",
84    "ipc:libdbinder",
85  ]
86
87  cflags_cc = []
88  if (has_pin_auth_part) {
89    cflags_cc += [ "-DHAS_PIN_AUTH_PART" ]
90    external_deps += [ "pin_auth:pinauth_framework" ]
91  }
92
93  if (has_user_auth_part) {
94    cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
95    external_deps += [ "user_auth_framework:userauth_client" ]
96  }
97}
98
99group("unittest") {
100  testonly = true
101
102  deps = [ ":account_proxy_mock_test" ]
103}
104