• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/unified_collector"
18
19config("unittest_config") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    ".",
24    "$hiview_plugin/unified_collector/storage/include",
25    "$hiview_plugin/unified_collector/power/include",
26  ]
27
28  cflags = [ "-D__UNITTEST__" ]
29}
30
31config("state_observer_config") {
32  visibility = [ ":*" ]
33
34  include_dirs = [
35    ".",
36    "$hiview_framework/native/unified_collection/process/include",
37    "$hiview_plugin/unified_collector/observer/include",
38  ]
39
40  cflags = [ "-D__UNITTEST__" ]
41}
42
43config("statetest_config") {
44  visibility = [ ":*" ]
45
46  include_dirs = [
47    ".",
48    "mock/include",
49    "$hiview_base/utility/include",
50    "$hiview_plugin/unified_collector/app_trace/include",
51    "$hiview_plugin/unified_collector/include",
52    "$hiview_plugin/unified_collector/observer/include",
53    "$hiview_plugin/unified_collector/storage/include",
54    "$hiview_plugin/unified_collector/task/include",
55    "$hiview_plugin/unified_collector/power/include",
56    "$hiview_framework/native/unified_collection/collector/impl/trace/utils/include",
57    "$hiview_framework/native/unified_collection/collector/inner_include",
58    "$hiview_framework/native/unified_collection/process/include",
59    "$hiview_framework/native/unified_collection/decorator/include",
60    "$hiview_base/event_report/include/",
61    "$hiview_plugin/usage_event_report/include/",
62    "$hiview_core/include/",
63    "$hiview_core/param_update/include",
64    "$hiview_root/include",
65    "$hiview_base/include/",
66  ]
67
68  if (power_manager_enable) {
69    include_dirs += [ "idl/include" ]
70  }
71
72  cflags = [ "-D__UNITTEST__" ]
73}
74
75ohos_unittest("CpuStorageTest") {
76  module_out_path = module_output_path
77
78  configs = [ ":unittest_config" ]
79
80  sources = [ "cpu_storage_test.cpp" ]
81
82  deps = [
83    "$hiview_base:hiviewbase_static_lib_for_tdd",
84    "$hiview_core:hiview_core",
85    "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_utility",
86    "$hiview_plugin/unified_collector:unified_collector",
87  ]
88
89  external_deps = [
90    "ffrt:libffrt",
91    "googletest:gmock",
92    "googletest:gtest_main",
93    "hilog:libhilog",
94    "relational_store:native_rdb",
95  ]
96
97  if (power_manager_enable) {
98    external_deps += [
99      "common_event_service:cesfwk_innerkits",
100      "power_manager:powermgr_client",
101    ]
102    defines = [ "POWER_MANAGER_ENABLE" ]
103  }
104}
105
106ohos_unittest("UCStateObserverTest") {
107  module_out_path = module_output_path
108
109  configs = [ ":state_observer_config" ]
110
111  sources = [ "uc_state_observer_test.cpp" ]
112
113  deps = [
114    "$hiview_base:hiviewbase_static_lib_for_tdd",
115    "$hiview_plugin/unified_collector:unified_collector",
116  ]
117
118  external_deps = [
119    "ability_base:want",
120    "ability_runtime:app_manager",
121    "googletest:gtest_main",
122    "hilog:libhilog",
123    "ipc:ipc_single",
124    "safwk:system_ability_fwk",
125  ]
126}
127