# 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("//build/test.gni") import("../../../../powermgr.gni") module_output_path = "${powermgr_part_name}/powermgr_native" ############################################################################### config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "${powermgr_service_path}/native/src/actions/", "${powermgr_service_path}/native/src/actions/default", "${powermgr_service_path}/native/src/hibernate", "${powermgr_service_path}/native/src/runninglock", "${powermgr_service_path}/native/src/shutdown", "${powermgr_service_path}/native/src/suspend", "${powermgr_service_path}/native/src/wakeup", "${powermgr_service_path}/native/src/screenoffpre", "${powermgr_root_path}/test/unittest/include", "${powermgr_root_path}/test/unittest/include/servicetest", "${powermgr_root_path}/test/unittest/include/servicetest/mock", "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include/", ] if (power_manager_feature_wakeup_action) { include_dirs += [ "${powermgr_service_path}/native/src/wakeup_action" ] } } config("module_mock_private_config") { include_dirs = [ "${powermgr_root_path}/test/unittest/include/mock", "${powermgr_root_path}/test/unittest/mock", "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include/", "//commonlibrary/c_utils/base/include/", "${powermgr_service_zidl}/include", ] } deps_ex = [ "ability_base:base", "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", "common_event_service:cesfwk_innerkits", "ffrt:libffrt", "hilog:libhilog", "ipc:ipc_core", "power_manager:power_ffrt", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] if (has_sensors_sensor_part) { deps_ex += [ "sensor:sensor_interface_native" ] } ##############################native_test########################################## ohos_unittest("powermgr_native_test") { module_out_path = module_output_path sources = [ "powermgr_service_native_test.cpp", "powermgr_service_test_proxy.cpp", ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", "${powermgr_utils_path}:coverage_flags", ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "//third_party/googletest:gtest_main", ] external_deps = [ "image_framework:image_native" ] external_deps += deps_ex } ##############################native_mock_parcel_test########################################## ohos_unittest("powermgr_native_mock_parcel_test") { module_out_path = module_output_path sources = [ "${powermgr_root_path}/test/unittest/mock/mock_message_parcel.cpp", "${powermgr_root_path}/test/unittest/mock/mock_parcel.cpp", "mock/powermgr_service_mock_parcel_test.cpp", "powermgr_service_test_proxy.cpp", ] configs = [ "${powermgr_utils_path}:utils_config", ":module_private_config", ":module_mock_private_config", "${powermgr_utils_path}:coverage_flags", ] defines = [ "MOCK_WRITE_INTERFACE_TOKEN_RETURN_TRUE" ] deps = [ "${powermgr_inner_api}:powermgr_client", "${powermgr_service_path}:powermgr_stub", "${powermgr_service_path}:powermgrservice", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } group("unittest") { testonly = true deps = [ ":powermgr_native_mock_parcel_test", ":powermgr_native_test", ] }