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("../../../../powermgr.gni") 16 17module_output_path = "${powermgr_part_name}/powermgr_native" 18 19############################################################################### 20config("module_private_config") { 21 visibility = [ ":*" ] 22 23 include_dirs = [ 24 "${powermgr_service_path}/native/src/actions/", 25 "${powermgr_service_path}/native/src/actions/default", 26 "${powermgr_service_path}/native/src/shutdown", 27 "${powermgr_service_path}/native/src/suspend", 28 "${powermgr_service_path}/native/src/wakeup", 29 "${powermgr_root_path}/test/unittest/include", 30 "${powermgr_root_path}/test/unittest/include/servicetest", 31 "${powermgr_root_path}/test/unittest/include/servicetest/mock", 32 "//foundation/multimodalinput/input/interfaces/native/innerkits/event/include/", 33 ] 34} 35 36config("module_mock_private_config") { 37 include_dirs = [ 38 "${powermgr_root_path}/test/unittest/include/mock", 39 "${powermgr_root_path}/test/unittest/mock", 40 "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include/", 41 "//commonlibrary/c_utils/base/include/", 42 "${powermgr_service_zidl}/include", 43 ] 44} 45 46deps_ex = [ 47 "ability_base:base", 48 "ability_base:want", 49 "ability_runtime:ability_manager", 50 "common_event_service:cesfwk_innerkits", 51 "ipc:ipc_core", 52 "hilog:libhilog", 53 "safwk:system_ability_fwk", 54 "samgr:samgr_proxy", 55 "sensor:sensor_interface_native", 56 "c_utils:utils", 57] 58 59##############################native_test########################################## 60ohos_unittest("powermgr_native_test") { 61 module_out_path = module_output_path 62 63 sources = [ 64 "powermgr_service_native_test.cpp", 65 "powermgr_service_test_proxy.cpp", 66 ] 67 68 configs = [ 69 "${powermgr_utils_path}:utils_config", 70 ":module_private_config", 71 "${powermgr_utils_path}:coverage_flags", 72 ] 73 74 deps = [ 75 "${powermgr_inner_api}:powermgr_client", 76 "${powermgr_service_path}:powermgr_stub", 77 "${powermgr_service_path}:powermgrservice", 78 "//third_party/googletest:gtest_main", 79 ] 80 81 external_deps = [ "image_framework:image_native" ] 82 external_deps += deps_ex 83} 84 85##############################native_mock_parcel_test########################################## 86ohos_unittest("powermgr_native_mock_parcel_test") { 87 module_out_path = module_output_path 88 89 sources = [ 90 "${powermgr_root_path}/test/unittest/mock/mock_message_parcel.cpp", 91 "${powermgr_root_path}/test/unittest/mock/mock_parcel.cpp", 92 "mock/powermgr_service_mock_parcel_test.cpp", 93 "powermgr_service_test_proxy.cpp", 94 ] 95 96 configs = [ 97 "${powermgr_utils_path}:utils_config", 98 ":module_private_config", 99 ":module_mock_private_config", 100 "${powermgr_utils_path}:coverage_flags", 101 ] 102 103 defines = [ "MOCK_WRITE_INTERFACE_TOKEN_RETURN_TRUE" ] 104 105 deps = [ 106 "${powermgr_inner_api}:powermgr_client", 107 "${powermgr_service_path}:powermgr_stub", 108 "${powermgr_service_path}:powermgrservice", 109 "//third_party/googletest:gtest_main", 110 ] 111 112 external_deps = deps_ex 113} 114 115group("unittest") { 116 testonly = true 117 deps = [ 118 ":powermgr_native_mock_parcel_test", 119 ":powermgr_native_test", 120 ] 121} 122