• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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.
13import("//base/hiviewdfx/hiview/hiview.gni")
14import("//build/ohos.gni")
15import("//build/test.gni")
16module_output_path = "hiviewdfx/hiview"
17group("moduletest") {
18  testonly = true
19}
20
21ohos_unittest("HiviewPlatformModuleTest") {
22  module_out_path = module_output_path
23
24  include_dirs = [ "moduletest/common" ]
25
26  sources = [ "moduletest/common/hiview_plugin_platform_module_test.cpp" ]
27
28  deps = [
29    "$hiview_base:hiviewbase_static_lib_for_tdd",
30    "//third_party/googletest:gtest_main",
31  ]
32}
33
34config("HolisticPlatformTest_config") {
35  include_dirs = [
36    "../",
37    "$hiview_test/plugins/examples_bundle/bundle_event_source_example",
38    "$hiview_test/plugins/examples/event_source_example",
39  ]
40
41  cflags_cc = [
42    "-D__UNITTEST__",
43    "-D__HIVIEW_OHOS__",
44    "-DUSE_POLL",
45  ]
46}
47
48ohos_unittest("HolisticPlatformTest") {
49  module_out_path = module_output_path
50  configs = [ ":HolisticPlatformTest_config" ]
51
52  sources = [ "unittest/common/holistic_platform_test.cpp" ]
53
54  deps = [
55    "$hiview_base:hiviewbase_static_lib_for_tdd",
56    "$hiview_core:hiview_core",
57    "$hiview_root/test/plugins/examples/dynamic_load_plugin_example:dynamicloadpluginexample",
58    "$hiview_root/test/plugins/examples/event_processor_example1:event_processor_example1",
59    "$hiview_root/test/plugins/examples/event_processor_example2:event_processor_example2",
60    "$hiview_root/test/plugins/examples/event_processor_example3:event_processor_example3",
61    "$hiview_root/test/plugins/examples/event_processor_example4:event_processor_example4",
62    "$hiview_root/test/plugins/examples/event_processor_example5:event_processor_example5",
63    "$hiview_root/test/plugins/examples/event_source_example:event_source_example",
64    "$hiview_test/plugins/examples_bundle:bundleplugintest",
65    "//third_party/googletest:gtest_main",
66  ]
67
68  resource_config_file = "$hiview_test/resource/ohos_test.xml"
69}
70
71ohos_unittest("ReportXPowerEventTest") {
72  module_out_path = module_output_path
73  configs = []
74
75  sources = [ "unittest/xpower_event/xpower_event_test.cpp" ]
76
77  deps = [
78    "$hiview_root/interfaces/innerkits/xpower_event:libxpower_event",
79    "//third_party/googletest:gtest_main",
80  ]
81
82  external_deps = [ "init:libbegetutil" ]
83}
84
85ark_support = false
86if (!defined(ohos_lite)) {
87  import("//build/test.gni")
88  import("//foundation/arkui/ace_engine/ace_config.gni")
89  import("//foundation/arkui/napi/napi.gni")
90  import("//foundation/arkui/napi/test/unittest/ut.gni")
91
92  foreach(item, ace_platforms) {
93    if (item.name == "ohos") {
94      engine_config = item.config
95      js_engines = engine_config.js_engines
96      foreach(engine, js_engines) {
97        if (engine.engine_name == "ark") {
98          ark_support = true
99        }
100      }
101    }
102  }
103
104  if (ark_support) {
105    ohos_unittest("ReportXPowerJsEventTest") {
106      module_out_path = module_output_path
107      cflags = [ "-g3" ]
108      defines = [ "NAPI_TEST" ]
109      include_dirs = ark_include
110      include_dirs += [
111        "//foundation/arkui/napi/test/unittest/engine/",
112        "//foundation/arkui/napi/test/unittest/common/",
113      ]
114
115      sources = [
116        "//foundation/arkui/napi/test/unittest/engine/test_ark.cpp",
117        "unittest/xpower_event/xpower_jsevent_test.cpp",
118      ]
119      sources += napi_sources
120
121      deps = ark_deps
122      deps += [
123        "$hiview_root/interfaces/innerkits/xpower_event:libxpower_event_js",
124      ]
125
126      external_deps = [
127        "bounds_checking_function:libsec_shared",
128        "c_utils:utils",
129        "ets_runtime:libark_jsruntime",
130        "init:libbegetutil",
131        "napi:ace_napi",
132      ]
133
134      external_deps += [ "hilog:libhilog" ]
135    }
136  }
137}
138
139group("unittest") {
140  testonly = true
141  deps = [
142    ":HiviewPlatformModuleTest",
143    ":HolisticPlatformTest",
144    ":ReportXPowerEventTest",
145    "unittest/unified_collection/client:UCollectionClientUnitTest",
146    "unittest/unified_collection/utility:UCollectionUtilityUnitTest",
147  ]
148  if (ark_support) {
149    deps += [ ":ReportXPowerJsEventTest" ]
150  }
151}
152