mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengreceivesession.cpp
changeset 22 496ad160a278
equal deleted inserted replaced
15:ccd8e69b5392 22:496ad160a278
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  INTERNAL INCLUDES
       
    20 #include "ut_musengreceivesession.h"
       
    21 #include "musengstubs.h"
       
    22 #include "musengtestdefs.h"
       
    23 #include "musengreceivesession.h"
       
    24 #include "mussessionproperties.h"
       
    25 #include "contactenginestub.h"
       
    26 #include "musengremotevideoplayer.h"
       
    27 
       
    28 //  SYSTEM INCLUDES
       
    29 #include <digia/eunit/eunitmacros.h>
       
    30 
       
    31 #include <mceinsession.h>
       
    32 #include <mcestreambundle.h>
       
    33 #include <mcevideostream.h>
       
    34 #include <mceaudiostream.h>
       
    35 #include <mcertpsource.h>
       
    36 #include <mcedisplaysink.h>
       
    37 #include <mcespeakersink.h>
       
    38 #include <mcecamerasource.h>
       
    39 #include <mcefilesource.h>
       
    40 #include <mcertpsink.h>
       
    41 #include <mceaudiocodec.h>
       
    42 #include <mceh263codec.h>
       
    43 #include <mceavccodec.h>
       
    44 
       
    45 #include <audiopreference.h>
       
    46 #include <centralrepository.h>
       
    47 
       
    48 
       
    49 // Using following value increases treshold buffer to 1 second from 
       
    50 // default 100 ms
       
    51 const TInt KMusEngJitterBufferTreshold = 50;
       
    52 const TInt KMusEngTresholdToSecondsFactor = 20;
       
    53 const TInt KMusEngTwoSecondInMilliSeconds = 2000; 
       
    54 // Use inactivity timer value that is a little bigger than treshold in seconds
       
    55 const TUint KMusEngInactivityTimer = KMusEngTresholdToSecondsFactor * 
       
    56                                      KMusEngJitterBufferTreshold + 
       
    57                                      KMusEngTwoSecondInMilliSeconds;
       
    58 
       
    59 _LIT( KTestContactName, "nokia" );
       
    60 
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 UT_CMusEngReceiveSession* UT_CMusEngReceiveSession::NewL()
       
    67     {
       
    68     UT_CMusEngReceiveSession* self = UT_CMusEngReceiveSession::NewLC();
       
    69     CleanupStack::Pop( self );
       
    70     return self;
       
    71     }
       
    72 
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 // -----------------------------------------------------------------------------
       
    77 // 
       
    78 UT_CMusEngReceiveSession* UT_CMusEngReceiveSession::NewLC()
       
    79     {
       
    80     UT_CMusEngReceiveSession* self = new( ELeave ) UT_CMusEngReceiveSession();
       
    81     CleanupStack::PushL( self );
       
    82     self->ConstructL();
       
    83     return self;
       
    84     }
       
    85 
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 UT_CMusEngReceiveSession::~UT_CMusEngReceiveSession()
       
    92     {
       
    93     // NOP
       
    94     }
       
    95 
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // Default constructor
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 UT_CMusEngReceiveSession::UT_CMusEngReceiveSession()
       
   102     {
       
   103     // NOP
       
   104     }
       
   105 
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // Second phase construct
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void UT_CMusEngReceiveSession::ConstructL()
       
   112     {
       
   113     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
   114     // It generates the test case table.
       
   115     CEUnitTestSuiteClass::ConstructL();
       
   116     }
       
   117     
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 void UT_CMusEngReceiveSession::SetupL(  )
       
   124     {
       
   125     // set fast mode ON
       
   126     User::LeaveIfError( RProperty::Set( NMusSessionApi::KCategoryUid,
       
   127                                         NMusSessionApi::KFastMode,
       
   128                                         0 ) );
       
   129     iLcSessionObserver = new( ELeave )CLcSessionObserverStub;
       
   130     iLcUiProvider = new( ELeave )CLcUiProviderStub;    
       
   131     iReceiveSession = CMusEngReceiveSession::NewL();
       
   132     iReceiveSession->SetLcSessionObserver( iLcSessionObserver );  
       
   133     iReceiveSession->SetLcUiProvider( iLcUiProvider );    
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 void UT_CMusEngReceiveSession::Teardown(  )
       
   141     {
       
   142     PropertyHelper::Close();
       
   143     delete iReceiveSession;
       
   144     delete iLcUiProvider;
       
   145     delete iLcSessionObserver;
       
   146     PropertyHelper::Close();
       
   147     // Delete static data from CenRep stub
       
   148     CRepository::ResetStubGlobal();
       
   149     CRepository::iForceFailWithCode = KErrNone;
       
   150     }
       
   151 
       
   152 
       
   153 // TEST HELPERS
       
   154 
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 // -----------------------------------------------------------------------------
       
   158 //
       
   159 CMceVideoStream* UT_CMusEngReceiveSession::ConstructVideoInStreamLC()
       
   160     {
       
   161     CMceVideoStream* videoStream = CMceVideoStream::NewLC();
       
   162     
       
   163     videoStream->SetSourceL( CMceRtpSource::NewLC() );
       
   164     CleanupStack::Pop();
       
   165     
       
   166     videoStream->AddSinkL( 
       
   167                 CMceDisplaySink::NewLC( *iReceiveSession->iManager ) );
       
   168     CleanupStack::Pop();    
       
   169     
       
   170     return videoStream;
       
   171     }
       
   172 
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 CMceVideoStream* UT_CMusEngReceiveSession::ConstructVideoOutStreamLC()
       
   179     {
       
   180     CMceVideoStream* videoStream = CMceVideoStream::NewLC();    
       
   181        
       
   182     videoStream->SetSourceL( 
       
   183                 CMceCameraSource::NewLC( *iReceiveSession->iManager ) );
       
   184     CleanupStack::Pop();
       
   185     
       
   186     videoStream->AddSinkL( CMceRtpSink::NewLC() );
       
   187     CleanupStack::Pop();
       
   188     
       
   189     return videoStream;
       
   190     }    
       
   191 
       
   192 
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 // -----------------------------------------------------------------------------
       
   196 //   
       
   197 CMceAudioStream* UT_CMusEngReceiveSession::ConstructAudioInStreamLC()
       
   198     {
       
   199     CMceAudioStream* audioStream = CMceAudioStream::NewLC();
       
   200    
       
   201     audioStream->SetSourceL( CMceRtpSource::NewLC() );
       
   202     CleanupStack::Pop();
       
   203     
       
   204     audioStream->AddSinkL( CMceSpeakerSink::NewLC() );
       
   205     CleanupStack::Pop();
       
   206     
       
   207     return audioStream;
       
   208     }
       
   209 
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 //
       
   213 // -----------------------------------------------------------------------------
       
   214 //   
       
   215 CMceAudioStream* UT_CMusEngReceiveSession::ConstructAudioOutStreamLC()
       
   216     {
       
   217     CMceAudioStream* audioStream = CMceAudioStream::NewLC();
       
   218 
       
   219     audioStream->SetSourceL( 
       
   220         CMceFileSource::NewLC( *iReceiveSession->iManager, KNullDesC() ) );
       
   221     CleanupStack::Pop();
       
   222     
       
   223     audioStream->AddSinkL( CMceRtpSink::NewLC() );
       
   224     CleanupStack::Pop();
       
   225 
       
   226     return audioStream;
       
   227 
       
   228     }
       
   229                                                  
       
   230 
       
   231 // -----------------------------------------------------------------------------
       
   232 // Helper to construct incoming sessions.
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 CMceInSession* UT_CMusEngReceiveSession::ConstructInSessionLC( 
       
   236                                              TInt aVideoStreamCount,
       
   237                                              TInt aAudioStreamCount,
       
   238                                              TBool aConstructSinks )
       
   239     {
       
   240     CMceInSession* inSession = CMceInSession::NewL( 
       
   241                                         *(iReceiveSession->iManager), 
       
   242                                         KTestOriginator() );
       
   243     CleanupStack::PushL( inSession );
       
   244                                         
       
   245     for ( TInt i = 0; i < aVideoStreamCount; ++i )
       
   246         {
       
   247         CMceVideoStream* videoStream = CMceVideoStream::NewLC();
       
   248         
       
   249         CMceRtpSource* rtpSource = CMceRtpSource::NewLC();
       
   250         videoStream->SetSourceL( rtpSource );
       
   251         CleanupStack::Pop( rtpSource );
       
   252         
       
   253         if ( aConstructSinks )
       
   254             {
       
   255             CMceDisplaySink* display = CMceDisplaySink::NewLC( 
       
   256                                                 *(iReceiveSession->iManager) );
       
   257             videoStream->AddSinkL( display );
       
   258             CleanupStack::Pop( display );
       
   259             }
       
   260         
       
   261         inSession->AddStreamL( videoStream );
       
   262         CleanupStack::Pop( videoStream );
       
   263         }
       
   264     
       
   265     for ( TInt i = 0; i < aAudioStreamCount; ++i )
       
   266         {
       
   267         CMceAudioStream* audioStream = CMceAudioStream::NewLC();
       
   268         
       
   269         CMceRtpSource* rtpSource = CMceRtpSource::NewLC();
       
   270         audioStream->SetSourceL( rtpSource );
       
   271         CleanupStack::Pop( rtpSource );
       
   272         
       
   273         if ( aConstructSinks )
       
   274             {
       
   275             CMceSpeakerSink* speaker = CMceSpeakerSink::NewLC();
       
   276             audioStream->AddSinkL( speaker );
       
   277             CleanupStack::Pop( speaker );
       
   278             }
       
   279         
       
   280         inSession->AddStreamL( audioStream );
       
   281         CleanupStack::Pop( audioStream );
       
   282         }    
       
   283     
       
   284     return inSession;
       
   285     }
       
   286                                              
       
   287                                              
       
   288 
       
   289 
       
   290 // TEST CASES
       
   291 
       
   292 
       
   293 // -----------------------------------------------------------------------------
       
   294 //
       
   295 // -----------------------------------------------------------------------------
       
   296 //
       
   297 void UT_CMusEngReceiveSession::UT_NewLL(  )
       
   298     {
       
   299     EUNIT_ASSERT( iReceiveSession );
       
   300     EUNIT_ASSERT( !iReceiveSession->iSession );
       
   301     EUNIT_ASSERT( iReceiveSession->iMceManagerUid == TUid::Uid( KMusUiUid ) );
       
   302     }
       
   303 
       
   304 // -----------------------------------------------------------------------------
       
   305 //
       
   306 // -----------------------------------------------------------------------------
       
   307 //
       
   308 void UT_CMusEngReceiveSession::UT_LcSessionStateL()
       
   309     {
       
   310     // No MCE session -> Convert to MLcSession::EReceived
       
   311     EUNIT_ASSERT_EQUALS( TInt( MLcSession::EReceived ), 
       
   312                          TInt( iReceiveSession->LcSessionState() ) )
       
   313                          
       
   314     // Some other state -> State returned from the base class 
       
   315     TMceTransactionDataContainer container;
       
   316     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   317     iReceiveSession->IncomingSession( inSession, &container );
       
   318     CleanupStack::Pop( inSession );
       
   319     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   320     iReceiveSession->EstablishLcSessionL();  
       
   321     EUNIT_ASSERT_EQUALS( TInt( MLcSession::EOpening ), 
       
   322                          TInt( iReceiveSession->LcSessionState() ) )
       
   323     }
       
   324 
       
   325 // -----------------------------------------------------------------------------
       
   326 //
       
   327 // -----------------------------------------------------------------------------
       
   328 //
       
   329 void UT_CMusEngReceiveSession::UT_EstablishLcSessionL()
       
   330     {
       
   331     // No MCE session
       
   332     EUNIT_ASSERT_SPECIFIC_LEAVE( 
       
   333         iReceiveSession->EstablishLcSessionL(), KErrNotReady )    
       
   334  
       
   335     // Construct a new session and accept it
       
   336     TMceTransactionDataContainer container;
       
   337     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   338     iReceiveSession->IncomingSession( inSession, &container );
       
   339     CleanupStack::Pop( inSession );
       
   340     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   341     iReceiveSession->EstablishLcSessionL();
       
   342     EUNIT_ASSERT( iReceiveSession->iSession )
       
   343     EUNIT_ASSERT_EQUALS( inSession, iReceiveSession->iSession );
       
   344     EUNIT_ASSERT_EQUALS( TInt( CMceSession::EAnswering ),
       
   345                          TInt( iReceiveSession->iSession->iState ) )    
       
   346     }   
       
   347 
       
   348 // -----------------------------------------------------------------------------
       
   349 //
       
   350 // -----------------------------------------------------------------------------
       
   351 //
       
   352 void UT_CMusEngReceiveSession::UT_TerminateLcSessionL()
       
   353     {
       
   354     // No MCE session
       
   355     EUNIT_ASSERT_SPECIFIC_LEAVE( 
       
   356         iReceiveSession->TerminateLcSessionL(), KErrNotReady )
       
   357     
       
   358     // Reject session, session state incoming, no operator variant
       
   359     TMceTransactionDataContainer container;
       
   360     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   361     iReceiveSession->IncomingSession( inSession, &container );
       
   362     CleanupStack::Pop( inSession );
       
   363     iReceiveSession->iSession->iState = CMceSession::EIncoming;
       
   364     iReceiveSession->iOperatorVariant = EFalse;
       
   365     iReceiveSession->TerminateLcSessionL();   
       
   366     EUNIT_ASSERT_EQUALS( TInt( CMceSession::ETerminated ),
       
   367                          TInt( iReceiveSession->iSession->iState ) )
       
   368  
       
   369     // Reject session, session state proceeding, no operator variant
       
   370     inSession = ConstructInSessionLC( 1, 0 );
       
   371     iReceiveSession->IncomingSession( inSession, &container );
       
   372     CleanupStack::Pop( inSession );
       
   373     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   374     iReceiveSession->iOperatorVariant = EFalse;
       
   375     iReceiveSession->TerminateLcSessionL();   
       
   376     EUNIT_ASSERT_EQUALS( TInt( CMceSession::ETerminated ),
       
   377                          TInt( iReceiveSession->iSession->iState ) )
       
   378     
       
   379     // Reject session, operator variant
       
   380     inSession = ConstructInSessionLC( 1, 0 );
       
   381     iReceiveSession->IncomingSession( inSession, &container );
       
   382     CleanupStack::Pop( inSession );
       
   383     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   384     iReceiveSession->iOperatorVariant = ETrue;
       
   385     iReceiveSession->TerminateLcSessionL(); 
       
   386     EUNIT_ASSERT_EQUALS( TInt( CMceSession::ETerminated ),
       
   387                          TInt( iReceiveSession->iSession->iState ) )
       
   388     
       
   389     // Terminate an established session
       
   390     inSession = ConstructInSessionLC( 1, 0 );
       
   391     iReceiveSession->IncomingSession( inSession, &container );
       
   392     CleanupStack::Pop( inSession );
       
   393     iReceiveSession->iSession->iState = CMceSession::EEstablished;
       
   394     iReceiveSession->iOperatorVariant = EFalse;
       
   395     iReceiveSession->TerminateLcSessionL(); 
       
   396     EUNIT_ASSERT_EQUALS( TInt( CMceSession::ETerminating ),
       
   397                          TInt( iReceiveSession->iSession->iState ) )    
       
   398     }
       
   399 
       
   400 // -----------------------------------------------------------------------------
       
   401 //
       
   402 // -----------------------------------------------------------------------------
       
   403 //
       
   404 void UT_CMusEngReceiveSession::UT_RemoteVideoPlayerL()
       
   405     {
       
   406     EUNIT_ASSERT( iReceiveSession->RemoteVideoPlayer() == 
       
   407                   iReceiveSession->iRemoteVideoPlayer )
       
   408     }
       
   409 
       
   410 // -----------------------------------------------------------------------------
       
   411 // 
       
   412 // -----------------------------------------------------------------------------
       
   413 //
       
   414 void UT_CMusEngReceiveSession::UT_RemoteDisplayName()
       
   415     {
       
   416 
       
   417     // Creating Valid Session     
       
   418     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   419     iReceiveSession->iSession = inSession; // Transfers ownership
       
   420     CleanupStack::Pop( inSession );
       
   421     iReceiveSession->CompleteSessionStructureL();
       
   422     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
   423     
       
   424 
       
   425     // Name is published using publish/subscribe key by Availblity
       
   426     User::LeaveIfError( RProperty::Set( NMusSessionApi::KCategoryUid,
       
   427                                         NMusSessionApi::KContactName,
       
   428                                         KTestContactName ) );
       
   429 
       
   430     EUNIT_ASSERT_EQUALS ( KTestContactName(), iReceiveSession->RemoteDisplayName() )
       
   431     
       
   432     
       
   433     User::LeaveIfError( RProperty::Set( NMusSessionApi::KCategoryUid,
       
   434                                        NMusSessionApi::KContactName,
       
   435                                        KNullDesC) );
       
   436     
       
   437     // Ensure its not null and its not equal
       
   438     EUNIT_ASSERT( KTestContactName() != iReceiveSession->RemoteDisplayName() );
       
   439     }
       
   440 
       
   441 // -----------------------------------------------------------------------------
       
   442 //
       
   443 // -----------------------------------------------------------------------------
       
   444 //
       
   445 void UT_CMusEngReceiveSession::UT_HandleSessionStateChangedL()
       
   446     {
       
   447     // Unknown session, let the base class handle 
       
   448     CMceInSession* inSession = ConstructInSessionLC( 1, 1 );
       
   449 
       
   450     iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() );
       
   451     
       
   452     // Simulate incoming session
       
   453     TMceTransactionDataContainer container;
       
   454     
       
   455     iReceiveSession->IncomingSession( inSession, &container ); 
       
   456     CleanupStack::Pop( inSession );
       
   457     
       
   458     // Session is in state EReserving, let the base class handle
       
   459     iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() );
       
   460     
       
   461     // The normal cases:
       
   462     
       
   463     // 1 ) First transition to state EProceeding, user and remote end should
       
   464     //     be notified
       
   465     inSession->iState = CMceSession::EProceeding;   
       
   466     iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() );
       
   467     EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ),
       
   468                          TInt( CLcSessionObserverStub::ESessionStateChanged ) )
       
   469     EUNIT_ASSERT( iReceiveSession->iRingLCalled )
       
   470 
       
   471     // Ensure Originator is taken from the incoming session
       
   472     EUNIT_ASSERT_EQUALS ( KTestOriginator(), *iReceiveSession->iOriginator )
       
   473     
       
   474     iLcSessionObserver->Reset();
       
   475     
       
   476     // 2 ) Now simulate second transition to EProceeding state which can happen
       
   477     //     if we force 100rel to be used. User and remote end should not be 
       
   478     //     notified anymore but change should be ignored.
       
   479     inSession->iState = CMceSession::EProceeding;
       
   480     iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() );
       
   481     EUNIT_ASSERT_EQUALS( TInt( CLcSessionObserverStub::EUnknown ),
       
   482                          TInt( iLcSessionObserver->iCalledFunction ) )
       
   483     }
       
   484 
       
   485 // -----------------------------------------------------------------------------
       
   486 //
       
   487 // -----------------------------------------------------------------------------
       
   488 // 
       
   489 void UT_CMusEngReceiveSession::UT_AdjustVideoCodecLL()
       
   490     {
       
   491     CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() );    
       
   492     CMceVideoCodec* codecH2632000 = CMceH263Codec::NewLC( KMceSDPNameH2632000() );
       
   493     CMceVideoCodec* codecAvc = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   494     CMceVideoCodec* codecUnknown = CMceH263Codec::NewLC( KNullDesC8() );
       
   495     
       
   496     iReceiveSession->AdjustVideoCodecL( *codecH263, KMceRTPSource );
       
   497     iReceiveSession->AdjustVideoCodecL( *codecH2632000, KMceRTPSource );
       
   498     iReceiveSession->AdjustVideoCodecL( *codecAvc, KMceRTPSource );
       
   499     iReceiveSession->AdjustVideoCodecL( *codecUnknown, KMceRTPSource );
       
   500     
       
   501     EUNIT_ASSERT_EQUALS( codecH263->KeepAliveTimer(), 5 )
       
   502     EUNIT_ASSERT_EQUALS( codecH263->KeepAlivePayloadType(), 96 )
       
   503     EUNIT_ASSERT_EQUALS( codecH263->KeepAliveData(), KNullDesC8() )
       
   504     
       
   505     EUNIT_ASSERT_EQUALS( codecH2632000->KeepAliveTimer(), 5 )
       
   506     EUNIT_ASSERT_EQUALS( codecH2632000->KeepAlivePayloadType(), 96 )
       
   507     EUNIT_ASSERT_EQUALS( codecH2632000->KeepAliveData(), KNullDesC8() )
       
   508     
       
   509     EUNIT_ASSERT_EQUALS( codecAvc->KeepAliveTimer(), 5 )
       
   510     EUNIT_ASSERT_EQUALS( codecAvc->KeepAlivePayloadType(), 98 )
       
   511     EUNIT_ASSERT_EQUALS( codecAvc->KeepAliveData(), KNullDesC8() )
       
   512     
       
   513     EUNIT_ASSERT_EQUALS( codecUnknown->KeepAliveTimer(), 5 )
       
   514     EUNIT_ASSERT_EQUALS( codecUnknown->KeepAlivePayloadType(), 0 )
       
   515     EUNIT_ASSERT_EQUALS( codecUnknown->KeepAliveData(), KNullDesC8() )
       
   516                 
       
   517     CleanupStack::PopAndDestroy( codecUnknown );
       
   518     CleanupStack::PopAndDestroy( codecAvc );
       
   519     CleanupStack::PopAndDestroy( codecH2632000 );
       
   520     CleanupStack::PopAndDestroy( codecH263 );
       
   521     }
       
   522     
       
   523 
       
   524 // -----------------------------------------------------------------------------
       
   525 //
       
   526 // -----------------------------------------------------------------------------
       
   527 // 
       
   528 void UT_CMusEngReceiveSession::UT_AdjustAudioCodecLL()
       
   529     {
       
   530     CMceAudioCodec* codec = 
       
   531                 iReceiveSession->iManager->SupportedAudioCodecs()[0]->CloneL();
       
   532     CleanupStack::PushL( codec );
       
   533     iReceiveSession->AdjustAudioCodecL( *codec );
       
   534     
       
   535     // Test keepalive timer
       
   536     
       
   537     TUint8 keepAliveTimer = codec->KeepAliveTimer();
       
   538     EUNIT_ASSERT( codec->KeepAliveTimer() == 5 )
       
   539     EUNIT_ASSERT( codec->KeepAlivePayloadType() == 97 )
       
   540     EUNIT_ASSERT( codec->KeepAliveData() == KNullDesC8() )
       
   541 
       
   542     // Test that base class has been called
       
   543     
       
   544     EUNIT_ASSERT( codec->iMMFPriority == KAudioPrioritySwisPlayback )
       
   545     EUNIT_ASSERT( codec->iMMFPriorityPreference == KAudioPrefSwisPlayback )
       
   546     
       
   547     CleanupStack::PopAndDestroy( codec );
       
   548     }
       
   549 
       
   550 
       
   551 // -----------------------------------------------------------------------------
       
   552 //
       
   553 // -----------------------------------------------------------------------------
       
   554 // 
       
   555 void UT_CMusEngReceiveSession::UT_DoCodecSelectionLL()
       
   556     {    
       
   557     // Check that Non-Interleaved AVC is preferred over single NAL 
       
   558     CMceVideoStream* videoStream = CMceVideoStream::NewLC();
       
   559     
       
   560     CMceVideoCodec* codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   561     codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal; 
       
   562     videoStream->AddCodecL( codecAvcSingleNal );
       
   563     CleanupStack::Pop( codecAvcSingleNal );
       
   564     
       
   565     CMceVideoCodec* codecAvcNonInterleaved = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   566     codecAvcNonInterleaved->iCodecMode = KMceAvcModeNonInterleaved;
       
   567     videoStream->AddCodecL( codecAvcNonInterleaved );
       
   568     CleanupStack::Pop( codecAvcNonInterleaved );
       
   569     
       
   570     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   571     
       
   572     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   573     EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->SdpName(), KMceSDPNameH264() )
       
   574     EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->CodecMode(),
       
   575                          KMceAvcModeNonInterleaved )
       
   576     
       
   577     CleanupStack::PopAndDestroy( videoStream );
       
   578                          
       
   579     // Check that Single NAL AVC is preferred over H263
       
   580     videoStream = CMceVideoStream::NewLC();
       
   581     
       
   582     CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() );    
       
   583     videoStream->AddCodecL( codecH263 );
       
   584     CleanupStack::Pop( codecH263 );
       
   585     
       
   586     codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   587     codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal; 
       
   588     videoStream->AddCodecL( codecAvcSingleNal );
       
   589     CleanupStack::Pop( codecAvcSingleNal );
       
   590 
       
   591     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   592     
       
   593     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   594     EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->SdpName(), KMceSDPNameH264() )
       
   595     EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->CodecMode(),
       
   596                          KMceAvcModeSingleNal )
       
   597                          
       
   598     CleanupStack::PopAndDestroy( videoStream );
       
   599     
       
   600     // Check that H263 codecs without AVC are handled correctly (in base class)
       
   601     videoStream = CMceVideoStream::NewLC();
       
   602     
       
   603     codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() );    
       
   604     videoStream->AddCodecL( codecH263 );
       
   605     CleanupStack::Pop( codecH263 );
       
   606     
       
   607     CMceVideoCodec* codecH2632000 = CMceH263Codec::NewLC( KMceSDPNameH2632000() );   
       
   608     videoStream->AddCodecL( codecH2632000 );
       
   609     CleanupStack::Pop( codecH2632000 );
       
   610     
       
   611     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   612     
       
   613     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   614     
       
   615     CleanupStack::PopAndDestroy( videoStream );
       
   616     
       
   617     // Check that AVC non-interleaved with best bitrate is preferred
       
   618     videoStream = CMceVideoStream::NewLC();
       
   619     
       
   620     codecAvcNonInterleaved = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   621     codecAvcNonInterleaved->iCodecMode = KMceAvcModeNonInterleaved;
       
   622     codecAvcNonInterleaved->SetMaxBitrateL( 80000 );
       
   623     videoStream->AddCodecL( codecAvcNonInterleaved );
       
   624     CleanupStack::Pop( codecAvcNonInterleaved );
       
   625     
       
   626     CMceVideoCodec* codecAvcNonInterleaved128 = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   627     codecAvcNonInterleaved128->iCodecMode = KMceAvcModeNonInterleaved;
       
   628     codecAvcNonInterleaved128->SetMaxBitrateL( 128000 );
       
   629     videoStream->AddCodecL( codecAvcNonInterleaved128 );
       
   630     CleanupStack::Pop( codecAvcNonInterleaved128 );
       
   631     
       
   632     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   633     
       
   634     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   635     EUNIT_ASSERT( videoStream->Codecs()[0] == codecAvcNonInterleaved128 )
       
   636 
       
   637     CleanupStack::PopAndDestroy( videoStream );
       
   638     
       
   639     // Check that in case of several AVC single NALs, the best bitrate is preferred
       
   640     videoStream = CMceVideoStream::NewLC();
       
   641     
       
   642     codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   643     codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal;
       
   644     codecAvcSingleNal->SetMaxBitrateL( 80000 );
       
   645     videoStream->AddCodecL( codecAvcSingleNal );
       
   646     CleanupStack::Pop( codecAvcSingleNal );
       
   647     
       
   648     CMceVideoCodec* codecAvcSingleNal128 = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   649     codecAvcSingleNal128->iCodecMode = KMceAvcModeSingleNal;
       
   650     codecAvcSingleNal128->SetMaxBitrateL( 128000 );
       
   651     videoStream->AddCodecL( codecAvcSingleNal128 );
       
   652     CleanupStack::Pop( codecAvcSingleNal128 );
       
   653     
       
   654     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   655     
       
   656     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   657     EUNIT_ASSERT( videoStream->Codecs()[0] == codecAvcSingleNal128 )
       
   658 
       
   659     CleanupStack::PopAndDestroy( videoStream );
       
   660    
       
   661     }
       
   662             
       
   663 
       
   664 // -----------------------------------------------------------------------------
       
   665 //
       
   666 // -----------------------------------------------------------------------------
       
   667 //    
       
   668 void UT_CMusEngReceiveSession::UT_IncomingSessionL()
       
   669     {
       
   670     _LIT8( KMusEngSwisTestIdentifier, "Require: precondition" );
       
   671     _LIT8( KMusEngTestHeader, "Some header" );
       
   672 
       
   673     TMceTransactionDataContainer container;
       
   674     
       
   675     // Simulate SWIS 2.2 invite. There are no streams, so completion fails and 
       
   676     // session gets rejected. Still prenotification has been given.
       
   677     CMceInSession* inSession = ConstructInSessionLC( 0, 0 );
       
   678     CDesC8Array* headers = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
   679     CleanupStack::PushL( headers );
       
   680     headers->AppendL( KMusEngTestHeader() );
       
   681     headers->AppendL( KMusEngSwisTestIdentifier() );
       
   682     container.SetHeaders( headers );
       
   683     CleanupStack::Pop( headers );
       
   684     iReceiveSession->IncomingSession( inSession, &container );    
       
   685     CleanupStack::Pop( inSession );
       
   686     container.Clear();
       
   687     
       
   688     EUNIT_ASSERT( iReceiveSession->iSession );
       
   689     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   690                   CMceSession::ETerminated );
       
   691     
       
   692     EUNIT_ASSERT( iReceiveSession->iSession->i100RelUsage == 
       
   693                   KMce100RelRequired )
       
   694     EUNIT_ASSERT( !iReceiveSession->iRingLCalled )              
       
   695 
       
   696     // Try again with valid session, normal case
       
   697     inSession = ConstructInSessionLC( 1, 0 );
       
   698     iReceiveSession->IncomingSession( inSession, &container );    
       
   699     CleanupStack::Pop( inSession );
       
   700     
       
   701     EUNIT_ASSERT( iReceiveSession->iSession );
       
   702     // Next state depends on success of completion of session structure.
       
   703     // When using alloc failure state is ETerminated, in succesfull case it is
       
   704     // EReserving. However it is set to "normal" state EReserving after 
       
   705     // assertion
       
   706     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   707                   CMceSession::EReserving ||
       
   708                   iReceiveSession->iSession->iState == 
       
   709                   CMceSession::ETerminated );
       
   710     iReceiveSession->iSession->iState = CMceSession::EReserving;
       
   711     
       
   712     // Try again without container, new session gets terminated and deleted
       
   713     inSession = ConstructInSessionLC( 1, 0 );
       
   714     iReceiveSession->IncomingSession( inSession, NULL );    
       
   715     CleanupStack::Pop( inSession );
       
   716     
       
   717     EUNIT_ASSERT( iReceiveSession->iSession );
       
   718     EUNIT_ASSERT( iReceiveSession->iSession != inSession );
       
   719     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   720                   CMceSession::EReserving );
       
   721                                
       
   722     // Try again when there is session pending, new session gets terminated
       
   723     // and deleted
       
   724     inSession = ConstructInSessionLC( 1, 0 );
       
   725     iReceiveSession->IncomingSession( inSession, &container );    
       
   726     CleanupStack::Pop( inSession );
       
   727     
       
   728     EUNIT_ASSERT( iReceiveSession->iSession );
       
   729     EUNIT_ASSERT( iReceiveSession->iSession != inSession );
       
   730     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   731                   CMceSession::EReserving );
       
   732     }
       
   733 
       
   734 
       
   735 // -----------------------------------------------------------------------------
       
   736 //
       
   737 // -----------------------------------------------------------------------------
       
   738 //
       
   739 void UT_CMusEngReceiveSession::UT_IncomingUpdateL()
       
   740     {
       
   741     TMceTransactionDataContainer container;
       
   742     
       
   743     // We do not have session and thus cannot have an update, new session gets
       
   744     // rejected and deleted.
       
   745     CMceInSession* oldSession = ConstructInSessionLC( 0, 0 );
       
   746     CMceInSession* newSession = ConstructInSessionLC( 0, 0 );
       
   747     iReceiveSession->IncomingUpdate( *oldSession, newSession, NULL );
       
   748     CleanupStack::Pop( newSession );
       
   749     CleanupStack::PopAndDestroy( oldSession );
       
   750     
       
   751     // Start establishing a session
       
   752     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   753     iReceiveSession->IncomingSession( inSession, &container );
       
   754     CleanupStack::Pop( inSession );
       
   755     
       
   756     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   757     iReceiveSession->EstablishLcSessionL();
       
   758     
       
   759     // Now we have an insession, try to update session that is not ours, 
       
   760     // new one gets rejected and deleted.
       
   761     oldSession = ConstructInSessionLC( 0, 0 );
       
   762     newSession = ConstructInSessionLC( 0, 0 );
       
   763     iReceiveSession->IncomingUpdate( *oldSession, newSession, NULL );
       
   764     CleanupStack::Pop( newSession );
       
   765     CleanupStack::PopAndDestroy( oldSession );
       
   766     
       
   767     // Try to update our insession before it is established. New session gets
       
   768     // rejected and deleted.
       
   769     newSession = ConstructInSessionLC( 0, 0 );
       
   770     iReceiveSession->IncomingUpdate( *iReceiveSession->iSession, 
       
   771                                      newSession, 
       
   772                                      NULL );
       
   773     CleanupStack::Pop( newSession );
       
   774     
       
   775     // Finish establishing insession
       
   776     iReceiveSession->iSession->iState = CMceSession::EEstablished;
       
   777     
       
   778     // Try to update the established session with invalid session, it gets
       
   779     // rejected and deleted
       
   780     newSession = ConstructInSessionLC( 0, 0 );
       
   781     iReceiveSession->IncomingUpdate( *iReceiveSession->iSession, 
       
   782                                      newSession, 
       
   783                                      NULL );
       
   784     CleanupStack::Pop( newSession ); 
       
   785     
       
   786     // Succeed in update 
       
   787     newSession = ConstructInSessionLC( 1, 0 );
       
   788     iReceiveSession->IncomingUpdate( *iReceiveSession->iSession, 
       
   789                                      newSession, 
       
   790                                      NULL );
       
   791     CleanupStack::Pop( newSession ); 
       
   792     EUNIT_ASSERT( iReceiveSession->iSession );
       
   793     EUNIT_ASSERT( iReceiveSession->iSession == newSession );
       
   794     
       
   795     }
       
   796 
       
   797 
       
   798 // -----------------------------------------------------------------------------
       
   799 //
       
   800 // -----------------------------------------------------------------------------
       
   801 // 
       
   802 void UT_CMusEngReceiveSession::UT_StreamStateChangedL()
       
   803     {
       
   804     TMceTransactionDataContainer container;
       
   805     
       
   806     CMceInSession* inSession = ConstructInSessionLC( 1, 1 );
       
   807     
       
   808     CMceMediaStream* videoStream = inSession->Streams()[0];
       
   809     CMceMediaStream* audioStream = inSession->Streams()[1];
       
   810     
       
   811     // Try without a session, nothing happens
       
   812     iReceiveSession->StreamStateChanged( *audioStream );
       
   813     
       
   814     // Establish session
       
   815     iReceiveSession->IncomingSession( inSession, &container );    
       
   816     CleanupStack::Pop( inSession );
       
   817     iLcSessionObserver->Reset();
       
   818 
       
   819     // Try with audiostream, nothing happens
       
   820     audioStream->iState = CMceMediaStream::EBuffering;
       
   821     iReceiveSession->StreamStateChanged( *audioStream );
       
   822     EUNIT_ASSERT( iLcSessionObserver->IsReseted() )
       
   823     
       
   824     // Try with videostream, but without a source, nothing happens
       
   825     CMceRtpSource* rtpSource = 
       
   826         static_cast<CMceRtpSource*>( videoStream->Source() ); //hack
       
   827     videoStream->iSource = NULL;   
       
   828     iReceiveSession->StreamStateChanged( *videoStream );
       
   829     EUNIT_ASSERT( iLcSessionObserver->IsReseted() )
       
   830     
       
   831     // Try with videostream and a camera source, nothing happens 
       
   832     videoStream->iSource = 
       
   833         CMceCameraSource::NewL( *iReceiveSession->iManager ); //hack
       
   834     iReceiveSession->StreamStateChanged( *videoStream );
       
   835     EUNIT_ASSERT( iLcSessionObserver->IsReseted() )
       
   836     
       
   837     // Remove hacks
       
   838     delete videoStream->iSource;
       
   839     videoStream->iSource = rtpSource;
       
   840         
       
   841     // Buffering, normal case
       
   842     videoStream->iState = CMceMediaStream::EBuffering;
       
   843     iReceiveSession->StreamStateChanged( *videoStream );
       
   844     EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ),
       
   845                          TInt( CLcSessionObserverStub::EPlayerStateChanged ) )
       
   846     EUNIT_ASSERT( iReceiveSession->iBuffered )
       
   847     iLcSessionObserver->Reset();
       
   848     
       
   849     // Streaming, normal case
       
   850     videoStream->iState = CMceMediaStream::EStreaming;
       
   851     iReceiveSession->iReceiving = EFalse;
       
   852     iReceiveSession->iBuffered = ETrue;
       
   853     iReceiveSession->StreamStateChanged( *videoStream );
       
   854     EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ),
       
   855                          TInt( CLcSessionObserverStub::EPlayerStateChanged ) )
       
   856     EUNIT_ASSERT_EQUALS( KMusEngInactivityTimer, rtpSource->iInactivityTimer ) 
       
   857     iLcSessionObserver->Reset();
       
   858     EUNIT_ASSERT_EQUALS( TInt( iLcUiProvider->iCalledFunction ),
       
   859                          TInt( CLcUiProviderStub::EHandleForegroundStatus ) )    
       
   860     iLcUiProvider->Reset();
       
   861     // Normally background info will be cleared once ui comes to foreground and
       
   862     // notifies engine about it
       
   863     iReceiveSession->iBackground = EFalse;
       
   864 
       
   865     // Streaming, event is received even when already receiving. Streaming
       
   866     // event is anyway notified.
       
   867     videoStream->iState = CMceMediaStream::EStreaming;
       
   868     iReceiveSession->iReceiving = ETrue;
       
   869     iReceiveSession->iBuffered = ETrue;
       
   870     iReceiveSession->StreamStateChanged( *videoStream );
       
   871     EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ),
       
   872                          TInt( CLcSessionObserverStub::EPlayerStateChanged ) )
       
   873     EUNIT_ASSERT_EQUALS( KMusEngInactivityTimer, rtpSource->iInactivityTimer ) 
       
   874     iLcSessionObserver->Reset();
       
   875     EUNIT_ASSERT_EQUALS( TInt( iLcUiProvider->iCalledFunction ),
       
   876                          TInt( CLcUiProviderStub::EUnknown ) )
       
   877       
       
   878     // Streaming and receiving started already. Streaming is not notified because
       
   879     // of buffering event hasn't been received
       
   880     videoStream->iState = CMceMediaStream::EStreaming;
       
   881     iReceiveSession->iReceiving = ETrue;
       
   882     iReceiveSession->iBuffered = EFalse;
       
   883     iReceiveSession->StreamStateChanged( *videoStream );
       
   884     EUNIT_ASSERT( iLcSessionObserver->IsReseted() )
       
   885     iLcSessionObserver->Reset();
       
   886     
       
   887     // Streaming, receiving not started and buffering not happened ( means no packet
       
   888     // received yet. Ignore this event too.
       
   889     videoStream->iState = CMceMediaStream::EStreaming;
       
   890     iReceiveSession->iReceiving = EFalse;
       
   891     iReceiveSession->iBuffered = EFalse;
       
   892     iReceiveSession->StreamStateChanged( *videoStream );
       
   893     EUNIT_ASSERT( iLcSessionObserver->IsReseted() )
       
   894     iLcSessionObserver->Reset();
       
   895     
       
   896     // Streaming, receiving not started and buffering happened.
       
   897     // Enabling RTP timer leaves. Should be a failure case.
       
   898     videoStream->iState = CMceMediaStream::EStreaming;
       
   899     iReceiveSession->iReceiving = EFalse;
       
   900     iReceiveSession->iBuffered = ETrue;
       
   901     iReceiveSession->StreamStateChanged( *videoStream );
       
   902     EUNIT_ASSERT_NOT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ),
       
   903                              TInt( CLcSessionObserverStub::EPlayerFailed ) )    
       
   904     iLcSessionObserver->Reset();
       
   905     
       
   906     // Try default behaviors
       
   907     videoStream->iState = CMceMediaStream::EIdle;
       
   908     iReceiveSession->StreamStateChanged( *videoStream );
       
   909     EUNIT_ASSERT( iLcSessionObserver->IsReseted() )
       
   910     }
       
   911 
       
   912 
       
   913 // -----------------------------------------------------------------------------
       
   914 //
       
   915 // -----------------------------------------------------------------------------
       
   916 //
       
   917 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithoutSessionL()
       
   918     {
       
   919     TRAPD( error, iReceiveSession->CompleteSessionStructureL() );
       
   920     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   921     EUNIT_ASSERT( error == KErrNotReady );
       
   922     }
       
   923 
       
   924 
       
   925 // -----------------------------------------------------------------------------
       
   926 //
       
   927 // -----------------------------------------------------------------------------
       
   928 //
       
   929 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithoutStreamsL()
       
   930     {
       
   931     CMceInSession* inSession = ConstructInSessionLC( 0, 0 );
       
   932     iReceiveSession->iSession = inSession; // Transfers ownership
       
   933     CleanupStack::Pop( inSession );
       
   934     
       
   935     TRAPD( error, iReceiveSession->CompleteSessionStructureL() );
       
   936     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   937     EUNIT_ASSERT( error == KErrCorrupt );
       
   938     }
       
   939 
       
   940 
       
   941 // -----------------------------------------------------------------------------
       
   942 //
       
   943 // -----------------------------------------------------------------------------
       
   944 //
       
   945 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithOutgoingStreamL()
       
   946     {    
       
   947     // Stream will be removed.
       
   948     CMceInSession* inSession = ConstructInSessionLC( 0, 0 );
       
   949     
       
   950     inSession->AddStreamL( ConstructVideoOutStreamLC() );
       
   951     CleanupStack::Pop();
       
   952     
       
   953     iReceiveSession->iSession = inSession; // Transfers ownership
       
   954     CleanupStack::Pop( inSession );
       
   955     
       
   956     TRAPD( error, iReceiveSession->CompleteSessionStructureL() )
       
   957     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   958     EUNIT_ASSERT( error == KErrCorrupt );
       
   959     EUNIT_ASSERT( inSession->Streams().Count() == 0 );
       
   960     EUNIT_ASSERT( inSession->Bundles().Count() == 0 );
       
   961     }
       
   962 
       
   963 
       
   964 // -----------------------------------------------------------------------------
       
   965 //
       
   966 // -----------------------------------------------------------------------------
       
   967 //
       
   968 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithVideoInL()
       
   969     {
       
   970     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   971 
       
   972     iReceiveSession->iSession = inSession; // Transfers ownership
       
   973     CleanupStack::Pop( inSession );
       
   974 
       
   975     iReceiveSession->CompleteSessionStructureL();
       
   976 
       
   977     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
   978     EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() )
       
   979     EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo )
       
   980     EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 )
       
   981     EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == 
       
   982                   KMceDisplaySink )
       
   983     
       
   984     // No audio, bundle is not constructed
       
   985     EUNIT_ASSERT( inSession->Bundles().Count() == 0 )
       
   986     }
       
   987 
       
   988 
       
   989 // -----------------------------------------------------------------------------
       
   990 // Video out is bound stream, it gets disabled
       
   991 // -----------------------------------------------------------------------------
       
   992 //
       
   993 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL()
       
   994     {    
       
   995     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   996 
       
   997     CMceVideoStream* videoOut = ConstructVideoOutStreamLC();
       
   998     inSession->Streams()[0]->BindL( videoOut );
       
   999     CleanupStack::Pop( videoOut );
       
  1000     
       
  1001     iReceiveSession->iSession = inSession; // Transfers ownership
       
  1002     CleanupStack::Pop( inSession );
       
  1003 
       
  1004     iReceiveSession->CompleteSessionStructureL();
       
  1005 
       
  1006     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
  1007 
       
  1008     CMceMediaStream* videoIn = inSession->Streams()[0];
       
  1009      
       
  1010     EUNIT_ASSERT( videoIn->IsEnabled() )
       
  1011     EUNIT_ASSERT( videoIn->Type() == KMceVideo )
       
  1012     EUNIT_ASSERT( videoIn->Sinks().Count() == 1 )
       
  1013     EUNIT_ASSERT( videoIn->Sinks()[0]->Type() == KMceDisplaySink )
       
  1014 
       
  1015     EUNIT_ASSERT( videoIn->BoundStream() )
       
  1016     EUNIT_ASSERT( !videoIn->BoundStreamL().IsEnabled() )    
       
  1017     
       
  1018     // No audio, bundle is not constructed
       
  1019     EUNIT_ASSERT( inSession->Bundles().Count() == 0 )
       
  1020     }
       
  1021 
       
  1022 
       
  1023 // -----------------------------------------------------------------------------
       
  1024 // Video in is bound stream, another one gets disabled
       
  1025 // -----------------------------------------------------------------------------
       
  1026 //
       
  1027 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL()
       
  1028     {
       
  1029     CMceInSession* inSession = ConstructInSessionLC( 0, 0 );
       
  1030 
       
  1031     CMceVideoStream* videoOut = ConstructVideoOutStreamLC();
       
  1032 
       
  1033     CMceVideoStream* videoIn = ConstructVideoInStreamLC();
       
  1034     videoOut->BindL( videoIn );
       
  1035     CleanupStack::Pop( videoIn );
       
  1036     
       
  1037     inSession->AddStreamL( videoOut );
       
  1038     CleanupStack::Pop( videoOut );
       
  1039     
       
  1040     iReceiveSession->iSession = inSession; // Transfers ownership
       
  1041     CleanupStack::Pop( inSession );
       
  1042 
       
  1043     iReceiveSession->CompleteSessionStructureL();
       
  1044 
       
  1045     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
  1046     EUNIT_ASSERT( !videoOut->IsEnabled() )
       
  1047     EUNIT_ASSERT( videoOut->Type() == KMceVideo )
       
  1048     EUNIT_ASSERT( videoOut->Sinks().Count() == 1 )
       
  1049     EUNIT_ASSERT( videoOut->Sinks()[0]->Type() == KMceRTPSink )
       
  1050     EUNIT_ASSERT( !videoOut->Sinks()[0]->IsEnabled() )
       
  1051 
       
  1052     EUNIT_ASSERT( videoOut->BoundStream() )
       
  1053     EUNIT_ASSERT( videoOut->BoundStreamL().IsEnabled() )
       
  1054     EUNIT_ASSERT( videoOut->BoundStreamL().Type() == KMceVideo )
       
  1055     EUNIT_ASSERT( videoOut->BoundStreamL().Sinks().Count() == 1 )
       
  1056     EUNIT_ASSERT( videoOut->BoundStreamL().Sinks()[0]->Type() == 
       
  1057                   KMceDisplaySink )   
       
  1058     EUNIT_ASSERT( videoOut->BoundStreamL().Sinks()[0]->IsEnabled() )
       
  1059                   
       
  1060     // No audio, bundle is not constructed
       
  1061     EUNIT_ASSERT( inSession->Bundles().Count() == 0 )
       
  1062     }
       
  1063 
       
  1064 
       
  1065 // -----------------------------------------------------------------------------
       
  1066 // Construct 3 video instreams:
       
  1067 // 0. Without bound stream
       
  1068 // 1. Bounds video out stream
       
  1069 // 2. Bounded by video out stream
       
  1070 // -----------------------------------------------------------------------------
       
  1071 //    
       
  1072 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithMultipleVideoInsL()
       
  1073     {
       
  1074     // construct session and stream 0
       
  1075     CMceInSession* inSession = ConstructInSessionLC( 2, 0 );
       
  1076     
       
  1077     // finish constructing stream 1
       
  1078     CMceVideoStream* videoOut = ConstructVideoOutStreamLC();
       
  1079     inSession->Streams()[1]->BindL( videoOut );
       
  1080     CleanupStack::Pop( videoOut );
       
  1081 
       
  1082     // finish constructing stream 2
       
  1083     videoOut = ConstructVideoOutStreamLC();
       
  1084 
       
  1085     CMceVideoStream* videoIn = ConstructVideoInStreamLC();
       
  1086     videoOut->BindL( videoIn );
       
  1087     CleanupStack::Pop( videoIn );
       
  1088     
       
  1089     inSession->AddStreamL( videoOut );
       
  1090     CleanupStack::Pop( videoOut );
       
  1091     
       
  1092     // Transfers ownership
       
  1093     iReceiveSession->iSession = inSession; 
       
  1094     CleanupStack::Pop( inSession );
       
  1095     
       
  1096     // complete
       
  1097     iReceiveSession->CompleteSessionStructureL();
       
  1098     
       
  1099     // First should be used, 4 other streams should be deleted
       
  1100     
       
  1101     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
  1102     
       
  1103     // First stream
       
  1104     EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() )
       
  1105     EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo )
       
  1106     EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 )
       
  1107     EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == KMceDisplaySink )
       
  1108     EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->IsEnabled() )
       
  1109 
       
  1110     // No audio, bundle is not constructed
       
  1111     EUNIT_ASSERT( inSession->Bundles().Count() == 0 )
       
  1112     }
       
  1113 
       
  1114 
       
  1115 // -----------------------------------------------------------------------------
       
  1116 // Streams in this test case
       
  1117 // 0. Video in
       
  1118 // 1. Audio in
       
  1119 // 2. Audio out bound to audio in
       
  1120 // 3. Audio in bound to audio out
       
  1121 // -----------------------------------------------------------------------------
       
  1122 //
       
  1123 void UT_CMusEngReceiveSession::
       
  1124                 UT_CompleteSessionStructureL_WithVideoAndMultipleAudioInsL()
       
  1125     {
       
  1126     // Construct session and streams 0 and 1
       
  1127     CMceInSession* inSession = inSession = ConstructInSessionLC( 1, 2 );
       
  1128     
       
  1129     // Construct stream 2
       
  1130     CMceAudioStream* audioOut = ConstructAudioOutStreamLC();
       
  1131     inSession->Streams()[2]->BindL( audioOut );
       
  1132     CleanupStack::Pop( audioOut );
       
  1133     
       
  1134     // Construct stream 3
       
  1135     
       
  1136     audioOut = ConstructAudioOutStreamLC();
       
  1137     
       
  1138     CMceAudioStream* audioIn = ConstructAudioInStreamLC();
       
  1139     audioOut->BindL( audioIn );
       
  1140     CleanupStack::Pop( audioIn );
       
  1141     
       
  1142     inSession->AddStreamL( audioOut );
       
  1143     CleanupStack::Pop( audioOut );
       
  1144     
       
  1145     // Transfers ownership
       
  1146     iReceiveSession->iSession = inSession; 
       
  1147     CleanupStack::Pop( inSession );
       
  1148 
       
  1149     // Complete
       
  1150     iReceiveSession->CompleteSessionStructureL();
       
  1151     EUNIT_ASSERT( inSession->Streams().Count() == 4 );
       
  1152     
       
  1153     // Stream 0
       
  1154     EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo )
       
  1155     EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() )
       
  1156     EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 )
       
  1157     EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == 
       
  1158                   KMceDisplaySink )
       
  1159     
       
  1160     // Stream 1
       
  1161     EUNIT_ASSERT( inSession->Streams()[1]->Type() == KMceAudio )
       
  1162     EUNIT_ASSERT( inSession->Streams()[1]->IsEnabled() )
       
  1163     EUNIT_ASSERT( inSession->Streams()[1]->Sinks().Count() == 1 )
       
  1164     EUNIT_ASSERT( inSession->Streams()[1]->Sinks()[0]->Type() == 
       
  1165                   KMceSpeakerSink );
       
  1166     CMceSpeakerSink* speaker = 
       
  1167         static_cast<CMceSpeakerSink*>(inSession->Streams()[1]->Sinks()[0]);
       
  1168     EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->LcVolumeL() )
       
  1169     
       
  1170     // Stream 2 and bound stream
       
  1171     EUNIT_ASSERT( inSession->Streams()[2]->Type() == KMceAudio )
       
  1172     EUNIT_ASSERT( inSession->Streams()[2]->IsEnabled() )
       
  1173     EUNIT_ASSERT( inSession->Streams()[2]->Sinks().Count() == 1 )
       
  1174     EUNIT_ASSERT( inSession->Streams()[2]->Sinks()[0]->Type() == 
       
  1175                   KMceSpeakerSink );
       
  1176     speaker = static_cast<CMceSpeakerSink*>(inSession->Streams()[2]->Sinks()[0]);
       
  1177     EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->LcVolumeL() )
       
  1178 
       
  1179     EUNIT_ASSERT( inSession->Streams()[2]->BoundStream() )
       
  1180     EUNIT_ASSERT( !inSession->Streams()[2]->BoundStreamL().IsEnabled() )
       
  1181     EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Type() == KMceAudio )
       
  1182     
       
  1183     EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Sinks().Count() == 1 )
       
  1184     EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Sinks()[0]->Type() == 
       
  1185                   KMceRTPSink );
       
  1186     
       
  1187     // Stream 3 and bound stream
       
  1188     EUNIT_ASSERT( inSession->Streams()[3]->Type() == KMceAudio )
       
  1189     EUNIT_ASSERT( !inSession->Streams()[3]->IsEnabled() )
       
  1190     EUNIT_ASSERT( inSession->Streams()[3]->Sinks().Count() == 1 )
       
  1191     EUNIT_ASSERT( inSession->Streams()[3]->Sinks()[0]->Type() == KMceRTPSink )
       
  1192     EUNIT_ASSERT( !inSession->Streams()[3]->Sinks()[0]->IsEnabled() )
       
  1193 
       
  1194     EUNIT_ASSERT( inSession->Streams()[3]->BoundStream() )
       
  1195     EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().IsEnabled() )
       
  1196     EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Type() == KMceAudio )
       
  1197     EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Sinks().Count() == 1 )    
       
  1198     EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Sinks()[0]->Type() == 
       
  1199                   KMceSpeakerSink )
       
  1200     speaker = static_cast<CMceSpeakerSink*>
       
  1201                         (inSession->Streams()[3]->BoundStreamL().Sinks()[0]);
       
  1202     EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->LcVolumeL() )
       
  1203               
       
  1204     // Check for bundles
       
  1205     EUNIT_ASSERT( inSession->Bundles().Count() == 1 )
       
  1206     EUNIT_ASSERT( inSession->Bundles()[0]->Streams().Count() == 4 )
       
  1207     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[0]->Type() == KMceAudio  )              
       
  1208     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[0]->Sinks()[0]->Type() == 
       
  1209                   KMceSpeakerSink  )
       
  1210     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[1]->Type() == KMceAudio  )              
       
  1211     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[1]->Sinks()[0]->Type() == 
       
  1212                   KMceSpeakerSink  )
       
  1213     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[2]->Type() == KMceAudio  )              
       
  1214     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[2]->Sinks()[0]->Type() == 
       
  1215                   KMceSpeakerSink  )
       
  1216     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[3]->Type() == KMceVideo )
       
  1217     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[3]->Sinks()[0]->Type() == 
       
  1218                   KMceDisplaySink )
       
  1219     }
       
  1220 
       
  1221 
       
  1222 // -----------------------------------------------------------------------------
       
  1223 // Streams in this test case
       
  1224 // 0. Video in
       
  1225 // 1. Audio in
       
  1226 // 2. Audio out bound to audio in
       
  1227 // 3. Audio in bound to audio out
       
  1228 // All audio will be removed because of operator variant
       
  1229 // -----------------------------------------------------------------------------
       
  1230 //
       
  1231 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_OperatorVariant()
       
  1232     {  
       
  1233     iReceiveSession->iOperatorVariant = ETrue;
       
  1234     
       
  1235     // Construct session and streams 0 and 1
       
  1236     CMceInSession* inSession = inSession = ConstructInSessionLC( 1, 2 );
       
  1237     
       
  1238     // Construct stream 2
       
  1239     CMceAudioStream* audioOut = ConstructAudioOutStreamLC();
       
  1240     inSession->Streams()[2]->BindL( audioOut );
       
  1241     CleanupStack::Pop( audioOut );
       
  1242     
       
  1243     // Construct stream 3
       
  1244     
       
  1245     audioOut = ConstructAudioOutStreamLC();
       
  1246     
       
  1247     CMceAudioStream* audioIn = ConstructAudioInStreamLC();
       
  1248     audioOut->BindL( audioIn );
       
  1249     CleanupStack::Pop( audioIn );
       
  1250     
       
  1251     inSession->AddStreamL( audioOut );
       
  1252     CleanupStack::Pop( audioOut );
       
  1253     
       
  1254     // Transfers ownership
       
  1255     iReceiveSession->iSession = inSession; 
       
  1256     CleanupStack::Pop( inSession );
       
  1257 
       
  1258     // Complete
       
  1259     iReceiveSession->CompleteSessionStructureL();
       
  1260     
       
  1261     // Check that all audio has been removed and no  bundles has been
       
  1262     // constructed
       
  1263     EUNIT_ASSERT_EQUALS( inSession->Streams().Count(), 1 )
       
  1264     EUNIT_ASSERT_EQUALS( inSession->Streams()[0]->Type(), KMceVideo )
       
  1265     EUNIT_ASSERT_EQUALS( inSession->Bundles().Count(), 0 )
       
  1266     
       
  1267     
       
  1268     // Session with bandwidth attributes b=AS and b=TIAS at session and media
       
  1269     // levels -> b=AS is taken in use at session level (b=TIAS is ignored)
       
  1270     //
       
  1271     delete iReceiveSession->iSession;
       
  1272     iReceiveSession->iSession = NULL;
       
  1273     
       
  1274     inSession = ConstructInSessionLC( 1, 0 );
       
  1275     //setting session level SDP attributes
       
  1276     CDesC8Array* sdpLines = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1277     CleanupStack::PushL( sdpLines );
       
  1278     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1279     sdpLines->AppendL( KMusEngSessionSdpLineTiasLine() );
       
  1280     inSession->SetSessionSDPLinesL( sdpLines );
       
  1281     CleanupStack::Pop( sdpLines );
       
  1282     
       
  1283     //setting media level SDP attributes
       
  1284     sdpLines = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1285     CleanupStack::PushL( sdpLines );
       
  1286     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1287     sdpLines->AppendL( KMusEngSessionSdpLineTiasLine() );
       
  1288     inSession->Streams()[ 0 ]->SetMediaAttributeLinesL( sdpLines );
       
  1289     CleanupStack::Pop( sdpLines );
       
  1290  
       
  1291     // Transfers ownership
       
  1292     iReceiveSession->iSession = inSession; 
       
  1293     CleanupStack::Pop( inSession );
       
  1294     
       
  1295     iReceiveSession->CompleteSessionStructureL();
       
  1296  
       
  1297     // Ensure there is only b=AS and no b=TIAS present at session level 
       
  1298     MDesC8Array* newSdpLines = iReceiveSession->iSession->iSessionSDPLines;
       
  1299     TBool bandwidthFoundFromSessionLevel = EFalse;
       
  1300     TBool tiasFoundFromSessionLevel = EFalse;
       
  1301     for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ )
       
  1302         {
       
  1303         if ( newSdpLines->MdcaPoint( i ).Compare( 
       
  1304                 KMusEngSessionSdpLineBandwidthField() ) == 0 )
       
  1305             {
       
  1306             bandwidthFoundFromSessionLevel = ETrue;
       
  1307             }
       
  1308         else if ( newSdpLines->MdcaPoint( i ).Find( 
       
  1309                 KMusEngSessionSdpLineTiasLine() ) == 0 )
       
  1310             {
       
  1311             tiasFoundFromSessionLevel = ETrue;
       
  1312             }
       
  1313         }
       
  1314     EUNIT_ASSERT( bandwidthFoundFromSessionLevel );
       
  1315     EUNIT_ASSERT( !tiasFoundFromSessionLevel );
       
  1316  
       
  1317     // Ensure there is no bandwidth attributes at media level 
       
  1318     newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->iMediaSDPLines;
       
  1319     EUNIT_ASSERT( !newSdpLines->MdcaCount() );
       
  1320 
       
  1321     
       
  1322     // Session with bandwidth AS and TIAS attributes at media level
       
  1323     // -> bandwidth AS is taken in use at media level
       
  1324     //
       
  1325     delete iReceiveSession->iSession;
       
  1326     iReceiveSession->iSession = NULL;
       
  1327     
       
  1328     inSession = ConstructInSessionLC( 1, 0 );
       
  1329     
       
  1330     sdpLines = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1331     CleanupStack::PushL( sdpLines );
       
  1332     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1333     sdpLines->AppendL( KMusEngSessionSdpLineTiasLine() );
       
  1334     inSession->Streams()[ 0 ]->SetMediaAttributeLinesL( sdpLines );
       
  1335     CleanupStack::Pop( sdpLines );
       
  1336     
       
  1337     // Transfers ownership
       
  1338     iReceiveSession->iSession = inSession; 
       
  1339     CleanupStack::Pop( inSession );
       
  1340     
       
  1341     iReceiveSession->CompleteSessionStructureL();
       
  1342     
       
  1343     // Ensure there is no bandwidth attribute at session level  
       
  1344     newSdpLines = iReceiveSession->iSession->iSessionSDPLines;
       
  1345     bandwidthFoundFromSessionLevel = EFalse;
       
  1346     for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ )
       
  1347         {
       
  1348         if ( newSdpLines->MdcaPoint( i ).Compare( 
       
  1349                 KMusEngSessionSdpLineBandwidthField() ) == 0
       
  1350              || newSdpLines->MdcaPoint( i ).Find( 
       
  1351                      KMusEngSessionSdpLineTiasLine() ) == 0 )
       
  1352             {
       
  1353             bandwidthFoundFromSessionLevel = ETrue;
       
  1354             }
       
  1355         }
       
  1356     EUNIT_ASSERT( !bandwidthFoundFromSessionLevel );
       
  1357     
       
  1358     // Ensure media level has only b=AS attribute
       
  1359     newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->iMediaSDPLines;
       
  1360     EUNIT_ASSERT( newSdpLines );
       
  1361     EUNIT_ASSERT( newSdpLines->MdcaCount() == 1 );
       
  1362     EUNIT_ASSERT( newSdpLines->MdcaPoint( 0 ) == KMusEngSessionSdpLineBandwidthField() );
       
  1363     }
       
  1364     
       
  1365 
       
  1366 // -----------------------------------------------------------------------------
       
  1367 //
       
  1368 // -----------------------------------------------------------------------------
       
  1369 // 
       
  1370 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_SdpBandwidthAttributesL()
       
  1371     {
       
  1372     CRepository::SetStubGlobal( MusSettingsKeys::KVideoBandwidth,
       
  1373                                 128 );
       
  1374 
       
  1375     // 1. Session without bandwidth attributes. => b=AS and b=TIAS will be
       
  1376     //    taken at media level
       
  1377     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
  1378 
       
  1379     iReceiveSession->iSession = inSession; // Transfers ownership
       
  1380     CleanupStack::Pop( inSession );
       
  1381 
       
  1382     iReceiveSession->CompleteSessionStructureL();
       
  1383 
       
  1384     // Ensure b=AS and b=TIAS present at media level only
       
  1385     MDesC8Array* newSdpLines = iReceiveSession->iSession->iSessionSDPLines;
       
  1386     EUNIT_ASSERT( newSdpLines->MdcaCount() == 1 );
       
  1387     EUNIT_ASSERT( newSdpLines->MdcaPoint( 0 ) == KMusEngSessionSdpLineXApplication() );
       
  1388 
       
  1389     // Ensure b=AS and b=TIAS present at media level
       
  1390     EUNIT_ASSERT( iReceiveSession->iSession->Streams().Count() > 0 );
       
  1391     newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->iMediaSDPLines;
       
  1392     EUNIT_ASSERT( newSdpLines );
       
  1393     EUNIT_ASSERT( newSdpLines->MdcaCount() == 2 );
       
  1394     EUNIT_ASSERT( newSdpLines->MdcaPoint( 0 ).Find(
       
  1395                   KMusEngSessionSdpLineBandwidthLine() ) == 0 );
       
  1396     EUNIT_ASSERT( newSdpLines->MdcaPoint( 1 ).Find( 
       
  1397                   KMusEngSessionSdpLineTiasLine() ) == 0 );    
       
  1398     
       
  1399     
       
  1400     // 2. Session with b=AS bandwidth attribute at session level
       
  1401     //     => b=AS and b=TIAS will be taken at session level
       
  1402     delete iReceiveSession->iSession;
       
  1403     iReceiveSession->iSession = NULL;
       
  1404     
       
  1405     inSession = ConstructInSessionLC( 1, 0 );
       
  1406     //setting session level SDP attributes
       
  1407     CDesC8Array* sdpLines = new ( ELeave ) CDesC8ArrayFlat( 1 );
       
  1408     CleanupStack::PushL( sdpLines );
       
  1409     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1410     inSession->SetSessionSDPLinesL( sdpLines );
       
  1411     CleanupStack::Pop( sdpLines );
       
  1412  
       
  1413     // Transfers ownership
       
  1414     iReceiveSession->iSession = inSession; 
       
  1415     CleanupStack::Pop( inSession );
       
  1416     
       
  1417     iReceiveSession->CompleteSessionStructureL();
       
  1418  
       
  1419     // Ensure b=AS and b=TIAS present at session level only 
       
  1420     newSdpLines = iReceiveSession->iSession->iSessionSDPLines;
       
  1421     EUNIT_ASSERT( newSdpLines );
       
  1422     EUNIT_ASSERT( newSdpLines->MdcaCount() == 3 );
       
  1423     EUNIT_ASSERT( newSdpLines->MdcaPoint( 0 ) == KMusEngSessionSdpLineXApplication() );
       
  1424     EUNIT_ASSERT( newSdpLines->MdcaPoint( 1 ).Find ( 
       
  1425                   KMusEngSessionSdpLineBandwidthLine() ) == 0 );
       
  1426     EUNIT_ASSERT( newSdpLines->MdcaPoint( 2 ).Find( 
       
  1427                   KMusEngSessionSdpLineTiasLine() ) == 0 );    
       
  1428 
       
  1429     EUNIT_ASSERT( iReceiveSession->iSession->Streams().Count() > 0 );    
       
  1430     newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->iMediaSDPLines;
       
  1431     EUNIT_ASSERT( newSdpLines );
       
  1432     EUNIT_ASSERT( newSdpLines->MdcaCount() == 0 );
       
  1433 
       
  1434     // 3. Session with b=AS bandwidth attribute at media level
       
  1435     //     => b=AS and b=TIAS will be taken at media level
       
  1436     delete iReceiveSession->iSession;
       
  1437     iReceiveSession->iSession = NULL;
       
  1438     
       
  1439     inSession = ConstructInSessionLC( 1, 0 );
       
  1440     //setting media level SDP attributes
       
  1441     sdpLines = new ( ELeave ) CDesC8ArrayFlat( 1 );
       
  1442     CleanupStack::PushL( sdpLines );
       
  1443     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1444     inSession->Streams()[ 0 ]->SetMediaAttributeLinesL( sdpLines );
       
  1445     CleanupStack::Pop( sdpLines );
       
  1446  
       
  1447     // Transfers ownership
       
  1448     iReceiveSession->iSession = inSession; 
       
  1449     CleanupStack::Pop( inSession );
       
  1450     
       
  1451     iReceiveSession->CompleteSessionStructureL();
       
  1452  
       
  1453     // Ensure b=AS and b=TIAS present only at media level 
       
  1454     newSdpLines = iReceiveSession->iSession->iSessionSDPLines;
       
  1455     EUNIT_ASSERT( newSdpLines );
       
  1456     EUNIT_ASSERT( newSdpLines->MdcaCount() == 1 );
       
  1457     EUNIT_ASSERT( newSdpLines->MdcaPoint( 0 ) == KMusEngSessionSdpLineXApplication() );
       
  1458 
       
  1459     EUNIT_ASSERT( iReceiveSession->iSession->Streams().Count() > 0 );    
       
  1460     newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->iMediaSDPLines;
       
  1461     EUNIT_ASSERT( newSdpLines );
       
  1462     EUNIT_ASSERT( newSdpLines->MdcaCount() == 2 );
       
  1463     EUNIT_ASSERT( newSdpLines->MdcaPoint( 0 ).Find ( 
       
  1464                   KMusEngSessionSdpLineBandwidthLine() ) == 0 );
       
  1465     EUNIT_ASSERT( newSdpLines->MdcaPoint( 1 ).Find( 
       
  1466                   KMusEngSessionSdpLineTiasLine() ) == 0 );    
       
  1467 
       
  1468    
       
  1469     // 4. Session with b=AS attribute at session level and
       
  1470     //    b=AS and b=TIAS at media level
       
  1471     //    => b=AS and b=TIAS will be taken at session and media level
       
  1472     delete iReceiveSession->iSession;
       
  1473     iReceiveSession->iSession = NULL;
       
  1474     
       
  1475     inSession = ConstructInSessionLC( 1, 0 );
       
  1476     //setting session level SDP attributes
       
  1477     sdpLines = new ( ELeave ) CDesC8ArrayFlat( 1 );
       
  1478     CleanupStack::PushL( sdpLines );
       
  1479     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1480     inSession->SetSessionSDPLinesL( sdpLines );
       
  1481     CleanupStack::Pop( sdpLines );
       
  1482  
       
  1483     //setting media level SDP attributes
       
  1484     sdpLines = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1485     CleanupStack::PushL( sdpLines );
       
  1486     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1487     sdpLines->AppendL( KMusEngSessionSdpLineTiasLine() );
       
  1488     inSession->Streams()[ 0 ]->SetMediaAttributeLinesL( sdpLines );
       
  1489     CleanupStack::Pop( sdpLines );
       
  1490 
       
  1491     // Transfers ownership
       
  1492     iReceiveSession->iSession = inSession; 
       
  1493     CleanupStack::Pop( inSession );
       
  1494     
       
  1495     iReceiveSession->CompleteSessionStructureL();
       
  1496  
       
  1497     // Ensure b=AS and b=TIAS present at session and media level 
       
  1498     newSdpLines = iReceiveSession->iSession->iSessionSDPLines;
       
  1499     EUNIT_ASSERT( newSdpLines );
       
  1500     EUNIT_ASSERT( newSdpLines->MdcaCount() == 3 );
       
  1501     EUNIT_ASSERT( newSdpLines->MdcaPoint( 0 ) == KMusEngSessionSdpLineXApplication() );
       
  1502     EUNIT_ASSERT( newSdpLines->MdcaPoint( 1 ).Find ( 
       
  1503                   KMusEngSessionSdpLineBandwidthLine() ) == 0 );
       
  1504     EUNIT_ASSERT( newSdpLines->MdcaPoint( 2 ).Find( 
       
  1505                   KMusEngSessionSdpLineTiasLine() ) == 0 );    
       
  1506 
       
  1507     EUNIT_ASSERT( iReceiveSession->iSession->Streams().Count() > 0 );    
       
  1508     newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->iMediaSDPLines;
       
  1509     EUNIT_ASSERT( newSdpLines );
       
  1510     EUNIT_ASSERT( newSdpLines->MdcaCount() == 2 );
       
  1511     EUNIT_ASSERT( newSdpLines->MdcaPoint( 0 ).Find ( 
       
  1512                   KMusEngSessionSdpLineBandwidthLine() ) == 0 );
       
  1513     EUNIT_ASSERT( newSdpLines->MdcaPoint( 1 ).Find( 
       
  1514                   KMusEngSessionSdpLineTiasLine() ) == 0 );
       
  1515     }
       
  1516 
       
  1517     
       
  1518 // -----------------------------------------------------------------------------
       
  1519 //
       
  1520 // -----------------------------------------------------------------------------
       
  1521 // 
       
  1522 void UT_CMusEngReceiveSession::UT_ParseAssertedIdentityL()
       
  1523     {  
       
  1524     _LIT8( KMusEngAssertedIdentitySip, "P-Asserted-Identity: sip:fluffy@cisco.com" );
       
  1525     _LIT8( KMusEngIdentitySip, "fluffy" );
       
  1526     _LIT8( KMusEngAssertedIdentityTel, "P-Asserted-Identity: tel:+14085264000" );
       
  1527     _LIT8( KMusEngAssertedIdentityTelBrace, "P-Asserted-Identity: <tel:+14085264000>" );
       
  1528     _LIT8( KMusEngIdentityTel, "+14085264000" );
       
  1529     _LIT8( KMusEngTestHeader, "Some header" );
       
  1530     
       
  1531     _LIT8( KMusEngAssertedIdentityInvalid, "P-Asserted-Identity: sip:fluffy cisco.com" );
       
  1532 
       
  1533     TMceTransactionDataContainer container;
       
  1534     CDesC8Array* headers;
       
  1535 
       
  1536     // only sip uri in asserted identity header 
       
  1537     headers = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1538     CleanupStack::PushL( headers );
       
  1539     headers->AppendL( KMusEngTestHeader );
       
  1540     headers->AppendL( KMusEngAssertedIdentitySip );
       
  1541     container.SetHeaders( headers );
       
  1542     CleanupStack::Pop( headers );
       
  1543     iReceiveSession->ParseAssertedIdentity( &container );    
       
  1544     container.Clear(); 
       
  1545     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KMusEngIdentitySip )
       
  1546     
       
  1547     // sip && tel uris in asserted identity headers
       
  1548     headers = new ( ELeave ) CDesC8ArrayFlat( 3 );
       
  1549     CleanupStack::PushL( headers );
       
  1550     headers->AppendL( KMusEngTestHeader );
       
  1551     headers->AppendL( KMusEngAssertedIdentitySip );
       
  1552     headers->AppendL( KMusEngAssertedIdentityTel );    
       
  1553     container.SetHeaders( headers );
       
  1554     CleanupStack::Pop( headers );
       
  1555     iReceiveSession->ParseAssertedIdentity( &container );    
       
  1556     container.Clear();  
       
  1557     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KMusEngIdentityTel )    
       
  1558     
       
  1559     // tel uri with braces in asserted identity header 
       
  1560     headers = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1561     CleanupStack::PushL( headers );
       
  1562     headers->AppendL( KMusEngTestHeader );
       
  1563     headers->AppendL( KMusEngAssertedIdentityTelBrace );
       
  1564     container.SetHeaders( headers );
       
  1565     CleanupStack::Pop( headers );
       
  1566     iReceiveSession->ParseAssertedIdentity( &container );    
       
  1567     container.Clear(); 
       
  1568     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KMusEngIdentityTel )    
       
  1569     
       
  1570    // invalid uri in asserted identity header
       
  1571     headers = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1572     CleanupStack::PushL( headers );
       
  1573     headers->AppendL( KMusEngTestHeader );
       
  1574     headers->AppendL( KMusEngAssertedIdentityInvalid );
       
  1575     container.SetHeaders( headers );
       
  1576     CleanupStack::Pop( headers );
       
  1577     iReceiveSession->ParseAssertedIdentity( &container );    
       
  1578     container.Clear(); 
       
  1579     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KNullDesC8 )    
       
  1580     
       
  1581     // null container
       
  1582     iReceiveSession->ParseAssertedIdentity( NULL );
       
  1583     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KNullDesC8 )    
       
  1584     
       
  1585     // null header
       
  1586     iReceiveSession->ParseAssertedIdentity( &container );
       
  1587     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KNullDesC8 )    
       
  1588     }
       
  1589 
       
  1590 // -----------------------------------------------------------------------------
       
  1591 // 
       
  1592 // -----------------------------------------------------------------------------
       
  1593 //
       
  1594 void UT_CMusEngReceiveSession::UT_ContactSavingLL()
       
  1595     {
       
  1596     ContactEngineStubHelper::Reset();
       
  1597     
       
  1598     // Saving of contact is done at destruction phase only if originator value
       
  1599     // exists
       
  1600     //
       
  1601     CMusEngReceiveSession* receiveSession = CMusEngReceiveSession::NewL();
       
  1602     receiveSession->SetLcSessionObserver( iLcSessionObserver );    
       
  1603     delete receiveSession;
       
  1604     receiveSession = NULL;
       
  1605     EUNIT_ASSERT( ContactEngineStubHelper::GetCalledFunction() == EContactEngineStubNone );
       
  1606     
       
  1607     
       
  1608     User::LeaveIfError( RProperty::Set( NMusSessionApi::KCategoryUid,
       
  1609                                         NMusSessionApi::KContactId,
       
  1610                                         2 ) );
       
  1611     User::LeaveIfError( RProperty::Set( NMusSessionApi::KCategoryUid,
       
  1612                                         NMusSessionApi::KTelNumber,
       
  1613                                         _L("12341234") ) );
       
  1614     
       
  1615     receiveSession = CMusEngReceiveSession::NewL();
       
  1616     CleanupStack::PushL( receiveSession );
       
  1617     receiveSession->SetLcSessionObserver( iLcSessionObserver );
       
  1618     delete receiveSession->iOriginator;
       
  1619     receiveSession->iOriginator = NULL;
       
  1620     receiveSession->iOriginator = _L8("sip:yep@10.10.10.10").AllocL();
       
  1621     CleanupStack::PopAndDestroy( receiveSession );
       
  1622     if ( ContactEngineStubHelper::GetCalledFunction() != EContactEngineStubSetText )
       
  1623         {
       
  1624         // out-of-memory was trap ignored and saving failed because of that
       
  1625         User::Leave( KErrNoMemory );
       
  1626         }
       
  1627     EUNIT_ASSERT( ContactEngineStubHelper::GetCalledFunction() == EContactEngineStubSetText );
       
  1628     }
       
  1629 
       
  1630 // -----------------------------------------------------------------------------
       
  1631 // 
       
  1632 // -----------------------------------------------------------------------------
       
  1633 //
       
  1634 void UT_CMusEngReceiveSession::UT_IsDisplayActive()
       
  1635     {
       
  1636     // Display is active only if receiving and display is explicitly enabled
       
  1637     CMceInSession* inSession = ConstructInSessionLC( 1, 1 );
       
  1638     iReceiveSession->iSession = inSession; // Transfers ownership
       
  1639     CleanupStack::Pop( inSession );
       
  1640     iReceiveSession->EnableDisplayL( ETrue );
       
  1641     EUNIT_ASSERT( !iReceiveSession->IsDisplayActive() )
       
  1642     iReceiveSession->iReceiving = ETrue;
       
  1643     EUNIT_ASSERT( iReceiveSession->IsDisplayActive() )
       
  1644     }
       
  1645 
       
  1646 // -----------------------------------------------------------------------------
       
  1647 //
       
  1648 // -----------------------------------------------------------------------------
       
  1649 //
       
  1650 void UT_CMusEngReceiveSession::UT_InactivityTimeoutL()
       
  1651     {
       
  1652     // Not receiving, no effect
       
  1653     iReceiveSession->iReceiving = EFalse;
       
  1654     CMceVideoStream* videoStream = CMceVideoStream::NewLC();
       
  1655     CMceRtpSource* rtpSource = CMceRtpSource::NewLC();
       
  1656     iReceiveSession->InactivityTimeout( *videoStream, *rtpSource );
       
  1657     EUNIT_ASSERT( iLcSessionObserver->IsReseted() );
       
  1658     
       
  1659     // Receiving, state change is notified and
       
  1660     // receiving and buffering status are cleared
       
  1661     iReceiveSession->iBuffered = ETrue;
       
  1662     iReceiveSession->iReceiving = ETrue;
       
  1663     iReceiveSession->InactivityTimeout( *videoStream, *rtpSource );
       
  1664     EUNIT_ASSERT_EQUALS( iLcSessionObserver->iCalledFunction, 
       
  1665                          CLcSessionObserverStub::EPlayerStateChanged );
       
  1666     EUNIT_ASSERT( !iReceiveSession->iReceiving );
       
  1667     EUNIT_ASSERT( !iReceiveSession->iBuffered );
       
  1668     CleanupStack::PopAndDestroy( rtpSource );
       
  1669     CleanupStack::PopAndDestroy( videoStream );
       
  1670     }
       
  1671 
       
  1672 
       
  1673 //  TEST TABLE
       
  1674 
       
  1675 EUNIT_BEGIN_TEST_TABLE(
       
  1676     UT_CMusEngReceiveSession,
       
  1677     "UT_CMusEngReceiveSesssion",
       
  1678     "UNIT" )
       
  1679 
       
  1680 EUNIT_TEST(
       
  1681     "NewL - test ",
       
  1682     "CMusEngReceiveSession",
       
  1683     "NewL",
       
  1684     "FUNCTIONALITY",
       
  1685     SetupL, UT_NewLL, Teardown)
       
  1686 
       
  1687 EUNIT_TEST(
       
  1688     "LcSessionState - test ",
       
  1689     "CMusEngReceiveSession",
       
  1690     "LcSessionState",
       
  1691     "FUNCTIONALITY",
       
  1692     SetupL, UT_LcSessionStateL, Teardown)
       
  1693     
       
  1694 EUNIT_TEST(
       
  1695     "EstablishLcSessionL - test ",
       
  1696     "CMusEngReceiveSession",
       
  1697     "EstablishLcSessionL",
       
  1698     "FUNCTIONALITY",
       
  1699     SetupL, UT_EstablishLcSessionL, Teardown)    
       
  1700     
       
  1701 EUNIT_TEST(
       
  1702     "TerminateLcSessionL - test ",
       
  1703     "CMusEngReceiveSession",
       
  1704     "TerminateLcSessionL",
       
  1705     "FUNCTIONALITY",
       
  1706     SetupL, UT_TerminateLcSessionL, Teardown)
       
  1707 
       
  1708 EUNIT_TEST(
       
  1709     "RemoteVideoPlayer - test ",
       
  1710     "CMusEngReceiveSession",
       
  1711     "RemoteVideoPlayer",
       
  1712     "FUNCTIONALITY",
       
  1713     SetupL, UT_RemoteVideoPlayerL, Teardown)
       
  1714     
       
  1715 EUNIT_TEST(
       
  1716     "RemoteDisplayName - test ",
       
  1717     "CMusEngReceiveSession",
       
  1718     "RemoteDisplayName",
       
  1719     "FUNCTIONALITY",
       
  1720     SetupL, UT_RemoteDisplayName, Teardown)
       
  1721 
       
  1722 EUNIT_TEST(
       
  1723     "HandleSessionStateChanged - test ",
       
  1724     "CMusEngReceiveSession",
       
  1725     "HandleSessionStateChanged",
       
  1726     "FUNCTIONALITY",
       
  1727     SetupL, UT_HandleSessionStateChangedL, Teardown)
       
  1728 
       
  1729 EUNIT_TEST(
       
  1730     "AdjustVideoCodecL - test ",
       
  1731     "CMusEngReceiveSession",
       
  1732     "AdjustVideoCodecL",
       
  1733     "FUNCTIONALITY",
       
  1734     SetupL, UT_AdjustVideoCodecLL, Teardown)
       
  1735 
       
  1736 EUNIT_TEST(
       
  1737     "AdjustAudioCodecL - test ",
       
  1738     "CMusEngReceiveSession",
       
  1739     "AdjustAudioCodecL",
       
  1740     "FUNCTIONALITY",
       
  1741     SetupL, UT_AdjustAudioCodecLL, Teardown)
       
  1742 
       
  1743 EUNIT_TEST(
       
  1744     "DoCodecSelectionL - test ",
       
  1745     "CMusEngReceiveSession",
       
  1746     "DoCodecSelectionL",
       
  1747     "FUNCTIONALITY",
       
  1748     SetupL, UT_DoCodecSelectionLL, Teardown)
       
  1749 
       
  1750 EUNIT_TEST(
       
  1751     "IncomingSession - test ",
       
  1752     "CMusEngReceiveSession",
       
  1753     "IncomingSession",
       
  1754     "FUNCTIONALITY",
       
  1755     SetupL, UT_IncomingSessionL, Teardown)
       
  1756 
       
  1757 EUNIT_TEST(
       
  1758     "IncomingUpdate - test ",
       
  1759     "CMusEngReceiveSession",
       
  1760     "IncomingUpdate",
       
  1761     "FUNCTIONALITY",
       
  1762     SetupL, UT_IncomingUpdateL, Teardown)
       
  1763 
       
  1764 EUNIT_TEST(
       
  1765     "StreamStateChanged - test ",
       
  1766     "CMusEngReceiveSession",
       
  1767     "StreamStateChanged",
       
  1768     "FUNCTIONALITY",
       
  1769     SetupL, UT_StreamStateChangedL, Teardown)
       
  1770 
       
  1771 EUNIT_TEST(
       
  1772     "UT_CompleteSessionStructureL_WithoutSessionL - test without a session",
       
  1773     "CMusEngReceiveSession",
       
  1774     "CompleteSessionStructureL",
       
  1775     "FUNCTIONALITY",
       
  1776     SetupL, UT_CompleteSessionStructureL_WithoutSessionL, Teardown)
       
  1777 
       
  1778 EUNIT_TEST(
       
  1779     "UT_CompleteSessionStructureL_WithoutStreamsL - without streams",
       
  1780     "CMusEngReceiveSession",
       
  1781     "CompleteSessionStructureL",
       
  1782     "FUNCTIONALITY",
       
  1783     SetupL, UT_CompleteSessionStructureL_WithoutStreamsL, Teardown)
       
  1784 
       
  1785 EUNIT_TEST(
       
  1786     "UT_CompleteSessionStructureL_WithOutgoingStreamL - with outgoing stream",
       
  1787     "CMusEngReceiveSession",
       
  1788     "CompleteSessionStructureL",
       
  1789     "FUNCTIONALITY",
       
  1790     SetupL, UT_CompleteSessionStructureL_WithOutgoingStreamL, Teardown)
       
  1791 
       
  1792 EUNIT_TEST(
       
  1793     "UT_CompleteSessionStructureL_WithVideoInL - with video in stream",
       
  1794     "CMusEngReceiveSession",
       
  1795     "CompleteSessionStructureL",
       
  1796     "FUNCTIONALITY",
       
  1797     SetupL, UT_CompleteSessionStructureL_WithVideoInL, Teardown)
       
  1798 
       
  1799 EUNIT_TEST(
       
  1800     "UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL - with sendrecv video, video out bound to video in",
       
  1801     "CMusEngReceiveSession",
       
  1802     "CompleteSessionStructureL",
       
  1803     "FUNCTIONALITY",
       
  1804     SetupL, UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL, Teardown)
       
  1805 
       
  1806 EUNIT_TEST(
       
  1807     "UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL - with sendrecv video, video in bound to video out",
       
  1808     "CMusEngReceiveSession",
       
  1809     "CompleteSessionStructureL",
       
  1810     "FUNCTIONALITY",
       
  1811     SetupL, UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL, Teardown)
       
  1812 
       
  1813 EUNIT_TEST(
       
  1814     "UT_CompleteSessionStructureL_WithMultipleVideoInsL - with multiple video in streams",
       
  1815     "CMusEngReceiveSession",
       
  1816     "CompleteSessionStructureL",
       
  1817     "FUNCTIONALITY",
       
  1818     SetupL, UT_CompleteSessionStructureL_WithMultipleVideoInsL, Teardown)
       
  1819         
       
  1820 EUNIT_TEST(
       
  1821     "CompleteSessionStructureL - test one video and multiple  audio streams",
       
  1822     "CMusEngReceiveSession",
       
  1823     "CompleteSessionStructureL",
       
  1824     "FUNCTIONALITY",
       
  1825     SetupL, UT_CompleteSessionStructureL_WithVideoAndMultipleAudioInsL, Teardown)
       
  1826     
       
  1827 EUNIT_TEST(
       
  1828     "CompleteSessionStructureL - test operator variant",
       
  1829     "CMusEngReceiveSession",
       
  1830     "CompleteSessionStructureL",
       
  1831     "FUNCTIONALITY",
       
  1832     SetupL, UT_CompleteSessionStructureL_OperatorVariant, Teardown)
       
  1833    
       
  1834 EUNIT_TEST(
       
  1835     "CompleteSessionStructureL - test SDP bandwidth attributes handling",
       
  1836     "CMusEngReceiveSession",
       
  1837     "CompleteSessionStructureL",
       
  1838     "FUNCTIONALITY",
       
  1839     SetupL, UT_CompleteSessionStructureL_SdpBandwidthAttributesL, Teardown)
       
  1840 
       
  1841 EUNIT_TEST(
       
  1842     "ParseAssertedIdentity",
       
  1843     "CMusEngReceiveSession",
       
  1844     "ParseAssertedIdentity",
       
  1845     "FUNCTIONALITY",
       
  1846     SetupL, UT_ParseAssertedIdentityL, Teardown)
       
  1847       
       
  1848 EUNIT_TEST(
       
  1849     "ContactSavingL - test",
       
  1850     "CMusEngReceiveSession",
       
  1851     "ContactSavingL",
       
  1852     "FUNCTIONALITY",
       
  1853     SetupL, UT_ContactSavingLL, Teardown)
       
  1854 
       
  1855 EUNIT_TEST(
       
  1856     "IsDisplayActive - test",
       
  1857     "CMusEngReceiveSession",
       
  1858     "IsDisplayActive",
       
  1859     "FUNCTIONALITY",
       
  1860     SetupL, UT_IsDisplayActive, Teardown)
       
  1861     
       
  1862 EUNIT_TEST(
       
  1863     "InactivityTimeout - test ",
       
  1864     "CMusEngReceiveSession",
       
  1865     "InactivityTimeout",
       
  1866     "FUNCTIONALITY",
       
  1867     SetupL, UT_InactivityTimeoutL, Teardown)      
       
  1868     
       
  1869 EUNIT_END_TEST_TABLE
       
  1870 
       
  1871 //  END OF FILE
       
  1872 
       
  1873