diff --git a/bundle.json b/bundle.json index 3cedd469cb3ac537f37f6fe5393aa291f96a63bf..079d346068712b9124481e9a33cba2440285a993 100644 --- a/bundle.json +++ b/bundle.json @@ -81,10 +81,10 @@ "//foundation/distributedhardware/distributedscreen/services/screentransport/test/unittest:screen_transport_test", "//foundation/distributedhardware/distributedscreen/services/softbusadapter/test/unittest:SoftBusAdapterTest", "//foundation/distributedhardware/distributedscreen/services/common/test/unittest:service_common_test", + "//foundation/distributedhardware/distributedscreen/services/screenservice/test/unittest:screen_service_test", "//foundation/distributedhardware/distributedscreen/screenhandler/test/fuzztest:fuzztest", "//foundation/distributedhardware/distributedscreen/interfaces/innerkits/native_cpp/test/fuzztest:fuzztest", "//foundation/distributedhardware/distributedscreen/services/softbusadapter/test/fuzztest:fuzztest", - "//foundation/distributedhardware/distributedscreen/services/screenservice/test/fuzztest:fuzztest", "//foundation/distributedhardware/distributedscreen/services/screentransport/test/fuzztest:fuzztest" ] } diff --git a/services/screenservice/test/unittest/BUILD.gn b/services/screenservice/test/unittest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cdbd37951c6d5cee5ab3811a882987895489364b --- /dev/null +++ b/services/screenservice/test/unittest/BUILD.gn @@ -0,0 +1,20 @@ +# 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. + +group("screen_service_test") { + testonly = true + deps = [ + "sinkservice:sink_service_test", + "sourceservice:source_service_test", + ] +} diff --git a/services/screenservice/test/unittest/sinkservice/BUILD.gn b/services/screenservice/test/unittest/sinkservice/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..dbaa665c3dd9b8e6c43705a51cbc7a8999c67f24 --- /dev/null +++ b/services/screenservice/test/unittest/sinkservice/BUILD.gn @@ -0,0 +1,91 @@ +# 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/distributedscreen/distributedscreen.gni") + +module_out_path = "distributed_screen/services/sink_service_test" + +config("module_private_config") { + visibility = [ ":*" ] + + include_dirs = [ + "//third_party/json/include", + "//utils/native/base/include", + "//utils/system/safwk/native/include", + "//foundation/graphic/graphic/standard/interfaces/inner_api/surface", + "//foundation/graphic/graphic/standard/interfaces/inner_api/common", + "${windowmanager_path}/interfaces/innerkits/dm", + "${fwk_common_path}/utils/include", + ] + + include_dirs += [ + "./dscreenservice/include", + "./screenregionmgr/include", + "${interfaces_path}/innerkits/native_cpp/screen_sink/include", + "${interfaces_path}/innerkits/native_cpp/screen_sink/include/callback", + "${interfaces_path}/innerkits/native_cpp/screen_source/include", + "${interfaces_path}/innerkits/native_cpp/screen_source/include/callback", + "${common_path}/include", + "${services_path}/common/utils/include", + "${services_path}/common/databuffer/include", + "${services_path}/common/screen_channel/include", + "${services_path}/screentransport/screensinktrans/include", + "${services_path}/screentransport/screensinkprocessor/include", + "${services_path}/screentransport/screensinkprocessor/decoder/include", + "${services_path}/screenclient/include/", + "${services_path}/screenservice/test/unittest/sinkservice/dscreenservice/include", + "${services_path}/screenservice/test/unittest/sinkservice/screenregionmgr/include", + "${services_path}/screenservice/sinkservice/dscreenservice/include", + "${services_path}/screenservice/sinkservice/screenregionmgr/include", + ] +} + +##UnitTest sink_service_test +ohos_unittest("SinkServiceTest") { + module_out_path = module_out_path + + sources = [ + "${services_path}/screenservice/test/unittest/sinkservice/dscreenservice/src/dscreen_sink_service_test.cpp", + "${services_path}/screenservice/test/unittest/sinkservice/screenregionmgr/src/mock_iscreen_sink_trans.cpp", + "${services_path}/screenservice/test/unittest/sinkservice/screenregionmgr/src/screen_region_test.cpp", + ] + + configs = [ ":module_private_config" ] + + deps = [ + "${common_path}:distributed_screen_utils", + "${fwk_utils_path}:distributedhardwareutils", + "${services_path}/screenclient:distributed_screen_client", + "${services_path}/screenservice/sinkservice:distributed_screen_sink", + "${services_path}/screentransport/screensinktrans:distributed_screen_sinktrans", + "${windowmanager_path}/dm:libdm", + "//foundation/graphic/standard/frameworks/surface:surface", + "//third_party/googletest:gmock", + "//third_party/googletest:gtest_main", + ] + + external_deps = [ + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "multimedia_media_standard:media_client", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", + ] +} + +group("sink_service_test") { + testonly = true + deps = [ ":SinkServiceTest" ] +} diff --git a/services/screenservice/test/unittest/sinkservice/dscreenservice/include/dscreen_sink_service_test.h b/services/screenservice/test/unittest/sinkservice/dscreenservice/include/dscreen_sink_service_test.h new file mode 100644 index 0000000000000000000000000000000000000000..17474bae8e1e1c7f7f0822c2dd19a9a38b84171c --- /dev/null +++ b/services/screenservice/test/unittest/sinkservice/dscreenservice/include/dscreen_sink_service_test.h @@ -0,0 +1,47 @@ +/* + * 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_DSCREEN_SINK_SERVICE_TEST_H +#define OHOS_DSCREEN_SINK_SERVICE_TEST_H + +#include + +#include "if_system_ability_manager.h" +#include "ipc_skeleton.h" +#include "ipc_types.h" +#include "iservice_registry.h" +#include "system_ability_definition.h" +#include "string_ex.h" + +#include "dscreen_constants.h" +#include "dscreen_errcode.h" +#include "dscreen_log.h" +#include "dscreen_sink_service.h" +#include "dscreen_util.h" + +namespace OHOS { +namespace DistributedHardware { +class DScreenSinkServiceTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); + + std::shared_ptr sinkService_ = nullptr; +}; +} // DistributedHardware +} // OHOS +#endif \ No newline at end of file diff --git a/services/screenservice/test/unittest/sinkservice/dscreenservice/src/dscreen_sink_service_test.cpp b/services/screenservice/test/unittest/sinkservice/dscreenservice/src/dscreen_sink_service_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ea8d626b02c0e6a03e270f0dea3d00d576acbddd --- /dev/null +++ b/services/screenservice/test/unittest/sinkservice/dscreenservice/src/dscreen_sink_service_test.cpp @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#define private public +#include "dscreen_sink_service_test.h" +#undef private + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void DScreenSinkServiceTest::SetUpTestCase(void) {} + +void DScreenSinkServiceTest::TearDownTestCase(void) {} + +void DScreenSinkServiceTest::SetUp() +{ + int32_t saId = DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID; + bool runOnCreate = false; + sinkService_ = std::make_shared(saId, runOnCreate); +} + +void DScreenSinkServiceTest::TearDown() {} + +/** + * @tc.name: InitSink_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenSinkServiceTest, InitSink_001, TestSize.Level1) +{ + std::string params = "params"; + int32_t actual = sinkService_->InitSink(params); + EXPECT_EQ(DH_SUCCESS, actual); +} + +/** + * @tc.name: SubscribeLocalHardware_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenSinkServiceTest, SubscribeLocalHardware_001, TestSize.Level1) +{ + std::string dhId = "dhId"; + std::string param = "param"; + int32_t actual = sinkService_->SubscribeLocalHardware(dhId, param); + EXPECT_EQ(DH_SUCCESS, actual); +} + +/** + * @tc.name: UnsubscribeLocalHardware_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenSinkServiceTest, UnsubscribeLocalHardware_001, TestSize.Level1) +{ + std::string dhId = "dhId"; + int32_t actual = sinkService_->UnsubscribeLocalHardware(dhId); + EXPECT_EQ(DH_SUCCESS, actual); +} +} // DistributedHardware +} // OHOS \ No newline at end of file diff --git a/services/screenservice/test/unittest/sinkservice/screenregionmgr/include/mock_iscreen_sink_trans.h b/services/screenservice/test/unittest/sinkservice/screenregionmgr/include/mock_iscreen_sink_trans.h new file mode 100644 index 0000000000000000000000000000000000000000..d27df4c2099013fdb393224c6cec7971077a6255 --- /dev/null +++ b/services/screenservice/test/unittest/sinkservice/screenregionmgr/include/mock_iscreen_sink_trans.h @@ -0,0 +1,36 @@ +/* + * 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_MOCK_ISCREEN_SINK_TRANS_H +#define OHOS_MOCK_ISCREEN_SINK_TRANS_H + +#include "iscreen_sink_trans.h" + +namespace OHOS { +namespace DistributedHardware { +class MockIScreenSinkTrans : public IScreenSinkTrans { +public: + MockIScreenSinkTrans() = default; + ~MockIScreenSinkTrans() = default; + virtual int32_t SetUp(const VideoParam &localParam, const VideoParam &remoteParam, const std::string &peerDevId); + virtual int32_t Release(); + virtual int32_t Start(); + virtual int32_t Stop(); + virtual int32_t RegisterStateCallback(const std::shared_ptr &callback); + virtual int32_t SetImageSurface(const sptr &surface); +}; +} // DistributedHardware +} // OHOS +#endif \ No newline at end of file diff --git a/services/screenservice/test/unittest/sinkservice/screenregionmgr/include/screen_region_test.h b/services/screenservice/test/unittest/sinkservice/screenregionmgr/include/screen_region_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cca4b3a97404a93f938d1b88d8313ca5b172f67c --- /dev/null +++ b/services/screenservice/test/unittest/sinkservice/screenregionmgr/include/screen_region_test.h @@ -0,0 +1,44 @@ +/* + * 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_SCREEN_REGION_TEST_H +#define OHOS_SCREEN_REGION_TEST_H + +#include + +#include "dscreen_constants.h" +#include "dscreen_errcode.h" +#include "dscreen_log.h" +#include "dscreen_util.h" +#include "mock_iscreen_sink_trans.h" +#include "screen_client.h" +#include "screen_client_common.h" +#include "screenregion.h" +#include "screen_sink_trans.h" + +namespace OHOS { +namespace DistributedHardware { +class ScreenRegionTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); + + std::shared_ptr screenRegion_ = nullptr; +}; +} // DistributedHardware +} // OHOS +#endif \ No newline at end of file diff --git a/services/screenservice/test/unittest/sinkservice/screenregionmgr/src/mock_iscreen_sink_trans.cpp b/services/screenservice/test/unittest/sinkservice/screenregionmgr/src/mock_iscreen_sink_trans.cpp new file mode 100644 index 0000000000000000000000000000000000000000..08fdb98c8284293a0a26df58577a207dfe4eb632 --- /dev/null +++ b/services/screenservice/test/unittest/sinkservice/screenregionmgr/src/mock_iscreen_sink_trans.cpp @@ -0,0 +1,56 @@ +/* + * 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 "mock_iscreen_sink_trans.h" + +namespace OHOS { +namespace DistributedHardware { +int32_t MockIScreenSinkTrans::SetUp(const VideoParam &localParam, const VideoParam &remoteParam, + const std::string &peerDevId) +{ + (void) localParam; + (void) remoteParam; + (void) peerDevId; + return 0; +} + +int32_t MockIScreenSinkTrans::Release() +{ + return 0; +} + +int32_t MockIScreenSinkTrans::Start() +{ + return 0; +} +int32_t MockIScreenSinkTrans::Stop() +{ + return 0; +} + +int32_t MockIScreenSinkTrans::RegisterStateCallback(const std::shared_ptr &callback) +{ + (void) callback; + return 0; +} + +int32_t MockIScreenSinkTrans::SetImageSurface(const sptr &surface) +{ + (void) surface; + return 0; +} +} // DistributedHardware +} // OHOS + diff --git a/services/screenservice/test/unittest/sinkservice/screenregionmgr/src/screen_region_test.cpp b/services/screenservice/test/unittest/sinkservice/screenregionmgr/src/screen_region_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c1e55934b643152c88fb4318ed86fa31ea5cdd76 --- /dev/null +++ b/services/screenservice/test/unittest/sinkservice/screenregionmgr/src/screen_region_test.cpp @@ -0,0 +1,151 @@ +/* + * 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. + */ + +#define private public +#include "screen_region_test.h" +#undef private + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void ScreenRegionTest::SetUpTestCase(void) {} + +void ScreenRegionTest::TearDownTestCase(void) {} + +void ScreenRegionTest::SetUp() +{ + const std::string remoteDevId = "remoteDevId"; + uint64_t screenId = 0; + uint64_t displayId = 0; + screenRegion_ = std::make_shared(remoteDevId, screenId, displayId); +} + +void ScreenRegionTest::TearDown() {} + +/** + * @tc.name: OnTransError_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, OnTransError_001, TestSize.Level1) +{ + int32_t err = 0; + const std::string content = "content"; + screenRegion_->sinkTrans_ = nullptr; + screenRegion_->OnTransError(err, content); +} + +/** + * @tc.name: SetVideoParam_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, SetVideoParam_001, TestSize.Level1) +{ + std::shared_ptr videoParam = std::make_shared(); + screenRegion_->SetVideoParam(videoParam); +} + +/** + * @tc.name: SetMapRelation_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, SetMapRelation_001, TestSize.Level1) +{ + std::shared_ptr mapRelation = std::make_shared(); + screenRegion_->SetMapRelation(mapRelation); +} + +/** + * @tc.name: Start_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, Start_001, TestSize.Level1) +{ + int32_t actual = screenRegion_->Start(); + EXPECT_EQ(ERR_DH_SCREEN_SA_SINKTRANS_NOT_INIT, actual); +} + +/** + * @tc.name: Start_002 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, Start_002, TestSize.Level1) +{ + screenRegion_->sinkTrans_ = std::make_shared(); + int32_t actual = screenRegion_->Start(); + EXPECT_EQ(DH_SUCCESS, actual); +} + +/** + * @tc.name: Stop_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, Stop_001, TestSize.Level1) +{ + screenRegion_->isRunning = true; + screenRegion_->sinkTrans_ = nullptr; + int32_t actual = screenRegion_->Stop(); + EXPECT_EQ(ERR_DH_SCREEN_SA_SINKTRANS_NOT_INIT, actual); +} + +/** + * @tc.name: Stop_002 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, Stop_002, TestSize.Level1) +{ + int32_t actual = screenRegion_->Stop(); + EXPECT_EQ(DH_SUCCESS, actual); +} + +/** + * @tc.name: GetScreenId_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, GetScreenId_001, TestSize.Level1) +{ + int32_t actual = screenRegion_->GetScreenId(); + EXPECT_EQ(screenRegion_->screenId_, actual); +} + +/** + * @tc.name: GetRemoteDevId_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenRegionTest, GetRemoteDevId_001, TestSize.Level1) +{ + std::string actual = screenRegion_->GetRemoteDevId(); + EXPECT_EQ(screenRegion_->remoteDevId_, actual); +} +} // DistributedHardware +} // OHOS \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/BUILD.gn b/services/screenservice/test/unittest/sourceservice/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..738dcbb67185fb5279c897eab23def3326c9313e --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/BUILD.gn @@ -0,0 +1,98 @@ +# 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/distributedscreen/distributedscreen.gni") + +module_out_path = "distributed_screen/services/source_service_test" + +config("module_private_config") { + visibility = [ ":*" ] + + include_dirs = [ + "//third_party/json/include", + "${windowmanager_path}/interfaces/innerkits/dm", + "//utils/native/base/include", + "//utils/system/safwk/native/include", + "//foundation/graphic/graphic/standard/interfaces/inner_api/surface", + "//foundation/graphic/graphic/standard/interfaces/inner_api/common", + "//foundation/graphic/graphic/standard/rosen/modules/render_service_base/include", + "${fwk_utils_path}/include/log", + "${fwk_utils_path}/include", + "${fwk_common_path}/log/inlcude", + "${fwk_common_path}/utils/include", + "${mediastandard_path}/interfaces/innerkits/native/media/include", + "${mediastandard_path}/interfaces/inner_api/native", + "//foundation/multimedia/image_standard/interfaces/innerkits/include", + ] + + include_dirs += [ + "./dscreenservice/include", + "./dscreenservice/include/callback", + "./dscreenmgr/include", + "${common_path}/include", + "${services_path}/common/utils/include", + "${services_path}/common/databuffer/include", + "${services_path}/common/screen_channel/include", + "${services_path}/screentransport/screensourceprocessor/include", + "${services_path}/screentransport/screensourceprocessor/encoder/include", + "${services_path}/screentransport/screensourcetrans/include", + "${services_path}/screenservice/test/unittest/sourceservice/dscreenmgr/include", + "${services_path}/screenservice/test/unittest/sourceservice/dscreenservice/include", + "${services_path}/screenservice/sourceservice/dscreenmgr/include", + "${services_path}/screenservice/sourceservice/dscreenservice/include", + "${services_path}/screenservice/sourceservice/dscreenservice/include/callback", + "${interfaces_path}/innerkits/native_cpp/screen_source/include", + "${interfaces_path}/innerkits/native_cpp/screen_source/include/callback", + "${interfaces_path}/innerkits/native_cpp/screen_sink/include", + ] +} + +##Unittest source_service_test +ohos_unittest("SourceServiceTest") { + module_out_path = module_out_path + + sources = [ + "${services_path}/screenservice/test/unittest/sourceservice/dscreenmgr/src/dscreen_manager_test.cpp", + "${services_path}/screenservice/test/unittest/sourceservice/dscreenmgr/src/dscreen_test.cpp", + "${services_path}/screenservice/test/unittest/sourceservice/dscreenmgr/src/screen_manager_adapter_test.cpp", + "${services_path}/screenservice/test/unittest/sourceservice/dscreenservice/src/dscreen_source_service_test.cpp", + ] + + configs = [ ":module_private_config" ] + + deps = [ + "${common_path}:distributed_screen_utils", + "${fwk_utils_path}:distributedhardwareutils", + "${services_path}/screenservice/sourceservice:distributed_screen_source", + "${services_path}/screentransport/screensourcetrans:distributed_screen_sourcetrans", + "${windowmanager_path}/dm:libdm", + "//foundation/graphic/standard/frameworks/surface:surface", + "//third_party/googletest:gmock", + "//third_party/googletest:gtest_main", + "//utils/native/base:utils", + ] + + external_deps = [ + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_standard:samgr_proxy", + ] +} + +group("source_service_test") { + testonly = true + deps = [ ":SourceServiceTest" ] +} diff --git a/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/dscreen_manager_test.h b/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/dscreen_manager_test.h new file mode 100644 index 0000000000000000000000000000000000000000..543c57bbd366f2f7bbb8a9915e0560699af52e1e --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/dscreen_manager_test.h @@ -0,0 +1,44 @@ +/* + * 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_DSCREEN_MANAGER_TEST_H +#define OHOS_DSCREEN_MANAGER_TEST_H + +#include + +#include "if_system_ability_manager.h" +#include "iservice_registry.h" +#include "nlohmann/json.hpp" + +#include "dscreen_constants.h" +#include "dscreen_errcode.h" +#include "dscreen_log.h" +#include "dscreen_manager.h" +#include "dscreen_util.h" +#include "idscreen_sink.h" +#include "screen_manager_adapter.h" + +namespace OHOS { +namespace DistributedHardware { +class DScreenManagerTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; +} // DistributedHardware +} // OHOS +#endif \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/dscreen_test.h b/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/dscreen_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e0700a90b783d1ecf759875e3750b999cacd0596 --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/dscreen_test.h @@ -0,0 +1,45 @@ +/* + * 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_DSCREEN_TEST_H +#define OHOS_DSCREEN_TEST_H + +#include + +#include "avcodec_info.h" +#include "avcodec_list.h" + +#include "dscreen.h" +#include "dscreen_constants.h" +#include "dscreen_errcode.h" +#include "dscreen_log.h" +#include "dscreen_util.h" +#include "screen_manager_adapter.h" +#include "screen_source_trans.h" + +namespace OHOS { +namespace DistributedHardware { +class DScreenTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); + + std::shared_ptr dScreen_ = nullptr; +}; +} // DistributedHardware +} // OHOS +#endif \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/screen_manager_adapter_test.h b/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/screen_manager_adapter_test.h new file mode 100644 index 0000000000000000000000000000000000000000..eebab5bfce3ac83dbed15b86c8731adc00c8264e --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/dscreenmgr/include/screen_manager_adapter_test.h @@ -0,0 +1,53 @@ +/* + * 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_SCREEN_MANAGER_ADAPTER_TEST_H +#define OHOS_SCREEN_MANAGER_ADAPTER_TEST_H + +#include +#include + +#include "display_manager.h" +#include "dm_common.h" +#include "screen.h" + +#include "dscreen_constants.h" +#include "dscreen_errcode.h" +#include "dscreen_log.h" +#include "screen_manager_adapter.h" + +namespace OHOS { +namespace DistributedHardware { +class ScreenMgrAdapterTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; + +class MockScreenGroupListener : public Rosen::ScreenManager::IScreenGroupListener { +public: + MockScreenGroupListener() = default; + ~MockScreenGroupListener() = default; + void OnChange(const std::vector &screenId, + Rosen::ScreenGroupChangeEvent MockScreenGroupChangeEvent) override + { + return; + } +}; +} // DistributedHardware +} // OHOS +#endif \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/dscreen_manager_test.cpp b/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/dscreen_manager_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5848a292b5426530a868e9579f093bdf03549d3f --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/dscreen_manager_test.cpp @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#define private public +#include "dscreen_manager_test.h" +#undef private + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void DScreenManagerTest::SetUpTestCase(void) {} + +void DScreenManagerTest::TearDownTestCase(void) {} + +void DScreenManagerTest::SetUp() {} + +void DScreenManagerTest::TearDown() {} + +/** + * @tc.name: EnableDistributedScreen_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenManagerTest, EnableDistributedScreen_001, TestSize.Level1) +{ + std::string devId = "devId"; + std::string dhId = "dhId"; + std::string param = "param"; + std::string reqId = "reqId"; + std::shared_ptr dScreenCallback_ = nullptr; + int32_t actual = DScreenManager::GetInstance().EnableDistributedScreen(devId, dhId, param, reqId); + EXPECT_EQ(ERR_DH_SCREEN_SA_ENABLE_FAILED, actual); +} + +/** + * @tc.name: DisableDistributedScreen_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenManagerTest, DisableDistributedScreen_001, TestSize.Level1) +{ + std::string devId = "devId"; + std::string dhId = "dhId"; + std::string reqId = "reqId"; + int32_t actual = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); + EXPECT_EQ(ERR_DH_SCREEN_SA_DISABLE_FAILED, actual); +} + +/** + * @tc.name: Init_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenManagerTest, Init_001, TestSize.Level1) +{ + int32_t actual = DScreenManager::GetInstance().Init(); + EXPECT_EQ(DH_SUCCESS, actual); +} + +/** + * @tc.name: UnInit_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenManagerTest, UnInit_001, TestSize.Level1) +{ + int32_t actual = DScreenManager::GetInstance().UnInit(); + EXPECT_EQ(DH_SUCCESS, actual); +} +} // DistributedHardware +} // OHOS \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/dscreen_test.cpp b/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/dscreen_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..456fd2f0fbbef2cc794509fefaacbf1327bc68db --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/dscreen_test.cpp @@ -0,0 +1,118 @@ +/* + * 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. + */ + +#define private public +#include "dscreen_test.h" +#undef private + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void DScreenTest::SetUpTestCase(void) {} + +void DScreenTest::TearDownTestCase(void) {} + +void DScreenTest::SetUp() +{ + const std::string devId = "devId"; + const std::string dhId = "dhId"; + std::shared_ptr dscreenCallback = nullptr; + dScreen_ = std::make_shared(devId, dhId, dscreenCallback); +} + +void DScreenTest::TearDown() {} + +/** + * @tc.name: GetVideoParam_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenTest, GetVideoParam_001, TestSize.Level1) +{ + std::shared_ptr videoParam = std::make_shared(); + dScreen_->SetVideoParam(videoParam); + std::shared_ptr actual = dScreen_->GetVideoParam(); + EXPECT_NE(nullptr, actual); +} + +/** + * @tc.name: GetState_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenTest, GetState_001, TestSize.Level1) +{ + DScreenState state = DISABLED; + dScreen_->SetState(state); + DScreenState actual = dScreen_->GetState(); + EXPECT_EQ(DISABLED, actual); +} + +/** + * @tc.name: GetScreenId_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenTest, GetScreenId_001, TestSize.Level1) +{ + uint64_t screenId = 1000; + uint64_t actual = dScreen_->GetScreenId(); + EXPECT_NE(screenId, actual); +} + +/** + * @tc.name: GetDHId_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenTest, GetDHId_001, TestSize.Level1) +{ + std::string dhId = "dhId"; + std::string actual = dScreen_->GetDHId(); + EXPECT_EQ(dhId, actual); +} + +/** + * @tc.name: GetDevId_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenTest, GetDevId_001, TestSize.Level1) +{ + std::string devId = "devId"; + std::string actual = dScreen_->GetDevId(); + EXPECT_EQ(devId, actual); +} + +/** + * @tc.name: AddTask_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenTest, AddTask_001, TestSize.Level1) +{ + std::shared_ptr task = nullptr; + int actual = dScreen_->AddTask(task); + EXPECT_EQ(ERR_DH_SCREEN_SA_DSCREEN_TASK_NOT_VALID, actual); +} +} // DistributedHardware +} // OHOS \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/screen_manager_adapter_test.cpp b/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/screen_manager_adapter_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a7119e3066730ef3babdd74792f20ff622513acb --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/dscreenmgr/src/screen_manager_adapter_test.cpp @@ -0,0 +1,108 @@ +/* + * 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. + */ + +#define private public +#include "screen_manager_adapter_test.h" +#undef private + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void ScreenMgrAdapterTest::SetUpTestCase(void) {} + +void ScreenMgrAdapterTest::TearDownTestCase(void) {} + +void ScreenMgrAdapterTest::SetUp() {} + +void ScreenMgrAdapterTest::TearDown() {} + +/** + * @tc.name: CreateVirtualScreen_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenMgrAdapterTest, CreateVirtualScreen_001, TestSize.Level1) +{ + std::string devId = "devId"; + std::string dhId = "dhId"; + uint64_t screenId = SCREEN_ID_INVALID; + std::shared_ptr videoParam = std::make_shared(); + videoParam->SetScreenWidth(2560); + videoParam->SetScreenHeight(1600); + std::string screenName = DSCREEN_PREFIX + SEPERATOR + devId + SEPERATOR + dhId; + ScreenMgrAdapter::GetInstance().screenIdMap_.emplace(screenName, SCREEN_ID_INVALID); + uint64_t actual = ScreenMgrAdapter::GetInstance().CreateVirtualScreen(devId, dhId, videoParam); + EXPECT_EQ(screenId, actual); + ScreenMgrAdapter::GetInstance().RemoveVirtualScreen(actual); +} + +/** + * @tc.name: RemoveVirtualScreen_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenMgrAdapterTest, RemoveVirtualScreen_001, TestSize.Level1) +{ + uint64_t screenId = 0; + uint64_t actual = ScreenMgrAdapter::GetInstance().RemoveVirtualScreen(screenId); + EXPECT_NE(DH_SUCCESS, actual); +} + +/** + * @tc.name: SetImageSurface_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenMgrAdapterTest, SetImageSurface_001, TestSize.Level1) +{ + uint64_t screenId = 0; + sptr surface; + int32_t actual = ScreenMgrAdapter::GetInstance().SetImageSurface(screenId, surface); + EXPECT_EQ(DH_SUCCESS, actual); +} + + +/** + * @tc.name: RegisterScreenGroupListener_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenMgrAdapterTest, RegisterScreenGroupListener_001, TestSize.Level1) +{ + sptr listener = new MockScreenGroupListener(); + int32_t actual = ScreenMgrAdapter::GetInstance().RegisterScreenGroupListener(listener); + EXPECT_EQ(DH_SUCCESS, actual); + ScreenMgrAdapter::GetInstance().UnregisterScreenGroupListener(listener); +} + +/** + * @tc.name: UnregisterScreenGroupListener_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenMgrAdapterTest, UnregisterScreenGroupListener_001, TestSize.Level1) +{ + sptr listener = new MockScreenGroupListener(); + int32_t actual = ScreenMgrAdapter::GetInstance().UnregisterScreenGroupListener(listener); + EXPECT_EQ(DH_SUCCESS, actual); +} +} // DistributedHardware +} // OHOS \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/dscreenservice/include/dscreen_source_service_test.h b/services/screenservice/test/unittest/sourceservice/dscreenservice/include/dscreen_source_service_test.h new file mode 100644 index 0000000000000000000000000000000000000000..500a1279a8e6f91faef637ae799df09684cca920 --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/dscreenservice/include/dscreen_source_service_test.h @@ -0,0 +1,47 @@ +/* + * 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_DSCREEN_SOURCE_SERVICE_TEST_H +#define OHOS_DSCREEN_SOURCE_SERVICE_TEST_H + +#include + +#include "if_system_ability_manager.h" +#include "ipc_skeleton.h" +#include "ipc_types.h" +#include "iservice_registry.h" +#include "string_ex.h" +#include "system_ability_definition.h" + +#include "dscreen_constants.h" +#include "dscreen_errcode.h" +#include "dscreen_log.h" +#include "dscreen_source_service.h" +#include "dscreen_util.h" + +namespace OHOS { +namespace DistributedHardware { +class DSCreenSourceServiceTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); + + std::shared_ptr dScreenSourceService_ = nullptr; +}; +} // DistributedHardware +} // OHOS +#endif \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/dscreenservice/src/dscreen_source_service_test.cpp b/services/screenservice/test/unittest/sourceservice/dscreenservice/src/dscreen_source_service_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d0f83650b6bdc049da5fbaaac4397d6e70d43a64 --- /dev/null +++ b/services/screenservice/test/unittest/sourceservice/dscreenservice/src/dscreen_source_service_test.cpp @@ -0,0 +1,104 @@ +/* + * 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. + */ + +#define private public +#include "dscreen_source_service_test.h" +#undef private + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void DSCreenSourceServiceTest::SetUpTestCase(void) {} + +void DSCreenSourceServiceTest::TearDownTestCase(void) {} + +void DSCreenSourceServiceTest::SetUp() +{ + int32_t saId = DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID; + bool runOnCreate = true; + dScreenSourceService_ = std::make_shared(saId, runOnCreate); +} + +void DSCreenSourceServiceTest::TearDown() {} + +/** + * @tc.name: InitSource_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DSCreenSourceServiceTest, InitSource_001, TestSize.Level1) +{ + std::string params = "params"; + sptr callback = nullptr; + int32_t actual = dScreenSourceService_->InitSource(params, callback); + EXPECT_EQ(DH_SUCCESS, actual); +} + +/** + * @tc.name: RegisterDistributedHardware_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DSCreenSourceServiceTest, RegisterDistributedHardware_001, TestSize.Level1) +{ + std::string devId = "devId"; + std::string dhId = "dhId"; + EnableParam param; + param.version = "version"; + param.attrs = "attrs"; + std::string reqId = "reqId"; + int32_t actual = dScreenSourceService_->RegisterDistributedHardware(devId, dhId, param, reqId); + EXPECT_EQ(DH_SUCCESS, actual); +} + +/** + * @tc.name: UnregisterDistributedHardware_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DSCreenSourceServiceTest, UnregisterDistributedHardware_001, TestSize.Level1) +{ + std::string devIdTrue = "devIdTrue"; + std::string dhIdTrue = "dhIdTrue"; + std::string reqId = "reqId"; + std::string devIdFalse = "devIdFalse"; + std::string dhIdFalse = "dhIdFalse"; + std::shared_ptr dscreenCallback = nullptr; + std::shared_ptr dScreen = std::make_shared(devIdFalse, dhIdFalse, dscreenCallback); + int32_t actual = dScreenSourceService_->UnregisterDistributedHardware(devIdTrue, dhIdTrue, reqId); + EXPECT_EQ(ERR_DH_SCREEN_SA_DISABLE_FAILED, actual); +} + +/** + * @tc.name: ConfigDistributedHardware_001 + * @tc.desc: Verify the Capacity function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DSCreenSourceServiceTest, ConfigDistributedHardware_001, TestSize.Level1) +{ + std::string devId = "DevId"; + std::string dhId = "DhId"; + std::string key = "Key"; + std::string value = "Value"; + int32_t actual = dScreenSourceService_->ConfigDistributedHardware(devId, dhId, key, value); + EXPECT_EQ(DH_SUCCESS, actual); +} +} // DistributedHardware +} // OHOS \ No newline at end of file