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/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 "c_utils:utils", 65 "hilog:libhilog", 66 "ipc:ipc_single", 67 ] 68} 69 70ohos_unittest("app_account_manager_subscribe_test") { 71 module_out_path = module_output_path 72 73 sources = [ "app_account_manager_subscribe_test.cpp" ] 74 sources += app_account_mock_sources 75 76 configs = [ 77 ":app_account_interfaces_native_config_mock", 78 ":app_account_native_config_unittest", 79 ] 80 81 deps = [ 82 "${app_account_innerkits_native_path}:app_account_innerkits", 83 "${app_account_services_path}:accountmgr", 84 "${app_account_services_path}/src/appaccount:app_account_service_core", 85 "${common_path}:libaccount_common", 86 "//third_party/googletest:gmock_main", 87 "//third_party/googletest:gtest_main", 88 ] 89 90 external_deps = [ 91 "ability_base:want", 92 "bundle_framework:appexecfwk_base", 93 "c_utils:utils", 94 "eventhandler:libeventhandler", 95 "hilog:libhilog", 96 "ipc:ipc_single", 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 "c_utils:utils", 122 "hilog:libhilog", 123 "ipc:ipc_single", 124 ] 125} 126 127group("unittest") { 128 testonly = true 129 130 deps = [ 131 ":app_account_common_test", 132 ":app_account_manager_subscribe_test", 133 ":app_account_manager_test", 134 ] 135} 136