98 lines
3.3 KiB
C++
98 lines
3.3 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 "ILog.h"
|
|
#include "MainThread.h"
|
|
#include "McuManagerTestTool.h"
|
|
#include "TestManager.h"
|
|
#include <thread>
|
|
namespace HunttingCameraTest
|
|
{
|
|
class MainThreadTest : public MainThread
|
|
{
|
|
public:
|
|
MainThreadTest() = default;
|
|
virtual ~MainThreadTest() = default;
|
|
void CustomizationInit(void) override
|
|
{
|
|
// Do nothing here to make sure test tool work.
|
|
}
|
|
};
|
|
class HunttingCameraTest : public testing::Test,
|
|
public TestManager,
|
|
public McuManagerTestTool,
|
|
public AppManagerTestTool,
|
|
public HalTestTool
|
|
|
|
{
|
|
public:
|
|
HunttingCameraTest() {}
|
|
virtual ~HunttingCameraTest() {}
|
|
static void SetUpTestCase()
|
|
{
|
|
CreateLogModule();
|
|
ILogInit(LOG_INSTANCE_TYPE_END);
|
|
}
|
|
static void TearDownTestCase() { ILogUnInit(); }
|
|
virtual void SetUp()
|
|
{
|
|
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThreadTest>();
|
|
MainThread::GetInstance(&mainThread);
|
|
// CreateAllKeysMcok();
|
|
HalTestTool::Init();
|
|
AppManagerTestTool::Init();
|
|
// HunttingCameraTestTool::Init();
|
|
// CreateHalCppModule();
|
|
// CreateDeviceManagerModule();
|
|
mLinuxTest = LinuxTest::CreateLinuxTest();
|
|
std::shared_ptr<LinuxApiMock> test = mLinuxTest;
|
|
LinuxApiMock::GetInstance(&test);
|
|
LinuxApiMock::GetInstance()->Init();
|
|
McuManagerTestTool::Init(mLinuxTest);
|
|
TestManager::Init();
|
|
}
|
|
virtual void TearDown()
|
|
{
|
|
// HunttingCameraTestTool::UnInit();
|
|
// DestroyDeviceManagerModule();
|
|
// DestroyAllKeysMock();
|
|
TestManager::UnInit();
|
|
AppManagerTestTool::UnInit();
|
|
HalTestTool::UnInit();
|
|
LinuxApiMock::GetInstance()->UnInit();
|
|
mLinuxTest = std::make_shared<LinuxTest>();
|
|
std::shared_ptr<LinuxApiMock> test = std::make_shared<LinuxApiMock>();
|
|
LinuxApiMock::GetInstance(&test);
|
|
McuManagerTestTool::UnInit();
|
|
MainThread::GetInstance()->UnInit();
|
|
std::shared_ptr<MainThread> mainThread = std::make_shared<MainThread>();
|
|
MainThread::GetInstance(&mainThread);
|
|
}
|
|
|
|
public:
|
|
std::shared_ptr<LinuxTest> mLinuxTest;
|
|
};
|
|
// ../output_files/test/bin/HunttingCameraTest --gtest_filter=HunttingCameraTest.INTEGRATION_HunttingCamera_EXAMPLE_Demo
|
|
TEST_F(HunttingCameraTest, INTEGRATION_HunttingCamera_EXAMPLE_Demo)
|
|
{
|
|
MainThread::GetInstance()->Init();
|
|
TestManager::ResetTimeOut(1000 * 3);
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
MockGetProductInfo();
|
|
MainThread::GetInstance()->Runing();
|
|
}
|
|
} // namespace HunttingCameraTest
|