From 2ebf13acbec713154637ab9a47a20315fa706013 Mon Sep 17 00:00:00 2001 From: Frank Herchet Date: Tue, 24 Apr 2012 09:37:37 +0200 Subject: *[GAM-71]: move connectNoMoreThreads test *[GAM-71]: change timeout to 1.5s *[GAM-71]: fix connectAbortTooLate test * fix issue in CAmEnvironment::TearDown Signed-off-by: Christian Mueller --- .../AmTelnetServerTest/CAmTelnetServerTest.cpp | 2 +- .../test/CAmRoutingReceiverAsync.cpp | 51 +++++++++++----------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp b/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp index c907c76..ebc3705 100644 --- a/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp +++ b/AudioManagerDaemon/test/AmTelnetServerTest/CAmTelnetServerTest.cpp @@ -89,7 +89,7 @@ void CAmEnvironment::SetUp() void CAmEnvironment::TearDown() { - + pthread_cancel(mSocketHandlerThread); } void CAmEnvironment::setSocketHandler(CAmSocketHandler* pSocketHandler) diff --git a/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp b/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp index 13c9806..399fc03 100644 --- a/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp +++ b/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp @@ -78,7 +78,7 @@ void CAmEnvironment::SetUp() pRouter->setRoutingReady(10); timespec t; - t.tv_nsec = 0; + t.tv_nsec = 500000000; t.tv_sec = 1; sh_timerHandle_t handle; @@ -371,29 +371,6 @@ TEST_F(CAmRoutingReceiverAsync,disconnect) pSocketHandler.start_listenting(); } -TEST_F(CAmRoutingReceiverAsync,connectNoMoreThreads) -{ - - am_Handle_s handle; - handle.handle = 1; - handle.handleType = H_CONNECT; - - am_connectionID_t connectionID = 1; - am_sourceID_t sourceID = 2; - am_sinkID_t sinkID = 1; - am_ConnectionFormat_e format = CF_GENIVI_ANALOG; - - EXPECT_CALL(pReceiveInterface,ackConnect(_,_,E_OK)).Times(10); - for (int i = 0; i < 10; i++) - { - handle.handle++; - connectionID++; - ASSERT_EQ(E_OK, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format)); - } - ASSERT_EQ(E_NOT_POSSIBLE, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format)); - pSocketHandler.start_listenting(); -} - TEST_F(CAmRoutingReceiverAsync,connectAbortTooLate) { @@ -406,7 +383,7 @@ TEST_F(CAmRoutingReceiverAsync,connectAbortTooLate) am_sinkID_t sinkID = 1; am_ConnectionFormat_e format = CF_GENIVI_ANALOG; - EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(2); + EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_OK)).Times(1); ASSERT_EQ(E_OK, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format)); sleep(3); ASSERT_EQ(E_NON_EXISTENT, pRouter->asyncAbort(handle)); @@ -499,6 +476,30 @@ TEST_F(CAmRoutingReceiverAsync,connect) pSocketHandler.start_listenting(); } +TEST_F(CAmRoutingReceiverAsync,connectNoMoreThreads) +{ + + am_Handle_s handle; + handle.handle = 1; + handle.handleType = H_CONNECT; + + am_connectionID_t connectionID = 1; + am_sourceID_t sourceID = 2; + am_sinkID_t sinkID = 1; + am_ConnectionFormat_e format = CF_GENIVI_ANALOG; + + EXPECT_CALL(pReceiveInterface,ackConnect(_,_,E_OK)).Times(10); + for (int i = 0; i < 10; i++) + { + handle.handle++; + connectionID++; + std::cout << "asyncConnect: " << connectionID << ", " << handle.handle << std::endl; + ASSERT_EQ(E_OK, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format)); + } + ASSERT_EQ(E_NOT_POSSIBLE, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format)); + pSocketHandler.start_listenting(); +} + int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); -- cgit v1.2.1