mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengmcesession.cpp
branchRCL_3
changeset 11 ff8a573c0e2e
parent 0 f0cf47e981f9
child 21 ce86b6d44a6d
equal deleted inserted replaced
10:04980be5c5fe 11:ff8a573c0e2e
   218     
   218     
   219     TTimeIntervalSeconds sessionTime = iLiveSession->GetSessionTime();
   219     TTimeIntervalSeconds sessionTime = iLiveSession->GetSessionTime();
   220     EUNIT_ASSERT( sessionTime >= TTimeIntervalSeconds( 0 ) );
   220     EUNIT_ASSERT( sessionTime >= TTimeIntervalSeconds( 0 ) );
   221     }
   221     }
   222     
   222     
   223 
   223 void UT_CMusEngMceSession::UT_CMusEngMceSession_IsDisplayEnabledLL()
       
   224     {
       
   225     TRAPD( error, iLiveSession->IsDisplayEnabledL() );
       
   226     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   227     EUNIT_ASSERT( error == KErrNotReady );
       
   228 
       
   229     ESTABLISH_OUT_SESSION( iLiveSession );
       
   230      
       
   231     //Enable
       
   232     CMceDisplaySink* display = 
       
   233                     MusEngMceUtils::GetDisplayL( *(iLiveSession->iSession) );
       
   234     display->iIsEnabled = ETrue;
       
   235     EUNIT_ASSERT( iLiveSession->IsDisplayEnabledL() );
       
   236     
       
   237     //Disable
       
   238     display->iIsEnabled = EFalse;
       
   239     EUNIT_ASSERT( !iLiveSession->IsDisplayEnabledL() );
       
   240     }
       
   241 	
       
   242 	
   224 // -----------------------------------------------------------------------------
   243 // -----------------------------------------------------------------------------
   225 //
   244 //
   226 // -----------------------------------------------------------------------------
   245 // -----------------------------------------------------------------------------
   227 //
   246 //
   228 void UT_CMusEngMceSession::UT_CMusEngMceSession_ConnectionActiveL()
   247 void UT_CMusEngMceSession::UT_CMusEngMceSession_ConnectionActiveL()
  1730     // Session terminated
  1749     // Session terminated
  1731     iLiveSession->iSession->iState = CMceSession::ETerminated;
  1750     iLiveSession->iSession->iState = CMceSession::ETerminated;
  1732     EUNIT_ASSERT( iLiveSession->IsRoamingBetweenAPsAllowed() )
  1751     EUNIT_ASSERT( iLiveSession->IsRoamingBetweenAPsAllowed() )
  1733     }
  1752     }
  1734 
  1753 
       
  1754 // -----------------------------------------------------------------------------
       
  1755 //
       
  1756 // -----------------------------------------------------------------------------
       
  1757 //
       
  1758 void UT_CMusEngMceSession::UT_CMusEngMceSession_VolumeChangedL()
       
  1759     {
       
  1760     // Try without session, nothing happens
       
  1761     EUNIT_ASSERT( iObserver->iVolume == 0 );
       
  1762     iLiveSession->VolumeChanged( 1, EFalse );
       
  1763     EUNIT_ASSERT( !VerifySpeakersVolume(*iLiveSession, 1) )
       
  1764     EUNIT_ASSERT( iObserver->iVolume == 0 );
       
  1765 
       
  1766     // Establish session
       
  1767     ESTABLISH_OUT_SESSION( iClipSession )
       
  1768     
       
  1769     // Try without observer
       
  1770     iClipSession->VolumeChanged( 2, EFalse );
       
  1771     EUNIT_ASSERT( VerifySpeakersVolume(*iClipSession, 2) )
       
  1772     EUNIT_ASSERT( iObserver->iVolume == 0 );
       
  1773     
       
  1774     
       
  1775     // Try with observer set
       
  1776     iClipSession->SetVolumeChangeObserver( iObserver );
       
  1777     iClipSession->VolumeChanged( 3, EFalse );
       
  1778     EUNIT_ASSERT( VerifySpeakersVolume(*iClipSession, 3) )
       
  1779     EUNIT_ASSERT( iObserver->iVolume == 3 );
       
  1780     
       
  1781     }
       
  1782 
  1735 // HELPERS
  1783 // HELPERS
       
  1784 TBool UT_CMusEngMceSession::VerifySpeakersVolume(CMusEngMceSession& aSession, TInt aVolume)
       
  1785     {
       
  1786     TBool result = EFalse;
       
  1787     
       
  1788     CMceSpeakerSink* speaker = NULL;    
       
  1789     CMceSession* session = aSession.iSession;
       
  1790     
       
  1791     if ( session ) 
       
  1792         {
       
  1793         for ( TInt i = 0; i < session->Streams().Count(); ++i )
       
  1794             {
       
  1795             for ( TInt j = 0; j < session->Streams()[i]->Sinks().Count(); ++j )
       
  1796                 {
       
  1797                 if ( session->Streams()[i]->Sinks()[j]->Type() == KMceSpeakerSink )
       
  1798                     {
       
  1799                     speaker = static_cast<CMceSpeakerSink*>(
       
  1800                                               session->Streams()[i]->Sinks()[j] );
       
  1801                     result = ( speaker->VolumeL() == aVolume );
       
  1802                     }
       
  1803                 }
       
  1804             } 
       
  1805         }
       
  1806     return result;
       
  1807     }
       
  1808 
  1736 
  1809 
  1737 // -----------------------------------------------------------------------------
  1810 // -----------------------------------------------------------------------------
  1738 //
  1811 //
  1739 // -----------------------------------------------------------------------------
  1812 // -----------------------------------------------------------------------------
  1740 //
  1813 //
  1989     "SsrcRemoved - test ",
  2062     "SsrcRemoved - test ",
  1990     "CMusEngMceSession",
  2063     "CMusEngMceSession",
  1991     "SsrcRemoved",
  2064     "SsrcRemoved",
  1992     "FUNCTIONALITY",
  2065     "FUNCTIONALITY",
  1993     SetupL, UT_CMusEngMceSession_SsrcRemovedL, Teardown)         
  2066     SetupL, UT_CMusEngMceSession_SsrcRemovedL, Teardown)         
       
  2067 EUNIT_TEST(
       
  2068     "IsDisplayEnabledL - test ",
       
  2069     "CMusEngMceSession",
       
  2070     "IsDisplayEnabledL",
       
  2071     "FUNCTIONALITY",
       
  2072     SetupL, UT_CMusEngMceSession_IsDisplayEnabledLL, Teardown)  	
  1994 
  2073 
  1995 EUNIT_TEST(
  2074 EUNIT_TEST(
  1996     "UpdateTimerEvent - test ",
  2075     "UpdateTimerEvent - test ",
  1997     "CMusEngMceSession",
  2076     "CMusEngMceSession",
  1998     "UpdateTimerEvent",
  2077     "UpdateTimerEvent",
  2004     "CMusEngMceSession",
  2083     "CMusEngMceSession",
  2005     "IsRoamingBetweenAPsAllowed",
  2084     "IsRoamingBetweenAPsAllowed",
  2006     "FUNCTIONALITY",
  2085     "FUNCTIONALITY",
  2007     SetupL, UT_CMusEngMceSession_IsRoamingBetweenAPsAllowedL, Teardown)
  2086     SetupL, UT_CMusEngMceSession_IsRoamingBetweenAPsAllowedL, Teardown)
  2008         
  2087         
       
  2088 EUNIT_TEST(
       
  2089     "VolumeChanged - test ",
       
  2090     "CMusEngMceSession",
       
  2091     "VolumeChanged",
       
  2092     "FUNCTIONALITY",
       
  2093     SetupL, UT_CMusEngMceSession_VolumeChangedL, Teardown)
       
  2094     
       
  2095 
  2009 EUNIT_END_TEST_TABLE
  2096 EUNIT_END_TEST_TABLE
  2010 
  2097 
  2011 //  END OF FILE
  2098 //  END OF FILE