1# Copyright (c) 2023 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("../../../displaymgr.gni") 16 17config("module_private_config") { 18 visibility = [ ":*" ] 19 include_dirs = [ 20 "${brightnessmgr_root_path}/include", 21 "${displaymgr_inner_api}/include/native/include", 22 "${displaymgr_utils_path}/native/include", 23 ] 24} 25 26set_defaults("ohos_unittest") { 27 module_out_path = "display_manager/display_brightness_manager" 28 29 configs = [ 30 "${brightnessmgr_root_path}:brightness_manager_config", 31 "${displaymgr_utils_path}:coverage_flags", 32 "${displaymgr_utils_path}:utils_config", 33 ":module_private_config", 34 ] 35 36 deps = [ "${displaymgr_inner_api}:displaymgr" ] 37 38 external_deps = [ 39 "ability_base:want", 40 "ability_base:zuri", 41 "ability_runtime:ability_manager", 42 "cJSON:cjson", 43 "c_utils:utils", 44 "common_event_service:cesfwk_innerkits", 45 "data_share:datashare_consumer", 46 "eventhandler:libeventhandler", 47 "ffrt:libffrt", 48 "googletest:gtest_main", 49 "hicollie:libhicollie", 50 "hilog:libhilog", 51 "ipc:ipc_core", 52 "power_manager:power_ffrt", 53 "power_manager:power_setting", 54 "power_manager:power_sysparam", 55 "power_manager:powermgr_client", 56 "safwk:system_ability_fwk", 57 "samgr:samgr_proxy", 58 "window_manager:libdm_lite", 59 ] 60} 61 62ohos_unittest("brightness_manager_ext_test") { 63 sources = [ 64 "${brightnessmgr_root_path}/src/brightness_manager_ext.cpp", 65 "./src/brightness_manager_ext_test.cpp", 66 "./src/mock_brightness_manager_interface.cpp", 67 ] 68 69 include_dirs = [ "./include/" ] 70 71 defines += [ "BRIGHTNESS_DT_ENABLE" ] 72} 73 74ohos_unittest("brightness_manager_test") { 75 sources = [ "./src/brightness_manager_test.cpp" ] 76 77 deps += [ "${brightnessmgr_root_path}:brightness_manager" ] 78} 79 80ohos_unittest("brightness_service_test") { 81 sources = [ "./src/brightness_service_test.cpp" ] 82 83 deps += [ "${brightnessmgr_root_path}:brightness_manager" ] 84} 85 86ohos_unittest("brightness_config_parse_test") { 87 sanitize = { 88 cfi = true 89 cfi_cross_dso = true 90 debug = false 91 } 92 branch_protector_ret = "pac_ret" 93 sources = [ "./src/brightness_config_parse_test.cpp" ] 94 cflags = [ 95 "-Dprivate=public", 96 "-Dprotected=public", 97 ] 98 deps += [ "${brightnessmgr_root_path}:brightness_manager" ] 99} 100 101group("unittest") { 102 testonly = true 103 deps = [ ":brightness_manager_test" ] 104 if (display_manager_feature_brightnessext != "") { 105 deps += [ ":brightness_manager_ext_test" ] 106 } else { 107 deps += [ ":brightness_service_test" ] 108 } 109 deps += [ ":brightness_config_parse_test" ] 110} 111