2 * Copyright (C) 2012, BMW AG
4 * This file is part of GENIVI Project AudioManager.
6 * Contributions are licensed to the GENIVI Alliance under one or more
7 * Contribution License Agreements.
10 * This Source Code Form is subject to the terms of the
11 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
12 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
17 * For further information see http://www.genivi.org/.
21 #include "CAmControlInterfaceTest.h"
26 #include "shared/CAmDltWrapper.h"
29 using namespace testing;
31 DLT_DECLARE_CONTEXT(AudioManager)
33 CAmControlInterfaceTest::CAmControlInterfaceTest() :
35 pDBusWrapper((CAmDbusWrapper*) 1), //
36 plistCommandPluginDirs(), //
37 plistRoutingPluginDirs(), //
38 pDatabaseHandler(std::string(":memory:")), //
39 pRoutingSender(plistRoutingPluginDirs), //RoutingReceiver
40 pCommandSender(plistCommandPluginDirs), //
41 pMockControlInterface(), //
42 pMockRoutingInterface(), //
43 pRoutingInterfaceBackdoor(), //
44 pCommandInterfaceBackdoor(), //
45 pControlInterfaceBackdoor(), //
47 pRouter(&pDatabaseHandler,&pControlSender), //
48 pDatabaseObserver(&pCommandSender, &pRoutingSender, &pSocketHandler), //
49 pControlReceiver(&pDatabaseHandler, &pRoutingSender, &pCommandSender, &pSocketHandler, &pRouter), //
50 pRoutingReceiver(&pDatabaseHandler, &pRoutingSender, &pControlSender, &pSocketHandler, pDBusWrapper)
52 CAmDltWrapper::instance(0)->registerApp("AudioManagerDeamon", "AudioManagerDeamon");
53 CAmDltWrapper::instance()->registerContext(AudioManager, "Main", "Main Context");
54 logInfo("The Audiomanager is started");
55 pDatabaseHandler.registerObserver(&pDatabaseObserver);
56 pControlInterfaceBackdoor.replaceController(&pControlSender, &pMockControlInterface);
57 pRoutingInterfaceBackdoor.injectInterface(&pRoutingSender, &pMockRoutingInterface, "mock");
61 CAmControlInterfaceTest::~CAmControlInterfaceTest()
65 void CAmControlInterfaceTest::SetUp()
67 logInfo("RoutingSendInterface Test started");
70 void CAmControlInterfaceTest::TearDown()
74 TEST_F(CAmControlInterfaceTest,registerDomain)
78 am_domainID_t domainID;
79 pCF.createDomain(domain);
81 //When we run this test, we expect the call on the control interface
82 EXPECT_CALL(pMockControlInterface,hookSystemRegisterDomain(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2), Return(E_OK)));
83 ASSERT_EQ(E_OK, pRoutingReceiver.registerDomain(domain,domainID));
84 ASSERT_EQ(domainID, 2);
87 TEST_F(CAmControlInterfaceTest,deregisterDomain)
89 am_domainID_t domainID = 34;
91 //When we run this test, we expect the call on the control interface
92 EXPECT_CALL(pMockControlInterface,hookSystemDeregisterDomain(34)).WillRepeatedly(Return(E_OK));
93 ASSERT_EQ(E_OK, pRoutingReceiver.deregisterDomain(domainID));
96 TEST_F(CAmControlInterfaceTest,registerSink)
100 pCF.createSink(sink);
102 //When we run this test, we expect the call on the control interface
103 EXPECT_CALL(pMockControlInterface,hookSystemRegisterSink(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2), Return(E_OK)));
104 ASSERT_EQ(E_OK, pRoutingReceiver.registerSink(sink,sinkID));
105 ASSERT_EQ(sinkID, 2);
108 TEST_F(CAmControlInterfaceTest,deregisterSink)
110 am_sinkID_t sinkID = 12;
112 //When we run this test, we expect the call on the control interface
113 EXPECT_CALL(pMockControlInterface,hookSystemDeregisterSink(12)).WillRepeatedly(Return(E_OK));
114 ASSERT_EQ(E_OK, pRoutingReceiver.deregisterSink(sinkID));
117 TEST_F(CAmControlInterfaceTest,registerSource)
120 am_sourceID_t sourceID;
121 pCF.createSource(source);
123 //When we run this test, we expect the call on the control interface
124 EXPECT_CALL(pMockControlInterface,hookSystemRegisterSource(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2), Return(E_OK)));
125 ASSERT_EQ(E_OK, pRoutingReceiver.registerSource(source,sourceID));
126 ASSERT_EQ(sourceID, 2);
129 TEST_F(CAmControlInterfaceTest,deregisterSource)
131 am_sourceID_t sourceID = 12;
133 //When we run this test, we expect the call on the control interface
134 EXPECT_CALL(pMockControlInterface,hookSystemDeregisterSource(12)).WillRepeatedly(Return(E_OK));
135 ASSERT_EQ(E_OK, pRoutingReceiver.deregisterSource(sourceID));
138 TEST_F(CAmControlInterfaceTest,registerGateway)
140 am_Gateway_s gateway;
141 am_gatewayID_t gatewayID;
142 pCF.createGateway(gateway);
144 //When we run this test, we expect the call on the control interface
145 EXPECT_CALL(pMockControlInterface,hookSystemRegisterGateway(_,_)).WillRepeatedly(DoAll(SetArgReferee<1>(2), Return(E_OK)));
146 ASSERT_EQ(E_OK, pRoutingReceiver.registerGateway(gateway,gatewayID));
147 ASSERT_EQ(gatewayID, 2);
150 TEST_F(CAmControlInterfaceTest,deregisterGateway)
152 am_gatewayID_t gatewayID = 12;
154 //When we run this test, we expect the call on the control interface
155 EXPECT_CALL(pMockControlInterface,hookSystemDeregisterGateway(12)).WillRepeatedly(Return(E_OK));
156 ASSERT_EQ(E_OK, pRoutingReceiver.deregisterGateway(gatewayID));
159 TEST_F(CAmControlInterfaceTest,ackConnect)
161 am_connectionID_t connectionID;
165 am_domainID_t domainID;
166 std::vector<am_Connection_s> connectionList;
167 std::vector<am_Handle_s> handlesList;
169 pCF.createSink(sink);
170 pCF.createDomain(domain);
171 domain.name = "mock";
172 domain.busname = "mock";
177 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
178 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
180 //when asyncConnect is called, we expect a call on the routingInterface
181 EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_GENIVI_STEREO)).WillOnce(Return(E_OK));
182 ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_GENIVI_STEREO,2,2));
184 //The handle should have the correct type
185 ASSERT_EQ(handle.handleType, H_CONNECT);
186 ASSERT_EQ(handle.handle, 1);
187 ASSERT_EQ(connectionID, 1);
189 //The list of handles shall have the handle inside
190 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
191 ASSERT_EQ(handlesList[0].handle, handle.handle);
192 ASSERT_EQ(handlesList[0].handleType, handle.handleType);
194 //we check the list of connections - but it must be empty because the ack did not arrive yet
195 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
196 ASSERT_TRUE(connectionList.empty());
198 //finally we answer via the RoutingInterface and expect a call on the controlInterface
199 EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
200 pRoutingReceiver.ackConnect(handle, connectionID, E_OK);
202 //the list of handles must be empty now
203 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
204 ASSERT_TRUE(handlesList.empty());
206 //but the connection must be in the connectionlist
207 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
208 ASSERT_TRUE(!connectionList.empty());
210 //no we try the same, but do expect a no_change answer directly and no call because connection already exists
211 //ASSERT_EQ(E_ALREADY_EXISTS, pControlReceiver.connect(handle,connectionID,CF_GENIVI_STEREO,2,2));
212 //needed to be removed because logic changed here
215 TEST_F(CAmControlInterfaceTest,ackDisconnect)
217 am_connectionID_t connectionID;
221 am_domainID_t domainID;
222 std::vector<am_Connection_s> connectionList;
223 std::vector<am_Handle_s> handlesList;
225 pCF.createSink(sink);
226 pCF.createDomain(domain);
227 domain.name = "mock";
228 domain.busname = "mock";
233 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
234 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
236 //now we first need to connect, we expect a call on the routing interface
237 EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_GENIVI_STEREO)).WillOnce(Return(E_OK));
238 ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_GENIVI_STEREO,2,2));
240 //answer with an ack to insert the connection in the database
241 EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
242 pRoutingReceiver.ackConnect(handle, connectionID, E_OK);
244 //now we can start to disconnect and expect a call on the routing interface
245 EXPECT_CALL(pMockRoutingInterface,asyncDisconnect(_,1)).WillOnce(Return(E_OK));
246 ASSERT_EQ(E_OK, pControlReceiver.disconnect(handle,1));
248 //during the disconnection, the connection is still in the list!
249 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
250 ASSERT_TRUE(!connectionList.empty());
252 //then we fire the ack and expect a call on the controlInterface
253 EXPECT_CALL(pMockControlInterface,cbAckDisconnect(_,E_OK)).Times(1);
254 pRoutingReceiver.ackDisconnect(handle, connectionID, E_OK);
256 //make sure the handle is gone
257 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
258 ASSERT_TRUE(handlesList.empty());
260 //make sure the connection is gone
261 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
262 ASSERT_TRUE(connectionList.empty());
264 //Now let's try to disconnect what is not existing...
265 ASSERT_EQ(E_NON_EXISTENT, pControlReceiver.disconnect(handle,2));
268 TEST_F(CAmControlInterfaceTest,ackDisconnectFailAndRetry)
270 logInfo("ackDisconnectFailAndRetry test started");
271 am_connectionID_t connectionID;
275 am_domainID_t domainID;
276 std::vector<am_Connection_s> connectionList;
277 std::vector<am_Handle_s> handlesList;
279 pCF.createSink(sink);
280 pCF.createDomain(domain);
281 domain.name = "mock";
282 domain.busname = "mock";
287 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
288 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
290 //now we first need to connect, we expect a call on the routing interface
291 EXPECT_CALL(pMockRoutingInterface,asyncConnect(_,1,2,2,CF_GENIVI_STEREO)).WillOnce(Return(E_OK));
292 ASSERT_EQ(E_OK, pControlReceiver.connect(handle,connectionID,CF_GENIVI_STEREO,2,2));
294 //answer with an ack to insert the connection in the database
295 EXPECT_CALL(pMockControlInterface,cbAckConnect(_,E_OK)).Times(1);
296 pRoutingReceiver.ackConnect(handle, connectionID, E_OK);
298 //now we can start to disconnect and expect a call on the routing interface
299 EXPECT_CALL(pMockRoutingInterface,asyncDisconnect(_,1)).WillOnce(Return(E_OK));
300 ASSERT_EQ(E_OK, pControlReceiver.disconnect(handle,1));
302 //during the disconnection, the connection is still in the list!
303 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
304 ASSERT_TRUE(!connectionList.empty());
306 //then we fire the ack and expect a call on the controlInterface
307 EXPECT_CALL(pMockControlInterface,cbAckDisconnect(_,E_NON_EXISTENT)).Times(1);
308 pRoutingReceiver.ackDisconnect(handle, connectionID, E_NON_EXISTENT);
310 //make sure the handle is gone
311 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
312 ASSERT_TRUE(handlesList.empty());
314 //make sure the connection is still there
315 ASSERT_EQ(E_OK, pDatabaseHandler.getListConnections(connectionList));
316 ASSERT_FALSE(connectionList.empty());
318 ASSERT_TRUE(pDatabaseHandler.existConnectionID(1));
320 //Now let's try to disconnect now
321 EXPECT_CALL(pMockRoutingInterface,asyncDisconnect(_,1)).WillOnce(Return(E_OK));
322 ASSERT_EQ(E_OK, pControlReceiver.disconnect(handle,1));
323 logInfo("ackDisconnectFailAndRetry test finished");
326 TEST_F(CAmControlInterfaceTest,setSourceState)
330 am_sourceID_t sourceID;
332 am_domainID_t domainID;
333 std::vector<am_Handle_s> handlesList;
335 am_SourceState_e state;
336 pCF.createSource(source);
337 pCF.createDomain(domain);
338 domain.name = "mock";
339 domain.busname = "mock";
344 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
345 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
347 //we set the sourcestate and expect a call on the routingInterface
348 EXPECT_CALL(pMockRoutingInterface,asyncSetSourceState(_,2,SS_PAUSED)).WillOnce(Return(E_OK));
349 ASSERT_EQ(E_OK, pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
351 //we want our handle in the list and let the type be the right one
352 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
353 ASSERT_EQ(handlesList[0].handle, handle.handle);
354 ASSERT_EQ(handlesList[0].handleType, H_SETSOURCESTATE);
356 //the state must be unchanged because did not get the ack
357 ASSERT_EQ(E_OK, pDatabaseHandler.getSoureState(source.sourceID,state));
358 ASSERT_EQ(state, SS_ON);
360 //now we sent out the ack and expect a call on the controlInterface
361 EXPECT_CALL(pMockControlInterface,cbAckSetSourceState(_,E_OK)).Times(1);
362 pRoutingReceiver.ackSetSourceState(handle, E_OK);
364 //finally we need the sourcestate to be changed
365 ASSERT_EQ(E_OK, pDatabaseHandler.getSoureState(source.sourceID,state));
366 ASSERT_EQ(state, SS_PAUSED);
368 //make sure the handle is gone
369 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
370 ASSERT_TRUE(handlesList.empty());
372 //we try again but expect a no change error
373 //ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceState(handle,source.sourceID,SS_PAUSED));
374 //needed to be removed because logic changed here
377 TEST_F(CAmControlInterfaceTest,SetSinkVolumeChange)
382 am_domainID_t domainID;
384 std::vector<am_Handle_s> handlesList;
386 pCF.createSink(sink);
387 pCF.createDomain(domain);
388 domain.name = "mock";
389 domain.busname = "mock";
394 //setup environment, we need a domain and a sink
395 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
396 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
398 //set the volume and expect a call on the routing interface
399 EXPECT_CALL(pMockRoutingInterface,asyncSetSinkVolume(_,2,11,RAMP_GENIVI_DIRECT,23)).WillOnce(Return(E_OK));
400 ASSERT_EQ(E_OK, pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_GENIVI_DIRECT,23));
402 //check the list of handles. The handle must be in there and have the right type
403 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
404 ASSERT_EQ(handlesList[0].handle, handle.handle);
405 ASSERT_EQ(handlesList[0].handleType, H_SETSINKVOLUME);
407 //now we read out the volume, but we expect no change because the ack did not arrive yet
408 ASSERT_EQ(E_OK, pDatabaseHandler.getSinkVolume(sinkID,volume));
409 ASSERT_EQ(sink.volume, volume);
411 //lets send the answer and expect a call on the controlInterface
412 EXPECT_CALL(pMockControlInterface,cbAckSetSinkVolumeChange(_,11,E_OK)).Times(1);
413 pRoutingReceiver.ackSetSinkVolumeChange(handle, 11, E_OK);
415 //finally, the new value must be in the database
416 ASSERT_EQ(E_OK, pDatabaseHandler.getSinkVolume(sinkID,volume));
417 ASSERT_EQ(11, volume);
419 //and the handle must be destroyed
420 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
421 ASSERT_TRUE(handlesList.empty());
423 //Now we try again, but the value is unchanged
424 //ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkVolume(handle,sinkID,11,RAMP_GENIVI_DIRECT,23));
425 //needed to be removed because logic changed here
428 TEST_F(CAmControlInterfaceTest,ackSetSourceVolumeChange)
431 am_sourceID_t sourceID;
433 am_domainID_t domainID;
435 std::vector<am_Handle_s> handlesList;
437 pCF.createSource(source);
438 pCF.createDomain(domain);
439 domain.name = "mock";
440 domain.busname = "mock";
446 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
447 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
449 //change the sinkVolume, expect a call on the routingInterface
450 EXPECT_CALL(pMockRoutingInterface,asyncSetSourceVolume(_,2,11,RAMP_GENIVI_DIRECT,23)).WillOnce(Return(E_OK));
451 ASSERT_EQ(E_OK, pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_GENIVI_DIRECT,23));
453 //check the list of handles. The handle must be in there and have the right type
454 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
455 ASSERT_EQ(handlesList[0].handle, handle.handle);
456 ASSERT_EQ(handlesList[0].handleType, H_SETSOURCEVOLUME);
458 //now we read out the volume, but we expect no change because the ack did not arrive yet
459 ASSERT_EQ(E_OK, pDatabaseHandler.getSourceVolume(sourceID,volume));
460 ASSERT_EQ(source.volume, volume);
462 //lets send the answer and expect a call on the controlInterface
463 EXPECT_CALL(pMockControlInterface,cbAckSetSourceVolumeChange(_,11,E_OK)).Times(1);
464 pRoutingReceiver.ackSetSourceVolumeChange(handle, 11, E_OK);
466 //finally, the new value must be in the database
467 ASSERT_EQ(E_OK, pDatabaseHandler.getSourceVolume(sourceID,volume));
468 ASSERT_EQ(11, volume);
470 //and the handle must be destroyed
471 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
472 ASSERT_TRUE(handlesList.empty());
474 //Now we try again, but the value is unchanged
475 //ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceVolume(handle,source.sourceID,11,RAMP_GENIVI_DIRECT,23));
476 //needed to be removed because logic changed here
479 TEST_F(CAmControlInterfaceTest,ackSetSinkSoundProperty)
484 am_domainID_t domainID;
485 std::vector<am_Handle_s> handlesList;
487 am_SoundProperty_s soundProperty;
489 pCF.createSink(sink);
490 pCF.createDomain(domain);
491 domain.name = "mock";
492 domain.busname = "mock";
495 soundProperty.type = SP_EXAMPLE_BASS;
496 soundProperty.value = 244;
498 //setup environment, we need a domain and a sink
499 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
500 ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sinkID));
502 //change the soundproperty, expect a call on the routinginterface
503 EXPECT_CALL(pMockRoutingInterface,asyncSetSinkSoundProperty(_,2,_)).WillOnce(Return(E_OK));
504 ASSERT_EQ(E_OK, pControlReceiver.setSinkSoundProperty(handle,sink.sinkID,soundProperty));
506 //check the list of handles. The handle must be in there and have the right type
507 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
508 ASSERT_EQ(handlesList[0].handle, handle.handle);
509 ASSERT_EQ(handlesList[0].handleType, H_SETSINKSOUNDPROPERTY);
511 //read out this property. There is no change, because the ack did not arrive yet.
512 ASSERT_EQ(E_OK, pDatabaseHandler.getSinkSoundPropertyValue(2,SP_EXAMPLE_BASS,oldvalue));
513 ASSERT_EQ(sink.listSoundProperties[0].value, oldvalue);
515 //lets send the answer and expect a call on the controlInterface
516 EXPECT_CALL(pMockControlInterface,cbAckSetSinkSoundProperty(_,E_OK)).Times(1);
517 pRoutingReceiver.ackSetSinkSoundProperty(handle, E_OK);
519 //finally, the new value must be in the database
520 ASSERT_EQ(E_OK, pDatabaseHandler.getSinkSoundPropertyValue(sinkID,SP_EXAMPLE_BASS,oldvalue));
521 ASSERT_EQ(soundProperty.value, oldvalue);
523 //and the handle must be destroyed
524 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
525 ASSERT_TRUE(handlesList.empty());
527 //Now we try again, but the value is unchanged
528 //ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSinkSoundProperty(handle,sink.sinkID,soundProperty));
529 //needed to be removed because logic changed here
532 TEST_F(CAmControlInterfaceTest,ackSetSourceSoundProperty)
535 am_sourceID_t sourceID;
537 am_domainID_t domainID;
538 std::vector<am_Handle_s> handlesList;
540 am_SoundProperty_s soundProperty;
542 pCF.createSource(source);
543 pCF.createDomain(domain);
544 domain.name = "mock";
545 domain.busname = "mock";
548 soundProperty.type = SP_EXAMPLE_BASS;
549 soundProperty.value = 244;
552 ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domainID));
553 ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,sourceID));
555 //we trigger the change and wait for a call on the routinginterface
556 EXPECT_CALL(pMockRoutingInterface,asyncSetSourceSoundProperty(_,2,_)).WillOnce(Return(E_OK));
557 ASSERT_EQ(E_OK, pControlReceiver.setSourceSoundProperty(handle,source.sourceID,soundProperty));
559 //check the list of handles. The handle must be in there and have the right type
560 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
561 ASSERT_EQ(handlesList[0].handle, handle.handle);
562 ASSERT_EQ(handlesList[0].handleType, H_SETSOURCESOUNDPROPERTY);
564 //read out this property. There is no change, because the ack did not arrive yet.
565 ASSERT_EQ(E_OK, pDatabaseHandler.getSourceSoundPropertyValue(2,SP_EXAMPLE_BASS,oldvalue));
566 ASSERT_EQ(source.listSoundProperties[0].value, oldvalue);
568 //lets send the answer and expect a call on the controlInterface
569 EXPECT_CALL(pMockControlInterface,cbAckSetSourceSoundProperty(_,E_OK)).Times(1);
570 pRoutingReceiver.ackSetSourceSoundProperty(handle, E_OK);
572 //finally, the new value must be in the database
573 ASSERT_EQ(E_OK, pDatabaseHandler.getSourceSoundPropertyValue(sourceID,SP_EXAMPLE_BASS,oldvalue));
574 ASSERT_EQ(soundProperty.value, oldvalue);
576 //and the handle must be destroyed
577 ASSERT_EQ(E_OK, pControlReceiver.getListHandles(handlesList));
578 ASSERT_TRUE(handlesList.empty());
580 //Now we try again, but the value is unchanged
581 //ASSERT_EQ(E_NO_CHANGE, pControlReceiver.setSourceSoundProperty(handle,source.sourceID,soundProperty));
582 //needed to be removed because logic changed here
585 TEST_F(CAmControlInterfaceTest,crossFading)
587 //todo: implement crossfading test
590 int main(int argc, char **argv)
592 ::testing::InitGoogleTest(&argc, argv);
593 return RUN_ALL_TESTS();