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("//base/powermgr/display_manager/displaymgr.gni") 15import("//base/powermgr/power_manager/powermgr.gni") 16import("//build/test.gni") 17 18module_output_path = "${displaymgr_part_name}/displaymgr" 19 20############################################################################### 21config("module_private_config") { 22 visibility = [ ":*" ] 23 24 include_dirs = [ 25 "include", 26 "include/mock", 27 "mock/include", 28 "${displaymgr_innerkits}/native/include", 29 "${displaymgr_service_zidl}/include", 30 "${displaymgr_utils_path}/native/include", 31 ] 32} 33 34deps_ex = [ 35 "ability_base:want", 36 "ability_base:zuri", 37 "ability_runtime:ability_manager", 38 "c_utils:utils", 39 "hiviewdfx_hilog_native:libhilog", 40 "ipc:ipc_core", 41 "power_manager:powermgr_client", 42 "safwk:system_ability_fwk", 43 "samgr:samgr_proxy", 44] 45 46##############################unittest########################################## 47ohos_unittest("unittest_display_mgr_service") { 48 module_out_path = module_output_path 49 50 sources = [ 51 "src/display_power_mgr_brightness_test.cpp", 52 "src/display_power_mgr_service_test.cpp", 53 ] 54 55 configs = [ 56 "${displaymgr_utils_path}:utils_config", 57 ":module_private_config", 58 ] 59 60 deps = [ 61 "${displaymgr_innerkits}:displaymgr", 62 "${powermgr_utils_path}/setting:power_setting", 63 "//third_party/googletest:gtest_main", 64 ] 65 66 external_deps = [ 67 "ability_base:want", 68 "ability_base:zuri", 69 "ability_runtime:ability_manager", 70 "c_utils:utils", 71 "data_share:datashare_consumer", 72 "hiviewdfx_hilog_native:libhilog", 73 "ipc:ipc_core", 74 "power_manager:powermgr_client", 75 "safwk:system_ability_fwk", 76 "samgr:samgr_proxy", 77 ] 78} 79 80############################display_service_death_test############################# 81ohos_unittest("display_service_death_test") { 82 module_out_path = module_output_path 83 84 sources = [ "src/display_service_death_test.cpp" ] 85 86 configs = [ 87 "${displaymgr_utils_path}:utils_config", 88 ":module_private_config", 89 ] 90 91 defines = [ "DISPLAY_SERVICE_DEATH_UT" ] 92 93 deps = [ 94 "${displaymgr_innerkits}:displaymgr", 95 "${powermgr_utils_path}/setting:power_setting", 96 "//third_party/googletest:gtest_main", 97 ] 98 99 external_deps = deps_ex 100} 101 102############################display_mock_parcel_test############################# 103ohos_unittest("display_mock_parcel_test") { 104 module_out_path = module_output_path 105 106 sources = [ 107 "mock/src/mock_message_parcel.cpp", 108 "mock/src/mock_parcel.cpp", 109 "src/mock/display_mock_parcel_test.cpp", 110 ] 111 112 configs = [ 113 "${displaymgr_utils_path}:utils_config", 114 ":module_private_config", 115 ] 116 117 deps = [ 118 "${displaymgr_innerkits}:displaymgr", 119 "${powermgr_utils_path}/setting:power_setting", 120 "//third_party/googletest:gtest_main", 121 ] 122 123 external_deps = deps_ex 124} 125 126############################display_mock_test############################# 127ohos_unittest("display_mock_test") { 128 module_out_path = module_output_path 129 130 sources = [ 131 "mock/src/mock_display_remote_object.cpp", 132 "mock/src/mock_message_parcel.cpp", 133 "mock/src/mock_parcel.cpp", 134 "src/mock/display_mock_test.cpp", 135 ] 136 137 configs = [ 138 "${displaymgr_utils_path}:utils_config", 139 ":module_private_config", 140 ] 141 142 defines = [ 143 "MOCK_READSTRING_DESCRIPTIR", 144 "MOCK_WRITE_INTERFACE_TOKEN_RETURN_TRUE", 145 ] 146 147 deps = [ 148 "${displaymgr_innerkits}:displaymgr", 149 "${powermgr_utils_path}/setting:power_setting", 150 "//third_party/googletest:gtest_main", 151 ] 152 153 external_deps = deps_ex 154} 155 156############################display_mock_object_test############################# 157ohos_unittest("display_mock_object_test") { 158 module_out_path = module_output_path 159 160 sources = [ 161 "mock/src/mock_display_remote_object.cpp", 162 "src/mock/display_mock_object_test.cpp", 163 ] 164 165 configs = [ 166 "${displaymgr_utils_path}:utils_config", 167 ":module_private_config", 168 ] 169 170 deps = [ 171 "${displaymgr_innerkits}:displaymgr", 172 "${powermgr_utils_path}/setting:power_setting", 173 "//third_party/googletest:gtest_main", 174 ] 175 176 external_deps = deps_ex 177} 178 179group("unittest") { 180 testonly = true 181 deps = [ 182 ":display_mock_object_test", 183 ":display_mock_parcel_test", 184 ":display_mock_test", 185 ":display_service_death_test", 186 ] 187} 188