mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengreceivesession.cpp
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     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 "centralrepository.h"
       
    25 
       
    26 //  SYSTEM INCLUDES
       
    27 #include <digia/eunit/eunitmacros.h>
       
    28 
       
    29 #include <mceinsession.h>
       
    30 #include <mcestreambundle.h>
       
    31 #include <mcevideostream.h>
       
    32 #include <mceaudiostream.h>
       
    33 #include <mcertpsource.h>
       
    34 #include <mcedisplaysink.h>
       
    35 #include <mcespeakersink.h>
       
    36 #include <mcecamerasource.h>
       
    37 #include <mcefilesource.h>
       
    38 #include <mcertpsink.h>
       
    39 #include <mceaudiocodec.h>
       
    40 #include <mceh263codec.h>
       
    41 #include <mceavccodec.h>
       
    42 
       
    43 #include <audiopreference.h>
       
    44 
       
    45 
       
    46 
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 UT_CMusEngReceiveSession* UT_CMusEngReceiveSession::NewL()
       
    53     {
       
    54     UT_CMusEngReceiveSession* self = UT_CMusEngReceiveSession::NewLC();
       
    55     CleanupStack::Pop( self );
       
    56     return self;
       
    57     }
       
    58 
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 // -----------------------------------------------------------------------------
       
    63 // 
       
    64 UT_CMusEngReceiveSession* UT_CMusEngReceiveSession::NewLC()
       
    65     {
       
    66     UT_CMusEngReceiveSession* self = new( ELeave ) UT_CMusEngReceiveSession();
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL();
       
    69     return self;
       
    70     }
       
    71 
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 UT_CMusEngReceiveSession::~UT_CMusEngReceiveSession()
       
    78     {
       
    79     // NOP
       
    80     }
       
    81 
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // Default constructor
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 UT_CMusEngReceiveSession::UT_CMusEngReceiveSession()
       
    88     {
       
    89     // NOP
       
    90     }
       
    91 
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // Second phase construct
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 void UT_CMusEngReceiveSession::ConstructL()
       
    98     {
       
    99     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
   100     // It generates the test case table.
       
   101     CEUnitTestSuiteClass::ConstructL();
       
   102     }
       
   103     
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 void UT_CMusEngReceiveSession::SetupL(  )
       
   110     {
       
   111     CRepository::iStaticEncoderUid = 0;
       
   112     iObserver = new( ELeave ) CMusEngObserverStub;
       
   113     iReceiveSession = CMusEngReceiveSession::NewL( TRect(0,0, 100,100), 
       
   114                                                    *iObserver,
       
   115                                                    *iObserver );
       
   116     
       
   117     }
       
   118 
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 void UT_CMusEngReceiveSession::Teardown(  )
       
   125     {
       
   126     delete iReceiveSession;
       
   127     delete iObserver;
       
   128     CRepository::iStaticEncoderUid = 0;
       
   129     
       
   130     }
       
   131 
       
   132 
       
   133 // TEST HELPERS
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 CMceVideoStream* UT_CMusEngReceiveSession::ConstructVideoInStreamLC()
       
   140     {
       
   141     CMceVideoStream* videoStream = CMceVideoStream::NewLC();
       
   142     
       
   143     videoStream->SetSourceL( CMceRtpSource::NewLC() );
       
   144     CleanupStack::Pop();
       
   145     
       
   146     videoStream->AddSinkL( 
       
   147                 CMceDisplaySink::NewLC( *iReceiveSession->iManager ) );
       
   148     CleanupStack::Pop();    
       
   149     
       
   150     return videoStream;
       
   151     }
       
   152 
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 //
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 CMceVideoStream* UT_CMusEngReceiveSession::ConstructVideoOutStreamLC()
       
   159     {
       
   160     CMceVideoStream* videoStream = CMceVideoStream::NewLC();    
       
   161        
       
   162     videoStream->SetSourceL( 
       
   163                 CMceCameraSource::NewLC( *iReceiveSession->iManager ) );
       
   164     CleanupStack::Pop();
       
   165     
       
   166     videoStream->AddSinkL( CMceRtpSink::NewLC() );
       
   167     CleanupStack::Pop();
       
   168     
       
   169     return videoStream;
       
   170     }    
       
   171 
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 // -----------------------------------------------------------------------------
       
   176 //   
       
   177 CMceAudioStream* UT_CMusEngReceiveSession::ConstructAudioInStreamLC()
       
   178     {
       
   179     CMceAudioStream* audioStream = CMceAudioStream::NewLC();
       
   180    
       
   181     audioStream->SetSourceL( CMceRtpSource::NewLC() );
       
   182     CleanupStack::Pop();
       
   183     
       
   184     audioStream->AddSinkL( CMceSpeakerSink::NewLC() );
       
   185     CleanupStack::Pop();
       
   186     
       
   187     return audioStream;
       
   188     }
       
   189 
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 //
       
   193 // -----------------------------------------------------------------------------
       
   194 //   
       
   195 CMceAudioStream* UT_CMusEngReceiveSession::ConstructAudioOutStreamLC()
       
   196     {
       
   197     CMceAudioStream* audioStream = CMceAudioStream::NewLC();
       
   198 
       
   199     audioStream->SetSourceL( 
       
   200         CMceFileSource::NewLC( *iReceiveSession->iManager, KNullDesC() ) );
       
   201     CleanupStack::Pop();
       
   202     
       
   203     audioStream->AddSinkL( CMceRtpSink::NewLC() );
       
   204     CleanupStack::Pop();
       
   205 
       
   206     return audioStream;
       
   207 
       
   208     }
       
   209                                                  
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // Helper to construct incoming sessions.
       
   213 // -----------------------------------------------------------------------------
       
   214 //
       
   215 CMceInSession* UT_CMusEngReceiveSession::ConstructInSessionLC( 
       
   216                                              TInt aVideoStreamCount,
       
   217                                              TInt aAudioStreamCount,
       
   218                                              TBool aConstructSinks )
       
   219     {
       
   220     CMceInSession* inSession = CMceInSession::NewL( 
       
   221                                         *(iReceiveSession->iManager), 
       
   222                                         KTestOriginator() );
       
   223     CleanupStack::PushL( inSession );
       
   224                                         
       
   225     for ( TInt i = 0; i < aVideoStreamCount; ++i )
       
   226         {
       
   227         CMceVideoStream* videoStream = CMceVideoStream::NewLC();
       
   228         
       
   229         CMceRtpSource* rtpSource = CMceRtpSource::NewLC();
       
   230         videoStream->SetSourceL( rtpSource );
       
   231         CleanupStack::Pop( rtpSource );
       
   232         
       
   233         if ( aConstructSinks )
       
   234             {
       
   235             CMceDisplaySink* display = CMceDisplaySink::NewLC( 
       
   236                                                 *(iReceiveSession->iManager) );
       
   237             videoStream->AddSinkL( display );
       
   238             CleanupStack::Pop( display );
       
   239             }
       
   240         
       
   241         inSession->AddStreamL( videoStream );
       
   242         CleanupStack::Pop( videoStream );
       
   243         }
       
   244     
       
   245     for ( TInt i = 0; i < aAudioStreamCount; ++i )
       
   246         {
       
   247         CMceAudioStream* audioStream = CMceAudioStream::NewLC();
       
   248         
       
   249         CMceRtpSource* rtpSource = CMceRtpSource::NewLC();
       
   250         audioStream->SetSourceL( rtpSource );
       
   251         CleanupStack::Pop( rtpSource );
       
   252         
       
   253         if ( aConstructSinks )
       
   254             {
       
   255             CMceSpeakerSink* speaker = CMceSpeakerSink::NewLC();
       
   256             audioStream->AddSinkL( speaker );
       
   257             CleanupStack::Pop( speaker );
       
   258             }
       
   259         
       
   260         inSession->AddStreamL( audioStream );
       
   261         CleanupStack::Pop( audioStream );
       
   262         }    
       
   263     
       
   264     return inSession;
       
   265     }
       
   266                                              
       
   267                                              
       
   268 
       
   269 
       
   270 // TEST CASES
       
   271 
       
   272 
       
   273 // -----------------------------------------------------------------------------
       
   274 //
       
   275 // -----------------------------------------------------------------------------
       
   276 //
       
   277 void UT_CMusEngReceiveSession::UT_NewLL(  )
       
   278     {
       
   279     EUNIT_ASSERT( iReceiveSession );
       
   280     EUNIT_ASSERT( !iReceiveSession->iSession );
       
   281     }
       
   282 
       
   283 
       
   284 // -----------------------------------------------------------------------------
       
   285 //
       
   286 // -----------------------------------------------------------------------------
       
   287 //
       
   288 void UT_CMusEngReceiveSession::UT_AcceptInvitationLL()
       
   289     {
       
   290     TMceTransactionDataContainer container;
       
   291     
       
   292     // There is no pending session to accept, must fail
       
   293     TRAPD( error, iReceiveSession->AcceptInvitationL( ETrue ) );
       
   294     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   295     EUNIT_ASSERT( error == KErrNotReady );
       
   296 
       
   297     // There is pending session, but it is not yet reserved resources,
       
   298     // so accepting fails
       
   299     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   300     iReceiveSession->IncomingSession( inSession, &container );
       
   301     CleanupStack::Pop( inSession );
       
   302     
       
   303     TRAP( error, iReceiveSession->AcceptInvitationL( ETrue ) );
       
   304     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   305     EUNIT_ASSERT( error == KErrNotReady );
       
   306     
       
   307     // Simulate resource reservation and reject
       
   308     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   309     iReceiveSession->AcceptInvitationL( EFalse );
       
   310     
       
   311     EUNIT_ASSERT( iReceiveSession->iSession->iState ==
       
   312                   CMceSession::ETerminated );
       
   313     
       
   314     // Construct new session and reject it with operator variant
       
   315     inSession = ConstructInSessionLC( 1, 0 );
       
   316     iReceiveSession->IncomingSession( inSession, &container );
       
   317     CleanupStack::Pop( inSession );
       
   318     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   319     iReceiveSession->iOperatorVariant = ETrue;
       
   320     
       
   321     iReceiveSession->AcceptInvitationL( EFalse );
       
   322     
       
   323     EUNIT_ASSERT( iReceiveSession->iSession->iState ==
       
   324                   CMceSession::ETerminated );
       
   325 
       
   326     // Construct new session and accept it
       
   327     inSession = ConstructInSessionLC( 1, 0 );
       
   328     iReceiveSession->IncomingSession( inSession, &container );
       
   329     CleanupStack::Pop( inSession );
       
   330     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   331 
       
   332     iReceiveSession->AcceptInvitationL( ETrue );   
       
   333     
       
   334     EUNIT_ASSERT( iReceiveSession->iSession );
       
   335     EUNIT_ASSERT( iReceiveSession->iSession == inSession );
       
   336     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   337                   CMceSession::EAnswering );
       
   338     
       
   339     
       
   340     }    
       
   341 
       
   342 
       
   343 // -----------------------------------------------------------------------------
       
   344 //
       
   345 // -----------------------------------------------------------------------------
       
   346 //
       
   347 void UT_CMusEngReceiveSession::UT_HandleSessionStateChangedL()
       
   348     {
       
   349     // Unknown session, let the base class handle 
       
   350     CMceInSession* inSession = ConstructInSessionLC( 1, 1 );
       
   351 
       
   352     iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() );
       
   353     
       
   354     // Simulate incoming session
       
   355     TMceTransactionDataContainer container;
       
   356     
       
   357     iReceiveSession->IncomingSession( inSession, &container ); 
       
   358     CleanupStack::Pop( inSession );
       
   359     
       
   360     // Session is in state EReserving, let the base class handle
       
   361     iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() );
       
   362     
       
   363     // The normal cases:
       
   364     
       
   365     // 1 ) First transition to state EProceeding, user and remote end should
       
   366     //     be notified
       
   367     inSession->iState = CMceSession::EProceeding;
       
   368     
       
   369     iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() );
       
   370     EUNIT_ASSERT( iObserver->iIncomingSessionCalled )
       
   371     EUNIT_ASSERT( iReceiveSession->iRingLCalled )
       
   372     iObserver->Reset();
       
   373     
       
   374     // 2 ) Now simulate second transition to EProceeding state which can happen
       
   375     //     if we force 100rel to be used. User and remote end should not be 
       
   376     //     notified anymore but change should be ignored.
       
   377     iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() );
       
   378     EUNIT_ASSERT( iObserver->IsReseted() )
       
   379     iObserver->Reset();
       
   380     
       
   381     }
       
   382 
       
   383 
       
   384 // -----------------------------------------------------------------------------
       
   385 //
       
   386 // -----------------------------------------------------------------------------
       
   387 // 
       
   388 void UT_CMusEngReceiveSession::UT_AdjustVideoCodecLL()
       
   389     {
       
   390     CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() );    
       
   391     CMceVideoCodec* codecH2632000 = CMceH263Codec::NewLC( KMceSDPNameH2632000() );
       
   392     CMceVideoCodec* codecAvc = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   393     CMceVideoCodec* codecUnknown = CMceH263Codec::NewLC( KNullDesC8() );
       
   394     
       
   395     iReceiveSession->AdjustVideoCodecL( *codecH263 );
       
   396     iReceiveSession->AdjustVideoCodecL( *codecH2632000 );
       
   397     iReceiveSession->AdjustVideoCodecL( *codecAvc );
       
   398     iReceiveSession->AdjustVideoCodecL( *codecUnknown );
       
   399     
       
   400     EUNIT_ASSERT_EQUALS( codecH263->KeepAliveTimer(), 5 )
       
   401     EUNIT_ASSERT_EQUALS( codecH263->KeepAlivePayloadType(), 96 )
       
   402     EUNIT_ASSERT_EQUALS( codecH263->KeepAliveData(), KNullDesC8() )
       
   403     
       
   404     EUNIT_ASSERT_EQUALS( codecH2632000->KeepAliveTimer(), 5 )
       
   405     EUNIT_ASSERT_EQUALS( codecH2632000->KeepAlivePayloadType(), 96 )
       
   406     EUNIT_ASSERT_EQUALS( codecH2632000->KeepAliveData(), KNullDesC8() )
       
   407     
       
   408     EUNIT_ASSERT_EQUALS( codecAvc->KeepAliveTimer(), 5 )
       
   409     EUNIT_ASSERT_EQUALS( codecAvc->KeepAlivePayloadType(), 98 )
       
   410     EUNIT_ASSERT_EQUALS( codecAvc->KeepAliveData(), KNullDesC8() )
       
   411     
       
   412     EUNIT_ASSERT_EQUALS( codecUnknown->KeepAliveTimer(), 5 )
       
   413     EUNIT_ASSERT_EQUALS( codecUnknown->KeepAlivePayloadType(), 0 )
       
   414     EUNIT_ASSERT_EQUALS( codecUnknown->KeepAliveData(), KNullDesC8() )
       
   415                 
       
   416     CleanupStack::PopAndDestroy( codecUnknown );
       
   417     CleanupStack::PopAndDestroy( codecAvc );
       
   418     CleanupStack::PopAndDestroy( codecH2632000 );
       
   419     CleanupStack::PopAndDestroy( codecH263 );
       
   420     }
       
   421     
       
   422 
       
   423 // -----------------------------------------------------------------------------
       
   424 //
       
   425 // -----------------------------------------------------------------------------
       
   426 // 
       
   427 void UT_CMusEngReceiveSession::UT_AdjustAudioCodecLL()
       
   428     {
       
   429     CMceAudioCodec* codec = 
       
   430                 iReceiveSession->iManager->SupportedAudioCodecs()[0]->CloneL();
       
   431     CleanupStack::PushL( codec );
       
   432     iReceiveSession->AdjustAudioCodecL( *codec );
       
   433     
       
   434     // Test keepalive timer
       
   435     
       
   436     TUint8 keepAliveTimer = codec->KeepAliveTimer();
       
   437     EUNIT_ASSERT( codec->KeepAliveTimer() == 5 )
       
   438     EUNIT_ASSERT( codec->KeepAlivePayloadType() == 97 )
       
   439     EUNIT_ASSERT( codec->KeepAliveData() == KNullDesC8() )
       
   440 
       
   441     // Test that base class has been called
       
   442     
       
   443     EUNIT_ASSERT( codec->iMMFPriority == KAudioPrioritySwisPlayback )
       
   444     EUNIT_ASSERT( codec->iMMFPriorityPreference == KAudioPrefSwisPlayback )
       
   445     
       
   446     CleanupStack::PopAndDestroy( codec );
       
   447     }
       
   448 
       
   449 
       
   450 // -----------------------------------------------------------------------------
       
   451 //
       
   452 // -----------------------------------------------------------------------------
       
   453 // 
       
   454 void UT_CMusEngReceiveSession::UT_DoCodecSelectionLL()
       
   455     {    
       
   456     // Check that Non-Interleaved AVC is preferred over single NAL 
       
   457     CMceVideoStream* videoStream = CMceVideoStream::NewLC();
       
   458     
       
   459     CMceVideoCodec* codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   460     codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal; 
       
   461     videoStream->AddCodecL( codecAvcSingleNal );
       
   462     CleanupStack::Pop( codecAvcSingleNal );
       
   463     
       
   464     CMceVideoCodec* codecAvcNonInterleaved = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   465     codecAvcNonInterleaved->iCodecMode = KMceAvcModeNonInterleaved;
       
   466     videoStream->AddCodecL( codecAvcNonInterleaved );
       
   467     CleanupStack::Pop( codecAvcNonInterleaved );
       
   468     
       
   469     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   470     
       
   471     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   472     EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->SdpName(), KMceSDPNameH264() )
       
   473     EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->CodecMode(),
       
   474                          KMceAvcModeNonInterleaved )
       
   475     
       
   476     CleanupStack::PopAndDestroy( videoStream );
       
   477                          
       
   478     // Check that Single NAL AVC is preferred over H263
       
   479     videoStream = CMceVideoStream::NewLC();
       
   480     
       
   481     CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() );    
       
   482     videoStream->AddCodecL( codecH263 );
       
   483     CleanupStack::Pop( codecH263 );
       
   484     
       
   485     codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   486     codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal; 
       
   487     videoStream->AddCodecL( codecAvcSingleNal );
       
   488     CleanupStack::Pop( codecAvcSingleNal );
       
   489 
       
   490     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   491     
       
   492     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   493     EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->SdpName(), KMceSDPNameH264() )
       
   494     EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->CodecMode(),
       
   495                          KMceAvcModeSingleNal )
       
   496                          
       
   497     CleanupStack::PopAndDestroy( videoStream );
       
   498     
       
   499     // Check that H263 codecs without AVC are handled correctly (in base class)
       
   500     videoStream = CMceVideoStream::NewLC();
       
   501     
       
   502     codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() );    
       
   503     videoStream->AddCodecL( codecH263 );
       
   504     CleanupStack::Pop( codecH263 );
       
   505     
       
   506     CMceVideoCodec* codecH2632000 = CMceH263Codec::NewLC( KMceSDPNameH2632000() );   
       
   507     videoStream->AddCodecL( codecH2632000 );
       
   508     CleanupStack::Pop( codecH2632000 );
       
   509     
       
   510     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   511     
       
   512     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   513     
       
   514     CleanupStack::PopAndDestroy( videoStream );
       
   515     
       
   516     // Check that AVC non-interleaved with best bitrate is preferred
       
   517     videoStream = CMceVideoStream::NewLC();
       
   518     
       
   519     codecAvcNonInterleaved = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   520     codecAvcNonInterleaved->iCodecMode = KMceAvcModeNonInterleaved;
       
   521     codecAvcNonInterleaved->SetMaxBitrateL( 80000 );
       
   522     videoStream->AddCodecL( codecAvcNonInterleaved );
       
   523     CleanupStack::Pop( codecAvcNonInterleaved );
       
   524     
       
   525     CMceVideoCodec* codecAvcNonInterleaved128 = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   526     codecAvcNonInterleaved128->iCodecMode = KMceAvcModeNonInterleaved;
       
   527     codecAvcNonInterleaved128->SetMaxBitrateL( 128000 );
       
   528     videoStream->AddCodecL( codecAvcNonInterleaved128 );
       
   529     CleanupStack::Pop( codecAvcNonInterleaved128 );
       
   530     
       
   531     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   532     
       
   533     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   534     EUNIT_ASSERT( videoStream->Codecs()[0] == codecAvcNonInterleaved128 )
       
   535 
       
   536     CleanupStack::PopAndDestroy( videoStream );
       
   537     
       
   538     // Check that in case of several AVC single NALs, the best bitrate is preferred
       
   539     videoStream = CMceVideoStream::NewLC();
       
   540     
       
   541     codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   542     codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal;
       
   543     codecAvcSingleNal->SetMaxBitrateL( 80000 );
       
   544     videoStream->AddCodecL( codecAvcSingleNal );
       
   545     CleanupStack::Pop( codecAvcSingleNal );
       
   546     
       
   547     CMceVideoCodec* codecAvcSingleNal128 = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   548     codecAvcSingleNal128->iCodecMode = KMceAvcModeSingleNal;
       
   549     codecAvcSingleNal128->SetMaxBitrateL( 128000 );
       
   550     videoStream->AddCodecL( codecAvcSingleNal128 );
       
   551     CleanupStack::Pop( codecAvcSingleNal128 );
       
   552     
       
   553     iReceiveSession->DoCodecSelectionL( *videoStream );
       
   554     
       
   555     EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 )
       
   556     EUNIT_ASSERT( videoStream->Codecs()[0] == codecAvcSingleNal128 )
       
   557 
       
   558     CleanupStack::PopAndDestroy( videoStream );
       
   559    
       
   560     }
       
   561             
       
   562 
       
   563 // -----------------------------------------------------------------------------
       
   564 //
       
   565 // -----------------------------------------------------------------------------
       
   566 //    
       
   567 void UT_CMusEngReceiveSession::UT_IncomingSessionL()
       
   568     {
       
   569     _LIT8( KMusEngSwisTestIdentifier, "Require: precondition" );
       
   570     _LIT8( KMusEngTestHeader, "Some header" );
       
   571 
       
   572     TMceTransactionDataContainer container;
       
   573     
       
   574     // Simulate SWIS 2.2 invite. There are no streams, so completion fails and 
       
   575     // session gets rejected. Still prenotification has been given.
       
   576     CMceInSession* inSession = ConstructInSessionLC( 0, 0 );
       
   577     CDesC8Array* headers = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
   578     CleanupStack::PushL( headers );
       
   579     headers->AppendL( KMusEngTestHeader() );
       
   580     headers->AppendL( KMusEngSwisTestIdentifier() );
       
   581     container.SetHeaders( headers );
       
   582     CleanupStack::Pop( headers );
       
   583     iReceiveSession->IncomingSession( inSession, &container );    
       
   584     CleanupStack::Pop( inSession );
       
   585     container.Clear();
       
   586     
       
   587     EUNIT_ASSERT( iObserver->iIncomingSessionPreNotificationCalled )
       
   588     
       
   589     EUNIT_ASSERT( iReceiveSession->iSession );
       
   590     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   591                   CMceSession::ETerminated );
       
   592     
       
   593     EUNIT_ASSERT( iReceiveSession->iSession->i100RelUsage == 
       
   594                   KMce100RelRequired )
       
   595     EUNIT_ASSERT( !iReceiveSession->iRingLCalled )              
       
   596 
       
   597     // Try again with valid session, normal case
       
   598     inSession = ConstructInSessionLC( 1, 0 );
       
   599     iReceiveSession->IncomingSession( inSession, &container );    
       
   600     CleanupStack::Pop( inSession );
       
   601     
       
   602     EUNIT_ASSERT( iReceiveSession->iSession );
       
   603     // Next state depends on success of completion of session structure.
       
   604     // When using alloc failure state is ETerminated, in succesfull case it is
       
   605     // EReserving. However it is set to "normal" state EReserving after 
       
   606     // assertion
       
   607     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   608                   CMceSession::EReserving ||
       
   609                   iReceiveSession->iSession->iState == 
       
   610                   CMceSession::ETerminated );
       
   611     iReceiveSession->iSession->iState = CMceSession::EReserving;
       
   612     
       
   613     // Try again without container, new session gets terminated and deleted
       
   614     inSession = ConstructInSessionLC( 1, 0 );
       
   615     iReceiveSession->IncomingSession( inSession, NULL );    
       
   616     CleanupStack::Pop( inSession );
       
   617     
       
   618     EUNIT_ASSERT( iReceiveSession->iSession );
       
   619     EUNIT_ASSERT( iReceiveSession->iSession != inSession );
       
   620     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   621                   CMceSession::EReserving );
       
   622                                
       
   623     // Try again when there is session pending, new session gets terminated
       
   624     // and deleted
       
   625     inSession = ConstructInSessionLC( 1, 0 );
       
   626     iReceiveSession->IncomingSession( inSession, &container );    
       
   627     CleanupStack::Pop( inSession );
       
   628     
       
   629     EUNIT_ASSERT( iReceiveSession->iSession );
       
   630     EUNIT_ASSERT( iReceiveSession->iSession != inSession );
       
   631     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   632                   CMceSession::EReserving );
       
   633     
       
   634     // Try again when there is usage of avc is turned off
       
   635     iReceiveSession->iSession->iState = CMceSession::ETerminated;
       
   636     TInt32 KMusDisableAVC = 0x0fffffff;
       
   637     CRepository::iStaticEncoderUid = KMusDisableAVC;
       
   638 
       
   639     inSession = ConstructInSessionLC( 1, 0 );
       
   640     
       
   641     // There will 3 AVC codecs and 1 H263 codec
       
   642     EUNIT_ASSERT( static_cast<CMceVideoStream*>( inSession->Streams()[0] )->Codecs().Count() == 4 );
       
   643     iReceiveSession->IncomingSession( inSession, &container );    
       
   644     CleanupStack::Pop( inSession );
       
   645     
       
   646     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   647                   CMceSession::EReserving ||
       
   648                   iReceiveSession->iSession->iState == 
       
   649                   CMceSession::ETerminated );
       
   650     
       
   651     // Should be only the H263 codec
       
   652     EUNIT_ASSERT( static_cast<CMceVideoStream*>( iReceiveSession->iSession->Streams()[0] )->Codecs().Count() <= 4 );
       
   653     
       
   654     //No supported codecs
       
   655     iReceiveSession->iSession->iState = CMceSession::ETerminated;
       
   656     iReceiveSession->iManager->iSupportedVideoCodecs.ResetAndDestroy();
       
   657     inSession = ConstructInSessionLC( 1, 0 );
       
   658     
       
   659     // There will no codecs, simulates situation where no codecs were match
       
   660     //currently session is not been rejected
       
   661     EUNIT_ASSERT( static_cast<CMceVideoStream*>( inSession->Streams()[0] )->Codecs().Count() == 0 );
       
   662     iReceiveSession->IncomingSession( inSession, &container );    
       
   663     CleanupStack::Pop( inSession );
       
   664     
       
   665     EUNIT_ASSERT( iReceiveSession->iSession->iState == 
       
   666                   CMceSession::EReserving ||
       
   667                   iReceiveSession->iSession->iState == 
       
   668                   CMceSession::ETerminated );
       
   669     
       
   670     // Should be only the H263 codec
       
   671     EUNIT_ASSERT( static_cast<CMceVideoStream*>( inSession->Streams()[0] )->Codecs().Count() == 0 );
       
   672     
       
   673     }
       
   674 
       
   675 
       
   676 // -----------------------------------------------------------------------------
       
   677 //
       
   678 // -----------------------------------------------------------------------------
       
   679 //
       
   680 void UT_CMusEngReceiveSession::UT_IncomingUpdateL()
       
   681     {
       
   682     TMceTransactionDataContainer container;
       
   683     
       
   684     // We do not have session and thus cannot have an update, new session gets
       
   685     // rejected and deleted.
       
   686     CMceInSession* oldSession = ConstructInSessionLC( 0, 0 );
       
   687     CMceInSession* newSession = ConstructInSessionLC( 0, 0 );
       
   688     iReceiveSession->IncomingUpdate( *oldSession, newSession, NULL );
       
   689     CleanupStack::Pop( newSession );
       
   690     CleanupStack::PopAndDestroy( oldSession );
       
   691     
       
   692     // Start establishing a session
       
   693     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   694     iReceiveSession->IncomingSession( inSession, &container );
       
   695     CleanupStack::Pop( inSession );
       
   696     
       
   697     iReceiveSession->iSession->iState = CMceSession::EProceeding;
       
   698     iReceiveSession->AcceptInvitationL( ETrue );
       
   699     
       
   700     // Now we have an insession, try to update session that is not ours, 
       
   701     // new one gets rejected and deleted.
       
   702     oldSession = ConstructInSessionLC( 0, 0 );
       
   703     newSession = ConstructInSessionLC( 0, 0 );
       
   704     iReceiveSession->IncomingUpdate( *oldSession, newSession, NULL );
       
   705     CleanupStack::Pop( newSession );
       
   706     CleanupStack::PopAndDestroy( oldSession );
       
   707     
       
   708     // Try to update our insession before it is established. New session gets
       
   709     // rejected and deleted.
       
   710     newSession = ConstructInSessionLC( 0, 0 );
       
   711     iReceiveSession->IncomingUpdate( *iReceiveSession->iSession, 
       
   712                                      newSession, 
       
   713                                      NULL );
       
   714     CleanupStack::Pop( newSession );
       
   715     
       
   716     // Finish establishing insession
       
   717     iReceiveSession->iSession->iState = CMceSession::EEstablished;
       
   718     
       
   719     // Try to update the established session with invalid session, it gets
       
   720     // rejected and deleted
       
   721     newSession = ConstructInSessionLC( 0, 0 );
       
   722     iReceiveSession->IncomingUpdate( *iReceiveSession->iSession, 
       
   723                                      newSession, 
       
   724                                      NULL );
       
   725     CleanupStack::Pop( newSession ); 
       
   726     
       
   727     // Succeed in update 
       
   728     newSession = ConstructInSessionLC( 1, 0 );
       
   729     iReceiveSession->IncomingUpdate( *iReceiveSession->iSession, 
       
   730                                      newSession, 
       
   731                                      NULL );
       
   732     CleanupStack::Pop( newSession ); 
       
   733     EUNIT_ASSERT( iReceiveSession->iSession );
       
   734     EUNIT_ASSERT( iReceiveSession->iSession == newSession );
       
   735     
       
   736     }
       
   737 
       
   738 
       
   739 // -----------------------------------------------------------------------------
       
   740 //
       
   741 // -----------------------------------------------------------------------------
       
   742 // 
       
   743 void UT_CMusEngReceiveSession::UT_StreamStateChangedL()
       
   744     {
       
   745     TMceTransactionDataContainer container;
       
   746     
       
   747     CMceInSession* inSession = ConstructInSessionLC( 1, 1 );
       
   748     
       
   749     CMceMediaStream* videoStream = inSession->Streams()[0];
       
   750     CMceMediaStream* audioStream = inSession->Streams()[1];
       
   751     
       
   752     // Try without a session, nothing happens
       
   753     iReceiveSession->StreamStateChanged( *audioStream );
       
   754     
       
   755     // Establish session 
       
   756     
       
   757     iReceiveSession->IncomingSession( inSession, &container );    
       
   758     CleanupStack::Pop( inSession );
       
   759     iObserver->Reset();
       
   760 
       
   761     // Try with audiostream, nothing happens
       
   762     audioStream->iState = CMceMediaStream::EBuffering;
       
   763     iReceiveSession->StreamStateChanged( *audioStream );
       
   764     EUNIT_ASSERT( iObserver->IsReseted() )
       
   765     
       
   766     // Try with videostream, but without a source, nothing happens 
       
   767         
       
   768         // Needed hacking
       
   769         CMceRtpSource* rtpSource = 
       
   770                         static_cast<CMceRtpSource*>( videoStream->Source() );
       
   771     videoStream->iSource = NULL;
       
   772     
       
   773     iReceiveSession->StreamStateChanged( *videoStream );
       
   774     EUNIT_ASSERT( iObserver->IsReseted() )
       
   775     
       
   776     // Try with videostream and a camera source, nothing happens 
       
   777         
       
   778         // Needed hacking
       
   779         videoStream->iSource = 
       
   780                     CMceCameraSource::NewLC( *iReceiveSession->iManager );
       
   781         CleanupStack::Pop();
       
   782     
       
   783     iReceiveSession->StreamStateChanged( *videoStream );
       
   784     EUNIT_ASSERT( iObserver->IsReseted() )
       
   785     
       
   786     // Remove hacks
       
   787     delete videoStream->iSource;
       
   788     videoStream->iSource = rtpSource;
       
   789         
       
   790     // Buffering, normal case
       
   791     videoStream->iState = CMceMediaStream::EBuffering;
       
   792     iReceiveSession->StreamStateChanged( *videoStream );
       
   793     EUNIT_ASSERT( iObserver->iStreamBufferingCalled )
       
   794     iObserver->Reset();
       
   795     
       
   796     // Streaming, normal case
       
   797     videoStream->iState = CMceMediaStream::EStreaming;
       
   798     iReceiveSession->StreamStateChanged( *videoStream );
       
   799     EUNIT_ASSERT( iObserver->iStreamStreamingCalled )
       
   800     EUNIT_ASSERT( rtpSource->iInactivityTimer == 2000 ) 
       
   801     iObserver->Reset();
       
   802     
       
   803     // Try default behaviors
       
   804     videoStream->iState = CMceMediaStream::EIdle;
       
   805     iReceiveSession->StreamStateChanged( *videoStream );
       
   806     EUNIT_ASSERT( iObserver->IsReseted() )
       
   807     
       
   808     }
       
   809 
       
   810 
       
   811 // -----------------------------------------------------------------------------
       
   812 //
       
   813 // -----------------------------------------------------------------------------
       
   814 //
       
   815 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithoutSessionL()
       
   816     {
       
   817     TRAPD( error, iReceiveSession->CompleteSessionStructureL() );
       
   818     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   819     EUNIT_ASSERT( error == KErrNotReady );
       
   820     }
       
   821 
       
   822 
       
   823 // -----------------------------------------------------------------------------
       
   824 //
       
   825 // -----------------------------------------------------------------------------
       
   826 //
       
   827 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithoutStreamsL()
       
   828     {
       
   829     CMceInSession* inSession = ConstructInSessionLC( 0, 0 );
       
   830     iReceiveSession->iSession = inSession; // Transfers ownership
       
   831     CleanupStack::Pop( inSession );
       
   832     
       
   833     TRAPD( error, iReceiveSession->CompleteSessionStructureL() );
       
   834     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   835     EUNIT_ASSERT( error == KErrCorrupt );
       
   836     }
       
   837 
       
   838 
       
   839 // -----------------------------------------------------------------------------
       
   840 //
       
   841 // -----------------------------------------------------------------------------
       
   842 //
       
   843 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithOutgoingStreamL()
       
   844     {    
       
   845     // Stream will be removed.
       
   846     CMceInSession* inSession = ConstructInSessionLC( 0, 0 );
       
   847     
       
   848     inSession->AddStreamL( ConstructVideoOutStreamLC() );
       
   849     CleanupStack::Pop();
       
   850     
       
   851     iReceiveSession->iSession = inSession; // Transfers ownership
       
   852     CleanupStack::Pop( inSession );
       
   853     
       
   854     TRAPD( error, iReceiveSession->CompleteSessionStructureL() )
       
   855     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   856     EUNIT_ASSERT( error == KErrCorrupt );
       
   857     EUNIT_ASSERT( inSession->Streams().Count() == 0 );
       
   858     EUNIT_ASSERT( inSession->Bundles().Count() == 0 );
       
   859     }
       
   860 
       
   861 
       
   862 // -----------------------------------------------------------------------------
       
   863 //
       
   864 // -----------------------------------------------------------------------------
       
   865 //
       
   866 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithVideoInL()
       
   867     {
       
   868     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   869 
       
   870     iReceiveSession->iSession = inSession; // Transfers ownership
       
   871     CleanupStack::Pop( inSession );
       
   872 
       
   873     iReceiveSession->CompleteSessionStructureL();
       
   874 
       
   875     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
   876     EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() )
       
   877     EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo )
       
   878     EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 )
       
   879     EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == 
       
   880                   KMceDisplaySink )
       
   881     
       
   882     // No audio, bundle is not constructed
       
   883     EUNIT_ASSERT( inSession->Bundles().Count() == 0 )
       
   884 
       
   885     }
       
   886 
       
   887 
       
   888 // -----------------------------------------------------------------------------
       
   889 // Video out is bound stream, it gets disabled
       
   890 // -----------------------------------------------------------------------------
       
   891 //
       
   892 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL()
       
   893     {    
       
   894     CMceInSession* inSession = ConstructInSessionLC( 1, 0 );
       
   895 
       
   896     CMceVideoStream* videoOut = ConstructVideoOutStreamLC();
       
   897     inSession->Streams()[0]->BindL( videoOut );
       
   898     CleanupStack::Pop( videoOut );
       
   899     
       
   900     iReceiveSession->iSession = inSession; // Transfers ownership
       
   901     CleanupStack::Pop( inSession );
       
   902 
       
   903     iReceiveSession->CompleteSessionStructureL();
       
   904 
       
   905     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
   906 
       
   907     CMceMediaStream* videoIn = inSession->Streams()[0];
       
   908      
       
   909     EUNIT_ASSERT( videoIn->IsEnabled() )
       
   910     EUNIT_ASSERT( videoIn->Type() == KMceVideo )
       
   911     EUNIT_ASSERT( videoIn->Sinks().Count() == 1 )
       
   912     EUNIT_ASSERT( videoIn->Sinks()[0]->Type() == KMceDisplaySink )
       
   913 
       
   914     EUNIT_ASSERT( videoIn->BoundStream() )
       
   915     EUNIT_ASSERT( !videoIn->BoundStreamL().IsEnabled() )    
       
   916     
       
   917     // No audio, bundle is not constructed
       
   918     EUNIT_ASSERT( inSession->Bundles().Count() == 0 )
       
   919     }
       
   920 
       
   921 
       
   922 // -----------------------------------------------------------------------------
       
   923 // Video in is bound stream, another one gets disabled
       
   924 // -----------------------------------------------------------------------------
       
   925 //
       
   926 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL()
       
   927     {
       
   928     CMceInSession* inSession = ConstructInSessionLC( 0, 0 );
       
   929 
       
   930     CMceVideoStream* videoOut = ConstructVideoOutStreamLC();
       
   931 
       
   932     CMceVideoStream* videoIn = ConstructVideoInStreamLC();
       
   933     videoOut->BindL( videoIn );
       
   934     CleanupStack::Pop( videoIn );
       
   935     
       
   936     inSession->AddStreamL( videoOut );
       
   937     CleanupStack::Pop( videoOut );
       
   938     
       
   939     iReceiveSession->iSession = inSession; // Transfers ownership
       
   940     CleanupStack::Pop( inSession );
       
   941 
       
   942     iReceiveSession->CompleteSessionStructureL();
       
   943 
       
   944     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
   945     EUNIT_ASSERT( !videoOut->IsEnabled() )
       
   946     EUNIT_ASSERT( videoOut->Type() == KMceVideo )
       
   947     EUNIT_ASSERT( videoOut->Sinks().Count() == 1 )
       
   948     EUNIT_ASSERT( videoOut->Sinks()[0]->Type() == KMceRTPSink )
       
   949     EUNIT_ASSERT( !videoOut->Sinks()[0]->IsEnabled() )
       
   950 
       
   951     EUNIT_ASSERT( videoOut->BoundStream() )
       
   952     EUNIT_ASSERT( videoOut->BoundStreamL().IsEnabled() )
       
   953     EUNIT_ASSERT( videoOut->BoundStreamL().Type() == KMceVideo )
       
   954     EUNIT_ASSERT( videoOut->BoundStreamL().Sinks().Count() == 1 )
       
   955     EUNIT_ASSERT( videoOut->BoundStreamL().Sinks()[0]->Type() == 
       
   956                   KMceDisplaySink )   
       
   957     EUNIT_ASSERT( videoOut->BoundStreamL().Sinks()[0]->IsEnabled() )
       
   958                   
       
   959     // No audio, bundle is not constructed
       
   960     EUNIT_ASSERT( inSession->Bundles().Count() == 0 )
       
   961     }
       
   962 
       
   963 
       
   964 // -----------------------------------------------------------------------------
       
   965 // Construct 3 video instreams:
       
   966 // 0. Without bound stream
       
   967 // 1. Bounds video out stream
       
   968 // 2. Bounded by video out stream
       
   969 // -----------------------------------------------------------------------------
       
   970 //    
       
   971 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_WithMultipleVideoInsL()
       
   972     {
       
   973     // construct session and stream 0
       
   974     CMceInSession* inSession = ConstructInSessionLC( 2, 0 );
       
   975     
       
   976     // finish constructing stream 1
       
   977     CMceVideoStream* videoOut = ConstructVideoOutStreamLC();
       
   978     inSession->Streams()[1]->BindL( videoOut );
       
   979     CleanupStack::Pop( videoOut );
       
   980 
       
   981     // finish constructing stream 2
       
   982     videoOut = ConstructVideoOutStreamLC();
       
   983 
       
   984     CMceVideoStream* videoIn = ConstructVideoInStreamLC();
       
   985     videoOut->BindL( videoIn );
       
   986     CleanupStack::Pop( videoIn );
       
   987     
       
   988     inSession->AddStreamL( videoOut );
       
   989     CleanupStack::Pop( videoOut );
       
   990     
       
   991     // Transfers ownership
       
   992     iReceiveSession->iSession = inSession; 
       
   993     CleanupStack::Pop( inSession );
       
   994     
       
   995     // complete
       
   996     iReceiveSession->CompleteSessionStructureL();
       
   997     
       
   998     // First should be used, 4 other streams should be deleted
       
   999     
       
  1000     EUNIT_ASSERT( inSession->Streams().Count() == 1 );
       
  1001     
       
  1002     // First stream
       
  1003     EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() )
       
  1004     EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo )
       
  1005     EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 )
       
  1006     EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == KMceDisplaySink )
       
  1007     EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->IsEnabled() )
       
  1008 
       
  1009     // No audio, bundle is not constructed
       
  1010     EUNIT_ASSERT( inSession->Bundles().Count() == 0 )
       
  1011     }
       
  1012 
       
  1013 
       
  1014 // -----------------------------------------------------------------------------
       
  1015 // Streams in this test case
       
  1016 // 0. Video in
       
  1017 // 1. Audio in
       
  1018 // 2. Audio out bound to audio in
       
  1019 // 3. Audio in bound to audio out
       
  1020 // -----------------------------------------------------------------------------
       
  1021 //
       
  1022 void UT_CMusEngReceiveSession::
       
  1023                 UT_CompleteSessionStructureL_WithVideoAndMultipleAudioInsL()
       
  1024     {
       
  1025     // Construct session and streams 0 and 1
       
  1026     CMceInSession* inSession = inSession = ConstructInSessionLC( 1, 2 );
       
  1027     
       
  1028     // Construct stream 2
       
  1029     CMceAudioStream* audioOut = ConstructAudioOutStreamLC();
       
  1030     inSession->Streams()[2]->BindL( audioOut );
       
  1031     CleanupStack::Pop( audioOut );
       
  1032     
       
  1033     // Construct stream 3
       
  1034     
       
  1035     audioOut = ConstructAudioOutStreamLC();
       
  1036     
       
  1037     CMceAudioStream* audioIn = ConstructAudioInStreamLC();
       
  1038     audioOut->BindL( audioIn );
       
  1039     CleanupStack::Pop( audioIn );
       
  1040     
       
  1041     inSession->AddStreamL( audioOut );
       
  1042     CleanupStack::Pop( audioOut );
       
  1043     
       
  1044     // Transfers ownership
       
  1045     iReceiveSession->iSession = inSession; 
       
  1046     CleanupStack::Pop( inSession );
       
  1047 
       
  1048     // Complete
       
  1049     iReceiveSession->CompleteSessionStructureL();
       
  1050     EUNIT_ASSERT( inSession->Streams().Count() == 4 );
       
  1051     
       
  1052     // Stream 0
       
  1053     EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo )
       
  1054     EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() )
       
  1055     EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 )
       
  1056     EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == 
       
  1057                   KMceDisplaySink )
       
  1058     
       
  1059     // Stream 1
       
  1060     EUNIT_ASSERT( inSession->Streams()[1]->Type() == KMceAudio )
       
  1061     EUNIT_ASSERT( inSession->Streams()[1]->IsEnabled() )
       
  1062     EUNIT_ASSERT( inSession->Streams()[1]->Sinks().Count() == 1 )
       
  1063     EUNIT_ASSERT( inSession->Streams()[1]->Sinks()[0]->Type() == 
       
  1064                   KMceSpeakerSink );
       
  1065     CMceSpeakerSink* speaker = 
       
  1066         static_cast<CMceSpeakerSink*>(inSession->Streams()[1]->Sinks()[0]);
       
  1067     EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->VolumeL() )
       
  1068     
       
  1069     // Stream 2 and bound stream
       
  1070     EUNIT_ASSERT( inSession->Streams()[2]->Type() == KMceAudio )
       
  1071     EUNIT_ASSERT( inSession->Streams()[2]->IsEnabled() )
       
  1072     EUNIT_ASSERT( inSession->Streams()[2]->Sinks().Count() == 1 )
       
  1073     EUNIT_ASSERT( inSession->Streams()[2]->Sinks()[0]->Type() == 
       
  1074                   KMceSpeakerSink );
       
  1075     speaker = static_cast<CMceSpeakerSink*>(inSession->Streams()[2]->Sinks()[0]);
       
  1076     EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->VolumeL() )
       
  1077 
       
  1078     EUNIT_ASSERT( inSession->Streams()[2]->BoundStream() )
       
  1079     EUNIT_ASSERT( !inSession->Streams()[2]->BoundStreamL().IsEnabled() )
       
  1080     EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Type() == KMceAudio )
       
  1081     
       
  1082     EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Sinks().Count() == 1 )
       
  1083     EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Sinks()[0]->Type() == 
       
  1084                   KMceRTPSink );
       
  1085     
       
  1086     // Stream 3 and bound stream
       
  1087     EUNIT_ASSERT( inSession->Streams()[3]->Type() == KMceAudio )
       
  1088     EUNIT_ASSERT( !inSession->Streams()[3]->IsEnabled() )
       
  1089     EUNIT_ASSERT( inSession->Streams()[3]->Sinks().Count() == 1 )
       
  1090     EUNIT_ASSERT( inSession->Streams()[3]->Sinks()[0]->Type() == KMceRTPSink )
       
  1091     EUNIT_ASSERT( !inSession->Streams()[3]->Sinks()[0]->IsEnabled() )
       
  1092 
       
  1093     EUNIT_ASSERT( inSession->Streams()[3]->BoundStream() )
       
  1094     EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().IsEnabled() )
       
  1095     EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Type() == KMceAudio )
       
  1096     EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Sinks().Count() == 1 )    
       
  1097     EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Sinks()[0]->Type() == 
       
  1098                   KMceSpeakerSink )
       
  1099     speaker = static_cast<CMceSpeakerSink*>
       
  1100                         (inSession->Streams()[3]->BoundStreamL().Sinks()[0]);
       
  1101     EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->VolumeL() )
       
  1102               
       
  1103     // Check for bundles
       
  1104     EUNIT_ASSERT( inSession->Bundles().Count() == 1 )
       
  1105     EUNIT_ASSERT( inSession->Bundles()[0]->Streams().Count() == 4 )
       
  1106     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[0]->Type() == KMceAudio  )              
       
  1107     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[0]->Sinks()[0]->Type() == 
       
  1108                   KMceSpeakerSink  )
       
  1109     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[1]->Type() == KMceAudio  )              
       
  1110     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[1]->Sinks()[0]->Type() == 
       
  1111                   KMceSpeakerSink  )
       
  1112     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[2]->Type() == KMceAudio  )              
       
  1113     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[2]->Sinks()[0]->Type() == 
       
  1114                   KMceSpeakerSink  )
       
  1115     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[3]->Type() == KMceVideo )
       
  1116     EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[3]->Sinks()[0]->Type() == 
       
  1117                   KMceDisplaySink )
       
  1118     }
       
  1119 
       
  1120 
       
  1121 // -----------------------------------------------------------------------------
       
  1122 // Streams in this test case
       
  1123 // 0. Video in
       
  1124 // 1. Audio in
       
  1125 // 2. Audio out bound to audio in
       
  1126 // 3. Audio in bound to audio out
       
  1127 // All audio will be removed because of operator variant
       
  1128 // -----------------------------------------------------------------------------
       
  1129 //
       
  1130 void UT_CMusEngReceiveSession::UT_CompleteSessionStructureL_OperatorVariant()
       
  1131     {  
       
  1132     iReceiveSession->iOperatorVariant = ETrue;
       
  1133     
       
  1134     // Construct session and streams 0 and 1
       
  1135     CMceInSession* inSession = inSession = ConstructInSessionLC( 1, 2 );
       
  1136     
       
  1137     // Construct stream 2
       
  1138     CMceAudioStream* audioOut = ConstructAudioOutStreamLC();
       
  1139     inSession->Streams()[2]->BindL( audioOut );
       
  1140     CleanupStack::Pop( audioOut );
       
  1141     
       
  1142     // Construct stream 3
       
  1143     
       
  1144     audioOut = ConstructAudioOutStreamLC();
       
  1145     
       
  1146     CMceAudioStream* audioIn = ConstructAudioInStreamLC();
       
  1147     audioOut->BindL( audioIn );
       
  1148     CleanupStack::Pop( audioIn );
       
  1149     
       
  1150     inSession->AddStreamL( audioOut );
       
  1151     CleanupStack::Pop( audioOut );
       
  1152     
       
  1153     // Transfers ownership
       
  1154     iReceiveSession->iSession = inSession; 
       
  1155     CleanupStack::Pop( inSession );
       
  1156 
       
  1157     // Complete
       
  1158     iReceiveSession->CompleteSessionStructureL();
       
  1159     
       
  1160     // Check that all audio has been removed and no  bundles has been
       
  1161     // constructed
       
  1162     EUNIT_ASSERT_EQUALS( inSession->Streams().Count(), 1 )
       
  1163     EUNIT_ASSERT_EQUALS( inSession->Streams()[0]->Type(), KMceVideo )
       
  1164     EUNIT_ASSERT_EQUALS( inSession->Bundles().Count(), 0 )
       
  1165     
       
  1166     
       
  1167     // Session with bandwidth attribute at sessionlevel
       
  1168     // -> bandwidth is taken in use at session level
       
  1169     //
       
  1170     delete iReceiveSession->iSession;
       
  1171     iReceiveSession->iSession = NULL;
       
  1172     
       
  1173     inSession = ConstructInSessionLC( 1, 0 );
       
  1174     CDesC8Array* sdpLines = new ( ELeave ) CDesC8ArrayFlat( 1 );
       
  1175     CleanupStack::PushL( sdpLines );
       
  1176     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1177     inSession->SetSessionSDPLinesL( sdpLines );
       
  1178     CleanupStack::Pop( sdpLines );
       
  1179     
       
  1180     // Transfers ownership
       
  1181     iReceiveSession->iSession = inSession; 
       
  1182     CleanupStack::Pop( inSession );
       
  1183     
       
  1184     iReceiveSession->CompleteSessionStructureL();
       
  1185     
       
  1186     MDesC8Array* newSdpLines = iReceiveSession->iSession->SessionSDPLinesL();
       
  1187     CleanupDeletePushL( newSdpLines );
       
  1188     TBool bandwidthFoundFromSessionLevel( EFalse );
       
  1189     for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ )
       
  1190         {
       
  1191         if ( newSdpLines->MdcaPoint( i ).Compare( 
       
  1192                 KMusEngSessionSdpLineBandwidthField() ) == 0 )
       
  1193             {
       
  1194             bandwidthFoundFromSessionLevel = ETrue;
       
  1195             }
       
  1196         }
       
  1197     EUNIT_ASSERT( bandwidthFoundFromSessionLevel );
       
  1198     CleanupStack::PopAndDestroy( newSdpLines );
       
  1199     
       
  1200     newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->MediaAttributeLinesL();
       
  1201     CleanupDeletePushL( newSdpLines );
       
  1202     TBool bandwidthFoundFromMediaLevel( EFalse );
       
  1203     for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ )
       
  1204         {
       
  1205         if ( newSdpLines->MdcaPoint( i ).Compare( 
       
  1206                 KMusEngSessionSdpLineBandwidthField() ) == 0 )
       
  1207             {
       
  1208             bandwidthFoundFromMediaLevel = ETrue;
       
  1209             }
       
  1210         }
       
  1211     EUNIT_ASSERT( !bandwidthFoundFromMediaLevel );
       
  1212     CleanupStack::PopAndDestroy( newSdpLines );
       
  1213     
       
  1214     // Session with bandwidth attribute at media level
       
  1215     // -> bandwidth is taken in use at media level
       
  1216     //
       
  1217     delete iReceiveSession->iSession;
       
  1218     iReceiveSession->iSession = NULL;
       
  1219     
       
  1220     inSession = ConstructInSessionLC( 1, 0 );
       
  1221     
       
  1222     sdpLines = new ( ELeave ) CDesC8ArrayFlat( 1 );
       
  1223     CleanupStack::PushL( sdpLines );
       
  1224     sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() );
       
  1225     inSession->Streams()[ 0 ]->SetMediaAttributeLinesL( sdpLines );
       
  1226     CleanupStack::Pop( sdpLines );
       
  1227     
       
  1228     // Transfers ownership
       
  1229     iReceiveSession->iSession = inSession; 
       
  1230     CleanupStack::Pop( inSession );
       
  1231     
       
  1232     iReceiveSession->CompleteSessionStructureL();
       
  1233     
       
  1234     newSdpLines = iReceiveSession->iSession->SessionSDPLinesL();
       
  1235     CleanupDeletePushL( newSdpLines );
       
  1236     bandwidthFoundFromSessionLevel = EFalse;
       
  1237     for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ )
       
  1238         {
       
  1239         if ( newSdpLines->MdcaPoint( i ).Compare( 
       
  1240                 KMusEngSessionSdpLineBandwidthField() ) == 0 )
       
  1241             {
       
  1242             bandwidthFoundFromSessionLevel = ETrue;
       
  1243             }
       
  1244         }
       
  1245     EUNIT_ASSERT( !bandwidthFoundFromSessionLevel );
       
  1246     CleanupStack::PopAndDestroy( newSdpLines );
       
  1247     
       
  1248     newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->MediaAttributeLinesL();
       
  1249     CleanupDeletePushL( newSdpLines );
       
  1250     bandwidthFoundFromMediaLevel = EFalse;
       
  1251     for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ )
       
  1252         {
       
  1253         if ( newSdpLines->MdcaPoint( i ).Compare( 
       
  1254                 KMusEngSessionSdpLineBandwidthField() ) == 0 )
       
  1255             {
       
  1256             bandwidthFoundFromMediaLevel = ETrue;
       
  1257             }
       
  1258         }
       
  1259     EUNIT_ASSERT( bandwidthFoundFromMediaLevel );
       
  1260     CleanupStack::PopAndDestroy( newSdpLines );
       
  1261     }
       
  1262     
       
  1263     
       
  1264 // -----------------------------------------------------------------------------
       
  1265 //
       
  1266 // -----------------------------------------------------------------------------
       
  1267 // 
       
  1268 void UT_CMusEngReceiveSession::UT_ParseAssertedIdentityL()
       
  1269     {  
       
  1270     _LIT8( KMusEngAssertedIdentitySip, "P-Asserted-Identity: sip:fluffy@cisco.com" );
       
  1271     _LIT8( KMusEngIdentitySip, "fluffy" );
       
  1272     _LIT8( KMusEngAssertedIdentityTel, "P-Asserted-Identity: tel:+14085264000" );
       
  1273     _LIT8( KMusEngAssertedIdentityTelBrace, "P-Asserted-Identity: <tel:+14085264000>" );
       
  1274     _LIT8( KMusEngIdentityTel, "+14085264000" );
       
  1275     _LIT8( KMusEngTestHeader, "Some header" );
       
  1276     
       
  1277     _LIT8( KMusEngAssertedIdentityInvalid, "P-Asserted-Identity: sip:fluffy cisco.com" );
       
  1278 
       
  1279     TMceTransactionDataContainer container;
       
  1280     CDesC8Array* headers;
       
  1281 
       
  1282     // only sip uri in asserted identity header 
       
  1283     headers = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1284     CleanupStack::PushL( headers );
       
  1285     headers->AppendL( KMusEngTestHeader );
       
  1286     headers->AppendL( KMusEngAssertedIdentitySip );
       
  1287     container.SetHeaders( headers );
       
  1288     CleanupStack::Pop( headers );
       
  1289     iReceiveSession->ParseAssertedIdentity( &container );    
       
  1290     container.Clear(); 
       
  1291     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KMusEngIdentitySip )
       
  1292     
       
  1293     // sip && tel uris in asserted identity headers
       
  1294     headers = new ( ELeave ) CDesC8ArrayFlat( 3 );
       
  1295     CleanupStack::PushL( headers );
       
  1296     headers->AppendL( KMusEngTestHeader );
       
  1297     headers->AppendL( KMusEngAssertedIdentitySip );
       
  1298     headers->AppendL( KMusEngAssertedIdentityTel );    
       
  1299     container.SetHeaders( headers );
       
  1300     CleanupStack::Pop( headers );
       
  1301     iReceiveSession->ParseAssertedIdentity( &container );    
       
  1302     container.Clear();  
       
  1303     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KMusEngIdentityTel )    
       
  1304     
       
  1305     // tel uri with braces in asserted identity header 
       
  1306     headers = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1307     CleanupStack::PushL( headers );
       
  1308     headers->AppendL( KMusEngTestHeader );
       
  1309     headers->AppendL( KMusEngAssertedIdentityTelBrace );
       
  1310     container.SetHeaders( headers );
       
  1311     CleanupStack::Pop( headers );
       
  1312     iReceiveSession->ParseAssertedIdentity( &container );    
       
  1313     container.Clear(); 
       
  1314     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KMusEngIdentityTel )    
       
  1315     
       
  1316    // invalid uri in asserted identity header
       
  1317     headers = new ( ELeave ) CDesC8ArrayFlat( 2 );
       
  1318     CleanupStack::PushL( headers );
       
  1319     headers->AppendL( KMusEngTestHeader );
       
  1320     headers->AppendL( KMusEngAssertedIdentityInvalid );
       
  1321     container.SetHeaders( headers );
       
  1322     CleanupStack::Pop( headers );
       
  1323     iReceiveSession->ParseAssertedIdentity( &container );    
       
  1324     container.Clear(); 
       
  1325     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KNullDesC8 )    
       
  1326     
       
  1327     // null container
       
  1328     iReceiveSession->ParseAssertedIdentity( NULL );
       
  1329     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KNullDesC8 )    
       
  1330     
       
  1331     // null header
       
  1332     iReceiveSession->ParseAssertedIdentity( &container );
       
  1333     EUNIT_ASSERT_EQUALS( iReceiveSession->iIdentity, KNullDesC8 )    
       
  1334     }
       
  1335 
       
  1336 
       
  1337 //  TEST TABLE
       
  1338 
       
  1339 EUNIT_BEGIN_TEST_TABLE(
       
  1340     UT_CMusEngReceiveSession,
       
  1341     "UT_CMusEngReceiveSesssion",
       
  1342     "UNIT" )
       
  1343 
       
  1344 EUNIT_TEST(
       
  1345     "NewL - test ",
       
  1346     "CMusEngReceiveSession",
       
  1347     "NewL",
       
  1348     "FUNCTIONALITY",
       
  1349     SetupL, UT_NewLL, Teardown)
       
  1350 
       
  1351 EUNIT_TEST(
       
  1352     "AcceptInvitationL - test ",
       
  1353     "CMusEngReceiveSession",
       
  1354     "AcceptInvitationL",
       
  1355     "FUNCTIONALITY",
       
  1356     SetupL, UT_AcceptInvitationLL, Teardown)
       
  1357 
       
  1358 EUNIT_TEST(
       
  1359     "HandleSessionStateChanged - test ",
       
  1360     "CMusEngReceiveSession",
       
  1361     "HandleSessionStateChanged",
       
  1362     "FUNCTIONALITY",
       
  1363     SetupL, UT_HandleSessionStateChangedL, Teardown)
       
  1364 
       
  1365 EUNIT_TEST(
       
  1366     "AdjustVideoCodecL - test ",
       
  1367     "CMusEngReceiveSession",
       
  1368     "AdjustVideoCodecL",
       
  1369     "FUNCTIONALITY",
       
  1370     SetupL, UT_AdjustVideoCodecLL, Teardown)
       
  1371 
       
  1372 EUNIT_TEST(
       
  1373     "AdjustAudioCodecL - test ",
       
  1374     "CMusEngReceiveSession",
       
  1375     "AdjustAudioCodecL",
       
  1376     "FUNCTIONALITY",
       
  1377     SetupL, UT_AdjustAudioCodecLL, Teardown)
       
  1378 
       
  1379 EUNIT_TEST(
       
  1380     "DoCodecSelectionL - test ",
       
  1381     "CMusEngReceiveSession",
       
  1382     "DoCodecSelectionL",
       
  1383     "FUNCTIONALITY",
       
  1384     SetupL, UT_DoCodecSelectionLL, Teardown)
       
  1385 
       
  1386 EUNIT_TEST(
       
  1387     "IncomingSession - test ",
       
  1388     "CMusEngReceiveSession",
       
  1389     "IncomingSession",
       
  1390     "FUNCTIONALITY",
       
  1391     SetupL, UT_IncomingSessionL, Teardown)
       
  1392 
       
  1393 EUNIT_TEST(
       
  1394     "IncomingUpdate - test ",
       
  1395     "CMusEngReceiveSession",
       
  1396     "IncomingUpdate",
       
  1397     "FUNCTIONALITY",
       
  1398     SetupL, UT_IncomingUpdateL, Teardown)
       
  1399 
       
  1400 EUNIT_TEST(
       
  1401     "StreamStateChanged - test ",
       
  1402     "CMusEngReceiveSession",
       
  1403     "StreamStateChanged",
       
  1404     "FUNCTIONALITY",
       
  1405     SetupL, UT_StreamStateChangedL, Teardown)
       
  1406 
       
  1407 EUNIT_TEST(
       
  1408     "UT_CompleteSessionStructureL_WithoutSessionL - test without a session",
       
  1409     "CMusEngReceiveSession",
       
  1410     "CompleteSessionStructureL",
       
  1411     "FUNCTIONALITY",
       
  1412     SetupL, UT_CompleteSessionStructureL_WithoutSessionL, Teardown)
       
  1413 
       
  1414 EUNIT_TEST(
       
  1415     "UT_CompleteSessionStructureL_WithoutStreamsL - without streams",
       
  1416     "CMusEngReceiveSession",
       
  1417     "CompleteSessionStructureL",
       
  1418     "FUNCTIONALITY",
       
  1419     SetupL, UT_CompleteSessionStructureL_WithoutStreamsL, Teardown)
       
  1420 
       
  1421 EUNIT_TEST(
       
  1422     "UT_CompleteSessionStructureL_WithOutgoingStreamL - with outgoing stream",
       
  1423     "CMusEngReceiveSession",
       
  1424     "CompleteSessionStructureL",
       
  1425     "FUNCTIONALITY",
       
  1426     SetupL, UT_CompleteSessionStructureL_WithOutgoingStreamL, Teardown)
       
  1427 
       
  1428 EUNIT_TEST(
       
  1429     "UT_CompleteSessionStructureL_WithVideoInL - with video in stream",
       
  1430     "CMusEngReceiveSession",
       
  1431     "CompleteSessionStructureL",
       
  1432     "FUNCTIONALITY",
       
  1433     SetupL, UT_CompleteSessionStructureL_WithVideoInL, Teardown)
       
  1434 
       
  1435 EUNIT_TEST(
       
  1436     "UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL - with sendrecv video, video out bound to video in",
       
  1437     "CMusEngReceiveSession",
       
  1438     "CompleteSessionStructureL",
       
  1439     "FUNCTIONALITY",
       
  1440     SetupL, UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL, Teardown)
       
  1441 
       
  1442 EUNIT_TEST(
       
  1443     "UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL - with sendrecv video, video in bound to video out",
       
  1444     "CMusEngReceiveSession",
       
  1445     "CompleteSessionStructureL",
       
  1446     "FUNCTIONALITY",
       
  1447     SetupL, UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL, Teardown)
       
  1448 
       
  1449 EUNIT_TEST(
       
  1450     "UT_CompleteSessionStructureL_WithMultipleVideoInsL - with multiple video in streams",
       
  1451     "CMusEngReceiveSession",
       
  1452     "CompleteSessionStructureL",
       
  1453     "FUNCTIONALITY",
       
  1454     SetupL, UT_CompleteSessionStructureL_WithMultipleVideoInsL, Teardown)
       
  1455         
       
  1456 EUNIT_TEST(
       
  1457     "CompleteSessionStructureL - test one video and multiple  audio streams",
       
  1458     "CMusEngReceiveSession",
       
  1459     "CompleteSessionStructureL",
       
  1460     "FUNCTIONALITY",
       
  1461     SetupL, UT_CompleteSessionStructureL_WithVideoAndMultipleAudioInsL, Teardown)
       
  1462     
       
  1463 EUNIT_TEST(
       
  1464     "CompleteSessionStructureL - test operator variant",
       
  1465     "CMusEngReceiveSession",
       
  1466     "CompleteSessionStructureL",
       
  1467     "FUNCTIONALITY",
       
  1468     SetupL, UT_CompleteSessionStructureL_OperatorVariant, Teardown)
       
  1469    
       
  1470 EUNIT_TEST(
       
  1471     "ParseAssertedIdentity",
       
  1472     "CMusEngReceiveSession",
       
  1473     "ParseAssertedIdentity",
       
  1474     "FUNCTIONALITY",
       
  1475     SetupL, UT_ParseAssertedIdentityL, Teardown)
       
  1476       
       
  1477    
       
  1478 EUNIT_END_TEST_TABLE
       
  1479 
       
  1480 //  END OF FILE
       
  1481 
       
  1482