summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Donchev <Aleksander.Donchev@partner.bmw.de>2014-03-28 16:34:25 +0100
committerChristian Linke <christian.linke@bmw.de>2014-03-28 16:48:03 +0100
commit7666421ecaa46c0244e6272db80e0192aed47a28 (patch)
treee6ff9ef6c2bb67df96a1929d8d1c3c3e851a43b2
parent4e95ee075a723ba9270cbd33704a553e51823795 (diff)
downloadaudiomanager-7666421ecaa46c0244e6272db80e0192aed47a28.tar.gz
* Some unit tests fixed due issues occured on pocky build systems.
Signed-off-by: Christian Linke <christian.linke@bmw.de>
-rw-r--r--AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp20
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp1
-rw-r--r--AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp11
-rw-r--r--PluginCommandInterfaceCAPI/test/CAmCommandSenderCAPITest.cpp6
-rw-r--r--PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp5
5 files changed, 35 insertions, 8 deletions
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp b/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
index 2dba164..ae05960 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
+++ b/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
@@ -2268,7 +2268,10 @@ TEST_F(CAmMapHandlerTest, peekDomain_2)
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
ASSERT_EQ(domainID, domain2ID); // FAILS, ID is 2 instead of 1
- ASSERT_TRUE(listDomains[0].domainID==domainID);
+ bool containsDomainID = std::find_if(listDomains.begin(), listDomains.end(), [&](const am_Domain_s & ref) {
+ return ref.domainID==domainID;
+ })!=listDomains.end();
+ ASSERT_TRUE(containsDomainID);
}
TEST_F(CAmMapHandlerTest, connectionIDBoundary)
@@ -2475,7 +2478,10 @@ TEST_F(CAmMapHandlerObserverCallbacksTest, peek_enter_removeDomain)
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
ASSERT_EQ(domainID, domain2ID); // FAILS, ID is 2 instead of 1
- ASSERT_TRUE(listDomains[0].domainID==domainID);
+ bool containsDomainID = std::find_if(listDomains.begin(), listDomains.end(), [&](const am_Domain_s & ref) {
+ return ref.domainID==domainID;
+ })!=listDomains.end();
+ ASSERT_TRUE(containsDomainID);
EXPECT_CALL(*MockDatabaseObserver::getMockObserverObject(), removeDomain(domainID)).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.removeDomainDB(domainID))<< "ERROR: database error";
EXPECT_TRUE(Mock::VerifyAndClearExpectations(MockDatabaseObserver::getMockObserverObject()));
@@ -2513,7 +2519,10 @@ TEST_F(CAmMapHandlerObserverCallbacksTest, peek_enter_update_removeSource)
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source3ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
ASSERT_EQ(sourceID, source3ID);
- ASSERT_TRUE(listSources[0].sourceID==sourceID);
+ bool containsSourceID = std::find_if(listSources.begin(), listSources.end(), [&](const am_Source_s & ref) {
+ return ref.sourceID==sourceID;
+ })!=listSources.end();
+ ASSERT_TRUE(containsSourceID);
std::vector<am_SoundProperty_s> listSoundProperties;
std::vector<am_ConnectionFormat_e> listConnectionFormats;
std::vector<am_MainSoundProperty_s> listMainSoundProperties;
@@ -2556,7 +2565,10 @@ TEST_F(CAmMapHandlerObserverCallbacksTest, peek_enter_update_removeSink)
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink3ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(sinkID, sink3ID);
- ASSERT_TRUE(listSinks[0].sinkID==sinkID);
+ bool containsSourceID = std::find_if(listSinks.begin(), listSinks.end(), [&](const am_Sink_s & ref) {
+ return ref.sinkID==sinkID;
+ })!=listSinks.end();
+ ASSERT_TRUE(containsSourceID);
std::vector<am_SoundProperty_s> listSoundProperties;
std::vector<am_ConnectionFormat_e> listConnectionFormats;
std::vector<am_MainSoundProperty_s> listMainSoundProperties;
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp
index 0833dde..e41e556 100644
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp
+++ b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp
@@ -164,6 +164,7 @@ TEST_F(CAmNodeStateCommunicatorTest, receiveLifecycleRequest)
std::ostringstream send;
send << "python send2nsm.py LifecycleRequest "<<Request<<" "<<RequestID;
system(send.str().c_str());
+ sleep(2);
}
TEST_F(CAmNodeStateCommunicatorTest, UnRegisterShutdownClient)
diff --git a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp b/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
index 4c55c34..2ea9639 100644
--- a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
+++ b/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
@@ -1248,8 +1248,15 @@ TEST_F(CAmRouterMapTest,simpleRoute4Domains2Routes)
ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
ASSERT_EQ(static_cast<uint>(2), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
- ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[1]));
+
+ bool containsRoute1 = std::find_if(listRoutes.begin(), listRoutes.end(), [&](const am_Route_s & ref) {
+ return pCF.compareRoute(compareRoute, ref);
+ })!=listRoutes.end();
+ bool containsRoute2 = std::find_if(listRoutes.begin(), listRoutes.end(), [&](const am_Route_s & ref) {
+ return pCF.compareRoute(compareRoute1, ref);
+ })!=listRoutes.end();
+ ASSERT_TRUE(containsRoute1);
+ ASSERT_TRUE(containsRoute2);
}
//test that checks 3 domains, one sink one source but the connectionformat of third domains do not fit.
diff --git a/PluginCommandInterfaceCAPI/test/CAmCommandSenderCAPITest.cpp b/PluginCommandInterfaceCAPI/test/CAmCommandSenderCAPITest.cpp
index 7cbc0c8..66bd0dc 100644
--- a/PluginCommandInterfaceCAPI/test/CAmCommandSenderCAPITest.cpp
+++ b/PluginCommandInterfaceCAPI/test/CAmCommandSenderCAPITest.cpp
@@ -85,6 +85,10 @@ void* run_service(void*)
}
else
{
+ ON_CALL(*env->mpCommandReceive, getListMainSources(_)).WillByDefault(Return(E_OK));
+ ON_CALL(*env->mpCommandReceive, getListMainSinks(_)).WillByDefault(Return(E_OK));
+ ON_CALL(*env->mpCommandReceive, getListMainSourceSoundProperties(_,_)).WillByDefault(Return(E_OK));
+
EXPECT_CALL(*env->mpCommandReceive,confirmCommandReady(10,_));
plugin.setCommandReady(10);
socketHandler.start_listenting();
@@ -203,6 +207,8 @@ CAmCommandSenderCAPITest::~CAmCommandSenderCAPITest()
void CAmCommandSenderCAPITest::SetUp()
{
::testing::GTEST_FLAG(throw_on_failure) = false;
+ ::testing::FLAGS_gmock_verbose = "error";
+// ::testing::DefaultValue<am_Error_e>::Set(am_Error_e(E_OK));
}
void CAmCommandSenderCAPITest::TearDown()
diff --git a/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp b/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp
index c02d5d3..8111494 100644
--- a/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp
+++ b/PluginRoutingInterfaceAsync/test/CAmRoutingReceiverAsync.cpp
@@ -46,12 +46,13 @@ CAmEnvironment::~CAmEnvironment()
void CAmEnvironment::SetUp()
{
+ ::testing::GTEST_FLAG(throw_on_failure) = false;
logInfo("RoutingSendInterface Test started ");
std::vector<int> domainIDs;
domainIDs.push_back(0);
domainIDs.push_back(1);
-
+ EXPECT_TRUE(Mock::VerifyAndClearExpectations(&env->pReceiveInterface));
EXPECT_CALL(env->pReceiveInterface,getSocketHandler(_)).WillOnce(DoAll(SetArgReferee<0>(&env->pSocketHandler), Return(E_OK)));
EXPECT_CALL(env->pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(CAmEnvironment::handleDomainRegister));
EXPECT_CALL(env->pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(CAmEnvironment::handleSourceRegister));
@@ -94,7 +95,7 @@ void CAmEnvironment::SetUp()
void CAmEnvironment::TearDown()
{
-
+ ::testing::GTEST_FLAG(throw_on_failure) = true;
}
CAmRoutingReceiverAsync::CAmRoutingReceiverAsync() :