• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024-2025 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_module + "/unified_collector"
18
19config("unittest_config") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    ".",
24    "$hiview_plugin/unified_collector/include",
25    "$hiview_plugin/unified_collector/storage/include",
26  ]
27
28  if (power_manager_enable) {
29    include_dirs += [
30      "$hiview_plugin/unified_collector/power/include",
31    ]
32  }
33
34  cflags = [ "-D__UNITTEST__" ]
35}
36
37config("state_observer_config") {
38  visibility = [ ":*" ]
39
40  include_dirs = [
41    ".",
42    "$hiview_framework/native/unified_collection/process/include",
43    "$hiview_plugin/unified_collector/observer/include",
44  ]
45
46  cflags = [ "-D__UNITTEST__" ]
47}
48
49ohos_unittest("CpuStorageTest") {
50  module_out_path = module_output_path
51
52  configs = [ ":unittest_config" ]
53
54  sources = [ "cpu_storage_test.cpp" ]
55
56  deps = [
57    "$hiview_base:hiviewbase_static_lib_for_tdd",
58    "$hiview_core:hiview_core",
59    "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_utility",
60    "$hiview_plugin/unified_collector:unified_collector",
61  ]
62
63  external_deps = [
64    "ffrt:libffrt",
65    "googletest:gmock",
66    "googletest:gtest_main",
67    "hilog:libhilog",
68    "relational_store:native_rdb",
69  ]
70
71  if (power_manager_enable) {
72    external_deps += [
73      "ability_base:want",
74      "common_event_service:cesfwk_innerkits",
75      "power_manager:powermgr_client",
76    ]
77    defines = [ "POWER_MANAGER_ENABLE" ]
78  }
79}
80
81ohos_unittest("UCStateObserverTest") {
82  module_out_path = module_output_path
83
84  configs = [ ":state_observer_config" ]
85
86  sources = [ "uc_state_observer_test.cpp" ]
87
88  deps = [
89    "$hiview_base:hiviewbase_static_lib_for_tdd",
90    "$hiview_plugin/unified_collector:unified_collector",
91  ]
92
93  external_deps = [
94    "ability_base:want",
95    "ability_runtime:app_manager",
96    "googletest:gtest_main",
97    "hilog:libhilog",
98    "ipc:ipc_single",
99    "safwk:system_ability_fwk",
100  ]
101}
102