• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022  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")
15
16module_output_path = "device_usage_statistics/deviceusagestatisticstest"
17
18config("module_private_config") {
19  visibility = [ ":*" ]
20
21  include_dirs = [
22    "../../interfaces/innerkits/include",
23    "../../services/common/include",
24    "../../services/packageusage/include",
25    "../../services/packagegroup/include",
26    "../../utils/include",
27    "//third_party/jsoncpp/include",
28  ]
29}
30
31ohos_unittest("DeviceUsageStatsTest") {
32  module_out_path = module_output_path
33
34  sources = [ "device_usage_statistics_test.cpp" ]
35
36  configs = [ ":module_private_config" ]
37
38  deps = [
39    "../../:usagestatservice_static",
40    "../../:usagestatsinner",
41    "../../:usagestatsutils",
42    "//third_party/jsoncpp:jsoncpp",
43  ]
44
45  external_deps = [
46    "c_utils:utils",
47    "eventhandler:libeventhandler",
48    "hilog:libhilog",
49    "ipc:ipc_single",
50    "power_manager:powermgr_client",
51    "safwk:system_ability_fwk",
52    "samgr:samgr_proxy",
53  ]
54}
55
56ohos_unittest("DeviceUsageStatsMultiTest") {
57  module_out_path = module_output_path
58
59  sources = [ "device_usage_statistics_multi_test.cpp" ]
60
61  configs = [ ":module_private_config" ]
62
63  deps = [
64    "../../:usagestatservice_static",
65    "../../:usagestatsinner",
66    "../../:usagestatsutils",
67    "//third_party/jsoncpp:jsoncpp",
68  ]
69
70  external_deps = [
71    "c_utils:utils",
72    "eventhandler:libeventhandler",
73    "hilog:libhilog",
74    "ipc:ipc_single",
75    "power_manager:powermgr_client",
76    "safwk:system_ability_fwk",
77    "samgr:samgr_proxy",
78  ]
79}
80
81ohos_unittest("DeviceUsageStatsServiceTest") {
82  module_out_path = module_output_path
83
84  sources = [ "device_usage_statistics_service_test.cpp" ]
85
86  configs = [ ":module_private_config" ]
87
88  deps = [
89    "../../:usagestatservice_static",
90    "../../:usagestatsinner",
91    "../../:usagestatsutils",
92    "//third_party/jsoncpp:jsoncpp",
93  ]
94
95  external_deps = [
96    "ability_runtime:app_manager",
97    "ability_runtime:wantagent_innerkits",
98    "access_token:libaccesstoken_sdk",
99    "c_utils:utils",
100    "common_event_service:cesfwk_innerkits",
101    "eventhandler:libeventhandler",
102    "hilog:libhilog",
103    "ipc:ipc_single",
104    "power_manager:powermgr_client",
105    "relational_store:native_rdb",
106    "safwk:system_ability_fwk",
107    "samgr:samgr_proxy",
108    "time_service:time_client",
109  ]
110}
111
112ohos_unittest("DeviceUsageStatsMockTest") {
113  module_out_path = module_output_path
114
115  sources = [
116    "device_usage_statistics_mock_test.cpp",
117    "mock/bundle_active_account_helper_mock.cpp",
118    "mock/bundle_active_client_mock.cpp",
119    "mock/bundle_active_core_mock.cpp",
120    "mock/bundle_active_usage_database_mock.cpp",
121    "mock/mock_service_registry.cpp",
122  ]
123
124  include_dirs = [ "mock/include" ]
125
126  configs = [ ":module_private_config" ]
127
128  deps = [
129    "../../:usagestatservice_static",
130    "../../:usagestatsinner",
131    "../../:usagestatsutils",
132    "//third_party/jsoncpp:jsoncpp",
133  ]
134
135  external_deps = [
136    "ability_runtime:app_manager",
137    "ability_runtime:wantagent_innerkits",
138    "access_token:libaccesstoken_sdk",
139    "c_utils:utils",
140    "common_event_service:cesfwk_innerkits",
141    "eventhandler:libeventhandler",
142    "hilog:libhilog",
143    "ipc:ipc_single",
144    "power_manager:powermgr_client",
145    "relational_store:native_rdb",
146    "safwk:system_ability_fwk",
147    "samgr:samgr_proxy",
148    "time_service:time_client",
149  ]
150}
151
152ohos_unittest("DeviceUsagePackageUsageTest") {
153  module_out_path = module_output_path
154
155  sources = [ "package_usage_test.cpp" ]
156
157  configs = [ ":module_private_config" ]
158
159  deps = [
160    "../../:usagestatservice_static",
161    "../../:usagestatsinner",
162    "../../:usagestatsutils",
163    "//third_party/jsoncpp:jsoncpp",
164  ]
165
166  external_deps = [
167    "ability_runtime:app_manager",
168    "ability_runtime:wantagent_innerkits",
169    "access_token:libaccesstoken_sdk",
170    "bundle_framework:appexecfwk_base",
171    "c_utils:utils",
172    "common_event_service:cesfwk_innerkits",
173    "eventhandler:libeventhandler",
174    "hilog:libhilog",
175    "ipc:ipc_single",
176    "power_manager:powermgr_client",
177    "relational_store:native_rdb",
178    "safwk:system_ability_fwk",
179    "samgr:samgr_proxy",
180    "time_service:time_client",
181  ]
182}
183
184group("unittest") {
185  testonly = true
186  deps = [
187    ":DeviceUsagePackageUsageTest",
188    ":DeviceUsageStatsMockTest",
189    ":DeviceUsageStatsMultiTest",
190    ":DeviceUsageStatsServiceTest",
191    ":DeviceUsageStatsTest",
192  ]
193}
194