This commit is contained in:
Fancy code 2024-04-29 16:04:22 +08:00
parent 70749f4612
commit f5043e8efe
4 changed files with 8 additions and 3 deletions

View File

@ -37,7 +37,7 @@ bool TopState::ExecuteStateMsg(VStateMachineData *msg)
}
StatusCode TopState::ReportEvent(const MediaReportEvent &event)
{
LogInfo("==================================================================ReportEvent:\n");
LogInfo(" ReportEvent:\n");
std::shared_ptr<VMissionData> message = std::make_shared<VMissionDataV2<MediaReportEvent>>(
static_cast<MissionEvent>(InternalStateEvent::MEDIA_REPORT_EVENT), event);
MissionStateMachine::GetInstance()->SendStateMessage(message);

View File

@ -29,12 +29,12 @@ namespace MediaManager_Mock_Test
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_MediaReprot)
{
SetAllCamerasResult(mAllCamerasMock);
MockReportCameraEvent("/tmp/test.MP4", CameraType::MAIN_CAMERA);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
// McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
MainThread::GetInstance()->Init();
TestManager::ResetTimeOut(1000 * 3);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
MockReportCameraEvent("/tmp/test.MP4", "test path", CameraEvent::PICTIRUE, CameraType::MAIN_CAMERA);
// MockAppPlayback();
MainThread::GetInstance()->Runing();
}

View File

@ -23,6 +23,9 @@ void CameraHalTest::SetCameraMonitor(std::shared_ptr<VCameraHalMonitor> &monitor
LogInfo("CameraHalTest::SetCameraMonitor.\n");
mMonitor = monitor;
SetCameraMonitorTrace(monitor);
if (nullptr != mFastBootEvent) {
monitor->ReportEvent(*(mFastBootEvent.get()));
}
}
void CameraHalTest::SetCameraMonitorTrace(std::shared_ptr<VCameraHalMonitor> &monitor)
{
@ -35,7 +38,8 @@ void CameraHalMock::MockReportCameraEvent(const CameraReportEvent &event)
{
auto monitor = mMonitor.lock();
if (mMonitor.expired()) {
LogError("monitor is nullptr.\n");
LogWarning("monitor is nullptr.\n");
mFastBootEvent = std::make_shared<CameraReportEvent>(event.mFileName, event.mCameraType);
return;
}
monitor->ReportEvent(event);

View File

@ -29,6 +29,7 @@ private:
protected:
const CameraType mCameraType;
std::weak_ptr<VCameraHalMonitor> mMonitor;
std::shared_ptr<CameraReportEvent> mFastBootEvent;
};
class CameraHalMock : public CameraHalTest
{