1# Copyright (c) 2021-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/os_account"
18
19config("os_account_service_config_unittest") {
20  visibility = [ ":*" ]
21
22  include_dirs = []
23
24  cflags = []
25  if (target_cpu == "arm") {
26    cflags += [ "-DBINDER_IPC_32BIT" ]
27  }
28
29  if (os_account_enable_account_short_name) {
30    cflags += [ "-DENABLE_ACCOUNT_SHORT_NAME" ]
31  }
32
33  defines = [
34    "ACCOUNT_LOG_TAG = \"OsAccountUTestFwk\"",
35    "LOG_DOMAIN = 0xD001B00",
36  ]
37}
38
39ohos_unittest("os_account_info_test") {
40  branch_protector_ret = "pac_ret"
41
42  sanitize = {
43    cfi = true
44    cfi_cross_dso = true
45    debug = false
46  }
47
48  module_out_path = module_output_path
49
50  sources = [ "os_account_info_test.cpp" ]
51
52  configs = [ ":os_account_service_config_unittest" ]
53
54  deps = [
55    "${common_path}:libaccount_common",
56    "${os_account_innerkits_native_path}:os_account_innerkits",
57    "//third_party/googletest:gmock_main",
58    "//third_party/googletest:gtest_main",
59  ]
60
61  external_deps = [
62    "ability_base:want",
63    "c_utils:utils",
64    "hilog:libhilog",
65  ]
66  cflags_cc = []
67  if (os_account_enable_multiple_os_accounts || use_clang_coverage) {
68    cflags_cc += [ "-DENABLE_MULTIPLE_OS_ACCOUNTS" ]
69  }
70}
71
72ohos_unittest("os_account_subscribe_info_test") {
73  branch_protector_ret = "pac_ret"
74
75  sanitize = {
76    cfi = true
77    cfi_cross_dso = true
78    debug = false
79  }
80
81  module_out_path = module_output_path
82
83  sources = [ "os_account_subscribe_info_test.cpp" ]
84
85  configs = [ ":os_account_service_config_unittest" ]
86
87  deps = [
88    "${common_path}:libaccount_common",
89    "${os_account_innerkits_native_path}:os_account_innerkits",
90    "//third_party/googletest:gtest_main",
91  ]
92
93  external_deps = [
94    "c_utils:utils",
95    "hilog:libhilog",
96    "ipc:ipc_single",
97  ]
98}
99
100group("unittest") {
101  testonly = true
102
103  deps = [
104    ":os_account_info_test",
105    ":os_account_subscribe_info_test",
106  ]
107}
108