summaryrefslogtreecommitdiff
path: root/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
diff options
context:
space:
mode:
Diffstat (limited to 'AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h')
-rw-r--r--AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h216
1 files changed, 111 insertions, 105 deletions
diff --git a/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h b/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
index b7d2a09..63f79cf 100644
--- a/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
+++ b/AudioManagerUtilities/test/AmSocketHandlerTest/CAmSocketHandlerTest.h
@@ -34,122 +34,128 @@
#undef ENABLED_SOCKETHANDLER_TEST_OUTPUT
#undef ENABLED_TIMERS_TEST_OUTPUT
-#define TIMERS_CB_TOLERANCE 10.f
+#define TIMERS_CB_TOLERANCE 8.f
namespace am
{
- class IAmTimerCb
- {
- public:
- virtual void timerCallback(sh_timerHandle_t handle, void * userData)=0;
- };
-
- class IAmSocketHandlerCb
- {
- public:
- virtual void receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)=0;
- virtual bool dispatchData(const sh_pollHandle_t handle, void* userData)=0;
- virtual bool check(const sh_pollHandle_t handle, void* userData)=0;
- };
-
- class MockIAmTimerCb : public IAmTimerCb
- {
- public:
+ class IAmTimerCb
+ {
+ public:
+ virtual ~IAmTimerCb()
+ {
+ }
+ virtual void timerCallback(sh_timerHandle_t handle, void * userData)=0;
+ };
+
+ class IAmSocketHandlerCb
+ {
+ public:
+ virtual ~IAmSocketHandlerCb()
+ {
+ }
+ virtual void receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void* userData)=0;
+ virtual bool dispatchData(const sh_pollHandle_t handle, void* userData)=0;
+ virtual bool check(const sh_pollHandle_t handle, void* userData)=0;
+ };
+
+ class MockIAmTimerCb: public IAmTimerCb
+ {
+ public:
MOCK_CONST_METHOD2(timerCallback,
- void(sh_timerHandle_t handle, void *userData));
- };
-
- class MockSocketHandlerCb : public IAmSocketHandlerCb
- {
- public:
+ void(sh_timerHandle_t handle, void *userData));
+ };
+
+ class MockSocketHandlerCb: public IAmSocketHandlerCb
+ {
+ public:
MOCK_CONST_METHOD3(receiveData,
- void(const pollfd pollfd, const sh_pollHandle_t handle, void* userData));
+ void(const pollfd pollfd, const sh_pollHandle_t handle, void* userData));
MOCK_CONST_METHOD2(dispatchData,
- void(const sh_pollHandle_t handle, void* userData));
+ void(const sh_pollHandle_t handle, void* userData));
MOCK_CONST_METHOD2(check,
- void(const sh_pollHandle_t handle, void* userData));
+ void(const sh_pollHandle_t handle, void* userData));
};
-
-class CAmSamplePlugin : public MockSocketHandlerCb
-{
-public:
- enum sockType_e
+
+ class CAmSamplePlugin: public MockSocketHandlerCb
{
- UNIX, INET
+ public:
+ enum sockType_e
+ {
+ UNIX, INET
+ };
+ CAmSamplePlugin(CAmSocketHandler *mySocketHandler, sockType_e socketType);
+ ~CAmSamplePlugin()
+ {
+ }
+ ;
+ void connectSocket(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+ void receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
+ bool dispatchData(const sh_pollHandle_t handle, void* userData);
+ bool check(const sh_pollHandle_t handle, void* userData);
+ TAmShPollFired<CAmSamplePlugin> connectFiredCB;
+ TAmShPollFired<CAmSamplePlugin> receiveFiredCB;
+ TAmShPollDispatch<CAmSamplePlugin> sampleDispatchCB;
+ TAmShPollCheck<CAmSamplePlugin> sampleCheckCB;
+
+ private:
+ CAmSocketHandler *mSocketHandler;
+ sh_pollHandle_t mConnecthandle, mReceiveHandle;
+ std::queue<std::string> msgList;
};
- CAmSamplePlugin(CAmSocketHandler *mySocketHandler, sockType_e socketType);
- ~CAmSamplePlugin()
+
+ class CAmTimerSockethandlerController: public MockIAmTimerCb
{
- }
- ;
- void connectSocket(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
- void receiveData(const pollfd pollfd, const sh_pollHandle_t handle, void* userData);
- bool dispatchData(const sh_pollHandle_t handle, void* userData);
- bool check(const sh_pollHandle_t handle, void* userData);
- TAmShPollFired<CAmSamplePlugin> connectFiredCB;
- TAmShPollFired<CAmSamplePlugin> receiveFiredCB;
- TAmShPollDispatch<CAmSamplePlugin> sampleDispatchCB;
- TAmShPollCheck<CAmSamplePlugin> sampleCheckCB;
-
-private:
- CAmSocketHandler *mSocketHandler;
- sh_pollHandle_t mConnecthandle, mReceiveHandle;
- std::queue<std::string> msgList;
-};
-
-class CAmTimerSockethandlerController: public MockIAmTimerCb
-{
- CAmSocketHandler *mpSocketHandler;
- timespec mUpdateTimeout;
-public:
- explicit CAmTimerSockethandlerController(CAmSocketHandler *SocketHandler, const timespec &timeout);
- virtual ~CAmTimerSockethandlerController();
-
- void timerCallback(sh_timerHandle_t handle, void * userData);
-
- TAmShTimerCallBack<CAmTimerSockethandlerController> pTimerCallback;
-};
-
-class CAmTimer: public MockIAmTimerCb
-{
- CAmSocketHandler *mpSocketHandler;
- timespec mUpdateTimeout;
- int32_t mRepeats;
-public:
- explicit CAmTimer(CAmSocketHandler *SocketHandler, const timespec &timeout, const int32_t repeats = 0u);
- virtual ~CAmTimer();
-
- void timerCallback(sh_timerHandle_t handle, void * userData);
-
- TAmShTimerCallBack<CAmTimer> pTimerCallback;
-};
-
-class CAmTimerMeasurment: public MockIAmTimerCb
-{
- CAmSocketHandler *mSocketHandler;
- timespec mUpdateTimeout;
- std::chrono::time_point<std::chrono::high_resolution_clock> mUpdateTimePoint;
- std::chrono::time_point<std::chrono::high_resolution_clock> mLastInvocationTime;
- std::chrono::duration<long, std::ratio<1l, 1000000000l>> mExpected;
- int32_t mRepeats;
- void * mpUserData;
- std::string mDebugText;
-public:
- explicit CAmTimerMeasurment(CAmSocketHandler *SocketHandler, const timespec &timeout, const std::string & label, const int32_t repeats = 0u, void * userData = NULL);
- virtual ~CAmTimerMeasurment();
-
- void timerCallback(sh_timerHandle_t handle, void * userData);
- TAmShTimerCallBack<CAmTimerMeasurment> pTimerCallback;
-};
-
-class CAmSocketHandlerTest: public ::testing::Test
-{
-public:
- CAmSocketHandlerTest();
- ~CAmSocketHandlerTest();
- void SetUp();
- void TearDown();
-};
+ CAmSocketHandler *mpSocketHandler;
+ timespec mUpdateTimeout;
+ public:
+ explicit CAmTimerSockethandlerController(CAmSocketHandler *SocketHandler, const timespec &timeout);
+ virtual ~CAmTimerSockethandlerController();
+
+ void timerCallback(sh_timerHandle_t handle, void * userData);
+
+ TAmShTimerCallBack<CAmTimerSockethandlerController> pTimerCallback;
+ };
+
+ class CAmTimer: public MockIAmTimerCb
+ {
+ CAmSocketHandler *mpSocketHandler;
+ timespec mUpdateTimeout;
+ int32_t mRepeats;
+ public:
+ explicit CAmTimer(CAmSocketHandler *SocketHandler, const timespec &timeout, const int32_t repeats = 0u);
+ virtual ~CAmTimer();
+
+ void timerCallback(sh_timerHandle_t handle, void * userData);
+
+ TAmShTimerCallBack<CAmTimer> pTimerCallback;
+ };
+
+ class CAmTimerMeasurment: public MockIAmTimerCb
+ {
+ CAmSocketHandler *mSocketHandler;
+ timespec mUpdateTimeout;
+ std::chrono::time_point<std::chrono::high_resolution_clock> mUpdateTimePoint;
+ std::chrono::time_point<std::chrono::high_resolution_clock> mLastInvocationTime;
+ std::chrono::duration<long, std::ratio<1l, 1000000000l>> mExpected;
+ int32_t mRepeats;
+ void * mpUserData;
+ std::string mDebugText;
+ public:
+ explicit CAmTimerMeasurment(CAmSocketHandler *SocketHandler, const timespec &timeout, const std::string & label, const int32_t repeats = 0u, void * userData = NULL);
+ virtual ~CAmTimerMeasurment();
+
+ void timerCallback(sh_timerHandle_t handle, void * userData);
+ TAmShTimerCallBack<CAmTimerMeasurment> pTimerCallback;
+ };
+
+ class CAmSocketHandlerTest: public ::testing::Test
+ {
+ public:
+ CAmSocketHandlerTest();
+ ~CAmSocketHandlerTest();
+ void SetUp();
+ void TearDown();
+ };
} /* namespace am */
#endif /* SOCKETHANDLERTEST_H_ */