diff --git a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp index 4827ee07c9c17a4f19895c950affd83d786ff568..f38a6af28e24bd9fdf3d081e1e52ace50ae02f7b 100644 --- a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp +++ b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -164,7 +164,7 @@ int DistributedInputInnerTest::CheckSinkProxy() const HWTEST_F(DistributedInputInnerTest, PrepareRemoteInput01, testing::ext::TestSize.Level0) { string deviceId = "PrepareRemoteInput01"; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); int32_t ret = DistributedInputKit::PrepareRemoteInput(deviceId, callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -181,7 +181,7 @@ HWTEST_F(DistributedInputInnerTest, PrepareRemoteInput03, testing::ext::TestSize { std::string srcId = "PrepareRemoteInput_test"; std::string sinkId = "PrepareRemoteInput_test"; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); int32_t ret = DistributedInputKit::PrepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -198,7 +198,7 @@ HWTEST_F(DistributedInputInnerTest, PrepareRemoteInput04, testing::ext::TestSize HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput01, testing::ext::TestSize.Level0) { string deviceId = "UnprepareRemoteInput01"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = DistributedInputKit::UnprepareRemoteInput(deviceId, callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -215,7 +215,7 @@ HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput03, testing::ext::TestSi { std::string srcId = "PrepareRemoteInput_src"; std::string sinkId = "PrepareRemoteInput_sink"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = DistributedInputKit::UnprepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -232,7 +232,7 @@ HWTEST_F(DistributedInputInnerTest, UnprepareRemoteInput04, testing::ext::TestSi HWTEST_F(DistributedInputInnerTest, StartRemoteInput01, testing::ext::TestSize.Level0) { string deviceId = "StartRemoteInput01"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = DistributedInputKit::StartRemoteInput(deviceId, static_cast(DInputDeviceType::ALL), callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -251,7 +251,7 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput03, testing::ext::TestSize.L { std::string sinkId = "StartRemoteInput_sink"; std::vector dhIds = {"dhIds_test"}; - sptr callback = new TestStartStopDInputCallback(); + sptr callback(new TestStartStopDInputCallback()); int32_t ret = DistributedInputKit::StartRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -269,7 +269,7 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput05, testing::ext::TestSize.L { string srcId = "StartRemoteInput01-src"; string sinkId = "StartRemoteInput01-sink"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = DistributedInputKit::StartRemoteInput(srcId, sinkId, static_cast(DInputDeviceType::ALL), callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -290,7 +290,7 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput07, testing::ext::TestSize.L string srcId = "StartRemoteInput01-src"; string sinkId = "StartRemoteInput01-sink"; std::vector dhIds = {"dhIds_test"}; - sptr callback = new TestStartStopDInputCallback(); + sptr callback(new TestStartStopDInputCallback()); int32_t ret = DistributedInputKit::StartRemoteInput(srcId, sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -308,7 +308,7 @@ HWTEST_F(DistributedInputInnerTest, StartRemoteInput08, testing::ext::TestSize.L HWTEST_F(DistributedInputInnerTest, StopRemoteInput01, testing::ext::TestSize.Level0) { string deviceId = "StopRemoteInput01"; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t ret = DistributedInputKit::StopRemoteInput(deviceId, static_cast(DInputDeviceType::ALL), callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -327,7 +327,7 @@ HWTEST_F(DistributedInputInnerTest, StopRemoteInput03, testing::ext::TestSize.Le { std::string sinkId = "StartRemoteInput_test"; std::vector dhIds = {"dhIds_test"}; - sptr callback = new TestStartStopDInputCallback(); + sptr callback(new TestStartStopDInputCallback()); int32_t ret = DistributedInputKit::StopRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -345,7 +345,7 @@ HWTEST_F(DistributedInputInnerTest, StopRemoteInput05, testing::ext::TestSize.Le { string srcId = "StopRemoteInput03-src"; string sinkId = "StopRemoteInput03-sink"; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t ret = DistributedInputKit::StopRemoteInput(srcId, sinkId, static_cast(DInputDeviceType::ALL), callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -366,7 +366,7 @@ HWTEST_F(DistributedInputInnerTest, StopRemoteInput07, testing::ext::TestSize.Le string srcId = "StartRemoteInput01-src"; string sinkId = "StartRemoteInput01-sink"; std::vector dhIds = {"dhIds_test"}; - sptr callback = new TestStartStopDInputCallback(); + sptr callback(new TestStartStopDInputCallback()); int32_t ret = DistributedInputKit::StopRemoteInput(srcId, sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -473,7 +473,7 @@ HWTEST_F(DistributedInputInnerTest, IsStartDistributedInput03, testing::ext::Tes HWTEST_F(DistributedInputInnerTest, RegisterInputNodeListener01, testing::ext::TestSize.Level0) { - sptr listener = new TestInputNodeListener(); + sptr listener(new TestInputNodeListener()); int32_t ret = DistributedInputKit::RegisterInputNodeListener(listener); EXPECT_EQ(DH_SUCCESS, ret); } @@ -487,7 +487,7 @@ HWTEST_F(DistributedInputInnerTest, RegisterInputNodeListener02, testing::ext::T HWTEST_F(DistributedInputInnerTest, UnregisterInputNodeListener01, testing::ext::TestSize.Level0) { - sptr listener = new TestInputNodeListener(); + sptr listener(new TestInputNodeListener()); int32_t ret = DistributedInputKit::UnregisterInputNodeListener(listener); EXPECT_EQ(DH_SUCCESS, ret); } @@ -501,7 +501,7 @@ HWTEST_F(DistributedInputInnerTest, UnregisterInputNodeListener02, testing::ext: HWTEST_F(DistributedInputInnerTest, RegisterSimulationEventListener01, testing::ext::TestSize.Level0) { - sptr listener = new TestSimulationEventListenerStub(); + sptr listener(new TestSimulationEventListenerStub()); int32_t ret = DistributedInputKit::RegisterSimulationEventListener(listener); EXPECT_EQ(DH_SUCCESS, ret); } @@ -515,7 +515,7 @@ HWTEST_F(DistributedInputInnerTest, RegisterSimulationEventListener02, testing:: HWTEST_F(DistributedInputInnerTest, UnregisterSimulationEventListener01, testing::ext::TestSize.Level0) { - sptr listener = new TestSimulationEventListenerStub(); + sptr listener(new TestSimulationEventListenerStub()); int32_t ret = DistributedInputKit::UnregisterSimulationEventListener(listener); EXPECT_EQ(DH_SUCCESS, ret); } diff --git a/interfaces/ipc/src/distributed_input_client.cpp b/interfaces/ipc/src/distributed_input_client.cpp index 9b09a7adae07bec6098ae1c205752a7574d83325..e784874a8fc99cb7d87e4bdcc7bb76587d4a8408 100644 --- a/interfaces/ipc/src/distributed_input_client.cpp +++ b/interfaces/ipc/src/distributed_input_client.cpp @@ -178,7 +178,7 @@ void DistributedInputClient::CheckSharingDhIdsCallback() return; } if (!isSharingDhIdsReg) { - sptr listener = new (std::nothrow) SharingDhIdListenerCb(); + sptr listener(new (std::nothrow) SharingDhIdListenerCb()); int32_t ret = DInputSAManager::GetInstance().dInputSinkProxy_->RegisterSharingDhIdListener(listener); if (ret == DH_SUCCESS) { @@ -198,7 +198,7 @@ void DistributedInputClient::CheckWhiteListCallback() return; } if (!isAddWhiteListCbReg) { - sptr addCallback = new (std::nothrow) AddWhiteListInfosCb(); + sptr addCallback(new (std::nothrow) AddWhiteListInfosCb()); int32_t ret = DInputSAManager::GetInstance().dInputSourceProxy_->RegisterAddWhiteListCallback(addCallback); if (ret == DH_SUCCESS) { @@ -210,7 +210,7 @@ void DistributedInputClient::CheckWhiteListCallback() } } if (!isDelWhiteListCbReg) { - sptr delCallback = new (std::nothrow) DelWhiteListInfosCb(); + sptr delCallback(new (std::nothrow) DelWhiteListInfosCb()); int32_t ret = DInputSAManager::GetInstance().dInputSourceProxy_->RegisterDelWhiteListCallback(delCallback); if (ret == DH_SUCCESS) { @@ -255,7 +255,7 @@ void DistributedInputClient::CheckSinkScreenInfoCallback() return; } if (!isGetSinkScreenInfosCbReg) { - sptr callback = new (std::nothrow) GetSinkScreenInfosCb(); + sptr callback(new (std::nothrow) GetSinkScreenInfosCb()); int32_t ret = DInputSAManager::GetInstance().dInputSinkProxy_->RegisterGetSinkScreenInfosCallback(callback); if (ret == DH_SUCCESS) { diff --git a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp index 0ca566bd10425db2672878aae2329bb95e6cedf2..b8d8570e5a585dcddd6fdab078940f9ac463842b 100644 --- a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp +++ b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp @@ -179,7 +179,7 @@ int32_t AddWhiteListInfosCallbackTest::TestDistributedInputSinkStub::RegisterSha HWTEST_F(AddWhiteListInfosCallbackTest, AddWhiteListInfosCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestAddWhiteListInfosCallbackStub(); + sptr callBackStubPtr(new TestAddWhiteListInfosCallbackStub()); AddWhiteListInfosCallbackProxy callBackProxy(callBackStubPtr); std::string deviceId = "deviceId0"; std::string json = "json0"; @@ -190,7 +190,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, AddWhiteListInfosCallback01, testing::ex HWTEST_F(AddWhiteListInfosCallbackTest, GetSinkScreenInfosCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestGetSinkScreenInfosCallbackStub(); + sptr callBackStubPtr(new TestGetSinkScreenInfosCallbackStub()); GetSinkScreenInfosCallbackProxy callBackProxy(callBackStubPtr); std::string json = "json0"; callBackProxy.OnResult(json); @@ -199,7 +199,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, GetSinkScreenInfosCallback01, testing::e HWTEST_F(AddWhiteListInfosCallbackTest, InputNodeListenerStub01, testing::ext::TestSize.Level1) { - sptr nodeListener = new TestInputNodeListenerStub(); + sptr nodeListener(new TestInputNodeListenerStub()); InputNodeListenerProxy nodeListenerProxy(nodeListener); std::string srcDevId = "srcDevId_test"; std::string sinkDevId = "sinkDevId_test"; @@ -214,7 +214,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, InputNodeListenerStub01, testing::ext::T HWTEST_F(AddWhiteListInfosCallbackTest, InputNodeListenerStub02, testing::ext::TestSize.Level1) { - sptr nodeListener = new TestInputNodeListenerStub(); + sptr nodeListener(new TestInputNodeListenerStub()); InputNodeListenerProxy nodeListenerProxy(nodeListener); std::string srcDevId = "srcDevId_test"; std::string sinkDevId = "sinkDevId_test"; @@ -227,7 +227,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, InputNodeListenerStub02, testing::ext::T HWTEST_F(AddWhiteListInfosCallbackTest, PrepareDInputCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestPrepareDInputCallbackStub(); + sptr callBackStubPtr(new TestPrepareDInputCallbackStub()); PrepareDInputCallbackProxy callBackProxy(callBackStubPtr); std::string devId = "devId_test"; int32_t status = 0; @@ -237,7 +237,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, PrepareDInputCallback01, testing::ext::T HWTEST_F(AddWhiteListInfosCallbackTest, RegisterDInputCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestRegisterDInputCallbackStub(); + sptr callBackStubPtr(new TestRegisterDInputCallbackStub()); RegisterDInputCallbackProxy callBackProxy(callBackStubPtr); std::string devId = "devId_test"; std::string dhId = "dhId_test"; @@ -249,7 +249,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, RegisterDInputCallback01, testing::ext:: HWTEST_F(AddWhiteListInfosCallbackTest, SharingDhIdListenerStub01, testing::ext::TestSize.Level1) { - sptr sharingStubPtr = new TestSharingDhIdListenerStub(); + sptr sharingStubPtr(new TestSharingDhIdListenerStub()); SharingDhIdListenerProxy sharingProxy(sharingStubPtr); std::string dhId = "dhId_test"; int32_t ret = sharingProxy.OnSharing(dhId); @@ -258,7 +258,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, SharingDhIdListenerStub01, testing::ext: HWTEST_F(AddWhiteListInfosCallbackTest, SharingDhIdListenerStub02, testing::ext::TestSize.Level1) { - sptr sharingStubPtr = new TestSharingDhIdListenerStub(); + sptr sharingStubPtr(new TestSharingDhIdListenerStub()); SharingDhIdListenerProxy sharingProxy(sharingStubPtr); std::string dhId = "dhId_test"; int32_t ret = sharingProxy.OnNoSharing(dhId); @@ -267,7 +267,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, SharingDhIdListenerStub02, testing::ext: HWTEST_F(AddWhiteListInfosCallbackTest, SimulationEventListenerStub01, testing::ext::TestSize.Level1) { - sptr simulationStubPtr = new TestSimulationEventListenerStub(); + sptr simulationStubPtr(new TestSimulationEventListenerStub()); SimulationEventListenerProxy sharingProxy(simulationStubPtr); uint32_t type = 1; uint32_t code = 1; @@ -278,7 +278,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, SimulationEventListenerStub01, testing:: HWTEST_F(AddWhiteListInfosCallbackTest, StartDInputCallbackStub01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestStartDInputCallbackStub(); + sptr callBackStubPtr(new TestStartDInputCallbackStub()); StartDInputCallbackProxy callBackProxy(callBackStubPtr); std::string devId = "devId_test"; uint32_t inputTypes = static_cast(DInputDeviceType::ALL); @@ -289,7 +289,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, StartDInputCallbackStub01, testing::ext: HWTEST_F(AddWhiteListInfosCallbackTest, StartStopDInputsCallbackStub01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestStartStopDInputsCallbackStub(); + sptr callBackStubPtr(new TestStartStopDInputsCallbackStub()); StartStopDInputsCallbackProxy callBackProxy(callBackStubPtr); std::string devId = "devId_test"; int32_t status = 1; @@ -300,7 +300,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, StartStopDInputsCallbackStub01, testing: HWTEST_F(AddWhiteListInfosCallbackTest, StartStopResultCallbackStub01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestStartStopResultCallbackStub(); + sptr callBackStubPtr(new TestStartStopResultCallbackStub()); StartStopResultCallbackProxy callBackProxy(callBackStubPtr); std::string srcId = "srcId_test"; std::string sinkId = "sinkId_test"; @@ -313,7 +313,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, StartStopResultCallbackStub01, testing:: HWTEST_F(AddWhiteListInfosCallbackTest, StartStopResultCallbackStub02, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestStartStopResultCallbackStub(); + sptr callBackStubPtr(new TestStartStopResultCallbackStub()); StartStopResultCallbackProxy callBackProxy(callBackStubPtr); std::string srcId = "srcId_test"; std::string sinkId = "sinkId_test"; @@ -326,7 +326,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, StartStopResultCallbackStub02, testing:: HWTEST_F(AddWhiteListInfosCallbackTest, StopDInputCallbackStub01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestStopDInputCallbackStub(); + sptr callBackStubPtr(new TestStopDInputCallbackStub()); StopDInputCallbackProxy callBackProxy(callBackStubPtr); std::string devId = "devId_test"; uint32_t inputTypes = static_cast(DInputDeviceType::ALL); @@ -337,7 +337,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, StopDInputCallbackStub01, testing::ext:: HWTEST_F(AddWhiteListInfosCallbackTest, DistributedInputSinkStub01, testing::ext::TestSize.Level1) { - sptr sinkStubPtr = new TestDistributedInputSinkStub(); + sptr sinkStubPtr(new TestDistributedInputSinkStub()); DistributedInputSinkProxy sinkProxy(sinkStubPtr); int32_t ret = sinkProxy.Init(); EXPECT_EQ(DH_SUCCESS, ret); @@ -349,7 +349,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, DistributedInputSinkStub01, testing::ext ret = sinkProxy.RegisterGetSinkScreenInfosCallback(callback); EXPECT_EQ(ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL, ret); - sptr sinkScreenCb = new TestGetSinkScreenInfosCallbackStub(); + sptr sinkScreenCb(new TestGetSinkScreenInfosCallbackStub()); ret = sinkProxy.RegisterGetSinkScreenInfosCallback(sinkScreenCb); EXPECT_EQ(DH_SUCCESS, ret); @@ -357,7 +357,7 @@ HWTEST_F(AddWhiteListInfosCallbackTest, DistributedInputSinkStub01, testing::ext ret = sinkProxy.NotifyStopDScreen(srcScreenInfoKey); EXPECT_EQ(DH_SUCCESS, ret); - sptr sharingDhIdListene = new TestSharingDhIdListenerStub(); + sptr sharingDhIdListene(new TestSharingDhIdListenerStub()); ret = sinkProxy.RegisterSharingDhIdListener(sharingDhIdListene); EXPECT_EQ(DH_SUCCESS, ret); } diff --git a/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp b/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp index 5a8769a98662147b961d0ef50008c7cbbda2b7d3..9a1539bff7df9a5c1c21643ab599ff84c71bac37 100644 --- a/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp +++ b/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -194,7 +194,7 @@ HWTEST_F(DistributedInputClientTest, UnregisterDistributedHardware02, testing::e HWTEST_F(DistributedInputClientTest, PrepareRemoteInput01, testing::ext::TestSize.Level1) { string deviceId = "PrepareRemoteInput01"; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().PrepareRemoteInput(deviceId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret); } @@ -213,7 +213,7 @@ HWTEST_F(DistributedInputClientTest, PrepareRemoteInput03, testing::ext::TestSiz { std::string srcId = "PrepareRemoteInput_test"; std::string sinkId = "PrepareRemoteInput_test"; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().PrepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret); } @@ -230,7 +230,7 @@ HWTEST_F(DistributedInputClientTest, PrepareRemoteInput04, testing::ext::TestSiz HWTEST_F(DistributedInputClientTest, UnprepareRemoteInput01, testing::ext::TestSize.Level0) { string deviceId = "UnprepareRemoteInput01"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().UnprepareRemoteInput(deviceId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret); } @@ -247,7 +247,7 @@ HWTEST_F(DistributedInputClientTest, UnprepareRemoteInput03, testing::ext::TestS { std::string srcId = "PrepareRemoteInput_src"; std::string sinkId = "PrepareRemoteInput_sink"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().UnprepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret); } @@ -264,7 +264,7 @@ HWTEST_F(DistributedInputClientTest, UnprepareRemoteInput04, testing::ext::TestS HWTEST_F(DistributedInputClientTest, StartRemoteInput01, testing::ext::TestSize.Level0) { string deviceId = "StartRemoteInput01"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput( deviceId, static_cast(DInputDeviceType::ALL), callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); @@ -283,7 +283,7 @@ HWTEST_F(DistributedInputClientTest, StartRemoteInput03, testing::ext::TestSize. { std::string sinkId = "StartRemoteInput_sink"; std::vector dhIds = {"dhIds_test"}; - sptr callback = new TestStartStopDInputCallback(); + sptr callback(new TestStartStopDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); } @@ -301,7 +301,7 @@ HWTEST_F(DistributedInputClientTest, StartRemoteInput05, testing::ext::TestSize. { string srcId = "StartRemoteInput01-src"; string sinkId = "StartRemoteInput01-sink"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput( srcId, sinkId, static_cast(DInputDeviceType::ALL), callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); @@ -322,7 +322,7 @@ HWTEST_F(DistributedInputClientTest, StartRemoteInput07, testing::ext::TestSize. string srcId = "StartRemoteInput01-src"; string sinkId = "StartRemoteInput01-sink"; std::vector dhIds = {"dhIds_test"}; - sptr callback = new TestStartStopDInputCallback(); + sptr callback(new TestStartStopDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().StartRemoteInput(srcId, sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); } @@ -340,7 +340,7 @@ HWTEST_F(DistributedInputClientTest, StartRemoteInput08, testing::ext::TestSize. HWTEST_F(DistributedInputClientTest, StopRemoteInput01, testing::ext::TestSize.Level0) { string deviceId = "StopRemoteInput01"; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput( deviceId, static_cast(DInputDeviceType::ALL), callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); @@ -359,7 +359,7 @@ HWTEST_F(DistributedInputClientTest, StopRemoteInput03, testing::ext::TestSize.L { std::string sinkId = "StartRemoteInput_test"; std::vector dhIds = {"dhIds_test"}; - sptr callback = new TestStartStopDInputCallback(); + sptr callback(new TestStartStopDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); } @@ -377,7 +377,7 @@ HWTEST_F(DistributedInputClientTest, StopRemoteInput05, testing::ext::TestSize.L { string srcId = "StopRemoteInput03-src"; string sinkId = "StopRemoteInput03-sink"; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput( srcId, sinkId, static_cast(DInputDeviceType::ALL), callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); @@ -398,7 +398,7 @@ HWTEST_F(DistributedInputClientTest, StopRemoteInput07, testing::ext::TestSize.L string srcId = "StartRemoteInput01-src"; string sinkId = "StartRemoteInput01-sink"; std::vector dhIds = {"dhIds_test"}; - sptr callback = new TestStartStopDInputCallback(); + sptr callback(new TestStartStopDInputCallback()); int32_t ret = DistributedInputClient::GetInstance().StopRemoteInput(srcId, sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); } diff --git a/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.cpp b/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.cpp index ba25611bbcc64aed6d852ad96f31dcef4971cc67..abbb9810b89185df5fd50a94d6f4aa4d672a16d1 100644 --- a/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.cpp +++ b/interfaces/ipc/test/delwhitelistinfoscallbackunittest/del_white_list_infos_call_back_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -41,7 +41,7 @@ void DelWhiteListInfosCallbackTest::TestDelWhiteListInfosCallbackStub::OnResult( HWTEST_F(DelWhiteListInfosCallbackTest, DelWhiteListInfosCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDelWhiteListInfosCallbackStub(); + sptr callBackStubPtr(new TestDelWhiteListInfosCallbackStub()); DelWhiteListInfosCallbackProxy callBackProxy(callBackStubPtr); std::string deviceId = "deviceId0"; callBackProxy.OnResult(deviceId); diff --git a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp index 160762e6ca95fad646585265b52834a9d1215d6f..3792a9b08954f23ea05a3fc62855ac3118b5b569 100644 --- a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp +++ b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -351,7 +351,7 @@ int32_t DInputSourceCallBackTest::TestDInputSimulationEventCallBack::OnSimulatio HWTEST_F(DInputSourceCallBackTest, SendRequest01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); IDInputSourceInterfaceCode code = IDInputSourceInterfaceCode::INIT; MessageParcel data; @@ -362,7 +362,7 @@ HWTEST_F(DInputSourceCallBackTest, SendRequest01, testing::ext::TestSize.Level1) HWTEST_F(DInputSourceCallBackTest, Init01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); int32_t ret = callBackProxy.Init(); EXPECT_EQ(DH_SUCCESS, ret); @@ -370,7 +370,7 @@ HWTEST_F(DInputSourceCallBackTest, Init01, testing::ext::TestSize.Level1) HWTEST_F(DInputSourceCallBackTest, Release01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); int32_t ret = callBackProxy.Release(); EXPECT_EQ(DH_SUCCESS, ret); @@ -378,204 +378,204 @@ HWTEST_F(DInputSourceCallBackTest, Release01, testing::ext::TestSize.Level1) HWTEST_F(DInputSourceCallBackTest, RegisterDistributedHardware01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string devId = "d6f4s6d4f6"; const std::string dhId = "Input_sd4f4s5d4f5s4"; const std::string parameters = "d4a6s5d46asd"; - sptr callback = new TestDInputRegisterCallBack(); + sptr callback(new TestDInputRegisterCallBack()); int32_t ret = callBackProxy.RegisterDistributedHardware(devId, dhId, parameters, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, UnregisterDistributedHardware01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string devId = "d6f4s6d4f6"; const std::string dhId = "Input_sd4f4s5d4f5s4"; - sptr callback = new TestDInputUnregisterCallBack(); + sptr callback(new TestDInputUnregisterCallBack()); int32_t ret = callBackProxy.UnregisterDistributedHardware(devId, dhId, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, PrepareRemoteInput01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string devId = "d6f4s6d4f6"; - sptr callback = new TestDInputPrepareCallBack(); + sptr callback(new TestDInputPrepareCallBack()); int32_t ret = callBackProxy.PrepareRemoteInput(devId, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, PrepareRemoteInput02, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string srcId = "d6f4s6d4f6"; const std::string sinkId = "5sd45s4d5s4d5"; - sptr callback = new TestDInputPrepareCallBack(); + sptr callback(new TestDInputPrepareCallBack()); int32_t ret = callBackProxy.PrepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, UnprepareRemoteInput01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string devId = "d6f4s6d4f6"; - sptr callback = new TestDInputUnprepareCallBack(); + sptr callback(new TestDInputUnprepareCallBack()); int32_t ret = callBackProxy.UnprepareRemoteInput(devId, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, UnprepareRemoteInput02, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string srcId = "d6f4s6d4f6"; const std::string sinkId = "5sd45s4d5s4d5"; - sptr callback = new TestDInputUnprepareCallBack(); + sptr callback(new TestDInputUnprepareCallBack()); int32_t ret = callBackProxy.UnprepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, StartRemoteInput01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string devId = "d6f4s6d4f6"; uint32_t inputTypes = 1; - sptr callback = new TestDInputStartCallBack(); + sptr callback(new TestDInputStartCallBack()); int32_t ret = callBackProxy.StartRemoteInput(devId, inputTypes, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, StartRemoteInput02, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string srcId = "d6f4s6d4f6"; const std::string sinkId = "5sd45s4d5s4d5"; uint32_t inputTypes = 1; - sptr callback = new TestDInputStartCallBack(); + sptr callback(new TestDInputStartCallBack()); int32_t ret = callBackProxy.StartRemoteInput(srcId, sinkId, inputTypes, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, StartRemoteInput03, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string sinkId = "d6f4s6d4f6"; std::vector dhIds; dhIds.push_back("Input_6ds54f6sd4f65sd4fsdf4s"); - sptr callback = new TestVectorStartStopCallBackStub(); + sptr callback(new TestVectorStartStopCallBackStub()); int32_t ret = callBackProxy.StartRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, StartRemoteInput04, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string srcId = "d6f4s6d4f6"; const std::string sinkId = "5sd45s4d5s4d5"; std::vector dhIds; dhIds.push_back("Input_6ds54f6sd4f65sd4fsdf4s"); - sptr callback = new TestVectorStartStopCallBackStub(); + sptr callback(new TestVectorStartStopCallBackStub()); int32_t ret = callBackProxy.StartRemoteInput(srcId, sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, StopRemoteInput01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string devId = "d6f4s6d4f6"; uint32_t inputTypes = 1; - sptr callback = new TestDInputStopCallBack(); + sptr callback(new TestDInputStopCallBack()); int32_t ret = callBackProxy.StopRemoteInput(devId, inputTypes, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, StopRemoteInput02, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string srcId = "d6f4s6d4f6"; const std::string sinkId = "5sd45s4d5s4d5"; uint32_t inputTypes = 1; - sptr callback = new TestDInputStopCallBack(); + sptr callback(new TestDInputStopCallBack()); int32_t ret = callBackProxy.StopRemoteInput(srcId, sinkId, inputTypes, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, StopRemoteInput03, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string sinkId = "d6f4s6d4f6"; std::vector dhIds; dhIds.push_back("Input_6ds54f6sd4f65sd4fsdf4s"); - sptr callback = new TestVectorStartStopCallBackStub(); + sptr callback(new TestVectorStartStopCallBackStub()); int32_t ret = callBackProxy.StopRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, StopRemoteInput04, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string srcId = "d6f4s6d4f6"; const std::string sinkId = "5sd45s4d5s4d5"; std::vector dhIds; dhIds.push_back("Input_6ds54f6sd4f65sd4fsdf4s"); - sptr callback = new TestVectorStartStopCallBackStub(); + sptr callback(new TestVectorStartStopCallBackStub()); int32_t ret = callBackProxy.StopRemoteInput(srcId, sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, RegisterAddWhiteListCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); - sptr callback = new TestAddWhiteListInfosCallBack(); + sptr callback(new TestAddWhiteListInfosCallBack()); int32_t ret = callBackProxy.RegisterAddWhiteListCallback(callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, RegisterDelWhiteListCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); - sptr callback = new TestDelWhiteListInfosCallBack(); + sptr callback(new TestDelWhiteListInfosCallBack()); int32_t ret = callBackProxy.RegisterDelWhiteListCallback(callback); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, RegisterInputNodeListener01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); - sptr listener = new TestDInputNodeListenerCallBack(); + sptr listener(new TestDInputNodeListenerCallBack()); int32_t ret = callBackProxy.RegisterInputNodeListener(listener); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, UnregisterInputNodeListener01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); - sptr listener = new TestDInputNodeListenerCallBack(); + sptr listener(new TestDInputNodeListenerCallBack()); int32_t ret = callBackProxy.UnregisterInputNodeListener(listener); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, SyncNodeInfoRemoteInput01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); const std::string userDevId = "a4sd654q8w7e9qwe"; const std::string dhid = "Input_sd65f46df46s54f"; @@ -586,18 +586,18 @@ HWTEST_F(DInputSourceCallBackTest, SyncNodeInfoRemoteInput01, testing::ext::Test HWTEST_F(DInputSourceCallBackTest, RegisterSimulationEventListener01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); - sptr listener = new TestDInputSimulationEventCallBack(); + sptr listener(new TestDInputSimulationEventCallBack()); int32_t ret = callBackProxy.RegisterSimulationEventListener(listener); EXPECT_EQ(DH_SUCCESS, ret); } HWTEST_F(DInputSourceCallBackTest, UnregisterSimulationEventListener01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestDInputSourceCallBackStub(); + sptr callBackStubPtr(new TestDInputSourceCallBackStub()); DistributedInputSourceProxy callBackProxy(callBackStubPtr); - sptr listener = new TestDInputSimulationEventCallBack(); + sptr listener(new TestDInputSimulationEventCallBack()); int32_t ret = callBackProxy.UnregisterSimulationEventListener(listener); EXPECT_EQ(DH_SUCCESS, ret); } diff --git a/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.cpp b/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.cpp index ec91a32c40c260b97d9d22de89c61c4dd697ec26..12b00e074820b421fbd9491e7b215be1baf32179 100644 --- a/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.cpp +++ b/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -222,7 +222,7 @@ HWTEST_F(DistributedInputIpcTest, RegisterInputNodeListener01, testing::ext::Tes HWTEST_F(DistributedInputIpcTest, RegisterInputNodeListener02, testing::ext::TestSize.Level1) { - sptr listener = new TestInputNodeListener(); + sptr listener(new TestInputNodeListener()); int32_t ret = DistributedInputClient::GetInstance().RegisterInputNodeListener(listener); EXPECT_EQ(ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL, ret); } @@ -236,7 +236,7 @@ HWTEST_F(DistributedInputIpcTest, UnregisterInputNodeListener01, testing::ext::T HWTEST_F(DistributedInputIpcTest, UnregisterInputNodeListener02, testing::ext::TestSize.Level1) { - sptr listener = new TestInputNodeListener(); + sptr listener(new TestInputNodeListener()); int32_t ret = DistributedInputClient::GetInstance().UnregisterInputNodeListener(listener); EXPECT_EQ(ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL, ret); } @@ -250,7 +250,7 @@ HWTEST_F(DistributedInputIpcTest, RegisterSimulationEventListener01, testing::ex HWTEST_F(DistributedInputIpcTest, RegisterSimulationEventListener02, testing::ext::TestSize.Level1) { - sptr listener = new TestSimulationEventListenerStub(); + sptr listener(new TestSimulationEventListenerStub()); int32_t ret = DistributedInputClient::GetInstance().RegisterSimulationEventListener(listener); EXPECT_EQ(ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL, ret); } @@ -264,7 +264,7 @@ HWTEST_F(DistributedInputIpcTest, UnregisterSimulationEventListener01, testing:: HWTEST_F(DistributedInputIpcTest, UnregisterSimulationEventListener02, testing::ext::TestSize.Level1) { - sptr listener = new TestSimulationEventListenerStub(); + sptr listener(new TestSimulationEventListenerStub()); int32_t ret = DistributedInputClient::GetInstance().UnregisterSimulationEventListener(listener); EXPECT_EQ(ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL, ret); } diff --git a/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.cpp b/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.cpp index 2539d292b53b566864541d3daddec4e659aaf9de..524fe357172bb89dbc9ffd7859d7f81dceade9d6 100644 --- a/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.cpp +++ b/interfaces/ipc/test/unpreparedinputcallbackunittest/unprepare_d_input_call_back_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -43,7 +43,7 @@ void UnprepareDInputCallbackTest::TestUnprepareDInputCallbackStub::OnResult(cons HWTEST_F(UnprepareDInputCallbackTest, UnprepareDInputCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestUnprepareDInputCallbackStub(); + sptr callBackStubPtr(new TestUnprepareDInputCallbackStub()); UnprepareDInputCallbackProxy callBackProxy(callBackStubPtr); std::string deviceId = "deviceId0"; int32_t status = 0; diff --git a/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.cpp b/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.cpp index 8ba47289209db492f41822bb13d1814dfc5d3e8f..91176a375d6ce88c5e969a6e993cc734415d0b28 100644 --- a/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.cpp +++ b/interfaces/ipc/test/unregisterdinputcallbackunittest/unregister_d_input_call_back_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 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 @@ -44,7 +44,7 @@ void UnregisterDInputCallbackTest::TestUnregisterDInputCallbackStub::OnResult(co HWTEST_F(UnregisterDInputCallbackTest, UnregisterDInputCallback01, testing::ext::TestSize.Level1) { - sptr callBackStubPtr = new TestUnregisterDInputCallbackStub(); + sptr callBackStubPtr(new TestUnregisterDInputCallbackStub()); UnregisterDInputCallbackProxy callBackProxy(callBackStubPtr); std::string deviceId = "deviceId0"; std::string dhId = "dhId0"; diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index a986d3d068bab886e43f05336624f86e4e2ff575..3dfa8efafc7b48cb1ad679256f7f5a5b64ac5452 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -833,8 +833,8 @@ void DistributedInputSinkManager::ProjectWindowListener::OnMessage(const DHTopic } sptr dScreenSinkSA = DInputContext::GetInstance().GetRemoteObject( DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID); - sptr dScreenSinkDeathRecipient = new(std::nothrow) DScreenSinkSvrRecipient(srcDeviceId, - srcWinId); + sptr dScreenSinkDeathRecipient(new(std::nothrow) DScreenSinkSvrRecipient(srcDeviceId, + srcWinId)); dScreenSinkSA->AddDeathRecipient(dScreenSinkDeathRecipient); DInputContext::GetInstance().AddRemoteObject(DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID, dScreenSinkSA); } diff --git a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp index 8820003640176a2b4e29112a1de57856ee2091af..609e4e349b8ae81bcc7a305a015ee4ba5a14386c 100644 --- a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp +++ b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp @@ -174,7 +174,7 @@ HWTEST_F(DistributedInputSinkManagerTest, GetSinkScreenInfosCbackSize01, testing HWTEST_F(DistributedInputSinkManagerTest, RegisterGetSinkScreenInfosCallback_01, testing::ext::TestSize.Level1) { - sptr callback = new TestGetSinkScreenInfosCb(); + sptr callback(new TestGetSinkScreenInfosCb()); int32_t ret = sinkManager_->RegisterGetSinkScreenInfosCallback(callback); EXPECT_EQ(DH_SUCCESS, ret); } diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index 39a78ef6d2ecf36550b166cf868d5700c6817319..f33bb693947f9c410adf019418278bddded92625 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -2648,8 +2648,8 @@ void DistributedInputSourceManager::StartDScreenListener::OnMessage(const DHTopi sptr dScreenSrcSA = DInputContext::GetInstance().GetRemoteObject(DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID); - sptr dScreenSrcDeathRecipient = new(std::nothrow) DScreenSourceSvrRecipient(srcDevId, - sinkDevId, srcScreenInfo.sourceWinId); + sptr dScreenSrcDeathRecipient(new(std::nothrow) DScreenSourceSvrRecipient(srcDevId, + sinkDevId, srcScreenInfo.sourceWinId)); dScreenSrcSA->AddDeathRecipient(dScreenSrcDeathRecipient); DInputContext::GetInstance().AddRemoteObject(DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID, dScreenSrcSA); } diff --git a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp index db31c2a1c9752cd79887359f4f4abf3a52eb5e7e..8bcabf18f026d04371b3d6866d376aeb633bf3d5 100644 --- a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp +++ b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp @@ -287,7 +287,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RegisterDistributedHardware_01, test std::string devId = ""; std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8"; std::string parameters = ""; - sptr callback = new TestRegisterDInputCb(); + sptr callback(new TestRegisterDInputCb()); int32_t ret = sourceManager_->RegisterDistributedHardware(devId, dhId, parameters, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_REGISTER_FAIL, ret); } @@ -309,7 +309,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RegisterDistributedHardware_02, test std::string dhId = pBuffer.descriptor; std::string parameters; StructTransJson(pBuffer, parameters); - sptr callback = new TestRegisterDInputCb(); + sptr callback(new TestRegisterDInputCb()); DistributedInputSourceManager::InputDeviceId inputDeviceId {devId, dhId, GetNodeDesc(parameters)}; sourceManager_->inputDevice_.push_back(inputDeviceId); int32_t ret = sourceManager_->RegisterDistributedHardware(devId, dhId, parameters, callback); @@ -344,7 +344,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnregCallbackNotify_01, testing::ext int32_t ret = sourceManager_->UnregCallbackNotify(devId, dhId); EXPECT_EQ(DH_SUCCESS, ret); - sptr callback = new TestUnregisterDInputCb(); + sptr callback(new TestUnregisterDInputCb()); DistributedInputSourceManager::DInputClientUnregistInfo info {devId, dhId, callback}; sourceManager_->unregCallbacks_.push_back(info); devId = "devId_20221221_test"; @@ -385,7 +385,7 @@ HWTEST_F(DistributedInputSourceManagerTest, CheckDeviceIsExists_01, testing::ext { std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8"; - sptr callback = new TestUnregisterDInputCb(); + sptr callback(new TestUnregisterDInputCb()); DistributedInputSourceManager::InputDeviceId inputDeviceId {devId, dhId}; sourceManager_->inputDevice_.push_back(inputDeviceId); auto it = sourceManager_->inputDevice_.begin(); @@ -397,7 +397,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware_01, te { std::string devId = ""; std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8"; - sptr callback = new TestUnregisterDInputCb(); + sptr callback(new TestUnregisterDInputCb()); int32_t ret = sourceManager_->UnregisterDistributedHardware(devId, dhId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, ret); } @@ -406,7 +406,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware_02, te { std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; std::string dhId = "1ds56v18e1v21v8v1erv15r1v8r1j1ty8"; - sptr callback = new TestUnregisterDInputCb(); + sptr callback(new TestUnregisterDInputCb()); int32_t ret = sourceManager_->UnregisterDistributedHardware(devId, dhId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNREGISTER_FAIL, ret); } @@ -420,7 +420,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnregisterDistributedHardware_02, te HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_01, testing::ext::TestSize.Level1) { std::string devId = ""; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); int32_t ret = sourceManager_->PrepareRemoteInput(devId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret); } @@ -428,7 +428,7 @@ HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_01, testing::ext: HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_02, testing::ext::TestSize.Level1) { std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); DistributedInputSourceManager::DInputClientPrepareInfo info {devId, callback}; sourceManager_->preCallbacks_.push_back(info); int32_t ret = sourceManager_->PrepareRemoteInput(devId, callback); @@ -439,7 +439,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_01, testing::ex { std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t sessionId = 1; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[devId] = sessionId; int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -448,7 +448,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_01, testing::ex HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_02, testing::ext::TestSize.Level1) { std::string devId = ""; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret); devId = "umkyu1b165e1be98151891erbe8r91ev"; @@ -461,7 +461,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_02, testing::ex HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_03, testing::ext::TestSize.Level1) { std::string devId = "devId_4810input4809_test"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = sourceManager_->UnprepareRemoteInput(devId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret); } @@ -475,7 +475,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_03, testing::ex HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_01, testing::ext::TestSize.Level1) { std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = sourceManager_->StartRemoteInput(devId, INPUTTYPE, callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -486,7 +486,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_01, testing::ext::T HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_02, testing::ext::TestSize.Level1) { std::string devId = ""; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = sourceManager_->StartRemoteInput(devId, INPUTTYPE, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); devId = "umkyu1b165e1be98151891erbe8r91ev"; @@ -502,7 +502,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_02, testing::ext::T HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_03, testing::ext::TestSize.Level1) { std::string devId = "devId_4810input4809_test"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = sourceManager_->StartRemoteInput(devId, INPUTTYPE, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); } @@ -516,7 +516,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_03, testing::ext::T HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_01, testing::ext::TestSize.Level1) { std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t ret = sourceManager_->StopRemoteInput(devId, INPUTTYPE, callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -527,7 +527,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_01, testing::ext::Te HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_02, testing::ext::TestSize.Level1) { std::string devId = ""; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t ret = sourceManager_->StopRemoteInput(devId, INPUTTYPE, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); devId = "umkyu1b165e1be98151891erbe8r91ev"; @@ -539,7 +539,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_02, testing::ext::Te HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_03, testing::ext::TestSize.Level1) { - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); std::string devId = "devId_4810input4809_test"; int32_t ret = sourceManager_->StopRemoteInput(devId, INPUTTYPE, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); @@ -555,7 +555,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_04, testing::ext::T { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, INPUTTYPE, callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -567,7 +567,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_05, testing::ext::T { std::string srcId = ""; std::string sinkId = ""; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, INPUTTYPE, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); srcId = "srcId_4810input4809_test"; @@ -585,7 +585,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_05, testing::ext::T HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_06, testing::ext::TestSize.Level1) { - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "devId_4810input4809_test"; int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, INPUTTYPE, callback); @@ -602,7 +602,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_04, testing::ext::Te { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, INPUTTYPE, callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -614,7 +614,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_05, testing::ext::Te { std::string srcId = ""; std::string sinkId = ""; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, INPUTTYPE, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); @@ -633,7 +633,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_05, testing::ext::Te HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_06, testing::ext::TestSize.Level1) { - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "devId_4810input4809_test"; int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, INPUTTYPE, callback); @@ -644,7 +644,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayStartRemoteInputByType_01, test { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); int32_t sessionId = 1; DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId; @@ -663,7 +663,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayStartRemoteInputByType_02, test { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->RelayStartRemoteInputByType(srcId, sinkId, INPUTTYPE, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); @@ -673,7 +673,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayStopRemoteInputByType_01, testi { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); int32_t sessionId = 1; DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId; @@ -692,7 +692,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayStopRemoteInputByType_02, testi { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->RelayStopRemoteInputByType(srcId, sinkId, INPUTTYPE, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); @@ -708,7 +708,7 @@ HWTEST_F(DistributedInputSourceManagerTest, PrepareRemoteInput_03, testing::ext: { std::string srcId = ""; std::string sinkId = ""; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); int32_t ret = sourceManager_->PrepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_PREPARE_FAIL, ret); srcId = "srcId_4810input4809_test"; @@ -736,7 +736,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_04, testing::ex std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t sessionId = 1; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[sinkId] = sessionId; int32_t ret = sourceManager_->UnprepareRemoteInput(srcId, sinkId, callback); @@ -747,7 +747,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_05, testing::ex { std::string srcId = ""; std::string sinkId = ""; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = sourceManager_->UnprepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret); srcId = "srcId_4810input4809_test"; @@ -767,7 +767,7 @@ HWTEST_F(DistributedInputSourceManagerTest, UnprepareRemoteInput_06, testing::ex { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "sinkId_48104809_test"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = sourceManager_->UnprepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret); } @@ -782,7 +782,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_07, testing::ext::T { std::vector dhIds; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); dhIds.push_back("Input_slkdiek3kddkeojfe"); int32_t ret = sourceManager_->StartRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -805,7 +805,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_08, testing::ext::T std::string sinkId = ""; std::vector dhIds; dhIds.push_back("Input_slkdiek3kddkeojfe"); - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); int32_t ret = sourceManager_->StartRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); @@ -822,7 +822,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_09, testing::ext::T dhIds.push_back("Input_slkdiek3kddkeojfe"); std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); sourceManager_->staStringCallbacks_.clear(); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->StartRemoteInput(sinkId, dhIds, callback); @@ -838,7 +838,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_09, testing::ext::T HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_07, testing::ext::TestSize.Level1) { std::vector dhIds; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; dhIds.push_back("Input_slkdiek3kddkeojfe"); int32_t sessionId = 1; @@ -863,7 +863,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_08, testing::ext::Te std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = ""; std::vector dhIds; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); int32_t ret = sourceManager_->StopRemoteInput(sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); sinkId = "umkyu1b165e1be98151891erbe8r91ev"; @@ -879,7 +879,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_09, testing::ext::Te dhIds.push_back("Input_slkdiek3kddkeojfe"); std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); sourceManager_->stpStringCallbacks_.clear(); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->StopRemoteInput(sinkId, dhIds, callback); @@ -895,7 +895,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_09, testing::ext::Te HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_10, testing::ext::TestSize.Level1) { std::vector dhIds; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; dhIds.push_back("Input_slkdiek3kddkeojfe"); @@ -922,7 +922,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_11, testing::ext::T std::string srcId = ""; std::string sinkId = ""; std::vector dhIds; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); @@ -947,7 +947,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_12, testing::ext::T dhIds.push_back("Input_slkdiek3kddkeojfe"); std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); sourceManager_->staStringCallbacks_.clear(); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->StartRemoteInput(srcId, sinkId, dhIds, callback); @@ -963,7 +963,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StartRemoteInput_12, testing::ext::T HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_10, testing::ext::TestSize.Level1) { std::vector dhIds; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; dhIds.push_back("Input_slkdiek3kddkeojfe"); @@ -990,7 +990,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_11, testing::ext::Te std::string srcId = ""; std::string sinkId = ""; std::vector dhIds; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); @@ -1015,7 +1015,7 @@ HWTEST_F(DistributedInputSourceManagerTest, StopRemoteInput_12, testing::ext::Te dhIds.push_back("Input_slkdiek3kddkeojfe"); std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestStartStopVectorCallbackStub(); + sptr callback(new TestStartStopVectorCallbackStub()); sourceManager_->stpStringCallbacks_.clear(); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->StopRemoteInput(srcId, sinkId, dhIds, callback); @@ -1054,7 +1054,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RegisterAddWhiteListCallback01, test HWTEST_F(DistributedInputSourceManagerTest, RegisterAddWhiteListCallback02, testing::ext::TestSize.Level0) { - sptr callback = new TestAddWhiteListInfosCb(); + sptr callback(new TestAddWhiteListInfosCb()); int32_t ret = sourceManager_->RegisterAddWhiteListCallback(callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -1068,7 +1068,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RegisterDelWhiteListCallback01, test HWTEST_F(DistributedInputSourceManagerTest, RegisterDelWhiteListCallback02, testing::ext::TestSize.Level0) { - sptr callback = new TestDelWhiteListInfosCb(); + sptr callback(new TestDelWhiteListInfosCb()); int32_t ret = sourceManager_->RegisterDelWhiteListCallback(callback); EXPECT_EQ(DH_SUCCESS, ret); } @@ -1095,7 +1095,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RegisterSimulationEventListener_01, HWTEST_F(DistributedInputSourceManagerTest, UnregisterSimulationEventListener_02, testing::ext::TestSize.Level1) { - sptr callback = new TestSimulationEventCb(); + sptr callback(new TestSimulationEventCb()); int32_t ret = sourceManager_->RegisterSimulationEventListener(callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -1107,7 +1107,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayPrepareRemoteInput_01, testing: { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); int32_t sessionId = 1; DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId; @@ -1123,7 +1123,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayUnprepareRemoteInput_01, testin { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); int32_t ret = sourceManager_->RelayUnprepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(DH_SUCCESS, ret); @@ -1136,7 +1136,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayUnprepareRemoteInput_02, testin { std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->RelayUnprepareRemoteInput(srcId, sinkId, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_UNPREPARE_FAIL, ret); @@ -1148,7 +1148,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayStartRemoteInputByDhid_01, test std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; std::vector dhIds; dhIds.push_back("input_slkdiek3kddkeojfe"); - sptr callback = new TestStartStopDInputsCb(); + sptr callback(new TestStartStopDInputsCb()); int32_t sessionId = 1; DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId; int32_t ret = sourceManager_->RelayStartRemoteInputByDhid(srcId, sinkId, dhIds, callback); @@ -1174,7 +1174,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayStartRemoteInputByDhid_02, test std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; std::vector dhIds; dhIds.push_back("input_slkdiek3kddkeojfe"); - sptr callback = new TestStartStopDInputsCb(); + sptr callback(new TestStartStopDInputsCb()); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->RelayStartRemoteInputByDhid(srcId, sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_FAIL, ret); @@ -1186,7 +1186,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayStopRemoteInputByDhid_01, testi std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; std::vector dhIds; dhIds.push_back("input_slkdiek3kddkeojfe"); - sptr callback = new TestStartStopDInputsCb(); + sptr callback(new TestStartStopDInputsCb()); int32_t sessionId = 1; DistributedInputTransportBase::GetInstance().remoteDevSessionMap_[srcId] = sessionId; int32_t ret = sourceManager_->RelayStopRemoteInputByDhid(srcId, sinkId, dhIds, callback); @@ -1212,7 +1212,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RelayStopRemoteInputByDhid_02, testi std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; std::vector dhIds; dhIds.push_back("input_slkdiek3kddkeojfe"); - sptr callback = new TestStartStopDInputsCb(); + sptr callback(new TestStartStopDInputsCb()); DistributedInputTransportBase::GetInstance().remoteDevSessionMap_.clear(); int32_t ret = sourceManager_->RelayStopRemoteInputByDhid(srcId, sinkId, dhIds, callback); EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_STOP_FAIL, ret); @@ -1223,7 +1223,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunRegisterCallback_01, testing::ext std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; std::string dhId = "input_slkdiek3kddkeojfe"; int32_t status = 0; - sptr callback = new TestRegisterDInputCb(); + sptr callback(new TestRegisterDInputCb()); DistributedInputSourceManager::DInputClientRegistInfo info {devId, dhId, callback}; sourceManager_->regCallbacks_.push_back(info); sourceManager_->RunRegisterCallback(devId, dhId, status); @@ -1249,7 +1249,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunUnregisterCallback_01, testing::e std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; std::string dhId = "input_slkdiek3kddkeojfe"; int32_t status = 0; - sptr callback = new TestUnregisterDInputCb(); + sptr callback(new TestUnregisterDInputCb()); DistributedInputSourceManager::DInputClientUnregistInfo info {devId, dhId, callback}; sourceManager_->unregCallbacks_.push_back(info); sourceManager_->RunUnregisterCallback(devId, dhId, status); @@ -1275,7 +1275,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunPrepareCallback_01, testing::ext: std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t status = 0; std::string object = "runprepareobject"; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); DistributedInputSourceManager::DInputClientPrepareInfo info {devId, callback}; sourceManager_->preCallbacks_.push_back(info); sourceManager_->RunPrepareCallback(devId, status, object); @@ -1292,7 +1292,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunWhiteListCallback_01, testing::ex { std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; std::string object = "runwhitelistobject"; - sptr callback = new TestAddWhiteListInfosCb(); + sptr callback(new TestAddWhiteListInfosCb()); sourceManager_->addWhiteListCallbacks_.insert(callback); sourceManager_->RunWhiteListCallback(devId, object); EXPECT_EQ(1, sourceManager_->addWhiteListCallbacks_.size()); @@ -1303,7 +1303,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunRelayPrepareCallback_01, testing: std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t status = 0; - sptr callback = new TestPrepareDInputCallback(); + sptr callback(new TestPrepareDInputCallback()); DistributedInputSourceManager::DInputClientRelayPrepareInfo info {srcId, sinkId, callback}; sourceManager_->relayPreCallbacks_.push_back(info); sourceManager_->RunRelayPrepareCallback(srcId, sinkId, status); @@ -1330,7 +1330,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunRelayUnprepareCallback_01, testin std::string srcId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t status = 0; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); DistributedInputSourceManager::DInputClientRelayUnprepareInfo info {srcId, sinkId, callback}; sourceManager_->relayUnpreCallbacks_.push_back(info); sourceManager_->RunRelayUnprepareCallback(srcId, sinkId, status); @@ -1356,7 +1356,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunUnprepareCallback_01, testing::ex std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t status = 0; std::string object = "runprepareobject"; - sptr callback = new TestUnprepareDInputCallback(); + sptr callback(new TestUnprepareDInputCallback()); DistributedInputSourceManager::DInputClientUnprepareInfo info {devId, callback}; sourceManager_->unpreCallbacks_.push_back(info); sourceManager_->RunUnprepareCallback(devId, status); @@ -1375,7 +1375,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunStartCallback_01, testing::ext::T std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t status = 0; uint32_t inputTypes = 1; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); DistributedInputSourceManager::DInputClientStartInfo info {devId, inputTypes, callback}; sourceManager_->staCallbacks_.push_back(info); sourceManager_->RunStartCallback(devId, inputTypes, status); @@ -1401,7 +1401,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunStopCallback_01, testing::ext::Te std::string devId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t status = 0; uint32_t inputTypes = 1; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); DistributedInputSourceManager::DInputClientStopInfo info {devId, inputTypes, callback}; sourceManager_->stpCallbacks_.push_back(info); sourceManager_->RunStopCallback(devId, inputTypes, status); @@ -1430,7 +1430,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunStartDhidCallback_01, testing::ex std::string localNetworkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::vector dhIds; dhIds.push_back("input_slkdiek3kddkeojfe"); - sptr callback = new TestStartStopDInputsCb(); + sptr callback(new TestStartStopDInputsCb()); DistributedInputSourceManager::DInputClientStartDhidInfo info {localNetworkId, sinkId, dhIds, callback}; sourceManager_->staStringCallbacks_.push_back(info); sourceManager_->RunStartDhidCallback(sinkId, dhId, status); @@ -1456,7 +1456,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunStopDhidCallback_01, testing::ext std::string localNetworkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; std::vector dhIds; dhIds.push_back(dhId); - sptr callback = new TestStartStopDInputsCb(); + sptr callback(new TestStartStopDInputsCb()); DistributedInputSourceManager::DInputClientStopDhidInfo info {localNetworkId, sinkId, dhIds, callback}; sourceManager_->stpStringCallbacks_.push_back(info); sourceManager_->RunStopDhidCallback(sinkId, dhId, status); @@ -1482,7 +1482,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunRelayStartDhidCallback_01, testin std::string dhId = "input_slkdiek3kddkeojfe"; std::vector dhIds; dhIds.push_back(dhId); - sptr callback = new TestStartStopDInputsCb(); + sptr callback(new TestStartStopDInputsCb()); DistributedInputSourceManager::DInputClientStartDhidInfo info{srcId, sinkId, dhIds, callback}; sourceManager_->relayStaDhidCallbacks_.push_back(info); sourceManager_->RunRelayStartDhidCallback(srcId, sinkId, status, dhId); @@ -1512,7 +1512,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunRelayStopDhidCallback_01, testing std::string dhId = "input_slkdiek3kddkeojfe"; std::vector dhIds; dhIds.push_back(dhId); - sptr callback = new TestStartStopDInputsCb(); + sptr callback(new TestStartStopDInputsCb()); DistributedInputSourceManager::DInputClientStopDhidInfo info{srcId, sinkId, dhIds, callback}; sourceManager_->relayStpDhidCallbacks_.push_back(info); sourceManager_->RunRelayStopDhidCallback(srcId, sinkId, status, dhId); @@ -1540,7 +1540,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunRelayStartTypeCallback_01, testin std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t status = 0; uint32_t inputTypes = 1; - sptr callback = new TestStartDInputCallback(); + sptr callback(new TestStartDInputCallback()); DistributedInputSourceManager::DInputClientStartTypeInfo info(srcId, sinkId, inputTypes, callback); sourceManager_->relayStaTypeCallbacks_.push_back(info); sourceManager_->RunRelayStartTypeCallback(srcId, sinkId, status, inputTypes); @@ -1567,7 +1567,7 @@ HWTEST_F(DistributedInputSourceManagerTest, RunRelayStopTypeCallback_01, testing std::string sinkId = "umkyu1b165e1be98151891erbe8r91ev"; int32_t status = 0; uint32_t inputTypes = 1; - sptr callback = new TestStopDInputCallback(); + sptr callback(new TestStopDInputCallback()); DistributedInputSourceManager::DInputClientStopTypeInfo info(srcId, sinkId, inputTypes, callback); sourceManager_->relayStpTypeCallbacks_.push_back(info); sourceManager_->RunRelayStopTypeCallback(srcId, sinkId, status, inputTypes); diff --git a/sinkhandler/src/distributed_input_sink_handler.cpp b/sinkhandler/src/distributed_input_sink_handler.cpp index 6fddbfb2b0b8fcd059cd293d04577878dc4e06e3..723a71cbc808f1d5fd167fe9ab3362f0c06664f6 100644 --- a/sinkhandler/src/distributed_input_sink_handler.cpp +++ b/sinkhandler/src/distributed_input_sink_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -41,7 +41,7 @@ int32_t DistributedInputSinkHandler::InitSink(const std::string ¶ms) DHLOGE("Failed to get system ability mgr."); return ERR_DH_INPUT_SINK_HANDLER_INIT_SINK_SA_FAIL; } - sptr loadCallback = new LoadDInputSinkCallback(params); + sptr loadCallback(new LoadDInputSinkCallback(params)); HisyseventUtil::GetInstance().SysEventWriteBehavior(DINPUT_INIT, "dinput sink LoadSystemAbility call"); int32_t ret = samgr->LoadSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SINK_SA_ID, loadCallback); diff --git a/sourcehandler/src/distributed_input_source_handler.cpp b/sourcehandler/src/distributed_input_source_handler.cpp index 5e2556d02e8728a58e74f04b5907e3a2d23d76a0..ddf38ff2bd16bde1c922dc35e0f18b5ab4ac325f 100644 --- a/sourcehandler/src/distributed_input_source_handler.cpp +++ b/sourcehandler/src/distributed_input_source_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -40,7 +40,7 @@ int32_t DistributedInputSourceHandler::InitSource(const std::string ¶ms) DHLOGE("Failed to get system ability mgr."); return ERR_DH_INPUT_SINK_HANDLER_INIT_SOURCE_SA_FAIL; } - sptr loadCallback = new LoadDInputSourceCallback(params); + sptr loadCallback(new LoadDInputSourceCallback(params)); HisyseventUtil::GetInstance().SysEventWriteBehavior(DINPUT_INIT, "dinput init source sa start."); int32_t ret = samgr->LoadSystemAbility(DISTRIBUTED_HARDWARE_INPUT_SOURCE_SA_ID, loadCallback); diff --git a/test/fuzztest/distributedinputkit_fuzzer/distributed_input_kit_fuzzer.cpp b/test/fuzztest/distributedinputkit_fuzzer/distributed_input_kit_fuzzer.cpp index c7b730a549ab0c1ed40812f02a9df762ebdf3e86..4448659d23120d95d1a5c9cf04b9240cd105a6e5 100644 --- a/test/fuzztest/distributedinputkit_fuzzer/distributed_input_kit_fuzzer.cpp +++ b/test/fuzztest/distributedinputkit_fuzzer/distributed_input_kit_fuzzer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2023 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 @@ -108,8 +108,8 @@ void PrepareInputFuzzTest(const uint8_t* data, size_t size) std::string networkId(reinterpret_cast(data), size); - OHOS::sptr prepareCb = new(std::nothrow) TestPrepareDInputCallback(); - OHOS::sptr unprepareCb = new(std::nothrow) TestUnprepareDInputCallback(); + OHOS::sptr prepareCb(new(std::nothrow) TestPrepareDInputCallback()); + OHOS::sptr unprepareCb(new(std::nothrow) TestUnprepareDInputCallback()); DistributedInput::DistributedInputKit::PrepareRemoteInput(networkId, prepareCb); DistributedInput::DistributedInputKit::UnprepareRemoteInput(networkId, unprepareCb); } @@ -124,11 +124,11 @@ void StartRemoteInputFuzzTest(const uint8_t* data, size_t size) std::string sinkId = "456"; uint32_t inputTypes = *(reinterpret_cast(data)); std::vector dhIds= {}; - OHOS::sptr startCb = new (std::nothrow) TestStartDInputCallback(); - OHOS::sptr stopCb = new (std::nothrow) TestStopDInputCallback(); + OHOS::sptr startCb(new (std::nothrow) TestStartDInputCallback()); + OHOS::sptr stopCb(new (std::nothrow) TestStopDInputCallback()); DistributedInput::DistributedInputKit::StartRemoteInput(sinkId, inputTypes, startCb); DistributedInput::DistributedInputKit::StartRemoteInput(srcId, sinkId, inputTypes, startCb); - OHOS::sptr callback = new (std::nothrow) TestIStartStopDInputsCallback(); + OHOS::sptr callback(new (std::nothrow) TestIStartStopDInputsCallback()); DistributedInput::DistributedInputKit::StartRemoteInput(sinkId, dhIds, callback); DistributedInput::DistributedInputKit::StartRemoteInput(srcId, sinkId, dhIds, callback); } @@ -160,11 +160,11 @@ void StopRemoteInputFuzzTest(const uint8_t* data, size_t size) std::string sinkId = "456"; uint32_t inputTypes = *(reinterpret_cast(data)); std::vector dhIds = {}; - OHOS::sptr startCb = new (std::nothrow) TestStartDInputCallback(); - OHOS::sptr stopCb = new (std::nothrow) TestStopDInputCallback(); + OHOS::sptr startCb(new (std::nothrow) TestStartDInputCallback()); + OHOS::sptr stopCb(new (std::nothrow) TestStopDInputCallback()); DistributedInput::DistributedInputKit::StopRemoteInput(sinkId, inputTypes, stopCb); DistributedInput::DistributedInputKit::StopRemoteInput(srcId, sinkId, inputTypes, stopCb); - OHOS::sptr callback = new (std::nothrow) TestIStartStopDInputsCallback(); + OHOS::sptr callback(new (std::nothrow) TestIStartStopDInputsCallback()); DistributedInput::DistributedInputKit::StopRemoteInput(sinkId, dhIds, callback); DistributedInput::DistributedInputKit::StopRemoteInput(srcId, sinkId, dhIds, callback); }