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 = "${displaymgr_part_name}/brightness_manager/test"
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 = [
37    "${displaymgr_inner_api}:displaymgr",
38    "//third_party/googletest:gtest_main",
39  ]
40
41  external_deps = [
42    "ability_base:want",
43    "ability_base:zuri",
44    "ability_runtime:ability_manager",
45    "c_utils:utils",
46    "common_event_service:cesfwk_innerkits",
47    "data_share:datashare_consumer",
48    "ffrt:libffrt",
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
86group("unittest") {
87  testonly = true
88  deps = [ ":brightness_manager_test" ]
89  if (display_manager_feature_brightnessext != "") {
90    deps += [ ":brightness_manager_ext_test" ]
91  } else {
92    deps += [ ":brightness_service_test" ]
93  }
94}
95