diff --git a/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/distributed_camera_source_service_test.cpp b/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/distributed_camera_source_service_test.cpp index 9d55180a8a8a5cc4a59444942e7743d6050503c1..57403d98dc047402302d8df0dd4f24852269b416 100644 --- a/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/distributed_camera_source_service_test.cpp +++ b/services/cameraservice/sourceservice/test/unittest/common/distributedcamera/distributed_camera_source_service_test.cpp @@ -46,6 +46,7 @@ namespace { const std::string TEST_DEVICE_ID = "bb536a637105409e904d4da83790a4a7"; const std::string TEST_CAMERA_DH_ID_0 = "camera_0"; const std::string TEST_REQID = "bb536a637105409e904d4da83790a4a7"; +const int32_t TEST_SOURCE_SERVICE = 200000; } void DistributedCameraSourceServiceTest::SetUpTestCase(void) @@ -178,6 +179,7 @@ HWTEST_F(DistributedCameraSourceServiceTest, dcamera_source_service_test_006, Te testSrcService_->listener_ = std::make_shared(); int32_t ret = testSrcService_->InitSource(params, callbackProxy); EXPECT_EQ(DCAMERA_OK, ret); + usleep(TEST_SOURCE_SERVICE); } /** @@ -193,6 +195,7 @@ HWTEST_F(DistributedCameraSourceServiceTest, dcamera_source_service_test_007, Te int32_t ret = testSrcService_->ReleaseSource(); EXPECT_EQ(DCAMERA_BAD_VALUE, ret); + usleep(TEST_SOURCE_SERVICE); } /** @@ -208,6 +211,7 @@ HWTEST_F(DistributedCameraSourceServiceTest, dcamera_source_service_test_008, Te int32_t ret = testSrcService_->LoadDCameraHDF(); EXPECT_EQ(DCAMERA_OK, ret); + usleep(TEST_SOURCE_SERVICE); } /** @@ -225,6 +229,7 @@ HWTEST_F(DistributedCameraSourceServiceTest, dcamera_source_service_test_009, Te EXPECT_EQ(DCAMERA_OK, ret); ret = testSrcService_->UnLoadCameraHDF(); EXPECT_EQ(DCAMERA_OK, ret); + usleep(TEST_SOURCE_SERVICE); } } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/services/data_process/test/unittest/common/pipeline_node/BUILD.gn b/services/data_process/test/unittest/common/pipeline_node/BUILD.gn index fa69c43bb58152d328aa7da76c5fc4e3cb67ab3f..3b99e70960a440f737edef2c251737cf285919fe 100644 --- a/services/data_process/test/unittest/common/pipeline_node/BUILD.gn +++ b/services/data_process/test/unittest/common/pipeline_node/BUILD.gn @@ -41,9 +41,11 @@ ohos_unittest("DCameraDataProcessPipelineNodeTest") { module_out_path = module_out_path sources = [ + "abstract_data_process_test.cpp", "decode_data_process_test.cpp", "encode_data_process_test.cpp", "fps_controller_process_test.cpp", + "property_carrier_test.cpp", "scale_convert_process_test.cpp", ] diff --git a/services/data_process/test/unittest/common/pipeline_node/abstract_data_process_test.cpp b/services/data_process/test/unittest/common/pipeline_node/abstract_data_process_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..04588486250af94d9c7801b0d1bb9a397e9b7b51 --- /dev/null +++ b/services/data_process/test/unittest/common/pipeline_node/abstract_data_process_test.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 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 + +#include "abstract_data_process.h" +#include "distributed_camera_errno.h" +#include "encode_data_process.h" + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +class AbstractDataProcessTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); + + std::shared_ptr testAbstractDataProcess_; +}; + +void AbstractDataProcessTest::SetUpTestCase(void) +{ +} + +void AbstractDataProcessTest::TearDownTestCase(void) +{ +} + +void AbstractDataProcessTest::SetUp(void) +{ + std::shared_ptr sinkPipeline = std::make_shared(); + testAbstractDataProcess_ = std::make_shared(sinkPipeline); +} + +void AbstractDataProcessTest::TearDown(void) +{ + testAbstractDataProcess_ = nullptr; +} + +/** + * @tc.name: abstract_data_process_test_001 + * @tc.desc: Verify SetNextNode. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(AbstractDataProcessTest, abstract_data_process_test_001, TestSize.Level1) +{ + EXPECT_EQ(false, testAbstractDataProcess_ == nullptr); + + std::shared_ptr nextDataProcess = nullptr; + int32_t ret = testAbstractDataProcess_->SetNextNode(nextDataProcess); + EXPECT_EQ(ret, DCAMERA_BAD_VALUE); +} +} // namespace DistributedHardware +} // namespace OHOS diff --git a/services/data_process/test/unittest/common/pipeline_node/property_carrier_test.cpp b/services/data_process/test/unittest/common/pipeline_node/property_carrier_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4c8b2b675e7e71fda9cbe16cb6309bf07fb93758 --- /dev/null +++ b/services/data_process/test/unittest/common/pipeline_node/property_carrier_test.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024 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 + +#include "property_carrier.h" +#include "distributed_camera_errno.h" + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +class PropertyCarrierTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); + + std::shared_ptr testPropertyCarrier_; +}; + +void PropertyCarrierTest::SetUpTestCase(void) +{ +} + +void PropertyCarrierTest::TearDownTestCase(void) +{ +} + +void PropertyCarrierTest::SetUp(void) +{ + testPropertyCarrier_ = std::make_shared(); +} + +void PropertyCarrierTest::TearDown(void) +{ + testPropertyCarrier_ = nullptr; +} + +/** + * @tc.name: property_carrier_test_001 + * @tc.desc: Verify CarrySurfaceProperty. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(PropertyCarrierTest, property_carrier_test_001, TestSize.Level1) +{ + EXPECT_EQ(false, testPropertyCarrier_ == nullptr); + + sptr surface = nullptr; + int32_t ret = testPropertyCarrier_->CarrySurfaceProperty(surface); + EXPECT_EQ(ret, DCAMERA_BAD_VALUE); +} +} // namespace DistributedHardware +} // namespace OHOS