# Copyright (c) 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("//build/test.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") module_output_path = "ability_tools/tools" ability_delegator_mock_sources = [ "${ability_runtime_path}/tools/test/mock/mock_ability_manager_stub.cpp" ] config("tools_ability_delegator_config") { include_dirs = [ "${ability_runtime_path}/tools/test/mock", "//third_party/googletest/googlemock/include", "${ability_runtime_path}/tools/aa/include", ] } ohos_unittest("ability_command_test") { module_out_path = module_output_path configs = [ ":tools_ability_delegator_config" ] sources = [ "ability_command_test.cpp" ] sources += ability_delegator_mock_sources deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set", "${ability_runtime_services_path}/abilitymgr:abilityms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:configuration", "bundle_framework:appexecfwk_base", "hilog:libhilog", "ipc:ipc_core", ] } ohos_unittest("test_observer_test") { module_out_path = module_output_path configs = [ ":tools_ability_delegator_config" ] sources = [ "test_observer_test.cpp" ] sources += ability_delegator_mock_sources deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set", "${ability_runtime_services_path}/abilitymgr:abilityms", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:configuration", "bundle_framework:appexecfwk_base", "hilog:libhilog", "ipc:ipc_core", ] } ohos_unittest("test_observer_proxy_test") { module_out_path = module_output_path sources = [ "test_observer_proxy_test.cpp" ] deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "hilog:libhilog", "ipc:ipc_core", ] } ohos_unittest("test_observer_stub_test") { module_out_path = module_output_path sources = [ "mock_test_observer_stub.cpp", "test_observer_stub_test.cpp", ] deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "hilog:libhilog", "ipc:ipc_core", ] } ohos_unittest("shell_command_result_test") { module_out_path = module_output_path sources = [ "shell_command_result_test.cpp" ] configs = [ ":tools_ability_delegator_config" ] deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:configuration", "bundle_framework:appexecfwk_base", "hilog:libhilog", "ipc:ipc_core", ] } print("accessibility_enable = ", accessibility_enable) if (accessibility_enable) { ohos_unittest("shell_command_executor_test") { module_out_path = module_output_path sources = [ "shell_command_executor_test.cpp" ] configs = [ ":tools_ability_delegator_config" ] deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:configuration", "accessibility:accessibility_common", "accessibility:accessibilityclient", "accessibility:accessibilityconfig", "bundle_framework:appexecfwk_base", "hilog:libhilog", "ipc:ipc_core", ] } ohos_unittest("accessibility_ability_command_test") { module_out_path = module_output_path symlink_target_name = [ "ability_tool" ] include_dirs = [ "${access_token_path}/interfaces/innerkits/token_setproc/include/" ] configs = [ ":tools_ability_delegator_config" ] sources = [ "${ability_runtime_path}/tools/aa/src/accessibility_ability_command.cpp", "${ability_runtime_path}/tools/aa/src/accessibility_ability_utils.cpp", "accessibility_ability_command_first_test.cpp", "accessibility_ability_command_second_test.cpp", "mock_accessibility_config.cpp", ] deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set", "//third_party/googletest:gtest_main", ] external_deps = [ "ability_base:configuration", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "accessibility:accessibility_common", "accessibility:accessibilityclient", "accessibility:accessibilityconfig", "bundle_framework:appexecfwk_base", "hilog:libhilog", "ipc:ipc_core", ] } } group("unittest") { testonly = true deps = [ ":ability_command_test", ":shell_command_result_test", ":test_observer_proxy_test", ":test_observer_stub_test", ":test_observer_test", ] if (accessibility_enable) { deps += [ ":accessibility_ability_command_test", ":shell_command_executor_test", ] } }