diff --git a/test/GtestUsing.h b/test/GtestUsing.h index e829a58e..44fa4e7b 100644 --- a/test/GtestUsing.h +++ b/test/GtestUsing.h @@ -47,5 +47,6 @@ using ::testing::Unused; using ::testing::WithArgs; using ::testing::internal::BuiltInDefaultValue; // using ::testing::Mock::VerifyAndClearExpectations; +using ::testing::Between; using ::testing::Mock; #endif \ No newline at end of file diff --git a/test/middleware/AppManager/tool/src/AppManagerMakePtrTest.cpp b/test/middleware/AppManager/tool/src/AppManagerMakePtrTest.cpp index ad9a7b09..e1598932 100644 --- a/test/middleware/AppManager/tool/src/AppManagerMakePtrTest.cpp +++ b/test/middleware/AppManager/tool/src/AppManagerMakePtrTest.cpp @@ -13,7 +13,12 @@ * limitations under the License. */ #include "AppManagerMakePtrTest.h" +#include "AppManagerMock.h" +#include "IAppManager.h" +#include "AppManagerMakePtr.h" #include "ILog.h" +#include "StatusCode.h" +#include void OverrideAppManagerMakePtrObject(std::shared_ptr &appManagerMock) { std::shared_ptr impl = std::make_shared(); diff --git a/test/middleware/AppManager/tool/src/AppManagerMock.cpp b/test/middleware/AppManager/tool/src/AppManagerMock.cpp index 925214d5..5c2649c2 100644 --- a/test/middleware/AppManager/tool/src/AppManagerMock.cpp +++ b/test/middleware/AppManager/tool/src/AppManagerMock.cpp @@ -13,7 +13,11 @@ * limitations under the License. */ #include "AppManagerMock.h" +#include "AppManager.h" +#include "IAppManager.h" #include "ILog.h" +#include "StatusCode.h" +#include const StatusCode AppManagerTest::SetAppMonitor(std::shared_ptr &monitor) { LogInfo("AppManagerTest::SetAppMonitor\n"); diff --git a/test/middleware/AppManager/tool/src/AppManagerTestTool.cpp b/test/middleware/AppManager/tool/src/AppManagerTestTool.cpp index 6a3eb3b7..fcf9ceec 100644 --- a/test/middleware/AppManager/tool/src/AppManagerTestTool.cpp +++ b/test/middleware/AppManager/tool/src/AppManagerTestTool.cpp @@ -16,9 +16,17 @@ #include "AppManagerMakePtrTest.h" #include "AppManagerMock.h" #include "AppMonitorMock.h" +#include "GtestUsing.h" +#include "IAppManager.h" #include "ILog.h" #include "ServersMock.h" +#include "StatusCode.h" #include "TcpModule.h" +#include +#include +#include +#include +#include constexpr int ONLY_BE_CALLED_ONCE = 1; AppManagerTestTool::AppManagerTestTool() { @@ -314,7 +322,7 @@ void AppManagerTestTool::AppManagerMockInit(std::shared_ptr &vMock) AppManagerTestTool::AppMonitorInit(mAppMonitorMock); }; EXPECT_CALL(*mock.get(), SetAppMonitorTrace(_)) - .Times(testing::Between(0, 1)) + .Times(Between(0, 1)) .WillOnce(DoAll(WithArgs<0>(Invoke(getAppMonitor)), Return(CreateStatusCode(STATUS_CODE_VIRTUAL_FUNCTION)))); } std::shared_ptr AppManagerTestTool::MakeMonitorMock(void) diff --git a/test/middleware/AppManager/tool/src/AppMonitorMock.cpp b/test/middleware/AppManager/tool/src/AppMonitorMock.cpp index 7dacab5f..dfa1a673 100644 --- a/test/middleware/AppManager/tool/src/AppMonitorMock.cpp +++ b/test/middleware/AppManager/tool/src/AppMonitorMock.cpp @@ -13,7 +13,11 @@ * limitations under the License. */ #include "AppMonitorMock.h" +#include "IAppManager.h" #include "ILog.h" +#include "StatusCode.h" +#include +#include StatusCode AppMonitorTest::GetProductInfo(AppGetProductInfo ¶m) { LogInfo("AppMonitorTest::GetProductInfo\n"); diff --git a/test/middleware/AppManager/tool/src/ServersMock.cpp b/test/middleware/AppManager/tool/src/ServersMock.cpp index e9308e36..bfd198e3 100644 --- a/test/middleware/AppManager/tool/src/ServersMock.cpp +++ b/test/middleware/AppManager/tool/src/ServersMock.cpp @@ -15,7 +15,11 @@ #include "ServersMock.h" #include "ILog.h" #include "servers.h" +#include #include +#include +#include +#include extern const char *APP_GET_PRODUCT_INFO; extern const char *APP_GET_DEVICE_ATTR; extern const char *APP_GET_MEDIA_INFO; diff --git a/test/utils/LinuxApiMock/src/LinuxApiMock.cpp b/test/utils/LinuxApiMock/src/LinuxApiMock.cpp index 3af63f02..ea9640be 100644 --- a/test/utils/LinuxApiMock/src/LinuxApiMock.cpp +++ b/test/utils/LinuxApiMock/src/LinuxApiMock.cpp @@ -13,9 +13,16 @@ * limitations under the License. */ #include "LinuxApiMock.h" -#include "ILog.h" #include "LinuxTestImpl.h" #include "WrapApi.h" +#include +#include +#include +#include +#include +#include +#include +#include std::shared_ptr &LinuxApiMock::GetInstance(std::shared_ptr *impl) { static auto instance = std::make_shared(); diff --git a/test/utils/LinuxApiMock/src/LinuxTestImpl.cpp b/test/utils/LinuxApiMock/src/LinuxTestImpl.cpp index 5fc68e4f..8bf58943 100644 --- a/test/utils/LinuxApiMock/src/LinuxTestImpl.cpp +++ b/test/utils/LinuxApiMock/src/LinuxTestImpl.cpp @@ -13,7 +13,17 @@ * limitations under the License. */ #include "LinuxTestImpl.h" +#include "GtestUsing.h" #include "ILog.h" +#include "LinuxApiMock.h" +#include "WrapApi.h" +#include +#include +#include +#include +#include +#include +#include #include /** * @brief The simulated interface has been subjected to lock serial processing to ensure that the return value can be diff --git a/test/utils/LinuxApiMock/src/WrapApi.cpp b/test/utils/LinuxApiMock/src/WrapApi.cpp index 731ffeaa..e71817a3 100644 --- a/test/utils/LinuxApiMock/src/WrapApi.cpp +++ b/test/utils/LinuxApiMock/src/WrapApi.cpp @@ -14,7 +14,10 @@ */ #include "WrapApi.h" #include "LinuxApiMock.h" +#include #include +#include +#include #ifdef __cplusplus extern "C" { #endif diff --git a/test/utils/McuProtocol/tool/src/McuProtocolTestTool.cpp b/test/utils/McuProtocol/tool/src/McuProtocolTestTool.cpp index 16cb847a..9ca9491f 100644 --- a/test/utils/McuProtocol/tool/src/McuProtocolTestTool.cpp +++ b/test/utils/McuProtocol/tool/src/McuProtocolTestTool.cpp @@ -13,14 +13,30 @@ * limitations under the License. */ #include "McuProtocolTestTool.h" +#include "GtestUsing.h" #include "ILog.h" +#include "LinuxApiMock.h" #include "ModBusCRC16.h" #include "ProtocolHandle.h" #include "ProtocolMonitor.h" +#include "UartDevice.h" +#include "UartDeviceTestTool.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include #include #include + using std::placeholders::_1; using std::placeholders::_2; using std::placeholders::_3; diff --git a/test/utils/McuProtocol/tool/src/ProtocolMonitor.cpp b/test/utils/McuProtocol/tool/src/ProtocolMonitor.cpp index 41470308..a0ff4bb6 100644 --- a/test/utils/McuProtocol/tool/src/ProtocolMonitor.cpp +++ b/test/utils/McuProtocol/tool/src/ProtocolMonitor.cpp @@ -13,7 +13,12 @@ * limitations under the License. */ #include "ProtocolMonitor.h" +#include "GtestUsing.h" #include "ILog.h" +#include +#include +#include +#include static void PrintHexadecimalData(const void *buf, const size_t &bufLength, const char *log) { printf("%s { 0x%02X", log, *(unsigned char *)buf); diff --git a/test/utils/TestManager/src/TestManager.cpp b/test/utils/TestManager/src/TestManager.cpp index 819d153a..f3f1d7c0 100644 --- a/test/utils/TestManager/src/TestManager.cpp +++ b/test/utils/TestManager/src/TestManager.cpp @@ -15,6 +15,9 @@ #include "TestManager.h" #include "ILog.h" #include "MainThread.h" +#include +#include +#include constexpr int TIMER_SLEEP_MS = 100; void TestManager::Init(void) { diff --git a/test/utils/UartDevice/tool/src/UartDeviceTestTool.cpp b/test/utils/UartDevice/tool/src/UartDeviceTestTool.cpp index 2ab1bb35..e13b7c01 100644 --- a/test/utils/UartDevice/tool/src/UartDeviceTestTool.cpp +++ b/test/utils/UartDevice/tool/src/UartDeviceTestTool.cpp @@ -13,8 +13,21 @@ * limitations under the License. */ #include "UartDeviceTestTool.h" +#include "GtestUsing.h" #include "ILog.h" +#include "LinuxApiMock.h" +#include "UartDevice.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include + static size_t WRITE_COUNT = -1; constexpr int INVALID_FD = -1; int UartDeviceTestTool::RegisterUartDevice(std::shared_ptr &mock, const UartInfo &uart)