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