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/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 "${account_test_common}:account_test_common_source_set", 56 "${common_path}:libaccount_common", 57 "${os_account_innerkits_native_path}:os_account_innerkits", 58 ] 59 60 external_deps = [ 61 "ability_base:want", 62 "cJSON:cjson", 63 "c_utils:utils", 64 "googletest:gmock_main", 65 "googletest:gtest_main", 66 "hilog:libhilog", 67 ] 68 cflags_cc = [] 69 if (os_account_enable_multiple_os_accounts || use_clang_coverage) { 70 cflags_cc += [ "-DENABLE_MULTIPLE_OS_ACCOUNTS" ] 71 } 72} 73 74ohos_unittest("os_account_subscribe_info_test") { 75 branch_protector_ret = "pac_ret" 76 77 sanitize = { 78 cfi = true 79 cfi_cross_dso = true 80 debug = false 81 } 82 83 module_out_path = module_output_path 84 85 sources = [ "os_account_subscribe_info_test.cpp" ] 86 87 configs = [ ":os_account_service_config_unittest" ] 88 89 deps = [ 90 "${common_path}:libaccount_common", 91 "${os_account_innerkits_native_path}:os_account_innerkits", 92 ] 93 94 external_deps = [ 95 "c_utils:utils", 96 "googletest:gmock_main", 97 "googletest:gtest_main", 98 "hilog:libhilog", 99 "ipc:ipc_single", 100 ] 101} 102 103group("unittest") { 104 testonly = true 105 106 deps = [ 107 ":os_account_info_test", 108 ":os_account_subscribe_info_test", 109 ] 110} 111