mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengoutsession.cpp
changeset 0 f0cf47e981f9
child 32 73a1feb507fb
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     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_musengoutsession.h"
       
    21 #include "musengstubs.h"
       
    22 #include "musengtestdefs.h"
       
    23 
       
    24 #include "musenglivesession.h"
       
    25 #include "musengclipsession.h"
       
    26 #include "mussipprofilehandler.h"
       
    27 
       
    28 
       
    29 //  SYSTEM INCLUDES
       
    30 #include <digia/eunit/eunitmacros.h>
       
    31 
       
    32 #include <mceoutsession.h>
       
    33 #include <mcestreambundle.h>
       
    34 #include <mceaudiostream.h>
       
    35 #include <mcevideostream.h>
       
    36 #include <mcespeakersink.h>
       
    37 #include <mcedisplaysink.h>
       
    38 #include <mceh263codec.h>
       
    39 #include <mceavccodec.h>
       
    40 #include <mceaudiocodec.h>
       
    41 
       
    42 #include <sipprofile.h>
       
    43 #include <sipstrings.h>
       
    44 
       
    45 #include <audiopreference.h>
       
    46 #include <uri8.h>
       
    47 
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 UT_CMusEngOutSession* UT_CMusEngOutSession::NewL()
       
    54     {
       
    55     UT_CMusEngOutSession* self = UT_CMusEngOutSession::NewLC();
       
    56     CleanupStack::Pop( self );
       
    57     return self;
       
    58     }
       
    59 
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 UT_CMusEngOutSession* UT_CMusEngOutSession::NewLC()
       
    66     {
       
    67     UT_CMusEngOutSession* self = new( ELeave ) UT_CMusEngOutSession();
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL();
       
    70     return self;
       
    71     }
       
    72 
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 UT_CMusEngOutSession::~UT_CMusEngOutSession()
       
    79     {
       
    80     // NOP
       
    81     }
       
    82 
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // Default constructor
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 UT_CMusEngOutSession::UT_CMusEngOutSession()
       
    89     {
       
    90     // NOP
       
    91     }
       
    92 
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // Second phase construct
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void UT_CMusEngOutSession::ConstructL()
       
    99     {
       
   100     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
   101     // It generates the test case table.
       
   102     CEUnitTestSuiteClass::ConstructL();
       
   103     }
       
   104     
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void UT_CMusEngOutSession::SetupL()
       
   111     {
       
   112     iObserver = new( ELeave ) CMusEngObserverStub;
       
   113     iLiveSession = CMusEngLiveSession::NewL( KNullDesC(),
       
   114                                              TRect(0,0, 100,100),
       
   115                                              *iObserver,
       
   116                                              *iObserver,
       
   117                                              *iObserver );
       
   118     SIPStrings::OpenL();
       
   119     
       
   120     iLiveSession->iPrivate = EFalse;
       
   121     iLiveSession->iPrivateNumber = EFalse;
       
   122     
       
   123     }
       
   124 
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 void UT_CMusEngOutSession::Teardown()
       
   131     {
       
   132     SIPStrings::Close();
       
   133     delete iLiveSession;
       
   134     delete iObserver;
       
   135     }
       
   136 
       
   137 
       
   138 
       
   139 // TEST CASES
       
   140 
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 void UT_CMusEngOutSession::UT_CMusEngOutSession_InviteLL()
       
   147     {
       
   148 
       
   149     // Initial state
       
   150     EUNIT_ASSERT( !iLiveSession->iSession );
       
   151     
       
   152     // Simulate failing session structure construction.
       
   153     iLiveSession->InviteL( KTestRecipientSipUri );
       
   154     
       
   155     iLiveSession->iSession->iState = CMceSession::EIdle;
       
   156     delete iLiveSession->iSession->Streams()[0];
       
   157     const RPointerArray<CMceMediaStream>& constStreams = 
       
   158                                             iLiveSession->iSession->Streams();
       
   159     const_cast<RPointerArray<CMceMediaStream>&>(constStreams)[0] = NULL;
       
   160 
       
   161     // Normal invite
       
   162     iLiveSession->InviteL( KTestRecipientSipUri );
       
   163     
       
   164     EUNIT_ASSERT( iLiveSession->iSession );
       
   165     // Next assertion ensures that session structure is new
       
   166     EUNIT_ASSERT( iLiveSession->iSession->Streams()[0] ); 
       
   167     EUNIT_ASSERT( *(iLiveSession->iRecipient) == KTestRecipientSipUri8() );
       
   168     EUNIT_ASSERT( iLiveSession->iSession->State() == CMceSession::EOffering );
       
   169     
       
   170     EUNIT_ASSERT( iLiveSession->iSession->iHeaders );
       
   171     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->Count() == 2 );
       
   172     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 0 ) ==
       
   173                   KMusEngAcceptContactHeader() );
       
   174     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 1 ) ==
       
   175                   KMusAcceptHeader() );    
       
   176     EUNIT_ASSERT( iLiveSession->iSession->iSessionSDPLines );
       
   177     EUNIT_ASSERT( iLiveSession->iSession->iSessionSDPLines->Count() == 1 );
       
   178     EUNIT_ASSERT( iLiveSession->iSession->iSessionSDPLines->MdcaPoint( 0 ) ==
       
   179                   KMusEngSessionSdpLineXApplication() );
       
   180     
       
   181     // Normal operator invite
       
   182     delete iLiveSession;
       
   183     iLiveSession = NULL;
       
   184     iLiveSession = CMusEngLiveSession::NewL( KNullDesC,
       
   185                                              TRect(0,0, 100,100),
       
   186                                              *iObserver,
       
   187                                              *iObserver,
       
   188                                              *iObserver );
       
   189    	iLiveSession->iOperatorVariant = ETrue;
       
   190    	CSIPProfile* profile = iLiveSession->iSipProfileHandler->Profile();
       
   191     delete profile->iArray;
       
   192     profile->iArray = NULL;
       
   193     profile->iArray = new ( ELeave ) CDesC8ArrayFlat( 1 );
       
   194     profile->iArray->AppendL( KMusTestUri );
       
   195 
       
   196     iLiveSession->InviteL( KTestRecipientSipUri );
       
   197     
       
   198     EUNIT_ASSERT( iLiveSession->iSession );
       
   199     // Next assertion ensures that session structure is new
       
   200     EUNIT_ASSERT( iLiveSession->iSession->Streams()[0] ); 
       
   201     EUNIT_ASSERT( *(iLiveSession->iRecipient) == KTestRecipientSipUri8() );
       
   202     EUNIT_ASSERT( iLiveSession->iSession->State() == CMceSession::EOffering );
       
   203     
       
   204     EUNIT_ASSERT( iLiveSession->iSession->iHeaders );
       
   205     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->Count() == 3 );
       
   206     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 0 ) ==
       
   207                   KMusEngAcceptContactHeader() );
       
   208     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 1 ) ==
       
   209                   KMusAcceptHeader() );
       
   210     
       
   211     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 2 ) ==
       
   212                   KMusPPreferredIdentityTestHeader() );
       
   213     
       
   214     EUNIT_ASSERT( iLiveSession->iSession->iSessionSDPLines );
       
   215     EUNIT_ASSERT( iLiveSession->iSession->iSessionSDPLines->Count() == 2 );
       
   216     EUNIT_ASSERT( iLiveSession->iSession->iSessionSDPLines->MdcaPoint( 0 ) ==
       
   217                   KMusEngSessionSdpLineApplication() )
       
   218    	EUNIT_ASSERT( iLiveSession->iSession->iSessionSDPLines->MdcaPoint( 1 ) ==
       
   219                   KMusEngSessionSdpLineType() )
       
   220                   
       
   221     EUNIT_ASSERT( iLiveSession->iSession->Streams().Count() > 0 );   
       
   222     TBool foundBandwidthLineFromMediaLevel( EFalse );
       
   223     for ( TInt i = 0; i <  iLiveSession->iSession->Streams().Count(); i++ )
       
   224         {
       
   225         if ( iLiveSession->iSession->Streams()[0]->Type() == KMceVideo )
       
   226             {
       
   227             if ( iLiveSession->iSession->Streams()[0]->iMediaSDPLines->MdcaCount() > 0 &&
       
   228                  iLiveSession->iSession->Streams()[0]->iMediaSDPLines->MdcaPoint( 0 ) ==
       
   229                     KMusEngSessionSdpLineBandwidthField() )
       
   230                 {
       
   231                 foundBandwidthLineFromMediaLevel = ETrue;
       
   232                 }
       
   233             }
       
   234         }
       
   235     EUNIT_ASSERT( foundBandwidthLineFromMediaLevel );
       
   236                       
       
   237     // Try invite again, must fail
       
   238     TRAPD( error, iLiveSession->InviteL( KTestRecipientSipUri ) );
       
   239     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   240     EUNIT_ASSERT( error == KErrAlreadyExists );
       
   241     
       
   242     // Simulate normal session ending, no need for observer call in this case
       
   243     iLiveSession->iSession->iState = CMceSession::ETerminated;
       
   244     
       
   245     // Try again. Establishment must be OK with new MceSession object
       
   246     iLiveSession->InviteL( KTestRecipientSipUri );
       
   247     EUNIT_ASSERT( iLiveSession->iSession->State() == CMceSession::EOffering );
       
   248 
       
   249       
       
   250     }
       
   251     
       
   252 
       
   253 // -----------------------------------------------------------------------------
       
   254 //
       
   255 // -----------------------------------------------------------------------------
       
   256 //    
       
   257 void UT_CMusEngOutSession::UT_CMusEngOutSession_CancelInviteLL()
       
   258     {
       
   259     // Try to cancel, must fail
       
   260     TRAPD( error, iLiveSession->CancelInviteL() );
       
   261     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   262     EUNIT_ASSERT( error == KErrNotReady );
       
   263     
       
   264     // Invite
       
   265     iLiveSession->InviteL( KTestRecipientSipUri );
       
   266     EUNIT_ASSERT( iLiveSession->iSession->State() == CMceSession::EOffering );
       
   267     
       
   268     // Cancel
       
   269     iLiveSession->CancelInviteL();
       
   270     EUNIT_ASSERT( iLiveSession->iSession->State() == CMceSession::ECancelling );
       
   271     
       
   272     // Try to cancel again, does nothing
       
   273     iLiveSession->CancelInviteL();
       
   274     EUNIT_ASSERT( iLiveSession->iSession->State() == CMceSession::ECancelling );
       
   275     }
       
   276 
       
   277 
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 // -----------------------------------------------------------------------------
       
   281 //  
       
   282 void UT_CMusEngOutSession::UT_CMusEngOutSession_EstablishSessionLL()
       
   283     {
       
   284     // Try to establish, must fail, because of missing session
       
   285     TRAPD( error, iLiveSession->EstablishSessionL() );
       
   286     MUS_TEST_FORWARD_ALLOC_FAILURE( error );
       
   287     EUNIT_ASSERT( error == KErrNotReady );
       
   288     iLiveSession->iPrivate = ETrue;
       
   289     iLiveSession->iPrivateNumber = EFalse;
       
   290     
       
   291     // Call to CMusEngOutMceSession::InviteL leads to call to EstablishL
       
   292     iLiveSession->InviteL( KTestRecipientSipUri );
       
   293     
       
   294     // Check that ports are correct
       
   295     
       
   296     for ( TInt i = 0; i < iLiveSession->iSession->Streams().Count(); ++i )
       
   297         {
       
   298         CMceMediaStream* stream = iLiveSession->iSession->Streams()[i];
       
   299         if ( stream->Type() == KMceAudio )
       
   300             {
       
   301             EUNIT_ASSERT( stream->iLocalMediaPort == 57344 )
       
   302             }
       
   303         else
       
   304             {
       
   305             EUNIT_ASSERT( stream->iLocalMediaPort == 49152 )
       
   306             }
       
   307         }
       
   308         
       
   309     // Check Accept-Contact -header
       
   310     
       
   311     EUNIT_ASSERT( iLiveSession->iSession->iHeaders )
       
   312     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->Count() == 2 )
       
   313     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 0 ) ==
       
   314                   KMusEngAcceptContactHeader() )
       
   315     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 1 ) ==
       
   316                   KMusAcceptHeader() );   
       
   317     EUNIT_ASSERT( iLiveSession->iSession->State() == CMceSession::EOffering );
       
   318     
       
   319     // Privacy test : Check Private -header & originator
       
   320     delete iLiveSession;
       
   321     iLiveSession = NULL;
       
   322     iLiveSession = CMusEngLiveSession::NewL( KNullDesC(),
       
   323                                                 TRect(0,0, 100,100),
       
   324                                                 *iObserver,
       
   325                                                 *iObserver,
       
   326                                                 *iObserver );
       
   327     iLiveSession->iPrivate = ETrue;
       
   328     iLiveSession->iPrivateNumber = ETrue;
       
   329     
       
   330     // Call to CMusEngOutMceSession::InviteL leads to call to EstablishL
       
   331     iLiveSession->InviteL( KTestRecipientSipUri );
       
   332     EUNIT_ASSERT( *iLiveSession->iSession->iOriginator == KMusAnonymousHeader );
       
   333     
       
   334     EUNIT_ASSERT( iLiveSession->iSession->iHeaders )
       
   335     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->Count() == 3 )
       
   336     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 0 ) ==
       
   337                   KMusEngAcceptContactHeader() )
       
   338     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 1 ) ==
       
   339                   KMusAcceptHeader() );   
       
   340     EUNIT_ASSERT( iLiveSession->iSession->iHeaders->MdcaPoint( 2 ).Find( KMusPrivacyHeader() ) == 0 );
       
   341     
       
   342     
       
   343     }
       
   344 
       
   345 
       
   346 // -----------------------------------------------------------------------------
       
   347 //
       
   348 // -----------------------------------------------------------------------------
       
   349 //    
       
   350 void UT_CMusEngOutSession::UT_CMusEngOutSession_HandleTerminationL()
       
   351     {
       
   352 
       
   353     // Try different values
       
   354     iLiveSession->HandleTermination( KSipStatusCode400BadRequest, 
       
   355                                      KNullDesC8() );
       
   356     EUNIT_ASSERT( iObserver->iSessionBadRequestCalled );
       
   357     iObserver->Reset();
       
   358     
       
   359     iLiveSession->HandleTermination( KSipStatusCode401Unauthorized, 
       
   360                                      KNullDesC8() );
       
   361     EUNIT_ASSERT( iObserver->iSessionUnauthorizedCalled );
       
   362     iObserver->Reset();
       
   363     
       
   364     iLiveSession->HandleTermination( KSipStatusCode402PaymentRequired, 
       
   365                                      KNullDesC8() );
       
   366     EUNIT_ASSERT( iObserver->iSessionPaymentRequiredCalled );
       
   367     iObserver->Reset();
       
   368     
       
   369     iLiveSession->HandleTermination( KSipStatusCode404RecipientNotFound, 
       
   370                                      KNullDesC8() );
       
   371     EUNIT_ASSERT( iObserver->iSessionRecipientNotFoundCalled );
       
   372     iObserver->Reset();
       
   373     
       
   374     iLiveSession->HandleTermination( KSipStatusCode416UnsupportedUriScheme, 
       
   375                                      KNullDesC8() );
       
   376     EUNIT_ASSERT( iObserver->iSessionRecipientNotFoundCalled );
       
   377     iObserver->Reset();
       
   378 
       
   379     iLiveSession->HandleTermination( KSipStatusCode479NotAbleToProcessURI, 
       
   380                                      KNullDesC8() );
       
   381     EUNIT_ASSERT( iObserver->iSessionRecipientNotFoundCalled );
       
   382     iObserver->Reset();
       
   383     
       
   384     iLiveSession->HandleTermination( 
       
   385                             KSipStatusCode407ProxyAuthenticationRequired, 
       
   386                             KNullDesC8() );
       
   387     EUNIT_ASSERT( iObserver->iSessionProxyAuthenticationRequiredCalled );
       
   388     iObserver->Reset();
       
   389     
       
   390     iLiveSession->HandleTermination( KSipStatusCode408ConnectionTimeOut, 
       
   391                                      KNullDesC8() );
       
   392     EUNIT_ASSERT( iObserver->iSessionRequestTimeOutCalled );
       
   393     iObserver->Reset();
       
   394     
       
   395     iLiveSession->HandleTermination( KSipStatusCode415UnsupportedMediaType, 
       
   396                                      KNullDesC8() );
       
   397     EUNIT_ASSERT( iObserver->iSessionUnsupportedMediaTypeCalled );
       
   398     iObserver->Reset();
       
   399     
       
   400     iLiveSession->HandleTermination( KSipStatusCode488NotAcceptableHere, 
       
   401                                      KNullDesC8() );
       
   402     EUNIT_ASSERT( iObserver->iSessionUnsupportedMediaTypeCalled );
       
   403     iObserver->Reset();
       
   404     
       
   405     iLiveSession->HandleTermination( KSipStatusCode606NotAcceptable, 
       
   406                                      KNullDesC8() );
       
   407     EUNIT_ASSERT( iObserver->iSessionUnsupportedMediaTypeCalled );
       
   408     iObserver->Reset(); 
       
   409     
       
   410     iLiveSession->HandleTermination( KSipStatusCode486BusyHere, 
       
   411                                      KNullDesC8() );
       
   412     EUNIT_ASSERT( iObserver->iSessionBusyHereCalled );
       
   413     iObserver->Reset();
       
   414     
       
   415     iLiveSession->HandleTermination( KSipStatusCode487RequestCancelled, 
       
   416                                      KNullDesC8() );
       
   417     EUNIT_ASSERT( iObserver->iSessionRequestCancelledCalled );
       
   418     iObserver->Reset();
       
   419     
       
   420     iLiveSession->HandleTermination( KSipStatusCode603Decline, KNullDesC8()  );
       
   421     EUNIT_ASSERT( iObserver->iSessionRejectedCalled );
       
   422     iObserver->Reset();
       
   423 
       
   424     iLiveSession->HandleTermination( KSipStatusCode480TemporarilyNotAvailable, 
       
   425                                      KNullDesC8() );
       
   426     EUNIT_ASSERT( iObserver->iSessionTemporarilyNotAvailable );
       
   427     iObserver->Reset();
       
   428     
       
   429     // Receive 486 with operator variant
       
   430     iLiveSession->iOperatorVariant = ETrue;
       
   431     iLiveSession->HandleTermination( KSipStatusCode486BusyHere, KNullDesC8()  );
       
   432     EUNIT_ASSERT( iObserver->iSessionRejectedCalled )
       
   433     EUNIT_ASSERT( !iObserver->iSessionBusyHereCalled )
       
   434     iObserver->Reset();
       
   435     iLiveSession->iOperatorVariant = EFalse;
       
   436     
       
   437     // Normal termination, let the base class handle
       
   438     iLiveSession->HandleTermination(  KSipStatusCode200OK, KNullDesC8()  );
       
   439     EUNIT_ASSERT( iObserver->iSessionTerminatedCalled ); // called by base class
       
   440     iObserver->Reset();
       
   441 
       
   442     }    
       
   443 
       
   444 
       
   445 // -----------------------------------------------------------------------------
       
   446 //
       
   447 // -----------------------------------------------------------------------------
       
   448 //   
       
   449 void UT_CMusEngOutSession::UT_CMusEngOutSession_AdjustVideoCodecLL()
       
   450     {
       
   451     //H263
       
   452     CMceH263Codec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH2632000() );
       
   453     iLiveSession->CMusEngMceOutSession::AdjustVideoCodecL( *codecH263 );
       
   454     // Test payloadtype
       
   455     EUNIT_ASSERT( codecH263->iPayloadType == 96 )
       
   456     CleanupStack::PopAndDestroy( codecH263 );
       
   457     
       
   458     //H264
       
   459     CMceAvcCodec* codecAvc = CMceAvcCodec::NewLC( KMceSDPNameH264() );
       
   460     iLiveSession->CMusEngMceOutSession::AdjustVideoCodecL( *codecAvc );
       
   461     // Test payloadtype
       
   462     EUNIT_ASSERT( codecAvc->iPayloadType == 98 )
       
   463     CleanupStack::PopAndDestroy( codecAvc );
       
   464     }
       
   465 
       
   466 
       
   467 // -----------------------------------------------------------------------------
       
   468 //
       
   469 // -----------------------------------------------------------------------------
       
   470 //   
       
   471 void UT_CMusEngOutSession::UT_CMusEngOutSession_AdjustAudioCodecLL()
       
   472     {
       
   473     CMceAudioCodec* codec = 
       
   474                 iLiveSession->iManager->SupportedAudioCodecs()[0]->CloneL();
       
   475     CleanupStack::PushL( codec );
       
   476     iLiveSession->CMusEngMceOutSession::AdjustAudioCodecL( *codec );
       
   477     
       
   478     // Test payloadtype
       
   479     
       
   480     EUNIT_ASSERT( codec->iPayloadType == 97 )
       
   481     
       
   482     // Test that base class has been called
       
   483     
       
   484     EUNIT_ASSERT( codec->iMMFPriority == KAudioPrioritySwisPlayback )
       
   485     EUNIT_ASSERT( codec->iMMFPriorityPreference == KAudioPrefSwisPlayback )
       
   486     
       
   487     CleanupStack::PopAndDestroy( codec );
       
   488     }
       
   489         
       
   490 
       
   491 // -----------------------------------------------------------------------------
       
   492 //
       
   493 // -----------------------------------------------------------------------------
       
   494 //   
       
   495 void UT_CMusEngOutSession::UT_CMusEngOutSession_CreateMceSessionStructureLL()
       
   496     {
       
   497     // Test removal of QoS-lines
       
   498     
       
   499     iLiveSession->iRecipient = KTestRecipientSipUri8().AllocL();
       
   500   
       
   501     // IETF profile
       
   502     iLiveSession->CreateMceSessionStructureL();
       
   503     TUint modifierValue = 500; //Just some value that is not used
       
   504     iLiveSession->iSession->GetModifierL( KMcePreconditions, modifierValue );
       
   505     EUNIT_ASSERT( modifierValue == KMcePreconditionsNotUsed );
       
   506     
       
   507     delete iLiveSession->iSession;
       
   508     iLiveSession->iSession = NULL;
       
   509     
       
   510     // IMS profile
       
   511     CSIPProfile* profile = iLiveSession->iSipProfileHandler->Profile();
       
   512     profile->iTypeInfo.iSIPProfileClass = TSIPProfileTypeInfo::EIms;
       
   513     iLiveSession->CreateMceSessionStructureL();
       
   514     modifierValue = 0;
       
   515     iLiveSession->iSession->GetModifierL( KMcePreconditions, modifierValue );
       
   516     EUNIT_ASSERT( modifierValue == KMcePreconditionsSupported );
       
   517     
       
   518     // IMS profile with force internet signaling
       
   519     
       
   520     // TODO: Stub MultimediaSharingSettings, set ForceInternetSignalingSettingL
       
   521     // to return EForceInternetSignaling and test again
       
   522     
       
   523     // Test bundling
       
   524     
       
   525     EUNIT_ASSERT( iLiveSession->iSession->Bundles().Count() == 0 )
       
   526 
       
   527     CMusEngClipSession* clipSession = CMusEngClipSession::NewL(
       
   528                                                     TRect(0, 100, 200, 300 ),
       
   529                                                     *iObserver,
       
   530                                                     *iObserver,
       
   531                                                     *iObserver );
       
   532     CleanupStack::PushL( clipSession );
       
   533     
       
   534     clipSession->SetClipL( KTestVideoFileName );
       
   535     
       
   536     clipSession->iRecipient = KTestRecipientSipUri8().AllocL();
       
   537     
       
   538     clipSession->CreateMceSessionStructureL();
       
   539     
       
   540     CMceSession* session = clipSession->iSession;
       
   541     
       
   542     EUNIT_ASSERT( session->Bundles().Count() == 1 )
       
   543     EUNIT_ASSERT( session->Bundles()[0]->Streams().Count() == 2 )
       
   544     EUNIT_ASSERT( session->Bundles()[0]->Streams()[0]->Type() == KMceAudio )
       
   545     EUNIT_ASSERT( session->Bundles()[0]->Streams()[0]->Sinks()[0]->Type() == 
       
   546                   KMceSpeakerSink )
       
   547     EUNIT_ASSERT( session->Bundles()[0]->Streams()[1]->Type() == KMceVideo )              
       
   548     EUNIT_ASSERT( session->Bundles()[0]->Streams()[1]->Sinks()[0]->Type() == 
       
   549                   KMceDisplaySink )
       
   550 
       
   551     CleanupStack::PopAndDestroy( clipSession );
       
   552     }
       
   553 
       
   554 //  TEST TABLE
       
   555 
       
   556 EUNIT_BEGIN_TEST_TABLE(
       
   557     UT_CMusEngOutSession,
       
   558     "UT_CMusEngOutSesssion",
       
   559     "UNIT" )
       
   560 
       
   561 EUNIT_TEST(
       
   562     "InviteL - test ",
       
   563     "CMusEngOutSession",
       
   564     "InviteL",
       
   565     "FUNCTIONALITY",
       
   566     SetupL, UT_CMusEngOutSession_InviteLL, Teardown)
       
   567 
       
   568 EUNIT_TEST(
       
   569     "CancelInviteL - test ",
       
   570     "CMusEngOutSession",
       
   571     "CancelInviteL",
       
   572     "FUNCTIONALITY",
       
   573     SetupL, UT_CMusEngOutSession_CancelInviteLL, Teardown)
       
   574 
       
   575 EUNIT_TEST(
       
   576     "EstablishSessionL - test ",
       
   577     "CMusEngOutSession",
       
   578     "EstablishSessionL",
       
   579     "FUNCTIONALITY",
       
   580     SetupL, UT_CMusEngOutSession_EstablishSessionLL, Teardown)   
       
   581 
       
   582 EUNIT_TEST(
       
   583     "HandleTermination - test ",
       
   584     "CMusEngOutSession",
       
   585     "HandleTermination",
       
   586     "FUNCTIONALITY",
       
   587     SetupL, UT_CMusEngOutSession_HandleTerminationL, Teardown)   
       
   588 
       
   589 EUNIT_TEST(
       
   590     "AdjustVideoCodecL - test ",
       
   591     "CMusEngOutSession",
       
   592     "AdjustVideoCodecL",
       
   593     "FUNCTIONALITY",
       
   594     SetupL, UT_CMusEngOutSession_AdjustVideoCodecLL, Teardown)   
       
   595 
       
   596 EUNIT_TEST(
       
   597     "AdjustAudioCodecL - test ",
       
   598     "CMusEngOutSession",
       
   599     "AdjustAudioCodecL",
       
   600     "FUNCTIONALITY",
       
   601     SetupL, UT_CMusEngOutSession_AdjustAudioCodecLL, Teardown)   
       
   602     
       
   603 EUNIT_TEST(
       
   604     "CreateMceSessionStructureL - test ",
       
   605     "CMusEngOutSession",
       
   606     "CreateMceSessionStructureL",
       
   607     "FUNCTIONALITY",
       
   608     SetupL, UT_CMusEngOutSession_CreateMceSessionStructureLL, Teardown)    
       
   609 
       
   610 EUNIT_END_TEST_TABLE
       
   611 
       
   612 //  END OF FILE
       
   613 
       
   614