206 lines
8.4 KiB
C++
206 lines
8.4 KiB
C++
/*
|
|
* Copyright (c) 2023 Fancy Code.
|
|
* 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 "AppManagerTestTool.h"
|
|
#include "GtestUsing.h"
|
|
#include "HalTestTool.h"
|
|
#include "HuntingCameraTest.h"
|
|
#include "ILog.h"
|
|
#include "MainThread.h"
|
|
#include "McuManagerTestTool.h"
|
|
#include "MissionManagerTestTool.h"
|
|
#include "TestManager.h"
|
|
#include <thread>
|
|
namespace AppMonitor_Mock_Test
|
|
{
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetProductInfo
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetProductInfo)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetProductInfo();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetDeviceAttr)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetDeviceAttr();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetMediaInfo
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetMediaInfo)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetMediaInfo();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetSdCardInfo)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetSdCardInfo();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetBatteryInfo)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetBatteryInfo();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetDateTime
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetDateTime)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockSetDateTime();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetTimeZone
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetTimeZone)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockSetTimeZone();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_MockUploadFiles
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_MockUploadFiles)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockUploadFiles();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_McuOpenFailed
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_McuOpenFailed)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
// MockUploadFiles();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetParamValue
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetParamValue)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetParamValue("all");
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetCapability
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetCapability)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetCapability();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetLockVideoStatus)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetLockVideoStatus();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetStorageInfo
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageInfo)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetStorageInfo();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_GetStorageFileList
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_GetStorageFileList)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetStorageFileList();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_SetParamValue
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_SetParamValue)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockSetParamValue();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_EnterRecorder
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_EnterRecorder)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockEnterRecorder();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
// ../output_files/test/bin/HuntingCameraTest
|
|
// --gtest_filter=HuntingCameraTest.INTEGRATION_HunttingCamera_AUTO_AppPlayback
|
|
TEST_F(HuntingCameraTest, INTEGRATION_HunttingCamera_AUTO_AppPlayback)
|
|
{
|
|
McuManagerTestTool::MockMcuDeviceOpenFailed(mLinuxTest);
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockAppPlayback();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
} // namespace AppMonitor_Mock_Test
|