1# Copyright (c) 2024 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/hiviewdfx/hiview/hiview.gni") 15import("//build/test.gni") 16 17module_output_path = "hiview/usage_event_report" 18 19config("usage_event_report_test_config") { 20 visibility = [ ":*" ] 21 22 include_dirs = [ 23 ".", 24 "$hiview_base/event_report/event/include", 25 "$hiview_base/event_report/factory/include", 26 "$hiview_base/event_report/include", 27 "$hiview_plugin/usage_event_report/cache/include", 28 "$hiview_plugin/usage_event_report/event/include", 29 "$hiview_plugin/usage_event_report/idl/include", 30 "$hiview_plugin/usage_event_report/include", 31 "$hiview_plugin/usage_event_report/service/factory/include", 32 ] 33 34 cflags = [ "-D__UNITTEST__" ] 35} 36 37ohos_unittest("UsageEventReportTest") { 38 module_out_path = module_output_path 39 configs = [ ":usage_event_report_test_config" ] 40 41 sources = [ "usage_event_report_test.cpp" ] 42 43 deps = [ 44 "$hiview_base:hiviewbase_static_lib_for_tdd", 45 "$hiview_base/event_report:hiview_event_report", 46 "$hiview_plugin/usage_event_report:usage_event_report", 47 ] 48 49 external_deps = [ 50 "ability_runtime:ability_manager", 51 "ability_runtime:app_manager", 52 "bundle_framework:appexecfwk_base", 53 "bundle_framework:appexecfwk_core", 54 "c_utils:utils", 55 "ffrt:libffrt", 56 "googletest:gtest_main", 57 "hilog:libhilog", 58 "hisysevent:libhisysevent", 59 "relational_store:native_rdb", 60 "samgr:samgr_proxy", 61 "window_manager:libdm", 62 ] 63 64 defines = [] 65 if (power_manager_enable) { 66 external_deps += [ "power_manager:powermgr_client" ] 67 defines += [ "POWER_MANAGER_ENABLE" ] 68 } 69} 70 71ohos_unittest("UsageEventReportCacheTest") { 72 module_out_path = module_output_path 73 configs = [ ":usage_event_report_test_config" ] 74 75 sources = [ "usage_event_report_cache_test.cpp" ] 76 77 deps = [ 78 "$hiview_base/event_report:hiview_event_report", 79 "$hiview_plugin/usage_event_report:usage_event_report_for_test", 80 ] 81 82 external_deps = [ 83 "c_utils:utils", 84 "googletest:gtest_main", 85 "hilog:libhilog", 86 "hisysevent:libhisysevent", 87 "relational_store:native_rdb", 88 ] 89} 90 91ohos_unittest("FoldAppUsageTest") { 92 module_out_path = module_output_path 93 configs = [ ":usage_event_report_test_config" ] 94 95 sources = [ "fold_app_usage_test.cpp" ] 96 97 deps = [ "$hiview_plugin/usage_event_report:usage_event_report_for_test" ] 98 99 external_deps = [ 100 "ability_runtime:app_manager", 101 "c_utils:utils", 102 "googletest:gtest_main", 103 "hilog:libhilog", 104 "hisysevent:libhisysevent", 105 "relational_store:native_rdb", 106 ] 107} 108