From 6237b40affb4974697d8698433f4fd8e56395247 Mon Sep 17 00:00:00 2001 From: wuxiaodong02 Date: Wed, 30 Nov 2022 20:27:29 +0800 Subject: [PATCH 1/9] add ut Signed-off-by: wuxiaodong02 --- .../src/distributed_hardware_fwk_kit_test.cpp | 69 +++++++- .../test/unittest/BUILD.gn | 4 +- .../accessmanager/access_manager_test.cpp | 150 ++++++++++++++++++ .../{ => component_manager}/BUILD.gn | 0 .../include/component_manager_test.h | 0 .../include/mock_idistributed_hardware_sink.h | 0 .../mock_idistributed_hardware_source.h | 0 .../src/component_manager_test.cpp | 0 .../component_monitior/BUILD.gn | 68 ++++++++ .../include/component_monitor_test.h | 38 +++++ .../src/component_monitor_test.cpp | 59 +++++++ .../unittest/common/hidumphelper/BUILD.gn | 61 +++++++ .../include/enabled_comps_dump_test.h | 32 ++++ .../src/enabled_comps_dump_test.cpp | 80 ++++++++++ 14 files changed, 556 insertions(+), 5 deletions(-) rename services/distributedhardwarefwkservice/test/unittest/common/componentmanager/{ => component_manager}/BUILD.gn (100%) rename services/distributedhardwarefwkservice/test/unittest/common/componentmanager/{ => component_manager}/include/component_manager_test.h (100%) rename services/distributedhardwarefwkservice/test/unittest/common/componentmanager/{ => component_manager}/include/mock_idistributed_hardware_sink.h (100%) rename services/distributedhardwarefwkservice/test/unittest/common/componentmanager/{ => component_manager}/include/mock_idistributed_hardware_source.h (100%) rename services/distributedhardwarefwkservice/test/unittest/common/componentmanager/{ => component_manager}/src/component_manager_test.cpp (100%) create mode 100644 services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/BUILD.gn create mode 100644 services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/include/component_monitor_test.h create mode 100644 services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/src/component_monitor_test.cpp create mode 100644 services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn create mode 100644 services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/include/enabled_comps_dump_test.h create mode 100644 services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp diff --git a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp index ba667792..ad5fba4a 100644 --- a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp +++ b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp @@ -20,12 +20,14 @@ #include #include +#include "distributed_hardware_errno.h" +#include "dhfwk_sa_manager.h" +#include "distributed_hardware_log.h" #include "iservice_registry.h" #include "system_ability_definition.h" - +#define private public #include "distributed_hardware_fwk_kit.h" -#include "distributed_hardware_log.h" -#include "distributed_hardware_errno.h" +#undef private using OHOS::DistributedHardware::DHTopic; @@ -73,7 +75,13 @@ uint32_t DistributedHardwareFwkKitTest::TestPublisherListener::GetTopicMsgCnt(co return msgCnts_[topic]; } -HWTEST_F(DistributedHardwareFwkKitTest, RegisterListener01, testing::ext::TestSize.Level0) +/** + * @tc.name: RegisterPublisherListener_001 + * @tc.desc: Verify the RegisterPublisherListener function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(DistributedHardwareFwkKitTest, RegisterPublisherListener_001, testing::ext::TestSize.Level0) { sptr listener1 = new TestPublisherListener(); int32_t ret = dhfwkPtr_->RegisterPublisherListener(DHTopic::TOPIC_START_DSCREEN, listener1); @@ -103,5 +111,58 @@ HWTEST_F(DistributedHardwareFwkKitTest, RegisterListener01, testing::ext::TestSi ret = dhfwkPtr_->UnregisterPublisherListener(DHTopic::TOPIC_DEV_OFFLINE, listener4); EXPECT_EQ(DH_FWK_SUCCESS, ret); } + +/** + * @tc.name: PublishMessage_001 + * @tc.desc: Verify the PublishMessage function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(DistributedHardwareFwkKitTest, PublishMessage_001, testing::ext::TestSize.Level0) +{ + uint32_t invalid = 7; + DHTopic topic = static_cast(invalid); + std::string message; + EXPECT_EQ(ERR_DH_FWK_PARA_INVALID, dhfwkPtr_->PublishMessage(topic, message)); +} + +/** + * @tc.name: PublishMessage_002 + * @tc.desc: Verify the PublishMessage function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(DistributedHardwareFwkKitTest, PublishMessage_002, testing::ext::TestSize.Level0) +{ + DHTopic topic = DHTopic::TOPIC_STOP_DSCREEN; + std::string message; + EXPECT_EQ(ERR_DH_FWK_PARA_INVALID, dhfwkPtr_->PublishMessage(topic, message)); +} + +/** + * @tc.name: PublishMessage_003 + * @tc.desc: Verify the PublishMessage function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(DistributedHardwareFwkKitTest, PublishMessage_003, testing::ext::TestSize.Level0) +{ + DHTopic topic = DHTopic::TOPIC_STOP_DSCREEN; + std::string message = "TOPIC_STOP_DSCREEN"; + EXPECT_EQ(ERR_DH_FWK_PUBLISH_MSG_FAILED, dhfwkPtr_->PublishMessage(topic, message)); +} + +/** + * @tc.name: OnDHFWKOnLine_001 + * @tc.desc: Verify the OnDHFWKOnLine function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(DistributedHardwareFwkKitTest, OnDHFWKOnLine_001, testing::ext::TestSize.Level0) +{ + bool isOnLine = true; + dhfwkPtr_->OnDHFWKOnLine(isOnLine); + EXPECT_EQ(nullptr, DHFWKSAManager::GetInstance().GetDHFWKProxy()); +} } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/services/distributedhardwarefwkservice/test/unittest/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/BUILD.gn index eb44ec1b..e120f0d7 100644 --- a/services/distributedhardwarefwkservice/test/unittest/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/BUILD.gn @@ -17,10 +17,12 @@ group("test") { deps = [ "common/accessmanager:AccessManagerTest", "common/componentloader:component_loader_test", - "common/componentmanager:component_manager_test", + "common/componentmanager/component_manager:component_manager_test", + "common/componentmanager/component_monitior:component_monitor_test", "common/dbadapter:db_adapter_test", "common/distributedhardwaremanager:distributed_hardware_manager_test", "common/distributedhardwareservice:distributed_hardware_service_test", + "common/hidumphelper:enabled_comps_dump_test", "common/localhardwaremanager:local_hardware_manager_test", "common/resourcemanager:resource_manager_test", "common/task:dh_task_test", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/access_manager_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/access_manager_test.cpp index 299db1e3..e735cdf2 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/access_manager_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/access_manager_test.cpp @@ -240,5 +240,155 @@ HWTEST_F(AccessManagerTest, AccessManagerInit, TestSize.Level0) { EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); } + +/** + * @tc.name: OnRemoteDied_001 + * @tc.desc: Verify the OnRemoteDied function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnRemoteDied_001, TestSize.Level0) +{ + AccessManager::GetInstance()->OnRemoteDied(); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: OnDeviceOnline_001 + * @tc.desc: Verify the OnDeviceOnline function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnDeviceOnline_001, TestSize.Level0) +{ + DmDeviceInfo deviceInfo; + AccessManager::GetInstance()->OnDeviceOnline(deviceInfo); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: OnDeviceOffline_001 + * @tc.desc: Verify the OnDeviceOffline function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnDeviceOffline_001, TestSize.Level0) +{ + DmDeviceInfo deviceInfo; + AccessManager::GetInstance()->OnDeviceOffline(deviceInfo); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: OnDeviceOffline_002 + * @tc.desc: Verify the OnDeviceOffline function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnDeviceOffline_002, TestSize.Level0) +{ + DmDeviceInfo deviceInfo; + std::string devId = "000001"; + EXPECT_EQ(EOK, memcpy_s(deviceInfo.deviceId, DM_MAX_DEVICE_ID_LEN, devId.c_str(), devId.length())); + AccessManager::GetInstance()->OnDeviceOffline(deviceInfo); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: OnDeviceOffline_003 + * @tc.desc: Verify the OnDeviceOffline function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnDeviceOffline_003, TestSize.Level0) +{ + DmDeviceInfo deviceInfo; + std::string devId = "000001"; + EXPECT_EQ(EOK, memcpy_s(deviceInfo.deviceId, DM_MAX_DEVICE_ID_LEN, devId.c_str(), devId.length())); + std::string netId = "000002"; + EXPECT_EQ(EOK, memcpy_s(deviceInfo.networkId, DM_MAX_DEVICE_ID_LEN, netId.c_str(), netId.length())); + AccessManager::GetInstance()->OnDeviceOffline(deviceInfo); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: OnDeviceReady_001 + * @tc.desc: Verify the OnDeviceReady function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnDeviceReady_001, TestSize.Level0) +{ + DmDeviceInfo deviceInfo; + AccessManager::GetInstance()->OnDeviceReady(deviceInfo); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: OnDeviceReady_002 + * @tc.desc: Verify the OnDeviceReady function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnDeviceReady_002, TestSize.Level0) +{ + DmDeviceInfo deviceInfo; + std::string devId = "000001"; + EXPECT_EQ(EOK, memcpy_s(deviceInfo.deviceId, DM_MAX_DEVICE_ID_LEN, devId.c_str(), devId.length())); + AccessManager::GetInstance()->OnDeviceReady(deviceInfo); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: OnDeviceReady_003 + * @tc.desc: Verify the OnDeviceReady function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnDeviceReady_003, TestSize.Level0) +{ + DmDeviceInfo deviceInfo; + std::string devId = "000001"; + EXPECT_EQ(EOK, memcpy_s(deviceInfo.deviceId, DM_MAX_DEVICE_ID_LEN, devId.c_str(), devId.length())); + std::string netId = "000002"; + EXPECT_EQ(EOK, memcpy_s(deviceInfo.networkId, DM_MAX_DEVICE_ID_LEN, netId.c_str(), netId.length())); + AccessManager::GetInstance()->OnDeviceReady(deviceInfo); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: OnDeviceChanged_001 + * @tc.desc: Verify the OnDeviceChanged function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, OnDeviceChanged_001, TestSize.Level0) +{ + DmDeviceInfo deviceInfo; + AccessManager::GetInstance()->OnDeviceChanged(deviceInfo); + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->Init()); +} + +/** + * @tc.name: UnInit_001 + * @tc.desc: Verify the UnInit function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, UnInit_001, TestSize.Level0) +{ + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->UnInit()); +} + +/** + * @tc.name: UnRegisterDevStateCallback_001 + * @tc.desc: Verify the UnRegisterDevStateCallback function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(AccessManagerTest, UnRegisterDevStateCallback_001, TestSize.Level0) +{ + EXPECT_EQ(DH_FWK_SUCCESS, AccessManager::GetInstance()->UnRegisterDevStateCallback()); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/BUILD.gn similarity index 100% rename from services/distributedhardwarefwkservice/test/unittest/common/componentmanager/BUILD.gn rename to services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/BUILD.gn diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/include/component_manager_test.h b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h similarity index 100% rename from services/distributedhardwarefwkservice/test/unittest/common/componentmanager/include/component_manager_test.h rename to services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/include/mock_idistributed_hardware_sink.h b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/mock_idistributed_hardware_sink.h similarity index 100% rename from services/distributedhardwarefwkservice/test/unittest/common/componentmanager/include/mock_idistributed_hardware_sink.h rename to services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/mock_idistributed_hardware_sink.h diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/include/mock_idistributed_hardware_source.h b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/mock_idistributed_hardware_source.h similarity index 100% rename from services/distributedhardwarefwkservice/test/unittest/common/componentmanager/include/mock_idistributed_hardware_source.h rename to services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/mock_idistributed_hardware_source.h diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/src/component_manager_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/src/component_manager_test.cpp similarity index 100% rename from services/distributedhardwarefwkservice/test/unittest/common/componentmanager/src/component_manager_test.cpp rename to services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/src/component_manager_test.cpp diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/BUILD.gn new file mode 100644 index 00000000..488d0450 --- /dev/null +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") + +module_out_path = "distributed_hardware_fwk/component_monitor_test" + +config("module_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "//base/notification/eventhandler/interfaces/inner_api", + "//commonlibrary/c_utils/base/include", + "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", + "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata/include", + "//third_party/json/include", + "include", + "${utils_path}/include", + "${utils_path}/include/log", + "${utils_path}/include/eventbus", + "${services_path}/distributedhardwarefwkservice/include", + "${services_path}/distributedhardwarefwkservice/include/componentloader", + "${services_path}/distributedhardwarefwkservice/include/componentmanager", + "${services_path}/distributedhardwarefwkservice/include/lowlatency", + "${services_path}/distributedhardwarefwkservice/include/resourcemanager", + "${services_path}/distributedhardwarefwkservice/include/versionmanager", + "${services_path}/distributedhardwarefwkservice/include/utils", + "${common_path}/utils/include", + "${common_path}/log/include", + ] +} + +ohos_unittest("ComponentMonitorTest") { + module_out_path = module_out_path + + sources = [ "src/component_monitor_test.cpp" ] + + configs = [ ":module_private_config" ] + + deps = [ + "//foundation/distributedhardware/distributed_hardware_fwk/services/distributedhardwarefwkservice:distributedhardwarefwksvr", + "//foundation/distributedhardware/distributed_hardware_fwk/utils:distributedhardwareutils", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"ComponentMonitorTest\"", + "LOG_DOMAIN=0xD004100", + ] +} + +group("component_monitor_test") { + testonly = true + deps = [ ":ComponentMonitorTest" ] +} diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/include/component_monitor_test.h b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/include/component_monitor_test.h new file mode 100644 index 00000000..634e5a01 --- /dev/null +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/include/component_monitor_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_DISTRIBUTED_HARDWARE_COMPONENT_MONITOR_TEST_H +#define OHOS_DISTRIBUTED_HARDWARE_COMPONENT_MONITOR_TEST_H + +#include "gtest/gtest.h" + +#define private public +#include "component_monitor.h" +#undef private + +namespace OHOS { +namespace DistributedHardware { +class ComponentMonitorTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); + + std::shared_ptr compMonitorPtr_ = nullptr; +}; +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/src/component_monitor_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/src/component_monitor_test.cpp new file mode 100644 index 00000000..0a265574 --- /dev/null +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/src/component_monitor_test.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "component_monitor_test.h" + +#include +#include +#include +#include +#include + +#include "component_loader.h" +#include "system_ability_status_change_stub.h" +#include "single_instance.h" + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void ComponentMonitorTest::SetUpTestCase(void) {} + +void ComponentMonitorTest::TearDownTestCase(void) {} + +void ComponentMonitorTest::SetUp() +{ + compMonitorPtr_ = std::make_shared(); +} + +void ComponentMonitorTest::TearDown() +{ + compMonitorPtr_ = nullptr; +} + +/** + * @tc.name: RemoveSAMonitor_001 + * @tc.desc: Verify the RemoveSAMonitor function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(ComponentMonitorTest, RemoveSAMonitor_001, TestSize.Level0) +{ + int32_t saId = static_cast(DHType::GPS); + compMonitorPtr_->RemoveSAMonitor(saId); + EXPECT_EQ(compMonitorPtr_->saListeners_.find(saId), compMonitorPtr_->saListeners_.end()); +} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn new file mode 100644 index 00000000..f47017a0 --- /dev/null +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn @@ -0,0 +1,61 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") + +module_out_path = "distributed_hardware_fwk/enabled_comps_dump_test" + +config("module_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "include", + "//base/notification/eventhandler/interfaces/inner_api", + "//third_party/json/include", + "//commonlibrary/c_utils/base/include", + "${common_path}/utils/include", + "${services_path}/distributedhardwarefwkservice/include/hidumphelper" + ] +} + +ohos_unittest("EnabledCompsDumpTest") { + module_out_path = module_out_path + + sources = [ "src/enabled_comps_dump_test.cpp" ] + + configs = [ ":module_private_config" ] + + deps = [ + "//foundation/distributedhardware/distributed_hardware_fwk/services/distributedhardwarefwkservice:distributedhardwarefwksvr", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"EnabledCompsDumpTest\"", + "LOG_DOMAIN=0xD004100", + ] + + external_deps = [ + "c_utils:utils", + "ipc:ipc_core", + "safwk:system_ability_fwk", + ] +} + +group("enabled_comps_dump_test") { + testonly = true + deps = [ ":EnabledCompsDumpTest" ] +} diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/include/enabled_comps_dump_test.h b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/include/enabled_comps_dump_test.h new file mode 100644 index 00000000..db52150a --- /dev/null +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/include/enabled_comps_dump_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_DISTRIBUTED_ENABLED_COMPS_DUMP_TEST_H +#define OHOS_DISTRIBUTED_ENABLED_COMPS_DUMP_TEST_H + +#include + +namespace OHOS { +namespace DistributedHardware { +class EnabledCompsDumpTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; +} // namespace DistributedHardware +} // namespace OHOS +#endif diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp new file mode 100644 index 00000000..f09f933a --- /dev/null +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "enabled_comps_dump_test.h" + +#include +#include +#include + +#define private public +#include "enabled_comps_dump.h" +#undef private + +using namespace testing::ext; +namespace OHOS { +namespace DistributedHardware { +void EnabledCompsDumpTest::SetUpTestCase(void) {} + +void EnabledCompsDumpTest::TearDownTestCase(void) {} + +void EnabledCompsDumpTest::SetUp() {} + +void EnabledCompsDumpTest::TearDown() {} + +/** + * @tc.name: DumpEnabledComp_001 + * @tc.desc: Verify the DumpEnabledComp function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(EnabledCompsDumpTest, DumpEnabledComp_001, TestSize.Level0) +{ + std::string networkId; + DHType dhType = DHType::CAMERA; + std::string dhId; + EnabledCompsDump::GetInstance().DumpEnabledComp(networkId, dhType, dhId); + EXPECT_EQ(false, EnabledCompsDump::GetInstance().compInfoSet_.empty()); +} + +/** + * @tc.name: DumpDisabledComp_001 + * @tc.desc: Verify the DumpDisabledComp function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(EnabledCompsDumpTest, DumpDisabledComp_001, TestSize.Level0) +{ + std::string networkId; + DHType dhType = DHType::CAMERA; + std::string dhId; + EnabledCompsDump::GetInstance().DumpEnabledComp(networkId, dhType, dhId); + EXPECT_EQ(false, EnabledCompsDump::GetInstance().compInfoSet_.empty()); +} + +/** + * @tc.name: Dump_001 + * @tc.desc: Verify the Dump function + * @tc.type: FUNC + * @tc.require: AR000GHSJM + */ +HWTEST_F(EnabledCompsDumpTest, Dump_001, TestSize.Level0) +{ + std::set compInfoSet; + EnabledCompsDump::GetInstance().Dump(compInfoSet); + EXPECT_EQ(false, EnabledCompsDump::GetInstance().compInfoSet_.empty()); +} +} // namespace DistributedHardware +} // namespace OHOS -- Gitee From 8cb51a542fe9e63074842974034158012ad45b7f Mon Sep 17 00:00:00 2001 From: wuxiaodong02 Date: Wed, 30 Nov 2022 21:29:55 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUILD.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wuxiaodong02 --- .../unittest/common/hidumphelper/src/BUILD.gn | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/BUILD.gn diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/BUILD.gn new file mode 100644 index 00000000..f47017a0 --- /dev/null +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/BUILD.gn @@ -0,0 +1,61 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") + +module_out_path = "distributed_hardware_fwk/enabled_comps_dump_test" + +config("module_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "include", + "//base/notification/eventhandler/interfaces/inner_api", + "//third_party/json/include", + "//commonlibrary/c_utils/base/include", + "${common_path}/utils/include", + "${services_path}/distributedhardwarefwkservice/include/hidumphelper" + ] +} + +ohos_unittest("EnabledCompsDumpTest") { + module_out_path = module_out_path + + sources = [ "src/enabled_comps_dump_test.cpp" ] + + configs = [ ":module_private_config" ] + + deps = [ + "//foundation/distributedhardware/distributed_hardware_fwk/services/distributedhardwarefwkservice:distributedhardwarefwksvr", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"EnabledCompsDumpTest\"", + "LOG_DOMAIN=0xD004100", + ] + + external_deps = [ + "c_utils:utils", + "ipc:ipc_core", + "safwk:system_ability_fwk", + ] +} + +group("enabled_comps_dump_test") { + testonly = true + deps = [ ":EnabledCompsDumpTest" ] +} -- Gitee From ee6eaf42c5f584896445d804e3c78991e389cafa Mon Sep 17 00:00:00 2001 From: wuxiaodong02 Date: Thu, 1 Dec 2022 14:43:27 +0800 Subject: [PATCH 3/9] add ut Signed-off-by: wuxiaodong02 --- .../src/distributed_hardware_fwk_kit_test.cpp | 4 +--- .../component_manager/include/component_manager_test.h | 4 ++-- .../component_monitior/src/component_monitor_test.cpp | 2 +- .../common/hidumphelper/src/enabled_comps_dump_test.cpp | 2 -- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp index ad5fba4a..4d082130 100644 --- a/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp +++ b/interfaces/inner_kits/test/unittest/common/distributedhardwarefwkkit/src/distributed_hardware_fwk_kit_test.cpp @@ -22,12 +22,10 @@ #include "distributed_hardware_errno.h" #include "dhfwk_sa_manager.h" +#include "distributed_hardware_fwk_kit.h" #include "distributed_hardware_log.h" #include "iservice_registry.h" #include "system_ability_definition.h" -#define private public -#include "distributed_hardware_fwk_kit.h" -#undef private using OHOS::DistributedHardware::DHTopic; diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h index 2caeca7a..e121a961 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_DISTRIBUTED_HARDWARE_COMPONENT_MANAGER_TEST_H -#define OHOS_DISTRIBUTED_HARDWARE_COMPONENT_MANAGER_TEST_H +#ifndef COMPONENT_MANAGER_TEST_H +#define COMPONENT_MANAGER_TEST_H #include "gtest/gtest.h" diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/src/component_monitor_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/src/component_monitor_test.cpp index 0a265574..3f575bfc 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/src/component_monitor_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/src/component_monitor_test.cpp @@ -38,7 +38,7 @@ void ComponentMonitorTest::SetUp() compMonitorPtr_ = std::make_shared(); } -void ComponentMonitorTest::TearDown() +void ComponentMonitorTest::TearDown() { compMonitorPtr_ = nullptr; } diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp index f09f933a..51787f4e 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp @@ -19,9 +19,7 @@ #include #include -#define private public #include "enabled_comps_dump.h" -#undef private using namespace testing::ext; namespace OHOS { -- Gitee From 2c1aca4902f61ec6443bdb8ba2dcebf484c1d040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E5=B0=8F=E4=B8=9C?= Date: Thu, 1 Dec 2022 07:14:23 +0000 Subject: [PATCH 4/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20serv?= =?UTF-8?q?ices/distributedhardwarefwkservice/test/unittest/common/hidumph?= =?UTF-8?q?elper/src/BUILD.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unittest/common/hidumphelper/src/BUILD.gn | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/BUILD.gn diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/BUILD.gn deleted file mode 100644 index f47017a0..00000000 --- a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/BUILD.gn +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") - -module_out_path = "distributed_hardware_fwk/enabled_comps_dump_test" - -config("module_private_config") { - visibility = [ ":*" ] - include_dirs = [ - "include", - "//base/notification/eventhandler/interfaces/inner_api", - "//third_party/json/include", - "//commonlibrary/c_utils/base/include", - "${common_path}/utils/include", - "${services_path}/distributedhardwarefwkservice/include/hidumphelper" - ] -} - -ohos_unittest("EnabledCompsDumpTest") { - module_out_path = module_out_path - - sources = [ "src/enabled_comps_dump_test.cpp" ] - - configs = [ ":module_private_config" ] - - deps = [ - "//foundation/distributedhardware/distributed_hardware_fwk/services/distributedhardwarefwkservice:distributedhardwarefwksvr", - "//third_party/googletest:gmock_main", - "//third_party/googletest:gtest_main", - ] - - defines = [ - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"EnabledCompsDumpTest\"", - "LOG_DOMAIN=0xD004100", - ] - - external_deps = [ - "c_utils:utils", - "ipc:ipc_core", - "safwk:system_ability_fwk", - ] -} - -group("enabled_comps_dump_test") { - testonly = true - deps = [ ":EnabledCompsDumpTest" ] -} -- Gitee From 78f65738665002fd4f9d373d0521de3218c7a3e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E5=B0=8F=E4=B8=9C?= Date: Thu, 1 Dec 2022 07:14:32 +0000 Subject: [PATCH 5/9] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20serv?= =?UTF-8?q?ices/distributedhardwarefwkservice/test/unittest/common/hidumph?= =?UTF-8?q?elper/BUILD.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unittest/common/hidumphelper/BUILD.gn | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn deleted file mode 100644 index f47017a0..00000000 --- a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/test.gni") -import( - "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") - -module_out_path = "distributed_hardware_fwk/enabled_comps_dump_test" - -config("module_private_config") { - visibility = [ ":*" ] - include_dirs = [ - "include", - "//base/notification/eventhandler/interfaces/inner_api", - "//third_party/json/include", - "//commonlibrary/c_utils/base/include", - "${common_path}/utils/include", - "${services_path}/distributedhardwarefwkservice/include/hidumphelper" - ] -} - -ohos_unittest("EnabledCompsDumpTest") { - module_out_path = module_out_path - - sources = [ "src/enabled_comps_dump_test.cpp" ] - - configs = [ ":module_private_config" ] - - deps = [ - "//foundation/distributedhardware/distributed_hardware_fwk/services/distributedhardwarefwkservice:distributedhardwarefwksvr", - "//third_party/googletest:gmock_main", - "//third_party/googletest:gtest_main", - ] - - defines = [ - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"EnabledCompsDumpTest\"", - "LOG_DOMAIN=0xD004100", - ] - - external_deps = [ - "c_utils:utils", - "ipc:ipc_core", - "safwk:system_ability_fwk", - ] -} - -group("enabled_comps_dump_test") { - testonly = true - deps = [ ":EnabledCompsDumpTest" ] -} -- Gitee From 2eb50aa14223bb95627201dbde9d8750ff98d4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E5=B0=8F=E4=B8=9C?= Date: Thu, 1 Dec 2022 07:15:46 +0000 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUILD.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 武小东 --- .../unittest/common/hidumphelper/BUILD.gn | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn new file mode 100644 index 00000000..bbe9a6e2 --- /dev/null +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/BUILD.gn @@ -0,0 +1,61 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/test.gni") +import( + "//foundation/distributedhardware/distributed_hardware_fwk/distributedhardwarefwk.gni") + +module_out_path = "distributed_hardware_fwk/enabled_comps_dump_test" + +config("module_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "include", + "//base/notification/eventhandler/interfaces/inner_api", + "//third_party/json/include", + "//commonlibrary/c_utils/base/include", + "${common_path}/utils/include", + "${services_path}/distributedhardwarefwkservice/include/hidumphelper", + ] +} + +ohos_unittest("EnabledCompsDumpTest") { + module_out_path = module_out_path + + sources = [ "src/enabled_comps_dump_test.cpp" ] + + configs = [ ":module_private_config" ] + + deps = [ + "//foundation/distributedhardware/distributed_hardware_fwk/services/distributedhardwarefwkservice:distributedhardwarefwksvr", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] + + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"EnabledCompsDumpTest\"", + "LOG_DOMAIN=0xD004100", + ] + + external_deps = [ + "c_utils:utils", + "ipc:ipc_core", + "safwk:system_ability_fwk", + ] +} + +group("enabled_comps_dump_test") { + testonly = true + deps = [ ":EnabledCompsDumpTest" ] +} -- Gitee From 9b740b2b02000701aae3f268fcefc0a980a1e14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E5=B0=8F=E4=B8=9C?= Date: Thu, 1 Dec 2022 07:35:49 +0000 Subject: [PATCH 7/9] update enabled_comps_dump_test.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 武小东 --- .../common/hidumphelper/src/enabled_comps_dump_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp index 51787f4e..f09f933a 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/src/enabled_comps_dump_test.cpp @@ -19,7 +19,9 @@ #include #include +#define private public #include "enabled_comps_dump.h" +#undef private using namespace testing::ext; namespace OHOS { -- Gitee From 7dcfc3a4b8d9e528079f68380246b5216da21367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E5=B0=8F=E4=B8=9C?= Date: Thu, 1 Dec 2022 08:47:06 +0000 Subject: [PATCH 8/9] update component_manager_test.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 武小东 --- .../component_manager/include/component_manager_test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h index e121a961..75c79c36 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h @@ -31,4 +31,4 @@ public: }; } // namespace DistributedHardware } // namespace OHOS -#endif +#endif COMPONENT_MANAGER_TEST_H -- Gitee From 56da538be5d712f5711e9b81fd0385007a04124c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E5=B0=8F=E4=B8=9C?= Date: Thu, 1 Dec 2022 09:04:13 +0000 Subject: [PATCH 9/9] update component_manager_test.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 武小东 --- .../component_manager/include/component_manager_test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h index 75c79c36..e87f7498 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_manager/include/component_manager_test.h @@ -31,4 +31,4 @@ public: }; } // namespace DistributedHardware } // namespace OHOS -#endif COMPONENT_MANAGER_TEST_H +#endif // COMPONENT_MANAGER_TEST_H -- Gitee