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/ohos.gni")
15import("//build/test.gni")
16import("//foundation/ability/ability_runtime/ability_runtime.gni")
17
18ohos_unittest("main_thread_test") {
19  module_out_path = "ability_runtime/appkit"
20
21  include_dirs = [
22    "${ability_runtime_path}/interfaces/kits/native/appkit/dfr",
23    "${ability_runtime_test_path}/mock/services_appmgr_test/include",
24  ]
25
26  sources = [
27    "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp",
28    "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp",
29    "${ability_runtime_test_path}/mock/services_appmgr_test/src/sys_mgr_client_mock.cpp",
30    "main_thread_test.cpp",
31  ]
32
33  configs = [ "${ability_runtime_services_path}/common:common_config" ]
34
35  cflags = []
36
37  if (target_cpu == "arm") {
38    cflags += [ "-DBINDER_IPC_32BIT" ]
39  }
40
41  deps = [
42    "${ability_runtime_native_path}/appkit:appkit_native",
43    "//third_party/googletest:gmock_main",
44    "//third_party/googletest:gtest_main",
45  ]
46
47  public_deps =
48      [ "${global_path}/resource_management/frameworks/resmgr:global_resmgr" ]
49
50  external_deps = [
51    "ability_base:configuration",
52    "ability_base:want",
53    "ability_base:zuri",
54    "ability_runtime:ability_deps_wrapper",
55    "ability_runtime:ability_manager",
56    "ability_runtime:abilitykit_native",
57    "ability_runtime:app_manager",
58    "ability_runtime:runtime",
59    "bundle_framework:appexecfwk_base",
60    "bundle_framework:appexecfwk_core",
61    "c_utils:utils",
62    "common_event_service:cesfwk_innerkits",
63    "eventhandler:libeventhandler",
64    "faultloggerd:libbacktrace_local",
65    "faultloggerd:libfaultloggerd",
66    "hilog:libhilog",
67    "hisysevent:libhisysevent",
68    "hitrace:hitrace_meter",
69    "init:libbegetutil",
70    "ipc:ipc_core",
71    "napi:ace_napi",
72    "samgr:samgr_proxy",
73  ]
74}
75
76ohos_unittest("main_thread_by_mock_bms_test") {
77  module_out_path = "ability_runtime/appkit"
78
79  include_dirs = [
80    "${ability_runtime_test_path}/mock/common/include",
81    "${ability_runtime_test_path}/mock/services_appmgr_test/include",
82  ]
83
84  sources = [
85    "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_bundle_manager.cpp",
86    "${ability_runtime_test_path}/mock/services_appmgr_test/src/mock_overlay_manager.cpp",
87    "${ability_runtime_test_path}/mock/services_appmgr_test/src/sys_mgr_client_mock.cpp",
88    "main_thread_by_mock_bms_test.cpp",
89  ]
90
91  configs = [ "${ability_runtime_services_path}/common:common_config" ]
92
93  cflags = []
94
95  if (target_cpu == "arm") {
96    cflags += [ "-DBINDER_IPC_32BIT" ]
97  }
98
99  deps = [
100    "${ability_runtime_native_path}/appkit:appkit_native",
101    "//third_party/googletest:gmock_main",
102    "//third_party/googletest:gtest_main",
103  ]
104
105  public_deps =
106      [ "${global_path}/resource_management/frameworks/resmgr:global_resmgr" ]
107
108  external_deps = [
109    "ability_base:configuration",
110    "ability_base:want",
111    "ability_base:zuri",
112    "ability_runtime:ability_deps_wrapper",
113    "ability_runtime:ability_manager",
114    "ability_runtime:abilitykit_native",
115    "ability_runtime:app_manager",
116    "ability_runtime:runtime",
117    "bundle_framework:appexecfwk_base",
118    "bundle_framework:appexecfwk_core",
119    "c_utils:utils",
120    "common_event_service:cesfwk_innerkits",
121    "eventhandler:libeventhandler",
122    "faultloggerd:libbacktrace_local",
123    "faultloggerd:libfaultloggerd",
124    "hilog:libhilog",
125    "hisysevent:libhisysevent",
126    "hitrace:hitrace_meter",
127    "init:libbegetutil",
128    "ipc:ipc_core",
129    "napi:ace_napi",
130    "samgr:samgr_proxy",
131  ]
132}
133
134group("unittest") {
135  testonly = true
136  deps = []
137}
138