Backup:MediaManager module.
This commit is contained in:
parent
8cf8280a2c
commit
ed9771b5b5
|
@ -15,6 +15,11 @@
|
||||||
#include "IHalCpp.h"
|
#include "IHalCpp.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
camera_report_event::camera_report_event(const std::string &fileName, const std::string &filePath,
|
||||||
|
const CameraEventType &type)
|
||||||
|
: mFileName(fileName), mFilePath(filePath), mType(type)
|
||||||
|
{
|
||||||
|
}
|
||||||
void VKeyHalMonitor::KeyEventHappened(const std::string &keyName, const VirtualKeyEvent &event,
|
void VKeyHalMonitor::KeyEventHappened(const std::string &keyName, const VirtualKeyEvent &event,
|
||||||
const unsigned int &timeMs)
|
const unsigned int &timeMs)
|
||||||
{
|
{
|
||||||
|
@ -32,6 +37,9 @@ StatusCode VWifiHal::OpenApMode(void)
|
||||||
{
|
{
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
|
void VCameraHalMonitor::ReportEvent(const CameraReportEvent &event)
|
||||||
|
{
|
||||||
|
}
|
||||||
std::shared_ptr<IHalCpp> &IHalCpp::GetInstance(std::shared_ptr<IHalCpp> *impl)
|
std::shared_ptr<IHalCpp> &IHalCpp::GetInstance(std::shared_ptr<IHalCpp> *impl)
|
||||||
{
|
{
|
||||||
static auto instance = std::make_shared<IHalCpp>();
|
static auto instance = std::make_shared<IHalCpp>();
|
||||||
|
@ -66,6 +74,7 @@ StatusCode IHalCpp::GetWifiHal(std::shared_ptr<VWifiHal> &wifi)
|
||||||
{
|
{
|
||||||
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
||||||
StatusCode IHalCpp::GetCameraHal(std::shared_ptr<VCameraHal> &camera)
|
StatusCode IHalCpp::GetCameraHal(std::map<CameraType, std::shared_ptr<VCameraHal>> &allCameras)
|
||||||
{
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
}
|
}
|
|
@ -12,8 +12,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef IHALCPP_H
|
#ifndef I_HAL_CPP_H
|
||||||
#define IHALCPP_H
|
#define I_HAL_CPP_H
|
||||||
#include "StatusCode.h"
|
#include "StatusCode.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -24,6 +24,25 @@ using VirtualKeyEvent = unsigned char;
|
||||||
constexpr int INVALID_PERIOD = -1;
|
constexpr int INVALID_PERIOD = -1;
|
||||||
constexpr int PERIPHERAL_CHECK_PERIOD_MS = 100;
|
constexpr int PERIPHERAL_CHECK_PERIOD_MS = 100;
|
||||||
constexpr int IMEI_LEN = 15;
|
constexpr int IMEI_LEN = 15;
|
||||||
|
enum class CameraType
|
||||||
|
{
|
||||||
|
MAIN_CAMERA = 0,
|
||||||
|
END
|
||||||
|
};
|
||||||
|
enum class CameraEventType
|
||||||
|
{
|
||||||
|
PICTIRUE = 0,
|
||||||
|
VIDEO,
|
||||||
|
PICTIRUE_AND_VIDEO,
|
||||||
|
END
|
||||||
|
};
|
||||||
|
typedef struct camera_report_event
|
||||||
|
{
|
||||||
|
camera_report_event(const std::string &fileName, const std::string &filePath, const CameraEventType &type);
|
||||||
|
const std::string mFileName;
|
||||||
|
const std::string mFilePath;
|
||||||
|
const CameraEventType mType;
|
||||||
|
} CameraReportEvent;
|
||||||
void CreateHalCppModule(void);
|
void CreateHalCppModule(void);
|
||||||
void DestroyHalCppModule(void);
|
void DestroyHalCppModule(void);
|
||||||
class VKeyHalMonitor
|
class VKeyHalMonitor
|
||||||
|
@ -60,6 +79,7 @@ class VCameraHalMonitor
|
||||||
public:
|
public:
|
||||||
VCameraHalMonitor() = default;
|
VCameraHalMonitor() = default;
|
||||||
virtual ~VCameraHalMonitor() = default;
|
virtual ~VCameraHalMonitor() = default;
|
||||||
|
virtual void ReportEvent(const CameraReportEvent &event);
|
||||||
};
|
};
|
||||||
class VCameraHal
|
class VCameraHal
|
||||||
{
|
{
|
||||||
|
@ -78,6 +98,6 @@ public:
|
||||||
virtual StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds);
|
virtual StatusCode GetAllLeds(std::map<std::string, std::shared_ptr<VLedHal>> &allLeds);
|
||||||
virtual StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys);
|
virtual StatusCode GetAllKeys(std::map<std::string, std::shared_ptr<VKeyHal>> &allKeys);
|
||||||
virtual StatusCode GetWifiHal(std::shared_ptr<VWifiHal> &wifi);
|
virtual StatusCode GetWifiHal(std::shared_ptr<VWifiHal> &wifi);
|
||||||
virtual StatusCode GetCameraHal(std::shared_ptr<VCameraHal> &camera);
|
virtual StatusCode GetCameraHal(std::map<CameraType, std::shared_ptr<VCameraHal>> &allCameras);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,6 +11,7 @@ include_directories(
|
||||||
${UTILS_SOURCE_PATH}/Log/include
|
${UTILS_SOURCE_PATH}/Log/include
|
||||||
${UTILS_SOURCE_PATH}/McuProtocol/include
|
${UTILS_SOURCE_PATH}/McuProtocol/include
|
||||||
${UTILS_SOURCE_PATH}/UartDevice/include
|
${UTILS_SOURCE_PATH}/UartDevice/include
|
||||||
|
${HAL_SOURCE_PATH}/include
|
||||||
)
|
)
|
||||||
#do not rely on any other library
|
#do not rely on any other library
|
||||||
#link_directories(
|
#link_directories(
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
#include "StatusCode.h"
|
#include "StatusCode.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
bool CreateMediaManager(void);
|
bool CreateMediaManagerModule(void);
|
||||||
bool DestroyMediaManager(void);
|
bool DestroyMediaManagerModule(void);
|
||||||
enum class SensorNum
|
enum class MediaChannel
|
||||||
{
|
{
|
||||||
SENSOR_1 = 1,
|
MEDIA_1 = 1,
|
||||||
SENSOR_2,
|
MEDIA_2,
|
||||||
END
|
END
|
||||||
};
|
};
|
||||||
enum class SensorTaskType
|
enum class MediaTaskType
|
||||||
{
|
{
|
||||||
TAKE_PICTURE = 0,
|
TAKE_PICTURE = 0,
|
||||||
TAKE_VIDEO,
|
TAKE_VIDEO,
|
||||||
|
@ -33,32 +33,34 @@ enum class SensorTaskType
|
||||||
MONITOR,
|
MONITOR,
|
||||||
END
|
END
|
||||||
};
|
};
|
||||||
class SensorTaskResponse
|
class MediaTaskResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SensorTaskResponse()
|
MediaTaskResponse() = default;
|
||||||
{
|
~MediaTaskResponse() = default;
|
||||||
}
|
|
||||||
~SensorTaskResponse()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
class VSensorTask
|
class VMediaTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VSensorTask() = default;
|
VMediaTask() = default;
|
||||||
virtual ~VSensorTask() = default;
|
virtual ~VMediaTask() = default;
|
||||||
virtual const SensorTaskType GetTaskType(void);
|
virtual const MediaTaskType GetTaskType(void);
|
||||||
virtual void Response(const std::vector<SensorTaskResponse> &response);
|
virtual void Response(const std::vector<MediaTaskResponse> &response);
|
||||||
virtual bool IsTaskFinished(void);
|
virtual bool IsTaskFinished(void);
|
||||||
virtual const signed int GetIsNight(void);
|
virtual const signed int GetIsNight(void);
|
||||||
virtual const unsigned int GetIsMultShot(void);
|
virtual const unsigned int GetIsMultShot(void);
|
||||||
};
|
};
|
||||||
class VSensorHandle
|
class VMediaMonitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VSensorHandle() = default;
|
VMediaMonitor() = default;
|
||||||
virtual ~VSensorHandle() = default;
|
virtual ~VMediaMonitor() = default;
|
||||||
|
};
|
||||||
|
class VMediaHandle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
VMediaHandle() = default;
|
||||||
|
virtual ~VMediaHandle() = default;
|
||||||
};
|
};
|
||||||
class IMediaManager
|
class IMediaManager
|
||||||
{
|
{
|
||||||
|
@ -66,5 +68,8 @@ public:
|
||||||
IMediaManager() = default;
|
IMediaManager() = default;
|
||||||
virtual ~IMediaManager() = default;
|
virtual ~IMediaManager() = default;
|
||||||
static std::shared_ptr<IMediaManager> &GetInstance(std::shared_ptr<IMediaManager> *impl = nullptr);
|
static std::shared_ptr<IMediaManager> &GetInstance(std::shared_ptr<IMediaManager> *impl = nullptr);
|
||||||
|
virtual const StatusCode Init(void);
|
||||||
|
virtual const StatusCode UnInit(void);
|
||||||
|
virtual StatusCode SetMeidaMonitor(std::shared_ptr<VMediaMonitor> &monitor);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -14,22 +14,22 @@
|
||||||
*/
|
*/
|
||||||
#include "IMediaManager.h"
|
#include "IMediaManager.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
const SensorTaskType VSensorTask::GetTaskType(void)
|
const MediaTaskType VMediaTask::GetTaskType(void)
|
||||||
{
|
{
|
||||||
return SensorTaskType::END;
|
return MediaTaskType::END;
|
||||||
}
|
}
|
||||||
void VSensorTask::Response(const std::vector<SensorTaskResponse> &response)
|
void VMediaTask::Response(const std::vector<MediaTaskResponse> &response)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
bool VSensorTask::IsTaskFinished(void)
|
bool VMediaTask::IsTaskFinished(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const signed int VSensorTask::GetIsNight(void)
|
const signed int VMediaTask::GetIsNight(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const unsigned int VSensorTask::GetIsMultShot(void)
|
const unsigned int VMediaTask::GetIsMultShot(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -47,3 +47,15 @@ std::shared_ptr<IMediaManager> &IMediaManager::GetInstance(std::shared_ptr<IMedi
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
const StatusCode IMediaManager::Init(void)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
}
|
||||||
|
const StatusCode IMediaManager::UnInit(void)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
}
|
||||||
|
StatusCode IMediaManager::SetMeidaMonitor(std::shared_ptr<VMediaMonitor> &monitor)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
}
|
|
@ -13,3 +13,15 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "MediaManagerImpl.h"
|
#include "MediaManagerImpl.h"
|
||||||
|
const StatusCode MediaManagerImpl::Init(void)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
}
|
||||||
|
const StatusCode MediaManagerImpl::UnInit(void)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
}
|
||||||
|
StatusCode MediaManagerImpl::SetMeidaMonitor(std::shared_ptr<VMediaMonitor> &monitor)
|
||||||
|
{
|
||||||
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
}
|
|
@ -14,11 +14,19 @@
|
||||||
*/
|
*/
|
||||||
#ifndef MEDIA_MANAGER_IMPL_H
|
#ifndef MEDIA_MANAGER_IMPL_H
|
||||||
#define MEDIA_MANAGER_IMPL_H
|
#define MEDIA_MANAGER_IMPL_H
|
||||||
|
#include "IHalCpp.h"
|
||||||
#include "IMediaManager.h"
|
#include "IMediaManager.h"
|
||||||
|
#include <map>
|
||||||
class MediaManagerImpl : public IMediaManager
|
class MediaManagerImpl : public IMediaManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MediaManagerImpl() = default;
|
MediaManagerImpl() = default;
|
||||||
virtual ~MediaManagerImpl() = default;
|
virtual ~MediaManagerImpl() = default;
|
||||||
|
const StatusCode Init(void) override;
|
||||||
|
const StatusCode UnInit(void) override;
|
||||||
|
StatusCode SetMeidaMonitor(std::shared_ptr<VMediaMonitor> &monitor) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map<CameraType, std::shared_ptr<VCameraHal>> mAllCameras;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -15,18 +15,18 @@
|
||||||
#include "MediaManagerMakePtr.h"
|
#include "MediaManagerMakePtr.h"
|
||||||
#include "ILog.h"
|
#include "ILog.h"
|
||||||
#include "MediaManagerImpl.h"
|
#include "MediaManagerImpl.h"
|
||||||
bool CreateMediaManager(void)
|
bool CreateMediaManagerModule(void)
|
||||||
{
|
{
|
||||||
auto instance = std::make_shared<IMediaManager>();
|
auto instance = std::make_shared<IMediaManager>();
|
||||||
StatusCode code = MediaManagerMakePtr::GetInstance()->CreateMediaManager(instance);
|
StatusCode code = MediaManagerMakePtr::GetInstance()->CreateMediaManagerModule(instance);
|
||||||
if (IsCodeOK(code)) {
|
if (IsCodeOK(code)) {
|
||||||
LogInfo("CreateMediaManager is ok.\n");
|
LogInfo("CreateMediaManagerModule is ok.\n");
|
||||||
IMediaManager::GetInstance(&instance);
|
IMediaManager::GetInstance(&instance);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool DestroyMediaManager(void)
|
bool DestroyMediaManagerModule(void)
|
||||||
{
|
{
|
||||||
auto instance = std::make_shared<IMediaManager>();
|
auto instance = std::make_shared<IMediaManager>();
|
||||||
IMediaManager::GetInstance(&instance);
|
IMediaManager::GetInstance(&instance);
|
||||||
|
@ -46,7 +46,7 @@ std::shared_ptr<MediaManagerMakePtr> &MediaManagerMakePtr::GetInstance(std::shar
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
const StatusCode MediaManagerMakePtr::CreateMediaManager(std::shared_ptr<IMediaManager> &impl)
|
const StatusCode MediaManagerMakePtr::CreateMediaManagerModule(std::shared_ptr<IMediaManager> &impl)
|
||||||
{
|
{
|
||||||
auto tmp = std::make_shared<MediaManagerImpl>();
|
auto tmp = std::make_shared<MediaManagerImpl>();
|
||||||
impl = tmp;
|
impl = tmp;
|
||||||
|
|
|
@ -23,6 +23,6 @@ public:
|
||||||
MediaManagerMakePtr() = default;
|
MediaManagerMakePtr() = default;
|
||||||
virtual ~MediaManagerMakePtr() = default;
|
virtual ~MediaManagerMakePtr() = default;
|
||||||
static std::shared_ptr<MediaManagerMakePtr> &GetInstance(std::shared_ptr<MediaManagerMakePtr> *impl = nullptr);
|
static std::shared_ptr<MediaManagerMakePtr> &GetInstance(std::shared_ptr<MediaManagerMakePtr> *impl = nullptr);
|
||||||
virtual const StatusCode CreateMediaManager(std::shared_ptr<IMediaManager> &impl);
|
virtual const StatusCode CreateMediaManagerModule(std::shared_ptr<IMediaManager> &impl);
|
||||||
};
|
};
|
||||||
#endif // !IPC_CONFIG_MAKE_PTR_H
|
#endif // !MEDIA_MANAGER_MAKE_PTR_H
|
|
@ -5,3 +5,4 @@ add_subdirectory(McuManager)
|
||||||
add_subdirectory(McuAskBase)
|
add_subdirectory(McuAskBase)
|
||||||
add_subdirectory(DeviceManager)
|
add_subdirectory(DeviceManager)
|
||||||
add_subdirectory(AppManager)
|
add_subdirectory(AppManager)
|
||||||
|
add_subdirectory(MediaManager)
|
81
test/middleware/MediaManager/CMakeLists.txt
Normal file
81
test/middleware/MediaManager/CMakeLists.txt
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
# include(${CMAKE_SOURCE_DIR}/build/independent_source.cmake)
|
||||||
|
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||||
|
include(${MIDDLEWARE_SOURCE_PATH}/AppManager/build/app_manager.cmake)
|
||||||
|
set(EXECUTABLE_OUTPUT_PATH ${TEST_OUTPUT_PATH}/bin)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
./src
|
||||||
|
./include
|
||||||
|
./tool/include
|
||||||
|
${UTILS_SOURCE_PATH}/Log/include
|
||||||
|
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||||
|
# ${UTILS_SOURCE_PATH}/KeyControl/include
|
||||||
|
# ${UTILS_SOURCE_PATH}/LedControl/include
|
||||||
|
# ${UTILS_SOURCE_PATH}/WebServer/include
|
||||||
|
# ${HAL_SOURCE_PATH}/include
|
||||||
|
${MIDDLEWARE_SOURCE_PATH}/MediaManager/include
|
||||||
|
${TEST_SOURCE_PATH}
|
||||||
|
# ${TEST_SOURCE_PATH}/hal/tool/include
|
||||||
|
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include
|
||||||
|
${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googlemock/include
|
||||||
|
)
|
||||||
|
|
||||||
|
link_directories(
|
||||||
|
${LIBS_OUTPUT_PATH}
|
||||||
|
${EXTERNAL_LIBS_OUTPUT_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
aux_source_directory(. SRC_FILES_MAIN)
|
||||||
|
aux_source_directory(./src SRC_FILES)
|
||||||
|
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
|
||||||
|
aux_source_directory(./src_mock SRC_FILES)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(TARGET_NAME MediaManagerTest)
|
||||||
|
add_executable(${TARGET_NAME} ${SRC_FILES_MAIN} ${SRC_FILES})
|
||||||
|
target_link_libraries(${TARGET_NAME} MediaManager MediaManagerTestTool gtest gmock pthread)
|
||||||
|
if(${TEST_COVERAGE} MATCHES "true")
|
||||||
|
target_link_libraries(${TARGET_NAME} gcov)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||||
|
add_custom_target(
|
||||||
|
MediaManagerTest_code_check
|
||||||
|
COMMAND ${CLANG_TIDY_EXE}
|
||||||
|
-checks='${CLANG_TIDY_CHECKS}'
|
||||||
|
--header-filter=.*
|
||||||
|
--system-headers=false
|
||||||
|
${SRC_FILES}
|
||||||
|
${CLANG_TIDY_CONFIG}
|
||||||
|
# --line-filter='[{\"name\":\"${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include/getest/gtest.h\"}]'
|
||||||
|
--line-filter='[{\"name\":\"${EXTERNAL_SOURCE_PATH}/gtest/googletest-release-1.11.0/googletest/include/getest/*.h\"}]'
|
||||||
|
-p ${PLATFORM_PATH}/cmake-shell
|
||||||
|
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/AppManager
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TARGET_NAME}
|
||||||
|
PRE_BUILD
|
||||||
|
COMMAND make MediaManagerTest_code_check
|
||||||
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||||
|
add_custom_target(
|
||||||
|
MediaManagerTest_code_format
|
||||||
|
COMMAND ${CLANG_FORMAT_EXE}
|
||||||
|
-style=file
|
||||||
|
-i ${SRC_FILES} ${SRC_FILES_MAIN} ${HEADER_FILES}
|
||||||
|
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/AppManager
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TARGET_NAME}
|
||||||
|
PRE_BUILD
|
||||||
|
COMMAND make MediaManagerTest_code_check
|
||||||
|
COMMAND make MediaManagerTest_code_format
|
||||||
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
define_file_name(${TARGET_NAME})
|
||||||
|
|
||||||
|
add_subdirectory(tool)
|
23
test/middleware/MediaManager/mainTest.cpp
Normal file
23
test/middleware/MediaManager/mainTest.cpp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* 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 <gmock/gmock.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <thread>
|
||||||
|
#include <unistd.h>
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
testing::InitGoogleTest(&argc, argv);
|
||||||
|
return RUN_ALL_TESTS();
|
||||||
|
}
|
74
test/middleware/MediaManager/src/MediaManager_Test.cpp
Normal file
74
test/middleware/MediaManager/src/MediaManager_Test.cpp
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* 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 "GtestUsing.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
#include "IMediaManager.h"
|
||||||
|
#include <gmock/gmock.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <thread>
|
||||||
|
namespace MediaManagerTest
|
||||||
|
{
|
||||||
|
class MediaManagerTest : public testing::Test
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MediaManagerTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~MediaManagerTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
static void SetUpTestCase()
|
||||||
|
{
|
||||||
|
CreateLogModule();
|
||||||
|
ILogInit(LOG_INSTANCE_TYPE_END);
|
||||||
|
}
|
||||||
|
static void TearDownTestCase()
|
||||||
|
{
|
||||||
|
ILogUnInit();
|
||||||
|
}
|
||||||
|
virtual void SetUp()
|
||||||
|
{
|
||||||
|
// HalTestTool::Init();
|
||||||
|
// AppManagerTestTool::Init();
|
||||||
|
// CreateHalCppModule();
|
||||||
|
CreateMediaManagerModule();
|
||||||
|
}
|
||||||
|
virtual void TearDown()
|
||||||
|
{
|
||||||
|
// AppManagerTestTool::UnInit();
|
||||||
|
// HalTestTool::UnInit();
|
||||||
|
DestroyMediaManagerModule();
|
||||||
|
// DestroyHalCppModule();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// const AppParam mAppParam;
|
||||||
|
};
|
||||||
|
// ../output_files/test/bin/MediaManagerTest --gtest_filter=MediaManagerTest.INTEGRATION_MediaManager_EXAMPLE_Demo0
|
||||||
|
TEST_F(MediaManagerTest, INTEGRATION_MediaManager_EXAMPLE_Demo0)
|
||||||
|
{
|
||||||
|
// std::shared_ptr<VAppMonitor> monitor = AppManagerTestTool::MakeMonitorMock();
|
||||||
|
// IAppManager::GetInstance()->Init(mAppParam);
|
||||||
|
// IAppManager::GetInstance()->SetAppMonitor(monitor);
|
||||||
|
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
// MockAppClientConnect();
|
||||||
|
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
// MockSetRecordingStatus(RecordingStatus::RECORDING_START);
|
||||||
|
// std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||||
|
// IAppManager::GetInstance()->UnInit();
|
||||||
|
IMediaManager::GetInstance()->Init();
|
||||||
|
IMediaManager::GetInstance()->UnInit();
|
||||||
|
}
|
||||||
|
} // namespace MediaManagerTest
|
56
test/middleware/MediaManager/tool/CMakeLists.txt
Normal file
56
test/middleware/MediaManager/tool/CMakeLists.txt
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
include(${CMAKE_SOURCE_DIR_IPCSDK}/build/global_config.cmake)
|
||||||
|
set(EXECUTABLE_OUTPUT_PATH ${EXEC_OUTPUT_PATH})
|
||||||
|
set(LIBRARY_OUTPUT_PATH ${LIBS_OUTPUT_PATH})
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
./src
|
||||||
|
./include
|
||||||
|
${UTILS_SOURCE_PATH}/StatusCode/include
|
||||||
|
${UTILS_SOURCE_PATH}/Log/include
|
||||||
|
# ${UTILS_SOURCE_PATH}/Servers/include
|
||||||
|
# ${UTILS_SOURCE_PATH}/TcpModule/include
|
||||||
|
${MIDDLEWARE_SOURCE_PATH}/MediaManager/src
|
||||||
|
${HAL_SOURCE_PATH}/include
|
||||||
|
${TEST_SOURCE_PATH}
|
||||||
|
${TEST_SOURCE_PATH}/utils/LinuxApiMock/include
|
||||||
|
${TEST_SOURCE_PATH}/utils/McuProtocol/tool/include
|
||||||
|
)
|
||||||
|
# link_directories(
|
||||||
|
# ${EXTERNAL_SOURCE_PATH}/libconfig/libconfig-1.7.3/lib/.libs
|
||||||
|
# )
|
||||||
|
|
||||||
|
aux_source_directory(./src TEST_TOOL_SRC_FILES)
|
||||||
|
set(TEST_TOOL_TARGET MediaManagerTestTool)
|
||||||
|
add_library(${TEST_TOOL_TARGET} STATIC ${TEST_TOOL_SRC_FILES})
|
||||||
|
target_link_libraries(${TEST_TOOL_TARGET} MediaManager Servers Log)
|
||||||
|
|
||||||
|
if ("${COMPILE_IMPROVE_SUPPORT}" MATCHES "true")
|
||||||
|
add_custom_target(
|
||||||
|
MediaManagerTestTool_code_check
|
||||||
|
COMMAND ${CLANG_TIDY_EXE}
|
||||||
|
-checks='${CLANG_TIDY_CHECKS}'
|
||||||
|
--header-filter=.*
|
||||||
|
--system-headers=false
|
||||||
|
${TEST_TOOL_SRC_FILES}
|
||||||
|
${CLANG_TIDY_CONFIG}
|
||||||
|
-p ${PLATFORM_PATH}/cmake-shell
|
||||||
|
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/MediaManager/tool
|
||||||
|
)
|
||||||
|
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||||
|
add_custom_target(
|
||||||
|
MediaManagerTestTool_code_format
|
||||||
|
COMMAND ${CLANG_FORMAT_EXE}
|
||||||
|
-style=file
|
||||||
|
-i ${TEST_TOOL_SRC_FILES} ${HEADER_FILES}
|
||||||
|
WORKING_DIRECTORY ${TEST_SOURCE_PATH}/middleware/MediaManager/tool
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${TEST_TOOL_TARGET}
|
||||||
|
PRE_BUILD
|
||||||
|
COMMAND make MediaManagerTestTool_code_check
|
||||||
|
COMMAND make MediaManagerTestTool_code_format
|
||||||
|
WORKING_DIRECTORY ${PLATFORM_PATH}/cmake-shell/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
define_file_name(${TEST_TOOL_TARGET})
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#ifndef MEDIA_MANAGER_TEST_TOOL_H
|
||||||
|
#define MEDIA_MANAGER_TEST_TOOL_H
|
||||||
|
#include "GtestUsing.h"
|
||||||
|
#include "IMediaManager.h"
|
||||||
|
#include <memory>
|
||||||
|
class MediaManagerTestTool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MediaManagerTestTool() = default;
|
||||||
|
virtual ~MediaManagerTestTool() = default;
|
||||||
|
void Init(void);
|
||||||
|
void UnInit(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void MediaManagerMockInit(std::shared_ptr<IMediaManager> &vMock);
|
||||||
|
void MediaMonitorInit(std::shared_ptr<VMediaMonitor> &vMock);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<IMediaManager> mMediaManagerMock;
|
||||||
|
std::shared_ptr<VMediaMonitor> mMediaMonitorMock;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* 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 "MediaManagerMakePtrTest.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
void OverrideMediaManagerMakePtrObject(std::shared_ptr<MediaManagerMock> &appManagerMock)
|
||||||
|
{
|
||||||
|
std::shared_ptr<MediaManagerMakePtr> impl = std::make_shared<MediaManagerMakePtrTest>();
|
||||||
|
std::shared_ptr<MediaManagerMakePtrTest> test = std::dynamic_pointer_cast<MediaManagerMakePtrTest>(impl);
|
||||||
|
if (test) {
|
||||||
|
test->mMediaManagerMock = appManagerMock;
|
||||||
|
}
|
||||||
|
MediaManagerMakePtr::GetInstance(&impl);
|
||||||
|
}
|
||||||
|
void CancelOverrideMediaManagerMakePtrObject(void)
|
||||||
|
{
|
||||||
|
std::shared_ptr<MediaManagerMakePtr> tmp = MediaManagerMakePtr::GetInstance();
|
||||||
|
std::shared_ptr<MediaManagerMakePtrTest> test = std::dynamic_pointer_cast<MediaManagerMakePtrTest>(tmp);
|
||||||
|
if (test) {
|
||||||
|
test->mMediaManagerMock.reset();
|
||||||
|
}
|
||||||
|
tmp.reset();
|
||||||
|
test.reset();
|
||||||
|
std::shared_ptr<MediaManagerMakePtr> impl = std::make_shared<MediaManagerMakePtrTest>();
|
||||||
|
MediaManagerMakePtr::GetInstance(&impl);
|
||||||
|
}
|
||||||
|
MediaManagerMakePtrTest::MediaManagerMakePtrTest()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
MediaManagerMakePtrTest::~MediaManagerMakePtrTest()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mMediaManagerMock.reset();
|
||||||
|
}
|
||||||
|
const StatusCode MediaManagerMakePtrTest::CreateMediaManagerModule(std::shared_ptr<IMediaManager> &impl)
|
||||||
|
{
|
||||||
|
if (mMediaManagerMock) {
|
||||||
|
LogInfo("CreateMediaManagerModule mMediaManagerMock\n");
|
||||||
|
impl = mMediaManagerMock;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LogWarning("CreateMcuManager failed:mMediaManagerMock is nullptr.\n");
|
||||||
|
}
|
||||||
|
return CreateStatusCode(STATUS_CODE_OK);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#ifndef MEDIA_MANAGER_MAKE_PTR_TEST_H
|
||||||
|
#define MEDIA_MANAGER_MAKE_PTR_TEST_H
|
||||||
|
#include "MediaManagerMock.h"
|
||||||
|
#include "MediaManagerTestTool.h"
|
||||||
|
#include "MediaManagerMakePtr.h"
|
||||||
|
void OverrideMediaManagerMakePtrObject(std::shared_ptr<MediaManagerMock> &appManagerMock);
|
||||||
|
void CancelOverrideMediaManagerMakePtrObject(void);
|
||||||
|
class MediaManagerMakePtrTest : public MediaManagerMakePtr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MediaManagerMakePtrTest();
|
||||||
|
virtual ~MediaManagerMakePtrTest();
|
||||||
|
const StatusCode CreateMediaManagerModule(std::shared_ptr<IMediaManager> &impl) override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::shared_ptr<MediaManagerMock> mMediaManagerMock;
|
||||||
|
};
|
||||||
|
#endif
|
30
test/middleware/MediaManager/tool/src/MediaManagerMock.cpp
Normal file
30
test/middleware/MediaManager/tool/src/MediaManagerMock.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* 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 "MediaManagerMock.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
StatusCode MediaManagerTest::SetMeidaMonitor(std::shared_ptr<VMediaMonitor> &monitor)
|
||||||
|
{
|
||||||
|
LogInfo("MediaManagerTest::SetAppMonitor\n");
|
||||||
|
StatusCode code = SetMediaMonitorTrace(monitor);
|
||||||
|
if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
return MediaManagerImpl::SetMeidaMonitor(monitor);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
const StatusCode MediaManagerTest::SetMediaMonitorTrace(std::shared_ptr<VMediaMonitor> &monitor)
|
||||||
|
{
|
||||||
|
LogInfo("SetMediaMonitorTrace::SetAppMonitorTrace\n");
|
||||||
|
return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
}
|
37
test/middleware/MediaManager/tool/src/MediaManagerMock.h
Normal file
37
test/middleware/MediaManager/tool/src/MediaManagerMock.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#ifndef MEDIA_MANAGER_MOCK_H
|
||||||
|
#define MEDIA_MANAGER_MOCK_H
|
||||||
|
#include "MediaManagerImpl.h"
|
||||||
|
#include "MediaManagerTestTool.h"
|
||||||
|
class MediaManagerTest : public MediaManagerImpl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MediaManagerTest() = default;
|
||||||
|
virtual ~MediaManagerTest() = default;
|
||||||
|
// const StatusCode SetMeidaMonitor(std::shared_ptr<VMediaMonitor> &monitor) override;
|
||||||
|
StatusCode SetMeidaMonitor(std::shared_ptr<VMediaMonitor> &monitor) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual const StatusCode SetMediaMonitorTrace(std::shared_ptr<VMediaMonitor> &monitor);
|
||||||
|
};
|
||||||
|
class MediaManagerMock : public MediaManagerTest
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MediaManagerMock() = default;
|
||||||
|
virtual ~MediaManagerMock() = default;
|
||||||
|
MOCK_METHOD1(SetMediaMonitorTrace, const StatusCode(std::shared_ptr<VMediaMonitor> &));
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* 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 "MediaManagerTestTool.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
#include "MediaManagerMakePtrTest.h"
|
||||||
|
#include "MediaManagerMock.h"
|
||||||
|
#include "MediaMonitorMock.h"
|
||||||
|
constexpr int ONLY_BE_CALLED_ONCE = 1;
|
||||||
|
void MediaManagerTestTool::Init(void)
|
||||||
|
{
|
||||||
|
mMediaManagerMock = std::make_shared<MediaManagerMock>();
|
||||||
|
MediaManagerMockInit(mMediaManagerMock);
|
||||||
|
std::shared_ptr<MediaManagerMock> mock = std::dynamic_pointer_cast<MediaManagerMock>(mMediaManagerMock);
|
||||||
|
OverrideMediaManagerMakePtrObject(mock);
|
||||||
|
}
|
||||||
|
void MediaManagerTestTool::UnInit(void)
|
||||||
|
{
|
||||||
|
mMediaManagerMock.reset();
|
||||||
|
mMediaMonitorMock.reset();
|
||||||
|
CancelOverrideMediaManagerMakePtrObject();
|
||||||
|
}
|
||||||
|
void MediaManagerTestTool::MediaManagerMockInit(std::shared_ptr<IMediaManager> &vMock)
|
||||||
|
{
|
||||||
|
std::shared_ptr<MediaManagerMock> mock = std::dynamic_pointer_cast<MediaManagerMock>(vMock);
|
||||||
|
if (!mock) {
|
||||||
|
LogError("vMock error.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto getMediaMonitor = [=](std::shared_ptr<VMediaMonitor> &monitor) {
|
||||||
|
LogInfo("mMediaMonitorMock get.\n");
|
||||||
|
mMediaMonitorMock = monitor;
|
||||||
|
MediaManagerTestTool::MediaMonitorInit(mMediaMonitorMock);
|
||||||
|
};
|
||||||
|
EXPECT_CALL(*mock.get(), SetMediaMonitorTrace(_))
|
||||||
|
.Times(ONLY_BE_CALLED_ONCE)
|
||||||
|
.WillOnce(DoAll(WithArgs<0>(Invoke(getMediaMonitor)), Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
}
|
||||||
|
void MediaManagerTestTool::MediaMonitorInit(std::shared_ptr<VMediaMonitor> &vMock)
|
||||||
|
{
|
||||||
|
std::shared_ptr<MediaMonitorMock> mock = std::dynamic_pointer_cast<MediaMonitorMock>(vMock);
|
||||||
|
if (mock) {
|
||||||
|
// EXPECT_CALL(*mock.get(), GetProductInfoTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetDeviceAttrTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetMediaInfoTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetSdCardInfoTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetParamValueTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetCapabilityTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetLockVideoStatusTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetStorageInfoTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetStorageFileListTrace(_, _))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetBatteryInfoTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), SetDateTimeTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), SetTimeZoneTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), SetParamValueTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), EnterRecorderTrace())
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), MediaPlaybackTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), UploadFileTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), GetThumbnailTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
// EXPECT_CALL(*mock.get(), MediaClientConnectedTrace(_))
|
||||||
|
// .WillRepeatedly(DoAll(Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION))));
|
||||||
|
}
|
||||||
|
}
|
274
test/middleware/MediaManager/tool/src/MediaMonitorMock.cpp
Normal file
274
test/middleware/MediaManager/tool/src/MediaMonitorMock.cpp
Normal file
|
@ -0,0 +1,274 @@
|
||||||
|
/*
|
||||||
|
* 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 "MediaMonitorMock.h"
|
||||||
|
#include "ILog.h"
|
||||||
|
// StatusCode MediaMonitorTest::GetProductInfo(AppGetProductInfo ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetProductInfo\n");
|
||||||
|
// StatusCode code = GetProductInfoTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetProductInfo(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetProductInfoTrace(AppGetProductInfo ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetProductInfoTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetDeviceAttr(AppGetDeviceAttr ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetDeviceAttr\n");
|
||||||
|
// StatusCode code = GetDeviceAttrTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetDeviceAttr(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetDeviceAttrTrace(AppGetDeviceAttr ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetDeviceAttrTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetMediaInfo(AppGetMeidaInfo ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetMediaInfo\n");
|
||||||
|
// StatusCode code = GetMediaInfoTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetMediaInfo(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetMediaInfoTrace(AppGetMeidaInfo ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetMediaInfoTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetSdCardInfo(AppGetSdCardInfo ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetSdCardInfo\n");
|
||||||
|
// StatusCode code = GetSdCardInfoTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetSdCardInfo(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetSdCardInfoTrace(AppGetSdCardInfo ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetSdCardInfoTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetBatteryInfo(AppGetBatteryInfo ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetBatteryInfo\n");
|
||||||
|
// StatusCode code = GetBatteryInfoTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetBatteryInfo(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetBatteryInfoTrace(AppGetBatteryInfo ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetBatteryInfoTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetParamValue(AppParamValue ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetParamValue\n");
|
||||||
|
// StatusCode code = GetParamValueTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetParamValue(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetParamValueTrace(AppParamValue ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetParamValueTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetCapability(AppGetCapability ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetCapability\n");
|
||||||
|
// StatusCode code = GetCapabilityTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetCapability(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetCapabilityTrace(AppGetCapability ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetCapabilityTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetLockVideoStatus(LockVideoStatus ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetLockVideoStatus\n");
|
||||||
|
// StatusCode code = GetLockVideoStatusTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetLockVideoStatus(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetLockVideoStatusTrace(LockVideoStatus ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetLockVideoStatusTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetStorageInfo(std::vector<AppGetStorageInfo> ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetStorageInfo\n");
|
||||||
|
// StatusCode code = GetStorageInfoTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetStorageInfo(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetStorageInfoTrace(std::vector<AppGetStorageInfo> ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetStorageInfoTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetStorageFileList\n");
|
||||||
|
// StatusCode code = GetStorageFileListTrace(fileInfo, param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetStorageFileList(fileInfo, param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetStorageFileListTrace(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::GetStorageFileListTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::SetDateTime(const AppSetDateTime ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::SetDateTime\n");
|
||||||
|
// LogInfo("mYear = %u\n", param.mYear);
|
||||||
|
// LogInfo("mMonth = %02u\n", param.mMonth);
|
||||||
|
// LogInfo("mDay = %02u\n", param.mDay);
|
||||||
|
// LogInfo("mHour = %02u\n", param.mHour);
|
||||||
|
// LogInfo("mMinute = %02u\n", param.mMinute);
|
||||||
|
// LogInfo("mSecond = %02u\n", param.mSecond);
|
||||||
|
// StatusCode code = SetDateTimeTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::SetDateTime(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::SetDateTimeTrace(const AppSetDateTime ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::SetDateTimeTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::SetTimeZone(const unsigned int &zone)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::SetTimeZone = %u\n", zone);
|
||||||
|
// StatusCode code = SetTimeZoneTrace(zone);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::SetTimeZone(zone);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::SetTimeZoneTrace(const unsigned int &zone)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::SetTimeZoneTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::SetParamValue(const AppSetParamValue ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::SetParamValue\n");
|
||||||
|
// StatusCode code = SetParamValueTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::SetParamValue(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::SetParamValueTrace(const AppSetParamValue ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::SetParamValueTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::EnterRecorder(void)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::EnterRecorder\n");
|
||||||
|
// StatusCode code = EnterRecorderTrace();
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::EnterRecorder();
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::EnterRecorderTrace(void)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::EnterRecorderTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::AppPlayback(const PlayBackEvent &event)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::AppPlayback\n");
|
||||||
|
// StatusCode code = AppPlaybackTrace(event);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::AppPlayback(event);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::AppPlaybackTrace(const PlayBackEvent &event)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::AppPlaybackTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::UploadFile(AppUploadFile ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::UploadFile\n");
|
||||||
|
// StatusCode code = UploadFileTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::UploadFile(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::UploadFileTrace(AppUploadFile ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::UploadFileTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::GetThumbnail(AppGetThumbnail ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::GetThumbnail\n");
|
||||||
|
// StatusCode code = GetThumbnailTrace(param);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::GetThumbnail(param);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::GetThumbnailTrace(AppGetThumbnail ¶m)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::UploadFileTrace\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTest::AppClientConnected(std::shared_ptr<VAppClient> &client)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTest::AppClientConnected\n");
|
||||||
|
// StatusCode code = AppClientConnectedTrace(client);
|
||||||
|
// if (StatusCodeEqual(code, "STATUS_CODE_VIRTUAL_FUNCTION")) {
|
||||||
|
// return VMediaMonitor::AppClientConnected(client);
|
||||||
|
// }
|
||||||
|
// return code;
|
||||||
|
// }
|
||||||
|
// StatusCode MediaMonitorTrace::AppClientConnectedTrace(std::shared_ptr<VAppClient> &client)
|
||||||
|
// {
|
||||||
|
// LogInfo("MediaMonitorTrace::AppClientConnected\n");
|
||||||
|
// return CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION);
|
||||||
|
// }
|
93
test/middleware/MediaManager/tool/src/MediaMonitorMock.h
Normal file
93
test/middleware/MediaManager/tool/src/MediaMonitorMock.h
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#ifndef APP_MONITOR_MOCK_H
|
||||||
|
#define APP_MONITOR_MOCK_H
|
||||||
|
#include "GtestUsing.h"
|
||||||
|
#include "IMediaManager.h"
|
||||||
|
class MediaMonitorTrace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MediaMonitorTrace() = default;
|
||||||
|
virtual ~MediaMonitorTrace() = default;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// virtual StatusCode GetProductInfoTrace(AppGetProductInfo ¶m);
|
||||||
|
// virtual StatusCode GetDeviceAttrTrace(AppGetDeviceAttr ¶m);
|
||||||
|
// virtual StatusCode GetMediaInfoTrace(AppGetMeidaInfo ¶m);
|
||||||
|
// virtual StatusCode GetSdCardInfoTrace(AppGetSdCardInfo ¶m);
|
||||||
|
// virtual StatusCode GetBatteryInfoTrace(AppGetBatteryInfo ¶m);
|
||||||
|
// virtual StatusCode GetParamValueTrace(AppParamValue ¶m);
|
||||||
|
// virtual StatusCode GetCapabilityTrace(AppGetCapability ¶m);
|
||||||
|
// virtual StatusCode GetLockVideoStatusTrace(LockVideoStatus ¶m);
|
||||||
|
// virtual StatusCode GetStorageInfoTrace(std::vector<AppGetStorageInfo> ¶m);
|
||||||
|
// virtual StatusCode GetStorageFileListTrace(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> ¶m);
|
||||||
|
// virtual StatusCode SetDateTimeTrace(const AppSetDateTime ¶m);
|
||||||
|
// virtual StatusCode SetTimeZoneTrace(const unsigned int &zone);
|
||||||
|
// virtual StatusCode SetParamValueTrace(const AppSetParamValue ¶m);
|
||||||
|
// virtual StatusCode EnterRecorderTrace(void);
|
||||||
|
// virtual StatusCode AppPlaybackTrace(const PlayBackEvent &event);
|
||||||
|
// virtual StatusCode UploadFileTrace(AppUploadFile ¶m);
|
||||||
|
// virtual StatusCode GetThumbnailTrace(AppGetThumbnail ¶m);
|
||||||
|
// virtual StatusCode AppClientConnectedTrace(std::shared_ptr<VAppClient> &client);
|
||||||
|
};
|
||||||
|
class MediaMonitorTest : public VMediaMonitor, virtual public MediaMonitorTrace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MediaMonitorTest() = default;
|
||||||
|
virtual ~MediaMonitorTest() = default;
|
||||||
|
// StatusCode GetProductInfo(AppGetProductInfo ¶m) override;
|
||||||
|
// StatusCode GetDeviceAttr(AppGetDeviceAttr ¶m) override;
|
||||||
|
// StatusCode GetMediaInfo(AppGetMeidaInfo ¶m) override;
|
||||||
|
// StatusCode GetSdCardInfo(AppGetSdCardInfo ¶m) override;
|
||||||
|
// StatusCode GetBatteryInfo(AppGetBatteryInfo ¶m) override;
|
||||||
|
// StatusCode GetParamValue(AppParamValue ¶m) override;
|
||||||
|
// StatusCode GetCapability(AppGetCapability ¶m) override;
|
||||||
|
// StatusCode GetLockVideoStatus(LockVideoStatus ¶m) override;
|
||||||
|
// StatusCode GetStorageInfo(std::vector<AppGetStorageInfo> ¶m) override;
|
||||||
|
// StatusCode GetStorageFileList(const AppGetFileInfo &fileInfo, std::vector<AppGetFileList> ¶m) override;
|
||||||
|
// StatusCode SetDateTime(const AppSetDateTime ¶m) override;
|
||||||
|
// StatusCode SetTimeZone(const unsigned int &zone) override;
|
||||||
|
// StatusCode SetParamValue(const AppSetParamValue ¶m) override;
|
||||||
|
// StatusCode EnterRecorder(void) override;
|
||||||
|
// StatusCode AppPlayback(const PlayBackEvent &event) override;
|
||||||
|
// StatusCode UploadFile(AppUploadFile ¶m) override;
|
||||||
|
// StatusCode GetThumbnail(AppGetThumbnail ¶m) override;
|
||||||
|
// StatusCode AppClientConnected(std::shared_ptr<VAppClient> &client) override;
|
||||||
|
};
|
||||||
|
class MediaMonitorMock : virtual public MediaMonitorTrace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MediaMonitorMock() = default;
|
||||||
|
virtual ~MediaMonitorMock() = default;
|
||||||
|
// MOCK_METHOD1(GetProductInfoTrace, StatusCode(AppGetProductInfo &));
|
||||||
|
// MOCK_METHOD1(GetDeviceAttrTrace, StatusCode(AppGetDeviceAttr &));
|
||||||
|
// MOCK_METHOD1(GetMediaInfoTrace, StatusCode(AppGetMeidaInfo &));
|
||||||
|
// MOCK_METHOD1(GetSdCardInfoTrace, StatusCode(AppGetSdCardInfo &));
|
||||||
|
// MOCK_METHOD1(GetBatteryInfoTrace, StatusCode(AppGetBatteryInfo &));
|
||||||
|
// MOCK_METHOD1(GetParamValueTrace, StatusCode(AppParamValue &));
|
||||||
|
// MOCK_METHOD1(GetCapabilityTrace, StatusCode(AppGetCapability &));
|
||||||
|
// MOCK_METHOD1(GetLockVideoStatusTrace, StatusCode(LockVideoStatus &));
|
||||||
|
// MOCK_METHOD1(GetStorageInfoTrace, StatusCode(std::vector<AppGetStorageInfo> &));
|
||||||
|
// MOCK_METHOD2(GetStorageFileListTrace, StatusCode(const AppGetFileInfo &, std::vector<AppGetFileList> &));
|
||||||
|
// MOCK_METHOD1(SetDateTimeTrace, StatusCode(const AppSetDateTime &));
|
||||||
|
// MOCK_METHOD1(SetTimeZoneTrace, StatusCode(const unsigned int &));
|
||||||
|
// MOCK_METHOD1(SetParamValueTrace, StatusCode(const AppSetParamValue &));
|
||||||
|
// MOCK_METHOD0(EnterRecorderTrace, StatusCode(void));
|
||||||
|
// MOCK_METHOD1(AppPlaybackTrace, StatusCode(const PlayBackEvent &));
|
||||||
|
// MOCK_METHOD1(UploadFileTrace, StatusCode(AppUploadFile &));
|
||||||
|
// MOCK_METHOD1(GetThumbnailTrace, StatusCode(AppGetThumbnail &));
|
||||||
|
// MOCK_METHOD1(AppClientConnectedTrace, StatusCode(std::shared_ptr<VAppClient> &));
|
||||||
|
};
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user