# Copyright (c) 2021-2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//base/account/os_account/os_account.gni") import("//build/test.gni") module_output_path = "os_account/services/app_account" config("app_account_service_config_mock") { include_dirs = [ "//third_party/googletest/googlemock/include", "${app_account_services_path}/test/mock/app_account", "${app_account_services_path}/test/mock/common", "${app_account_innerkits_native_path}/include", "//base/security/access_token/interfaces/innerkits/accesstoken/include", ] } config("app_account_service_config_unittest") { visibility = [ ":*" ] include_dirs = [] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } defines = [ "ACCOUNT_LOG_TAG = \"AppAccountMTest\"", "LOG_DOMAIN = 0xD001B00", ] } ohos_moduletest("app_account_check_labels_module_test") { module_out_path = module_output_path sources = [ "app_account_check_labels_module_test.cpp" ] configs = [ ":app_account_service_config_unittest" ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "samgr:samgr_proxy", ] } ohos_moduletest("account_permission_manager_module_test") { module_out_path = module_output_path sources = [ "account_permission_manager_module_test.cpp" ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${common_path}:libaccount_common", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] } ohos_moduletest("app_account_authenticator_callback_test") { module_out_path = module_output_path cflags_cc = [] sources = [ "app_account_authenticator_callback_test.cpp" ] configs = [ ":app_account_service_config_unittest" ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } } ohos_moduletest("app_account_event_module_test") { module_out_path = module_output_path cflags_cc = [] sources = [ "app_account_event_module_test.cpp" ] configs = [ ":app_account_service_config_unittest" ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "bundle_framework:appexecfwk_base", "c_utils:utils", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "samgr:samgr_proxy", ] if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } } ohos_moduletest("app_account_authenticate_test") { module_out_path = module_output_path cflags_cc = [] sources = [ "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", "app_account_authenticate_test.cpp", ] configs = [ ":app_account_service_config_mock", ":app_account_service_config_unittest", ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } } ohos_moduletest("app_account_control_manager_module_test") { module_out_path = module_output_path sources = [ "app_account_control_manager_module_test.cpp" ] configs = [ ":app_account_service_config_unittest" ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] } ohos_moduletest("app_account_authenticator_session_module_test") { module_out_path = module_output_path include_dirs = [ "${app_account_services_path}/test/mock/app_account" ] sources = [ "${app_account_services_path}/test/mock/app_account/app_account_authenticator_manager.cpp", "${app_account_services_path}/test/mock/app_account/mock_app_account_authenticator_stub.cpp", "${app_account_services_path}/test/mock/common/ability_manager_adapter.cpp", "app_account_authenticator_session_module_test.cpp", ] configs = [ ":app_account_service_config_unittest" ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "samgr:samgr_proxy", ] } ohos_moduletest("app_account_manager_service_module_test") { module_out_path = module_output_path cflags_cc = [] cflags = [] sources = [ "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", "app_account_manager_service_module_test.cpp", ] configs = [ ":app_account_service_config_mock", ":app_account_service_config_unittest", ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } if (os_account_distributed_feature) { cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ] } } ohos_moduletest("at_not_mock_app_account_manager_service_module_test") { module_out_path = module_output_path sources = [ "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", "at_not_mock_app_account_manager_service_module_test.cpp", ] configs = [ ":app_account_service_config_unittest" ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", ] } ohos_moduletest("app_account_manager_service_subscribe_module_test") { module_out_path = module_output_path cflags_cc = [] sources = [ "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", "app_account_manager_service_subscribe_module_test.cpp", ] configs = [ ":app_account_service_config_mock", ":app_account_service_config_unittest", ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } } ohos_moduletest("app_account_manager_service_sync_module_test") { module_out_path = module_output_path cflags_cc = [] cflags = [] sources = [ "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", "app_account_manager_service_sync_module_test.cpp", ] configs = [ ":app_account_service_config_mock", ":app_account_service_config_unittest", ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } if (os_account_distributed_feature) { cflags += [ "-DDISTRIBUTED_FEATURE_ENABLED" ] } } ohos_moduletest("bundle_manager_adapter_module_test") { module_out_path = module_output_path include_dirs = [ "//base/account/os_account/services/accountmgr/include/bundle_manager_adapter" ] sources = [ "//base/account/os_account/services/accountmgr/src/bundle_manager_adapter/bundle_manager_adapter_proxy.cpp", "bundle_manager_adapter_module_test.cpp", ] configs = [ ":app_account_service_config_unittest" ] deps = [ "${app_account_services_path}:accountmgr", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "ability_runtime:wantagent_innerkits", "bundle_framework:appexecfwk_base", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", ] } ohos_moduletest("app_account_authenticator_session_manager_module_test") { module_out_path = module_output_path include_dirs = [ "${app_account_services_path}/test/mock/app_account" ] sources = [ "${app_account_services_path}/test/mock/app_account/app_account_authenticator_manager.cpp", "${app_account_services_path}/test/mock/app_account/mock_app_account_authenticator_stub.cpp", "${app_account_services_path}/test/mock/common/ability_manager_adapter.cpp", "app_account_authenticator_session_manager_module_test.cpp", ] configs = [ ":app_account_service_config_unittest" ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "c_utils:utils", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "samgr:samgr_proxy", ] } ohos_moduletest("app_account_manager_service_thread_module_test") { module_out_path = module_output_path cflags_cc = [] sources = [ "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", "app_account_manager_service_thread_module_test.cpp", ] configs = [ ":app_account_service_config_mock", ":app_account_service_config_unittest", ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } } ohos_moduletest("app_account_subscribe_manager_test") { module_out_path = module_output_path cflags_cc = [] sources = [ "${app_account_services_path}/test/mock/app_account/accesstoken_kit.cpp", "${app_account_services_path}/test/mock/common/bundle_manager_adapter.cpp", "app_account_subscribe_manager_test.cpp", ] configs = [ ":app_account_service_config_mock", ":app_account_service_config_unittest", ] deps = [ "${app_account_innerkits_native_path}:app_account_innerkits", "${app_account_services_path}:accountmgr", "${app_account_services_path}/src/appaccount:app_account_service_core", "${common_path}:libaccount_common", "${innerkits_native_path}:libaccountkits", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:base", "ability_base:want", "ability_runtime:app_manager", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "kv_store:distributeddata_inner", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_ces_part) { cflags_cc += [ "-DHAS_CES_PART" ] external_deps += [ "common_event_service:cesfwk_innerkits" ] } } group("moduletest") { testonly = true deps = [ ":account_permission_manager_module_test", ":app_account_authenticate_test", ":app_account_authenticator_callback_test", ":app_account_authenticator_session_manager_module_test", ":app_account_authenticator_session_module_test", ":app_account_check_labels_module_test", ":app_account_control_manager_module_test", ":app_account_event_module_test", ":app_account_manager_service_module_test", ":app_account_manager_service_subscribe_module_test", ":app_account_manager_service_sync_module_test", ":app_account_manager_service_thread_module_test", ":app_account_subscribe_manager_test", ":at_not_mock_app_account_manager_service_module_test", ":bundle_manager_adapter_module_test", ] }