summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristian mueller <christian.ei.mueller@bmw.de>2012-02-07 17:43:37 +0100
committerchristian mueller <christian.ei.mueller@bmw.de>2012-02-07 17:43:37 +0100
commit8a2db276ede7516038eb5d2bf13b89cc3ff185a7 (patch)
treefbd1a82775a0165a285e28696700c47a96b8a208
parentf00468f45b72e2693b79af30665f683967deb5a7 (diff)
downloadaudiomanager-8a2db276ede7516038eb5d2bf13b89cc3ff185a7.tar.gz
* add another routing test
* change answer in case routing can not be done on only one domain
-rw-r--r--AudioManagerDaemon/src/Router.cpp4
-rw-r--r--AudioManagerDaemon/test/routing/routingTest.cpp63
2 files changed, 65 insertions, 2 deletions
diff --git a/AudioManagerDaemon/src/Router.cpp b/AudioManagerDaemon/src/Router.cpp
index 8bc2924..9ed0f5b 100644
--- a/AudioManagerDaemon/src/Router.cpp
+++ b/AudioManagerDaemon/src/Router.cpp
@@ -60,9 +60,9 @@ am_Error_e Router::getRoute(const bool onlyfree, const am_sourceID_t sourceID, c
//get the prio of the Controller:
mControlSender->getConnectionFormatChoice(sourceID, sinkID, listFormats, listPriorityConnectionFormats);
- //no possible connection, so no route !
+ //no possible connection, so no route ! But we report OK since there is no fault ...
if (listPriorityConnectionFormats.empty())
- return E_NOT_POSSIBLE;
+ return E_OK;
//return the first item as route:
am_RoutingElement_s routingElement;
diff --git a/AudioManagerDaemon/test/routing/routingTest.cpp b/AudioManagerDaemon/test/routing/routingTest.cpp
index d160e1a..9158064 100644
--- a/AudioManagerDaemon/test/routing/routingTest.cpp
+++ b/AudioManagerDaemon/test/routing/routingTest.cpp
@@ -77,6 +77,69 @@ ACTION(returnConnectionFormat){
arg3=arg2;
}
+//test that checks just sinks and source in a domain but connectionformats do not match
+TEST_F(routingTest,simpleRoute2withDomainNoMatchFormats)
+{
+ EXPECT_CALL(pMockInterface,cbNumberOfSourcesChanged()).Times(1);
+ EXPECT_CALL(pMockInterface,cbNumberOfSinksChanged()).Times(1);
+ EXPECT_CALL(pMockControlInterface,getConnectionFormatChoice(_,_,_,_)).WillRepeatedly(DoAll(returnConnectionFormat(), Return(E_OK)));
+
+ //initialize 2 domains
+ am_Domain_s domain1;
+ am_domainID_t domainID1;
+
+ domain1.domainID = 0;
+ domain1.name = "domain1";
+ domain1.busname = "domain1bus";
+ domain1.state = DS_CONTROLLED;
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain1,domainID1));
+
+ am_Source_s source;
+ am_sourceID_t sourceID;
+
+ source.domainID = domainID1;
+ source.name = "source1";
+ source.sourceState = SS_ON;
+ source.sourceID = 0;
+ source.sourceClassID = 5;
+ source.listConnectionFormats.push_back(CF_MONO);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
+
+ am_Sink_s sink;
+ am_sinkID_t sinkID;
+
+ sink.domainID = domainID1;
+ sink.name = "sink1";
+ sink.sinkID = 0;
+ sink.sinkClassID = 5;
+ sink.muteState = MS_MUTED;
+ sink.listConnectionFormats.push_back(CF_ANALOG);
+
+ ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
+
+ std::vector<am_Route_s> listRoutes;
+ std::vector<am_RoutingElement_s> listRoutingElements;
+ am_RoutingElement_s hopp1;
+
+ hopp1.sinkID = sinkID;
+ hopp1.sourceID = sourceID;
+ hopp1.domainID = domainID1;
+ hopp1.connectionFormat = source.listConnectionFormats[0];
+
+ listRoutingElements.push_back(hopp1);
+
+ am_Route_s compareRoute;
+ compareRoute.route = listRoutingElements;
+ compareRoute.sinkID = sinkID;
+ compareRoute.sourceID = sourceID;
+
+ ASSERT_EQ(E_OK, pRouter.getRoute(true,sourceID,sinkID,listRoutes));
+ ASSERT_EQ(0, listRoutes.size());
+
+}
+
//test that checks just sinks and source in a domain
TEST_F(routingTest,simpleRoute2withDomain)
{