# Copyright (c) 2021-2022 Huawei Device Co., Ltd.module_private_config # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("../../../../batterystats.gni") module_output_path = "${batterystats_part_name}/batterystats" config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "${batterystats_root_path}/test/unittest/include", "${batterystats_root_path}/test/unittest/include/clienttest", "${batterystats_service_native}/include", ] } config("module_mock_private_config") { include_dirs = [ "${batterystats_root_path}/test/unittest/include/clienttest/mock", "${batterystats_root_path}/test/unittest/mock/include", "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include/", "//commonlibrary/c_utils/base/include/", ] } deps_ex = [ "ability_base:base", "ability_base:want", "call_manager:tel_call_manager_api", "common_event_service:cesfwk_innerkits", "config_policy:configpolicy_util", "c_utils:utils", "display_manager:displaymgr", "hisysevent:libhisysevent", "hisysevent:libhisyseventmanager", "hilog:libhilog", "ipc:ipc_core", "power_manager:powermgr_client", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] ############################service_test############################# ohos_unittest("stats_service_test") { module_out_path = module_output_path sources = [ "stats_service_test.cpp" ] configs = [ "${batterystats_utils_path}:batterystats_utils_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_service_path}:batterystats_service", "${batterystats_service_path}:batterystats_stub", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ############################service_death_test############################# ohos_unittest("stats_service_death_test") { module_out_path = module_output_path sources = [ "${batterystats_root_path}/test/unittest/mock/source/mock_battery_stats_parser.cpp", "stats_service_death_test.cpp", ] configs = [ ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] defines = [ "STATS_SERVICE_DEATH_UT" ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_service_path}:batterystats_stub", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################wifi_test############################# ohos_unittest("stats_wifi_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_wifi_test.cpp", ] configs = [ "${batterystats_utils_path}:batterystats_utils_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex external_deps += [ "wifi:wifi_sdk" ] } ############################camera_test############################# ohos_unittest("stats_camera_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_camera_test.cpp", ] configs = [ "${batterystats_utils_path}:batterystats_utils_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################audio_test############################# ohos_unittest("stats_audio_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_audio_test.cpp", ] configs = [ ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################powermgr_test############################# ohos_unittest("stats_powermgr_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_powermgr_test.cpp", ] configs = [ "${batterystats_utils_path}:batterystats_utils_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################location_test############################# ohos_unittest("stats_location_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_location_test.cpp", ] configs = [ "${batterystats_utils_path}:batterystats_utils_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################dump_test############################# ohos_unittest("stats_dump_test") { module_out_path = module_output_path sources = [ "stats_dump_test.cpp" ] configs = [ "${batterystats_utils_path}:batterystats_utils_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ############################display_test############################# ohos_unittest("stats_display_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_display_test.cpp", ] configs = [ ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################phone_test############################# ohos_unittest("stats_phone_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_phone_test.cpp", ] configs = [ ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################bluetooth_test############################# ohos_unittest("stats_bluetooth_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_bluetooth_test.cpp", ] configs = [ ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex external_deps += [ "bluetooth:btframework" ] } ############################alarm_test############################# ohos_unittest("stats_alarm_test") { module_out_path = module_output_path sources = [ "${batterystats_service_path}/native/src/battery_stats_parser.cpp", "stats_alarm_test.cpp", ] configs = [ ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################util_test############################# ohos_unittest("stats_util_test") { module_out_path = module_output_path sources = [ "stats_util_test.cpp" ] configs = [ "${batterystats_utils_path}:coverage_flags", ":module_private_config", "${batterystats_utils_path}:batterystats_utils_config", ] deps = [ "${batterystats_service_path}:batterystats_service", "${batterystats_service_path}:batterystats_stub", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", ] external_deps = deps_ex } ############################client_test_mock_parcel############################# ohos_unittest("stats_client_test_mock_parcel") { module_out_path = module_output_path sources = [ "${batterystats_root_path}/test/unittest/mock/source/mock_message_parcel.cpp", "${batterystats_root_path}/test/unittest/mock/source/mock_parcel.cpp", "${batterystats_service_path}/zidl/src/battery_stats_proxy.cpp", "mock/stats_client_test_mock_parcel.cpp", ] configs = [ ":module_mock_private_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################client_test_mock_object############################# ohos_unittest("stats_client_test_mock_object") { module_out_path = module_output_path sources = [ "${batterystats_root_path}/test/unittest/mock/source/mock_stats_remote_object.cpp", "${batterystats_service_path}/zidl/src/battery_stats_proxy.cpp", "mock/stats_client_test_mock_object.cpp", ] configs = [ ":module_mock_private_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } ############################mock_peer_test############################# ohos_unittest("stats_client_test_mock_peer") { module_out_path = module_output_path sources = [ "${batterystats_root_path}/test/unittest/mock/source/mock_peer_holder.cpp", "${batterystats_service_path}/zidl/src/battery_stats_proxy.cpp", "mock/stats_client_test_mock_peer.cpp", ] configs = [ ":module_mock_private_config", ":module_private_config", "${batterystats_utils_path}:coverage_flags", ] deps = [ "${batterystats_inner_api}:batterystats_client", "${batterystats_service_path}:batterystats_service", "${batterystats_utils_path}:batterystats_utils", "//third_party/googletest:gtest_main", "//third_party/jsoncpp:jsoncpp", ] external_deps = deps_ex } group("unittest") { testonly = true deps = [ ":stats_alarm_test", ":stats_audio_test", ":stats_bluetooth_test", ":stats_camera_test", ":stats_client_test_mock_object", ":stats_client_test_mock_parcel", ":stats_client_test_mock_peer", ":stats_display_test", ":stats_dump_test", ":stats_location_test", ":stats_phone_test", ":stats_powermgr_test", ":stats_service_death_test", ":stats_service_test", ":stats_util_test", ":stats_wifi_test", ] }