mirror of
https://github.com/openharmony/distributed_camera.git
synced 2026-07-20 19:57:22 -04:00
fix distributed camera ut bug
Signed-off-by: zhuxu <zhuxu29@huawei.com>
This commit is contained in:
+6
-2
@@ -13,14 +13,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#include <gtest/gtest.h>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
#define private public
|
||||
#include "dcamera_sink_controller.h"
|
||||
#undef private
|
||||
|
||||
#include "distributed_hardware_log.h"
|
||||
|
||||
#include "mock_camera_channel.h"
|
||||
#include "mock_camera_operator.h"
|
||||
#include "mock_dcamera_sink_output.h"
|
||||
@@ -31,6 +32,7 @@
|
||||
#include "dcamera_sink_dev.h"
|
||||
#include "dcamera_utils_tools.h"
|
||||
#include "distributed_camera_errno.h"
|
||||
#include "distributed_hardware_log.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
@@ -48,6 +50,7 @@ public:
|
||||
};
|
||||
std::string g_testDeviceIdController;
|
||||
|
||||
const int32_t SLEEP_TIME_MS = 500;
|
||||
const std::string SESSION_FLAG_CONTINUE = "dataContinue";
|
||||
const std::string SESSION_FLAG_SNAPSHOT = "dataSnapshot";
|
||||
const std::string TEST_DEVICE_ID_EMPTY = "";
|
||||
@@ -302,6 +305,7 @@ HWTEST_F(DCameraSinkControllerTest, dcamera_sink_controller_test_010, TestSize.L
|
||||
HWTEST_F(DCameraSinkControllerTest, dcamera_sink_controller_test_011, TestSize.Level1)
|
||||
{
|
||||
controller_->OnSessionState(DCAMERA_CHANNEL_STATE_DISCONNECTED);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
|
||||
|
||||
DCameraInfoCmd cmd;
|
||||
cmd.value_ = std::make_shared<DCameraInfo>();
|
||||
|
||||
+8
-1
@@ -13,8 +13,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
#define private public
|
||||
#include "dcamera_sink_data_process.h"
|
||||
#undef private
|
||||
@@ -42,9 +45,10 @@ public:
|
||||
std::shared_ptr<ICameraChannel> channel_;
|
||||
};
|
||||
|
||||
const std::string TEST_STRING = "test_string";
|
||||
const int32_t SLEEP_TIME_MS = 500;
|
||||
const int32_t TEST_WIDTH = 1080;
|
||||
const int32_t TEST_HEIGHT = 1920;
|
||||
const std::string TEST_STRING = "test_string";
|
||||
|
||||
std::shared_ptr<DCameraCaptureInfo> g_testCaptureInfoContinuousNotEncode;
|
||||
std::shared_ptr<DCameraCaptureInfo> g_testCaptureInfoContinuousNeedEncode;
|
||||
@@ -169,6 +173,7 @@ HWTEST_F(DCameraSinkDataProcessTest, dcamera_sink_data_process_test_005, TestSiz
|
||||
{
|
||||
dataProcess_->captureInfo_ = g_testCaptureInfoContinuousNotEncode;
|
||||
int32_t ret = dataProcess_->FeedStream(g_testDataBuffer);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
|
||||
EXPECT_EQ(DCAMERA_OK, ret);
|
||||
}
|
||||
|
||||
@@ -182,6 +187,7 @@ HWTEST_F(DCameraSinkDataProcessTest, dcamera_sink_data_process_test_006, TestSiz
|
||||
{
|
||||
dataProcess_->captureInfo_ = g_testCaptureInfoContinuousNeedEncode;
|
||||
int32_t ret = dataProcess_->FeedStream(g_testDataBuffer);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
|
||||
EXPECT_EQ(DCAMERA_OK, ret);
|
||||
}
|
||||
|
||||
@@ -195,6 +201,7 @@ HWTEST_F(DCameraSinkDataProcessTest, dcamera_sink_data_process_test_007, TestSiz
|
||||
{
|
||||
dataProcess_->captureInfo_ = g_testCaptureInfoSnapshot;
|
||||
int32_t ret = dataProcess_->FeedStream(g_testDataBuffer);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
|
||||
EXPECT_EQ(DCAMERA_OK, ret);
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
|
||||
Reference in New Issue
Block a user