multimediacommsengine/mmcesrv/mmceserver/tsrc/ut_server/src/UT_CMCECSSubSession.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 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 
       
    20 
       
    21 //  CLASS HEADER
       
    22 #include "ut_cmcecssubsession.h"
       
    23 
       
    24 //  EXTERNAL INCLUDES
       
    25 #include <digia/eunit/eunitmacros.h>
       
    26 
       
    27 
       
    28 //  INTERNAL INCLUDES
       
    29 #include "MCETestHelper.h"
       
    30 #include "mcecssubsession.h"
       
    31 #include "mcecssessionimplementation.h"
       
    32 #include "mceservercore.h"
       
    33 #include "mcecssession.h"
       
    34 #include "mcecssubsessionreceiver.h"
       
    35 #include "mcecsserveritc.h"
       
    36 #include "mceserver.pan"
       
    37 #include "mceserial.h"
       
    38 #include "mcecomsession.h"
       
    39 #include "mcecomaudiostream.h"
       
    40 #include "mcecomamrcodec.h"
       
    41 #include "mcecomrtpsink.h"
       
    42 #include "mcecomrtpsource.h"
       
    43 #include "mcemessagedispatcher.h"
       
    44 
       
    45 _LIT8( KReceiveMessage, "received");
       
    46 
       
    47 
       
    48 // CONSTRUCTION
       
    49 UT_CMceCsSubSession* UT_CMceCsSubSession::NewL()
       
    50     {
       
    51     UT_CMceCsSubSession* self = UT_CMceCsSubSession::NewLC(); 
       
    52     CleanupStack::Pop();
       
    53 
       
    54     return self;
       
    55     }
       
    56 
       
    57 UT_CMceCsSubSession* UT_CMceCsSubSession::NewLC()
       
    58     {
       
    59     UT_CMceCsSubSession* self = new( ELeave ) UT_CMceCsSubSession();
       
    60     CleanupStack::PushL( self );
       
    61 
       
    62 	self->ConstructL(); 
       
    63 
       
    64     return self;
       
    65     }
       
    66 
       
    67 
       
    68 // Destructor (virtual by CBase)
       
    69 UT_CMceCsSubSession::~UT_CMceCsSubSession()
       
    70     {
       
    71     }
       
    72 
       
    73 // Default constructor
       
    74 UT_CMceCsSubSession::UT_CMceCsSubSession()
       
    75     {
       
    76     }
       
    77 
       
    78 // Second phase construct
       
    79 void UT_CMceCsSubSession::ConstructL()
       
    80     {
       
    81     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
       
    82     // It generates the test case table.
       
    83     CEUnitTestSuiteClass::ConstructL();
       
    84     }
       
    85 
       
    86 //  METHODS
       
    87 
       
    88 void UT_CMceCsSubSession::SetupL(  )
       
    89     {
       
    90 
       
    91     CMCETls::OpenL();
       
    92     SdpCodecStringPool::OpenL();
       
    93     
       
    94     
       
    95     //TMceIds ids;
       
    96     iIds.iProfileID = 1;
       
    97     iIds.iManagerType = KMceCSSIPSession;
       
    98     iIds.iDialogType = KMceDlgTypeInvite;
       
    99     iServerCore = CMceServerCore::NewL();
       
   100     
       
   101     iStorage = CMCETls::Storage();
       
   102     
       
   103 	CDesC8ArrayFlat* params = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity );
       
   104 	CleanupStack::PushL( params );
       
   105 	params->AppendL( _L8("User <user2@host>") );
       
   106 	params->AppendL( _L8("User <user@host>") );
       
   107     
       
   108     CMceMsgTextArray* msgParams = new (ELeave) CMceMsgTextArray( *params );
       
   109     CleanupStack::PushL( msgParams );
       
   110     iStorage->StoreL( iIds, *msgParams );
       
   111     CleanupStack::PopAndDestroy( msgParams );
       
   112     CleanupStack::PopAndDestroy( params );
       
   113     
       
   114     iSession = CMceCsSession::NewL( *iServerCore );
       
   115     iSession->CreateSubSessionL(iIds, RMessage2());
       
   116     iSubSession =  static_cast<CMceCsSubSession*>((iSession->Implementation().SubSessions())[0]);
       
   117     } 
       
   118 
       
   119 void UT_CMceCsSubSession::Teardown(  )
       
   120     {
       
   121     CMCETls::Close();
       
   122     delete iSession;
       
   123     delete iServerCore;
       
   124     SdpCodecStringPool::Close();
       
   125     }
       
   126 
       
   127 
       
   128 
       
   129 void UT_CMceCsSubSession::UT_CMceCsSubSession_GetFunctionsL(  )
       
   130     {
       
   131     
       
   132     EUNIT_ASSERT( iSubSession->Type() == KMceCSSIPSession );
       
   133     EUNIT_ASSERT( iSubSession->DialogId() == 1 );
       
   134 
       
   135     CSIPDialogAssocBase* dialog = iSubSession->Dialog();
       
   136     EUNIT_ASSERT( dialog != NULL);
       
   137     CSIPServerTransaction& request = iSubSession->Request();
       
   138     EUNIT_ASSERT( &request == NULL);
       
   139     CSIPClientTransaction& response = iSubSession->Response();
       
   140     EUNIT_ASSERT( &response == NULL);
       
   141     CMceCsSessionImplementation& session = iSubSession->Client();
       
   142     EUNIT_ASSERT(&session != NULL);
       
   143     CMceSipConnection& sipconnection = iSubSession->SIPConnection();
       
   144     EUNIT_ASSERT(&sipconnection != NULL);
       
   145     CMceSipManager& manager = iSubSession->Manager();
       
   146     EUNIT_ASSERT(&manager != NULL);
       
   147     const RPointerArray<CSIPClientTransaction>& pendingTransactions = 
       
   148         iSubSession->PendingTransactions();
       
   149     EUNIT_ASSERT( pendingTransactions.Count() == 0 );
       
   150     const CFCSession* fc = iSubSession->FCSession();
       
   151     EUNIT_ASSERT(&fc != NULL);
       
   152     
       
   153 //test setting and getting of spare slots of TMceIds    
       
   154     MCEIDS_DEFINE_SPARE_INDEX_1( kSpare1 );    
       
   155     MCEIDS_DEFINE_SPARE_INDEX_2( kSpare2 );    
       
   156     MCEIDS_DEFINE_SPARE_INDEX_3( kSpare3 );    
       
   157     
       
   158     iIds.iSpare1 = 1;
       
   159     iIds.iSpare2 = 2;
       
   160     iIds.iSpare3 = 3;
       
   161     
       
   162     EUNIT_ASSERT( iIds.Get( kSpare1 ) == 1 );
       
   163     EUNIT_ASSERT( iIds.Get( kSpare2 ) == 2 );
       
   164     EUNIT_ASSERT( iIds.Get( kSpare3 ) == 3 );
       
   165     
       
   166     iIds.Set( kSpare1, 0 );
       
   167     EUNIT_ASSERT( iIds.Get( kSpare1 ) == 0 );
       
   168     EUNIT_ASSERT( iIds.iSpare1 == 0 );
       
   169     
       
   170     iIds.Set( kSpare2, 0 );
       
   171     EUNIT_ASSERT( iIds.Get( kSpare2 ) == 0 );
       
   172     EUNIT_ASSERT( iIds.iSpare2 == 0 );
       
   173     
       
   174     iIds.Set( kSpare3, 0 );
       
   175     EUNIT_ASSERT( iIds.Get( kSpare3 ) == 0 );
       
   176     EUNIT_ASSERT( iIds.iSpare3 == 0 );
       
   177 
       
   178     }
       
   179 
       
   180 void UT_CMceCsSubSession::UT_CMceCsSubSession_ServiceLL()
       
   181     {
       
   182     
       
   183     HBufC8* message = KReceiveMessage().AllocLC();
       
   184     iSubSession->iReceiver->SendToClientL( iStorage->iIds, message );
       
   185     CleanupStack::Pop( message );
       
   186     
       
   187     iStorage->iCompletionCode = -1;
       
   188     iStorage->iItcFunction = EMceItcReceive;
       
   189     iSubSession->ServiceL( iIds, EMceItcReceive, RMessage2() );
       
   190 	EUNIT_ASSERT( iStorage->iCompletionCode == 0 );
       
   191 	EUNIT_ASSERT( iStorage->iContextServer != NULL );
       
   192 	EUNIT_ASSERT( iStorage->iContextServer->Compare( KReceiveMessage ) == 0 );
       
   193     
       
   194     HBufC8* returnMessage = NULL;
       
   195     
       
   196     CMceMsgBase* msg = NULL;
       
   197     EUNIT_ASSERT_LEAVE( iSubSession->CMceCsSubSession::DoServiceL( iIds, EMceItcSetAppUid, *returnMessage ) );
       
   198     EUNIT_ASSERT_LEAVE( iSubSession->CMceCsSubSession::DoServiceL( iIds, EMceItcSetAppUid, KNullDesC8 ) );
       
   199     EUNIT_ASSERT_LEAVE( iSubSession->CMceCsSubSession::DoServiceL( iIds, EMceItcSetAppUid, *msg ) );
       
   200     
       
   201     }
       
   202 
       
   203 
       
   204 
       
   205 
       
   206 void UT_CMceCsSubSession::UT_CMceCsSubSession_SetPendingTransactionLL(  )
       
   207     {
       
   208     
       
   209     CSIPClientTransaction* cltrans2 = 
       
   210         MCETestHelper::ClientTransactionLC( SipStrConsts::EBye );
       
   211         
       
   212     CSIPClientTransaction* cltrans = 
       
   213         MCETestHelper::ClientTransactionLC( SipStrConsts::EInvite );
       
   214         
       
   215     CSIPTransactionBase* bstrans = ( CSIPTransactionBase* ) cltrans;
       
   216     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 0 );
       
   217     iSubSession->SetPendingTransactionL( cltrans );
       
   218     CleanupStack::Pop( cltrans );
       
   219     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 1 );
       
   220     EUNIT_ASSERT( iSubSession->PendingTransactions()[0] == cltrans );
       
   221     iSubSession->SetPendingTransactionL( cltrans2 );
       
   222     CleanupStack::Pop( cltrans2 );
       
   223     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 2 );
       
   224     EUNIT_ASSERT( iSubSession->PendingTransactions()[1] == cltrans2 );
       
   225     }
       
   226     
       
   227 void UT_CMceCsSubSession::UT_CMceCsSubSession_ClientReadyToReceiveL(  )
       
   228     {
       
   229     iSubSession->ServiceL(iIds, EMceItcClientReadyToReceive, RMessage2() );
       
   230     TRAPD(err, iSubSession->ClientReadyToReceiveL(RMessage2()));
       
   231     EUNIT_ASSERT(err == KErrAlreadyExists);
       
   232     }
       
   233     
       
   234 void UT_CMceCsSubSession::UT_CMceCsSubSession_CancelClientReceiveL(  )
       
   235     {
       
   236     iSubSession->ServiceL(iIds, EMceItcClientReadyToReceive, RMessage2() );
       
   237     iSubSession->ServiceL(iIds, EMceItcClientCancelReceive, RMessage2() );
       
   238     
       
   239     TRAPD(err, iSubSession->CancelClientReceiveL());
       
   240     EUNIT_ASSERT(err == KErrNotFound);
       
   241     }
       
   242 
       
   243 void UT_CMceCsSubSession::UT_CMceCsSubSession_InviteCompletedL()
       
   244     {
       
   245     
       
   246     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 0 );
       
   247     
       
   248     CSIPClientTransaction* clitransaction = 
       
   249         MCETestHelper::ClientTransactionLC( SipStrConsts::EInvite );
       
   250     
       
   251     //not found
       
   252     iSubSession->InviteCompleted( *clitransaction );
       
   253     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 0 );
       
   254     
       
   255 	iSubSession->SetPendingTransactionL( clitransaction );
       
   256     CleanupStack::Pop( clitransaction );
       
   257     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 1 );
       
   258     
       
   259     iSubSession->InviteCompleted( *clitransaction );
       
   260     
       
   261     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 0 );
       
   262     
       
   263     }
       
   264 
       
   265 
       
   266 void UT_CMceCsSubSession::UT_CMceCsSubSession_PopRequestL(  )
       
   267     {
       
   268 
       
   269     CSIPServerTransaction* trx = 
       
   270         MCETestHelper::ServerTransactionL( SipStrConsts::EInvite );
       
   271     CleanupStack::PushL(trx);
       
   272     EUNIT_ASSERT( &iSubSession->Request() == NULL );
       
   273     iSubSession->iPendingReceivedRequests.AppendL( trx );
       
   274     CleanupStack::Pop(trx);
       
   275     EUNIT_ASSERT( &iSubSession->Request() == trx );
       
   276         
       
   277     CSIPServerTransaction* req = iSubSession->PopRequest();
       
   278     EUNIT_ASSERT( req == trx );
       
   279     EUNIT_ASSERT( &iSubSession->Request() == NULL );
       
   280     delete req;
       
   281     
       
   282     
       
   283     }
       
   284     
       
   285 void UT_CMceCsSubSession::UT_CMceCsSubSession_PopResponseL(  )
       
   286     {
       
   287     CSIPClientTransaction* clitransaction = 
       
   288         MCETestHelper::ClientTransactionLC( SipStrConsts::EBye );
       
   289     
       
   290     iSubSession->SetPendingTransactionL( clitransaction );
       
   291     CleanupStack::Pop( clitransaction );
       
   292     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 1 );
       
   293     EUNIT_ASSERT( &iSubSession->Response() == NULL );
       
   294 
       
   295     iSubSession->iResponse = clitransaction;
       
   296     EUNIT_ASSERT( &iSubSession->Response() == clitransaction );
       
   297     
       
   298     CSIPClientTransaction* rsp = iSubSession->PopResponse();
       
   299     EUNIT_ASSERT( rsp == NULL );
       
   300     EUNIT_ASSERT( &iSubSession->Response() == clitransaction );
       
   301     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 1 );
       
   302 
       
   303     clitransaction->iState = CSIPTransactionBase::ECompleted;
       
   304     iSubSession->RemovePendingTrx( *clitransaction );
       
   305     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 0 );
       
   306     
       
   307     rsp = iSubSession->PopResponse();
       
   308     EUNIT_ASSERT( rsp == clitransaction );
       
   309     EUNIT_ASSERT( &iSubSession->Response() == NULL );
       
   310     EUNIT_ASSERT( iSubSession->PendingTransactions().Count() == 0 );
       
   311     delete rsp;
       
   312 
       
   313     }
       
   314     
       
   315     
       
   316 void UT_CMceCsSubSession::UT_CMceCsSubSession_ClientExistsL()
       
   317     {
       
   318     EUNIT_ASSERT(!iSubSession->ClientExists() )
       
   319     }
       
   320     
       
   321     
       
   322 void UT_CMceCsSubSession::UT_CMceCsSubSession_DecodeLL()
       
   323     {
       
   324     CMceMsgBase* decodedMessage = NULL;
       
   325     TAny* object = NULL;
       
   326     TMceMessageDispatcher<CMceCsSubSession> dispacther( *iSubSession, iSubSession->iReceiver->ITC() );
       
   327     
       
   328 //EMceItcMsgTypeSession:
       
   329 
       
   330     CMceComSession* session = CMceComSession::NewL( CMceComSession::EOutSession );
       
   331     CleanupStack::PushL( session );
       
   332     
       
   333     CMceMsgObject<CMceComSession>* sessionMsg = new (ELeave) CMceMsgObject<CMceComSession>( *session, EMceItcMsgTypeSession );
       
   334     CleanupStack::PushL( sessionMsg );
       
   335     sessionMsg->EncodeL();
       
   336     
       
   337     decodedMessage = dispacther.DecodeL( sessionMsg->Type(), sessionMsg->EncodeBuffer().Ptr( 0 ) );
       
   338     CleanupStack::PopAndDestroy( sessionMsg );
       
   339     CleanupStack::PopAndDestroy( session );
       
   340     
       
   341     EUNIT_ASSERT( decodedMessage != NULL );
       
   342     decodedMessage->Close();
       
   343     delete decodedMessage;
       
   344     
       
   345     
       
   346 //EMceItcMsgTypeStream:
       
   347 
       
   348     CMceComAudioStream* stream = CMceComAudioStream::NewLC();
       
   349     
       
   350     CMceMsgObject<CMceComMediaStream>* streamMsg = new (ELeave) CMceMsgObject<CMceComMediaStream>( *stream, EMceItcMsgTypeStream );
       
   351     CleanupStack::PushL( streamMsg );
       
   352     streamMsg->EncodeL();
       
   353     
       
   354     decodedMessage = dispacther.DecodeL( streamMsg->Type(), streamMsg->EncodeBuffer().Ptr( 0 ) );
       
   355     CleanupStack::PopAndDestroy( streamMsg );
       
   356     CleanupStack::PopAndDestroy( stream );
       
   357 
       
   358     EUNIT_ASSERT( decodedMessage != NULL );
       
   359     decodedMessage->Close();
       
   360     delete decodedMessage;
       
   361 
       
   362     
       
   363 //EMceItcMsgTypeCodec:
       
   364 
       
   365     TBuf8<KMceMaxSdpNameLength> amr;
       
   366     amr.Append( _L("AMR") );
       
   367     
       
   368     CMceComAMRCodec* codec = CMceComAMRCodec::NewLC( amr );
       
   369     CMceMsgObject<CMceComAudioCodec>* codecMsg = new (ELeave) CMceMsgObject<CMceComAudioCodec>( *codec, EMceItcMsgTypeCodec );
       
   370     CleanupStack::PushL( codecMsg );
       
   371     codecMsg->EncodeL();
       
   372     
       
   373     decodedMessage = dispacther.DecodeL( codecMsg->Type(), codecMsg->EncodeBuffer().Ptr( 0 ) );
       
   374     CleanupStack::PopAndDestroy( codecMsg );
       
   375     CleanupStack::PopAndDestroy( codec );
       
   376 
       
   377     EUNIT_ASSERT( decodedMessage != NULL );
       
   378     decodedMessage->Close();
       
   379     delete decodedMessage;
       
   380 
       
   381 
       
   382     
       
   383 //EMceItcMsgTypeSink:
       
   384 
       
   385     CMceComRtpSink* sink = CMceComRtpSink::NewLC();
       
   386     CMceMsgObject<CMceComMediaSink>* sinkMsg = new (ELeave) CMceMsgObject<CMceComMediaSink>( *sink, EMceItcMsgTypeSink );
       
   387     CleanupStack::PushL( sinkMsg );
       
   388     sinkMsg->EncodeL();
       
   389     
       
   390     decodedMessage = dispacther.DecodeL( sinkMsg->Type(), sinkMsg->EncodeBuffer().Ptr( 0 ) );
       
   391     CleanupStack::PopAndDestroy( sinkMsg );
       
   392     CleanupStack::PopAndDestroy( sink );
       
   393 
       
   394     EUNIT_ASSERT( decodedMessage != NULL );
       
   395     decodedMessage->Close();
       
   396     delete decodedMessage;
       
   397 
       
   398 //EMceItcMsgTypeSource:
       
   399 
       
   400     CMceComRtpSource* source = CMceComRtpSource::NewLC();
       
   401     CMceMsgObject<CMceComMediaSource>* sourceMsg = new (ELeave) CMceMsgObject<CMceComMediaSource>( *source, EMceItcMsgTypeSource );
       
   402     CleanupStack::PushL( sourceMsg );
       
   403     sourceMsg->EncodeL();
       
   404     
       
   405     decodedMessage = dispacther.DecodeL( sourceMsg->Type(), sourceMsg->EncodeBuffer().Ptr( 0 ) );
       
   406     CleanupStack::PopAndDestroy( sourceMsg );
       
   407     CleanupStack::PopAndDestroy( source );
       
   408 
       
   409     EUNIT_ASSERT( decodedMessage != NULL );
       
   410     decodedMessage->Close();
       
   411     delete decodedMessage;
       
   412 
       
   413 
       
   414 
       
   415 //EMceItcMsgTypeSIPReply:
       
   416 
       
   417     HBufC8* reason = _L8("reason").AllocLC();
       
   418     HBufC8* contentType = _L8("contentType").AllocLC();
       
   419     CDesC8Array* sipHeaders = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity );
       
   420     CleanupStack::PushL( sipHeaders );
       
   421 
       
   422     CMceMsgSIPReply* replyMsg = new (ELeave) CMceMsgSIPReply( *reason, 405,
       
   423                                                               *sipHeaders, *contentType );
       
   424                                                               
       
   425     CleanupStack::PushL( replyMsg );
       
   426     replyMsg->EncodeL();
       
   427     
       
   428     decodedMessage = dispacther.DecodeL( replyMsg->Type(), replyMsg->EncodeBuffer().Ptr( 0 ) );
       
   429     CleanupStack::PopAndDestroy( replyMsg );
       
   430     CleanupStack::PopAndDestroy( sipHeaders );
       
   431     CleanupStack::PopAndDestroy( contentType );
       
   432     CleanupStack::PopAndDestroy( reason );
       
   433 
       
   434     EUNIT_ASSERT( decodedMessage != NULL );
       
   435     decodedMessage->Close();
       
   436     delete decodedMessage;
       
   437 
       
   438 
       
   439 //EMceItcMsgTypeTextArray:
       
   440 
       
   441 
       
   442     sipHeaders = new (ELeave) CDesC8ArrayFlat( KMceArrayGranularity );
       
   443     CleanupStack::PushL( sipHeaders );
       
   444 
       
   445     CMceMsgTextArray* hdrsMsg = new (ELeave) CMceMsgTextArray( *sipHeaders );
       
   446                                                               
       
   447     CleanupStack::PushL( hdrsMsg );
       
   448     hdrsMsg->EncodeL();
       
   449     
       
   450     decodedMessage = dispacther.DecodeL( hdrsMsg->Type(), hdrsMsg->EncodeBuffer().Ptr( 0 ) );
       
   451     CleanupStack::PopAndDestroy( hdrsMsg );
       
   452     CleanupStack::PopAndDestroy( sipHeaders );
       
   453 
       
   454     EUNIT_ASSERT( decodedMessage != NULL );
       
   455     decodedMessage->Close();
       
   456     delete decodedMessage;
       
   457 
       
   458 
       
   459 //EMceItcMsgTypeEvent:
       
   460     
       
   461     }
       
   462     
       
   463 void UT_CMceCsSubSession::UT_CMceCsSubSession_ProfileL()
       
   464     {
       
   465   	CSIPProfile* profile = &iSubSession->Profile();
       
   466     EUNIT_ASSERT( profile != NULL );  	
       
   467     }    
       
   468     
       
   469 
       
   470 void UT_CMceCsSubSession::UT_CMceCsSubSession_HasInitialInviteTransactionBeenCompletedL()
       
   471     {
       
   472     CSIPClientTransaction* initialInviteTransaction = 
       
   473         MCETestHelper::ClientTransactionLC( SipStrConsts::EInvite );
       
   474     CleanupStack::Pop( initialInviteTransaction );  
       
   475     iSubSession->iInitialInvite = initialInviteTransaction;
       
   476     
       
   477     // Transaction not completed
       
   478     EUNIT_ASSERT( !iSubSession->HasInitialInviteTransactionBeenCompleted() )
       
   479 
       
   480     // Transaction completed but exists
       
   481     initialInviteTransaction->SetState( CSIPTransactionBase::ECompleted );
       
   482     EUNIT_ASSERT( iSubSession->HasInitialInviteTransactionBeenCompleted() )
       
   483     
       
   484     // Transaction terminated but exists
       
   485     initialInviteTransaction->SetState( CSIPTransactionBase::ETerminated );
       
   486     EUNIT_ASSERT( iSubSession->HasInitialInviteTransactionBeenCompleted() )
       
   487     
       
   488     // Transaction does not exist
       
   489     delete iSubSession->iInitialInvite;
       
   490     iSubSession->iInitialInvite = NULL;
       
   491     EUNIT_ASSERT( iSubSession->HasInitialInviteTransactionBeenCompleted() )
       
   492     }
       
   493 
       
   494 void UT_CMceCsSubSession::UT_CMceCsSubSession_GetRequestL()
       
   495     {
       
   496         
       
   497     const RPointerArray<CSIPClientTransaction>& pendingReceivedRequest = 
       
   498         iSubSession->PendingTransactions();
       
   499         
       
   500     EUNIT_ASSERT( iSubSession->PendingReceivedRequests().Count() == 0 );
       
   501     
       
   502     CSIPServerTransaction* trx =         
       
   503     MCETestHelper::ServerTransactionL( SipStrConsts::EInfo );
       
   504     CleanupStack::PushL(trx);
       
   505     iSubSession->iPendingReceivedRequests.AppendL( trx );
       
   506     CleanupStack::Pop(trx);
       
   507     EUNIT_ASSERT( iSubSession->PendingReceivedRequests().Count() == 1 );
       
   508     
       
   509     EUNIT_ASSERT( iSubSession->PendingReceivedRequests()[0] == trx );
       
   510     
       
   511     }
       
   512     
       
   513     
       
   514 void UT_CMceCsSubSession::UT_CMceCsSubSession_DialogRequestReceivedL  ()
       
   515 	{
       
   516     CSIPServerTransaction* srvtransaction = 
       
   517         MCETestHelper::ServerTransactionL( SipStrConsts::EInfo );
       
   518     CleanupStack::PushL( srvtransaction );
       
   519 
       
   520 	TBool consumed = iSubSession->DialogRequestReceived( srvtransaction, iSubSession->Dialog()->Dialog() );
       
   521 	MCE_CHECK_MEMORY_LEAVE( !consumed )
       
   522   	EUNIT_ASSERT( iSubSession->PendingReceivedRequests()[0] == srvtransaction );
       
   523   	CleanupStack::Pop( srvtransaction );
       
   524 	}
       
   525 
       
   526 
       
   527 
       
   528 //  TEST TABLE
       
   529 
       
   530 EUNIT_BEGIN_TEST_TABLE( 
       
   531     UT_CMceCsSubSession,
       
   532     "UT_CMceCsSubSession",
       
   533     "UNIT" )
       
   534 
       
   535 EUNIT_TEST(
       
   536     "GetFunctions - test ",
       
   537     "CMceCsSubSession",
       
   538     "GetFunctions",
       
   539     "FUNCTIONALITY",
       
   540     SetupL, UT_CMceCsSubSession_GetFunctionsL, Teardown)
       
   541 
       
   542 EUNIT_TEST(
       
   543     "ServiceL - test ",
       
   544     "CMceCsSubSession",
       
   545     "ServiceL",
       
   546     "FUNCTIONALITY",
       
   547     SetupL, UT_CMceCsSubSession_ServiceLL, Teardown)
       
   548 
       
   549 
       
   550 EUNIT_TEST(
       
   551     "SetPendingTransactionL - test ",
       
   552     "CMceCsSubSession",
       
   553     "SetPendingTransactionL",
       
   554     "FUNCTIONALITY",
       
   555     SetupL, UT_CMceCsSubSession_SetPendingTransactionLL, Teardown)
       
   556 
       
   557 EUNIT_TEST(
       
   558     "ClientReadyToReceive - test ",
       
   559     "CMceCsSubSession",
       
   560     "ClientReadyToReceive",
       
   561     "FUNCTIONALITY",
       
   562     SetupL, UT_CMceCsSubSession_ClientReadyToReceiveL, Teardown)
       
   563     
       
   564 EUNIT_TEST(
       
   565     "CancelClientReceive - test ",
       
   566     "CMceCsSubSession",
       
   567     "CancelClientReceive",
       
   568     "FUNCTIONALITY",
       
   569     SetupL, UT_CMceCsSubSession_CancelClientReceiveL, Teardown)
       
   570     
       
   571 EUNIT_TEST(
       
   572     "InviteCompleted - test ",
       
   573     "CMceCsSubSession",
       
   574     "InviteCompleted",
       
   575     "FUNCTIONALITY",
       
   576     SetupL, UT_CMceCsSubSession_InviteCompletedL, Teardown)
       
   577 
       
   578 EUNIT_TEST(
       
   579     "PopRequest - test ",
       
   580     "CMceCsSubSession",
       
   581     "PopRequest",
       
   582     "FUNCTIONALITY",
       
   583     SetupL, UT_CMceCsSubSession_PopRequestL, Teardown)
       
   584 
       
   585 EUNIT_TEST(
       
   586     "PopResponse - test ",
       
   587     "CMceCsSubSession",
       
   588     "PopResponse",
       
   589     "FUNCTIONALITY",
       
   590     SetupL, UT_CMceCsSubSession_PopResponseL, Teardown)
       
   591 
       
   592 EUNIT_TEST(
       
   593     "ClientExists - test ",
       
   594     "CMceCsSubSession",
       
   595     "ClientExists",
       
   596     "FUNCTIONALITY",
       
   597     SetupL, UT_CMceCsSubSession_ClientExistsL, Teardown)
       
   598 
       
   599 
       
   600 EUNIT_TEST(
       
   601     "DecodeL - test ",
       
   602     "CMceCsSubSession",
       
   603     "DecodeL",
       
   604     "FUNCTIONALITY",
       
   605     SetupL, UT_CMceCsSubSession_DecodeLL, Teardown)
       
   606 
       
   607 EUNIT_TEST(
       
   608     "Profile - test ",
       
   609     "CMceCsSubSession",
       
   610     "Profile",
       
   611     "FUNCTIONALITY",
       
   612     SetupL, UT_CMceCsSubSession_ProfileL, Teardown)
       
   613 
       
   614 EUNIT_TEST(
       
   615     "HasInitialInviteTransactionBeenCompleted - test ",
       
   616     "CMceCsSubSession",
       
   617     "HasInitialInviteTransactionBeenCompleted",
       
   618     "FUNCTIONALITY",
       
   619     SetupL, UT_CMceCsSubSession_HasInitialInviteTransactionBeenCompletedL, Teardown)
       
   620 
       
   621 EUNIT_TEST(
       
   622     "Pending Request - test ",
       
   623     "CMceCsSubSession",
       
   624     "GetRequest",
       
   625     "FUNCTIONALITY",
       
   626     SetupL, UT_CMceCsSubSession_GetRequestL, Teardown)
       
   627 
       
   628 EUNIT_TEST(
       
   629     "DialogRequestReceived - test ",
       
   630     "CMceCsSubSession",
       
   631     "DialogRequestReceived",
       
   632     "FUNCTIONALITY",
       
   633     SetupL, UT_CMceCsSubSession_DialogRequestReceivedL, Teardown)
       
   634     
       
   635 
       
   636 
       
   637     
       
   638     
       
   639 
       
   640 EUNIT_END_TEST_TABLE
       
   641 
       
   642 //  END OF FILE