diff --git a/adapter/uhdf2/test/unittest/manager/BUILD.gn b/adapter/uhdf2/test/unittest/manager/BUILD.gn index 5275e213e2d2c5096b8502c78be4efd942fbb337..9f1199328e32b45db8374095e55643c22e94d883 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 c01bf2fddc5f146712dc0c2b37b6dacb17c81ef5..71b3abb4fd5bb619ab64c07f4de686ee2fbf7c75 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 FooInterfaceProxy : public OHOS::HDI::IProxyBroker { + public: + explicit FooInterfaceProxy(const OHOS::sptr &impl) : IProxyBroker(impl) {} + ~FooInterfaceProxy() {} + }; + FooInterfaceProxy *proxy = new FooInterfaceProxy(nullptr); + OHOS::sptr remote = proxy->AsObject(); + ASSERT_EQ(remote, nullptr); + OHOS::sptr intf = proxy->AsInterface(); + ASSERT_NE(intf, nullptr); +}