From f24d2beb907ef575148ebf89060f0c495afd7725 Mon Sep 17 00:00:00 2001 From: j30052480 Date: Wed, 12 Jun 2024 17:15:46 +0800 Subject: [PATCH 1/2] feat: add testcase for iproxy_broker Signed-off-by: j30052480 --- adapter/uhdf2/test/unittest/manager/BUILD.gn | 2 ++ .../unittest/common/devmgr_uevent_test.cpp | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/adapter/uhdf2/test/unittest/manager/BUILD.gn b/adapter/uhdf2/test/unittest/manager/BUILD.gn index 5275e213e..9f1199328 100644 --- a/adapter/uhdf2/test/unittest/manager/BUILD.gn +++ b/adapter/uhdf2/test/unittest/manager/BUILD.gn @@ -194,9 +194,11 @@ ohos_unittest("hdf_adapter_uhdf_test_uevent") { if (is_standard_system) { external_deps = [ "c_utils:utils", + "hdf_core:libhdf_ipc_adapter", "hdf_core:libhdf_utils", "hdf_core:libhdi", "hilog:libhilog", + "ipc:ipc_single", ] } else { external_deps = [ "hilog:libhilog" ] diff --git a/framework/core/manager/test/unittest/common/devmgr_uevent_test.cpp b/framework/core/manager/test/unittest/common/devmgr_uevent_test.cpp index c01bf2fdd..e45095f96 100644 --- a/framework/core/manager/test/unittest/common/devmgr_uevent_test.cpp +++ b/framework/core/manager/test/unittest/common/devmgr_uevent_test.cpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include using namespace testing::ext; static constexpr const char *TEST_SERVICE_NAME = "sample_driver_service"; @@ -205,3 +207,22 @@ HWTEST_F(DevmgrUeventTest, DevmgrUeventStressTest, TestSize.Level3) ASSERT_TRUE(sampleService == nullptr); } } + +HWTEST_F(DevmgrUeventTest, HdiProxyBrokerTest001, TestSize.Level1) +{ + class IFooInterface : public OHOS::HDI::HdiBase { + public: + IFooInterface() = default; + virtual ~IFooInterface() = default; + }; + class FooIntterfaceProxy : public OHOS::HDI::IProxyBroker { + public: + explicit FooIntterfaceProxy(const OHOS::sptr &impl) : IProxyBroker(impl) {} + ~FooIntterfaceProxy() {} + }; + FooIntterfaceProxy *proxy = new FooIntterfaceProxy(nullptr); + OHOS::sptr remote = proxy->AsObject(); + ASSERT_EQ(remote, nullptr); + OHOS::sptr intf = proxy->AsInterface(); + ASSERT_NE(intf, nullptr); +} -- Gitee From 46b5224ac440b9a9b2d5aa62cf5562a2bd82c38c Mon Sep 17 00:00:00 2001 From: j30052480 Date: Thu, 13 Jun 2024 09:29:06 +0800 Subject: [PATCH 2/2] feat: add testcase for iproxy_broker Signed-off-by: j30052480 --- .../manager/test/unittest/common/devmgr_uevent_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/core/manager/test/unittest/common/devmgr_uevent_test.cpp b/framework/core/manager/test/unittest/common/devmgr_uevent_test.cpp index e45095f96..71b3abb4f 100644 --- a/framework/core/manager/test/unittest/common/devmgr_uevent_test.cpp +++ b/framework/core/manager/test/unittest/common/devmgr_uevent_test.cpp @@ -215,12 +215,12 @@ HWTEST_F(DevmgrUeventTest, HdiProxyBrokerTest001, TestSize.Level1) IFooInterface() = default; virtual ~IFooInterface() = default; }; - class FooIntterfaceProxy : public OHOS::HDI::IProxyBroker { + class FooInterfaceProxy : public OHOS::HDI::IProxyBroker { public: - explicit FooIntterfaceProxy(const OHOS::sptr &impl) : IProxyBroker(impl) {} - ~FooIntterfaceProxy() {} + explicit FooInterfaceProxy(const OHOS::sptr &impl) : IProxyBroker(impl) {} + ~FooInterfaceProxy() {} }; - FooIntterfaceProxy *proxy = new FooIntterfaceProxy(nullptr); + FooInterfaceProxy *proxy = new FooInterfaceProxy(nullptr); OHOS::sptr remote = proxy->AsObject(); ASSERT_EQ(remote, nullptr); OHOS::sptr intf = proxy->AsInterface(); -- Gitee