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("//base/account/os_account/os_account.gni") 15import("//build/test.gni") 16 17module_output_path = "os_account/frameworks/app_account" 18 19config("app_account_interfaces_native_config_mock") { 20 include_dirs = [ 21 "//third_party/googletest/googlemock/include", 22 "${app_account_innerkits_native_path}/test/mock", 23 ] 24} 25 26app_account_mock_sources = [] 27 28config("app_account_native_config_unittest") { 29 visibility = [ ":*" ] 30 31 include_dirs = [ "include" ] 32 33 cflags = [] 34 if (target_cpu == "arm") { 35 cflags += [ "-DBINDER_IPC_32BIT" ] 36 } 37 38 defines = [ 39 "ACCOUNT_LOG_TAG = \"AppAccountUTestFwk\"", 40 "LOG_DOMAIN = 0xD001B00", 41 ] 42} 43 44ohos_unittest("app_account_manager_test") { 45 module_out_path = module_output_path 46 47 sources = [ "app_account_manager_test.cpp" ] 48 sources += app_account_mock_sources 49 50 configs = [ 51 ":app_account_interfaces_native_config_mock", 52 ":app_account_native_config_unittest", 53 ] 54 55 deps = [ 56 "${app_account_innerkits_native_path}:app_account_innerkits", 57 "${common_path}:libaccount_common", 58 "//third_party/googletest:gmock_main", 59 "//third_party/googletest:gtest_main", 60 ] 61 62 external_deps = [ 63 "ability_base:want", 64 "hiviewdfx_hilog_native:libhilog", 65 "ipc:ipc_core", 66 ] 67} 68 69ohos_unittest("app_account_manager_subscribe_test") { 70 module_out_path = module_output_path 71 72 sources = [ "app_account_manager_subscribe_test.cpp" ] 73 sources += app_account_mock_sources 74 75 configs = [ 76 ":app_account_interfaces_native_config_mock", 77 ":app_account_native_config_unittest", 78 ] 79 80 deps = [ 81 "${app_account_innerkits_native_path}:app_account_innerkits", 82 "${app_account_services_path}:accountmgr", 83 "${app_account_services_path}/src/appaccount:app_account_service_core", 84 "${common_path}:libaccount_common", 85 "//third_party/googletest:gmock_main", 86 "//third_party/googletest:gtest_main", 87 ] 88 89 external_deps = [ 90 "ability_base:want", 91 "bundle_framework:appexecfwk_base", 92 "c_utils:utils", 93 "eventhandler:libeventhandler", 94 "hiviewdfx_hilog_native:libhilog", 95 "ipc:ipc_core", 96 "kv_store:distributeddata_inner", 97 "samgr:samgr_proxy", 98 ] 99} 100 101ohos_unittest("app_account_common_test") { 102 module_out_path = module_output_path 103 104 sources = [ "app_account_common_test.cpp" ] 105 sources += app_account_mock_sources 106 107 configs = [ 108 ":app_account_interfaces_native_config_mock", 109 ":app_account_native_config_unittest", 110 ] 111 112 deps = [ 113 "${app_account_innerkits_native_path}:app_account_innerkits", 114 "${common_path}:libaccount_common", 115 "//third_party/googletest:gmock_main", 116 "//third_party/googletest:gtest_main", 117 ] 118 119 external_deps = [ 120 "ability_base:want", 121 "bundle_framework:appexecfwk_base", 122 "bundle_framework:appexecfwk_core", 123 "hiviewdfx_hilog_native:libhilog", 124 "ipc:ipc_core", 125 ] 126} 127 128group("unittest") { 129 testonly = true 130 131 deps = [ 132 ":app_account_common_test", 133 ":app_account_manager_subscribe_test", 134 ":app_account_manager_test", 135 ] 136} 137