void UT_CMccRtpKeepalive::UT_CMccRtpKeepalive_StopKeepaliveL()
{
    TInt refCount( 0 );

    if ( iAlloc )
    {
        iKeepaliveHandler->StartKeepaliveL(
            *static_cast<CMccRtpDataSource*>( iRtpSource ), *iRtpMediaClock );


        iKeepaliveHandler->StopKeepalive( *static_cast<CMccRtpDataSource*>( iRtpSource ), refCount );
        EUNIT_ASSERT_EQUALS( refCount, 0 );
    }
    else
    {
        EUNIT_ASSERT_EQUALS(
            iKeepaliveHandler->StopKeepalive( *static_cast<CMccRtpDataSource*>( iRtpSource ), refCount ),
            KErrNotFound );

        iKeepaliveHandler->StartKeepaliveL( *static_cast<CMccRtpDataSource*>( iRtpSource ), *iRtpMediaClock );
        EUNIT_ASSERT_EQUALS( iKeepaliveHandler->iUsers.Count(), 1 );

        iKeepaliveHandler->StopKeepalive( *static_cast<CMccRtpDataSource*>( iRtpSource ), refCount );
        EUNIT_ASSERT_EQUALS( refCount, 0 );
    }
}
Пример #2
0
// -----------------------------------------------------------------------------
// UT_CQwertyKeyMap::UT_CheckSpecialCharactersL
// Check that the special characters from HbKeyboardSctLandscape are mapped.
// -----------------------------------------------------------------------------
//
void UT_CQwertyKeyMap::UT_CheckSpecialCharactersL()
    {
    // NOTE: these test cases pass in english, but not necesary with other
    // languages, as each language has its own keymap with some differences.

    _LIT(KInputWithSpecialChars, "<A1>C#W*2-($)&");
    _LIT(KMappedResult, "#a1#c#w#2-###&");
    HBufC* mapped = iKeyMap->GetMappedStringL(KInputWithSpecialChars);
    CleanupStack::PushL(mapped);
    EUNIT_ASSERT_EQUALS(*mapped, KMappedResult);
    CleanupStack::PopAndDestroy(mapped);
    mapped = NULL;
    
    
    // Those special characters (e.g '.') that are present in virtual
    // QWERTY keymap, have been mapped to individual keys.
    // That depends on the used language.
    
    _LIT(KInputWithSpecialChars2, ".8Hg %01 kK£");
    _LIT(KMappedResult2, ".8hg #01 kk#");
    mapped = iKeyMap->GetMappedStringL(KInputWithSpecialChars2);
    CleanupStack::PushL(mapped);
    EUNIT_ASSERT_EQUALS(*mapped, KMappedResult2);
    CleanupStack::PopAndDestroy(mapped);
    mapped = NULL;
    }
void UT_CG711PayloadFormatWrite::UT_CG711PayloadFormatWrite_FrameTimeIntervalL(  )
{
    //iWrite->iFrameTimeInterval = 20000 *  2;  // 20k * Channels
    TTimeIntervalMicroSeconds catchAfish;
    TMediaId mediaIdAudio( KUidMediaTypeAudio, 1 );
    TMediaId mediaIdVideo( KUidMediaTypeVideo, 1 );

    if ( !iAlloc )
    {
        catchAfish = iWrite->FrameTimeInterval ( mediaIdAudio );
        EUNIT_ASSERT_EQUALS( catchAfish.Int64(), 0 );

        catchAfish = iWrite->FrameTimeInterval ( mediaIdVideo );
        EUNIT_ASSERT_EQUALS( catchAfish.Int64(), 0 );


    }

    else
    {
        EUNIT_ASSERT_NO_LEAVE( iWrite->FrameTimeInterval ( mediaIdAudio ) );
        EUNIT_ASSERT_NO_LEAVE( iWrite->FrameTimeInterval ( mediaIdVideo ) );

    }
}
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_SourcePlayLL()
    {
    // Not logged on
    EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->SourcePlayL(), KErrNotFound );
    
    // Not allowed if not yet prepared
    InitializeL();
    EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->SourcePlayL(), KErrNotReady );
    
    // Ok when already prepared
    iSource->iState = MMccRtpInterface::ERtpStatePrimed;
    
    EUNIT_ASSERT_NO_LEAVE( iSource->SourcePlayL() );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamStarted );
    
    // Resuming
    iSource->iState = MMccRtpInterface::ERtpStatePaused; 
    EUNIT_ASSERT_NO_LEAVE( iSource->SourcePlayL() );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamResumed );
    EUNIT_ASSERT( iRtpKeepaliveMechanism->iStopped == EFalse )
    
    // State downgrade is ignored
    EUNIT_ASSERT_NO_LEAVE( iSource->SourcePrimeL() );
    EUNIT_ASSERT( MMccRtpInterface::ERtpStatePlaying == iSource->State() );
    
    // "Secure session"
    iRtpKeepaliveMechanism->iStopped = ETrue;
    TInt fakeSecSession( 3 );
    iSource->iSecSession = reinterpret_cast<CSRTPSession*>( &fakeSecSession );
    EUNIT_ASSERT_NO_LEAVE( iSource->SourcePlayL() );
    EUNIT_ASSERT( iRtpKeepaliveMechanism->iStopped == ETrue )
    iSource->iSecSession = NULL;
    }
void UT_CMccJitterCalculator::UT_CMccJitterCalculator_CalculateFerL()
    {
    TUint32 returnValue( 0 );
    
    // packet  lost
    TUint32 prevValue( 0 );
    TBool valueToadd( ETrue );
    TBool flagToAdd( ETrue );
    returnValue = iCalculator->CalculateFer( prevValue, valueToadd, flagToAdd );
    EUNIT_ASSERT_EQUALS( returnValue, 2000 );
    
    // packet  lost
    // returnValue == 2000
    returnValue = iCalculator->CalculateFer( returnValue, valueToadd, flagToAdd );
    EUNIT_ASSERT_EQUALS( returnValue, 3992 );
    
    // no packet lost - late packet - remove FER
    // decrease fer
    flagToAdd = EFalse;
    // returnValue == 3996
    returnValue = iCalculator->CalculateFer( returnValue, valueToadd, flagToAdd );
    
    EUNIT_ASSERT_EQUALS( returnValue, 2008 );
    
    // no packet lost - late packet - remove FER
    // decrease fer
    flagToAdd = EFalse;
    // returnValue == 5
    returnValue = 5;
    returnValue = iCalculator->CalculateFer( returnValue, valueToadd, flagToAdd );
    
    EUNIT_ASSERT_EQUALS( returnValue, 0);
    }
Пример #6
0
// -----------------------------------------------------------------------------
// CMceVideoCodecTest:: GettersTestL
// -----------------------------------------------------------------------------
//
void CMceVideoCodecTest::GettersTestL()
    {
    CMceComVideoCodec* flatData = 
        static_cast<CMceComVideoCodec*>( iVideoCodec->iFlatData );
    
    // AllowedFrameRates
    flatData->iAllowedFrameRates = KSomeAllowedFrameRates;
    EUNIT_ASSERT( iVideoCodec->AllowedFrameRates() == KSomeAllowedFrameRates );
    
    // FrameRate
    flatData->iFrameRate = KSomeFrameRate;
    EUNIT_ASSERT( iVideoCodec->FrameRate() == KSomeFrameRate);
    
    // MaxBitRate
    flatData->iMaxBitRate = KSomeMaxBitRate;
    EUNIT_ASSERT( iVideoCodec->MaxBitRate() == KSomeMaxBitRate );
    
    // AllowedResolutions
    flatData->iAllowedResolutions = KSomeAllowedResolutions;
    EUNIT_ASSERT( iVideoCodec->AllowedResolutions() == KSomeAllowedResolutions );
    
    // Resolution
    flatData->iResolutionWidth = KSomeResolutionWidth;
    flatData->iResolutionHeight = KSomeResolutionHeight;
    EUNIT_ASSERT_EQUALS( KSomeResolutionWidth, iVideoCodec->Resolution().iWidth );
    EUNIT_ASSERT_EQUALS( KSomeResolutionHeight, iVideoCodec->Resolution().iHeight );
    
    }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_RegisterPayloadTypesLL()
    {
    RArray<TUint> payloads;
    CleanupClosePushL( payloads );
    payloads.AppendL( KPcmuPayloadType );
    payloads.AppendL( KDefaultAmrNbPT );
    iSource->RegisterPayloadTypesL( payloads );
    EUNIT_ASSERT_EQUALS( iSource->iUsers.Count(), 2 );
    
    // Do again, multiple entries are not created
    iSource->RegisterPayloadTypesL( payloads );
    EUNIT_ASSERT_EQUALS( iSource->iUsers.Count(), 2 );

    // Try to unregister not registered payload type
    RArray<TUint> payloads2;
    CleanupClosePushL( payloads2 );
    payloads2.AppendL( KPcmaPayloadType );
    iSource->UnRegisterPayloadTypes( payloads2 );
    EUNIT_ASSERT_EQUALS( iSource->iUsers.Count(), 2 );
    CleanupStack::PopAndDestroy( &payloads2 );
    
    // Unregister registered payload types
    iSource->UnRegisterPayloadTypes( payloads );
    EUNIT_ASSERT_EQUALS( iSource->iUsers.Count(), 0 );
    CleanupStack::PopAndDestroy( &payloads );
    }
void UT_CMceCsReceiveQueue::UT_CMceCsReceiveQueue_IsEmptyL(  )
    {
    TMceIds ids;

    // Test empty
    EUNIT_ASSERT (iReceiveQueue->IsEmpty());
	EUNIT_ASSERT_EQUALS (0, iReceiveQueue->iReceiveItems.Count());

    // Add first item
    HBufC8* headers = HBufC8::NewL(1);
    CleanupStack::PushL (headers);
    HBufC8* content = HBufC8::NewLC(1);
    TMceCSReceiveItem item1(ids,headers,content,ETrue);
	User::LeaveIfError(iReceiveQueue->AddLast(item1));
    CleanupStack::Pop (2); // content, headers 
    EUNIT_ASSERT (!iReceiveQueue->IsEmpty());
    EUNIT_ASSERT_EQUALS (1, iReceiveQueue->iReceiveItems.Count());

    // Add second item
    TMceCSReceiveItem item2(ids,KErrGeneral);
    User::LeaveIfError(iReceiveQueue->AddLast(item2));
    EUNIT_ASSERT (!iReceiveQueue->IsEmpty());
	EUNIT_ASSERT_EQUALS (2, iReceiveQueue->iReceiveItems.Count());

    // Test remove first item
    iReceiveQueue->RemoveFirst();
    EUNIT_ASSERT (!iReceiveQueue->IsEmpty());
	EUNIT_ASSERT_EQUALS (1, iReceiveQueue->iReceiveItems.Count());

    // Test remove second item
    iReceiveQueue->RemoveFirst();
    EUNIT_ASSERT (iReceiveQueue->IsEmpty());
    EUNIT_ASSERT_EQUALS (0, iReceiveQueue->iReceiveItems.Count());
    }
void UT_CDTMFPayloadFormatRead::UT_CDTMFPayloadFormatRead_SetPayloadFormatL()
    {
    TDTMFPayloadFormat nullData( EDTMFPayloadFormatNotDefined );
    EUNIT_ASSERT_EQUALS( iRead->SetPayloadFormat( nullData ), KErrNotSupported );
    
    TDTMFPayloadFormat validData( EDTMFPayloadFormatTone );
    EUNIT_ASSERT_EQUALS( iRead->SetPayloadFormat( validData ), KErrNone );
    }
void UT_CDTMFPayloadFormatRead::UT_CDTMFPayloadFormatRead_FrameTimeIntervalL(  )
    {
    TInt64 interval = iRead->FrameTimeInterval( KUidMediaTypeAudio ).Int64();
    RDebug::Print( _L( "Frametime Interval value = %d" ), interval );
    
    EUNIT_ASSERT_EQUALS( iRead->FrameTimeInterval( KUidMediaTypeAudio ).Int64(), interval );
    EUNIT_ASSERT_EQUALS( iRead->FrameTimeInterval( KUidMediaTypeVideo ).Int64(), 0 );
    }
Пример #11
0
// -----------------------------------------------------------------------------
// UT_CQwertyKeyMap::UT_CheckAmountOfMappedKeysL
// Check the internal qwerty keymap does not have unnecessary (empty) entries.
// -----------------------------------------------------------------------------
//
void UT_CQwertyKeyMap::UT_CheckAmountOfMappedKeysL()
    {
    TInt amountOfMappedKeys = iKeyMap->iAmountOfKeys;
    
    EUNIT_ASSERT_EQUALS(amountOfMappedKeys, iKeyMap->iKeyNames.count());
    EUNIT_ASSERT_EQUALS(amountOfMappedKeys, iKeyMap->iKeyValues.count());
    //EUNIT_ASSERT_EQUALS(amountOfMappedKeys, iKeyMap->iKeyMapping.count());
    }
void Ut_CSpsBufferedPublisher::Ut_CSpsBufferedPublisher_DataSizeL()
{
    const TUint32 data( 0xFFFFFFFF );
    CSpsBufferedPublisher::SetL( KUidSystemCategory, KSPNotifyChangeKey, data );
    RArray<TUint32> array;
    iPublisher->GetL( array );
    EUNIT_ASSERT_EQUALS( 1, array.Count() );
    EUNIT_ASSERT_EQUALS( data, array[0] );
    array.Close();
}
void CNSmlDummyDataProvider_Test::TestStoreSupportMimeTypeL()
    {
    _LIT8( KNSmlvCard21Name, "text/x-vcard" );
    _LIT8( KNSmlvCard21Ver, "2.1" );

    const CSmlDataStoreFormat& storeFormat = iCNSmlDummyDataProvider->DoStoreFormatL();
    EUNIT_ASSERT_EQUALS( storeFormat.MimeFormatCount() ,1 );
    EUNIT_ASSERT_EQUALS( storeFormat.MimeFormat(0).MimeType().DesC(), KNSmlvCard21Name() );
    EUNIT_ASSERT_EQUALS( storeFormat.MimeFormat(0).MimeVersion().DesC(), KNSmlvCard21Ver() );
    }
void UT_CMccJitterCalculator::UT_CMccJitterCalculator_StartObservingL()
    {
    // Test delete of inactive calculator
    delete iCalculator;
    iCalculator = NULL;
    
    iCalculator = CMccJitterCalculator::NewL( *this );
    
    // Jitter reports
    iCalculator->iReportType = EMccJitterReport;
    EUNIT_ASSERT_EQUALS( iCalculator->StartObserving(), KErrNone );
    EUNIT_ASSERT_EQUALS( iCalculator->iJitterObsOn, ETrue );
    
    // Packet loss reports
    iCalculator->iReportType = EMccPacketLossReport;
    EUNIT_ASSERT_EQUALS( iCalculator->StartObserving(), KErrNone );
    EUNIT_ASSERT_EQUALS( iCalculator->iFrameLossObsOn, ETrue );
    
    // All reports
    iCalculator->iFrameLossObsOn = EFalse;
    iCalculator->iJitterObsOn = EFalse;
    iCalculator->iMediaQualityObservingStarted = EFalse;
    iCalculator->iReportType = EMccQualityReportAll;
    EUNIT_ASSERT_EQUALS( iCalculator->StartObserving(), KErrNone );
    EUNIT_ASSERT_EQUALS( iCalculator->iJitterObsOn, ETrue );
    EUNIT_ASSERT_EQUALS( iCalculator->iFrameLossObsOn, ETrue );
    EUNIT_ASSERT_EQUALS( iCalculator->iMediaQualityObservingStarted, ETrue );
   
    // Not supported reports
    iCalculator->iReportType = 998;
    EUNIT_ASSERT_EQUALS( iCalculator->StartObserving(), KErrArgument );
    }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_TestBaseClassL()
    {
    // Test some base class functions which are hard to test by other means
    
    // Internal event to all clients (no users)
    iSource->SendInternalRtpEventToAllClients( 
        iSource->iUsers, KMccRtpSourceUid, EMccInternalEventNone, KMccStreamError, 0, KErrGeneral );
    
    // Users exist
    InitializeL();
    
    iSource->SendInternalRtpEventToAllClients( 
        iSource->iUsers, KMccRtpSourceUid, EMccInternalEventNone, KMccStreamError, 0, KErrGeneral );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamError );
    
    // Secure events
    iSource->SendSecureRtpEventToClient( 
        NULL, KMccRtpSourceUid, EMccInternalEventNone, KMccStreamPaused, 0 );
    iSource->SendSecureRtpEventToClient( 
        iEventHandler, KMccRtpSourceUid, EMccInternalEventNone, KMccStreamPaused, 0 );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamPaused );
    
    // SendJitterEventToClient()
    iSource->SendJitterEventToClient( iEventHandler, KMccRtpSourceUid, 
    	EMccInternalEventNone, KMccEventNone, 0, 0, 1,2,3,4,5,6 );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccEventNone );
    const TMccRtpEventDataExtended& rtpEvent = 
    	(*reinterpret_cast<const TMccRtpEventDataExtendedPackage*>( &iEventHandler->iLastEvent.iEventData ))();
    EUNIT_ASSERT_EQUALS( rtpEvent.iJitterEstimate, 1 );
    EUNIT_ASSERT_EQUALS( rtpEvent.iPacketsReceived, 2 );
    EUNIT_ASSERT_EQUALS( rtpEvent.iPrevTransTime, 3 );
    EUNIT_ASSERT_EQUALS( rtpEvent.iTriggeredJitterLevel, 4 );
    EUNIT_ASSERT_EQUALS( rtpEvent.iPacketLoss, 5 );
    EUNIT_ASSERT_EQUALS( rtpEvent.iTriggeredPacketLoss, 6 );
    }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_SetSourceDataTypeCodeL()
    {
    TFourCC codec;
    TMediaId media( KUidMediaTypeVideo ); // wrong media type

    EUNIT_ASSERT_EQUALS( iSource->SetSourceDataTypeCode( codec, media ), KErrNone );

    // Set the correct media type
    TMediaId media2( KUidMediaTypeAudio );
    EUNIT_ASSERT_EQUALS( iSource->SetSourceDataTypeCode( codec, media2 ), KErrNone );
    }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_SourceDataTypeCodeL()
    {
    TMediaId mediaId( KUidMediaTypeVideo );
    EUNIT_ASSERT_EQUALS( iSource->SourceDataTypeCode( mediaId ), TFourCC() );

    iSource->SourceThreadLogoff();
    TFourCC codec( ' ','A','M','R' );
    TMediaId media2( KUidMediaTypeAudio );
    iSource->SetSourceDataTypeCode( codec, media2 );

    // The codecs SHOULD be equal
    EUNIT_ASSERT_EQUALS( iSource->SourceDataTypeCode( media2 ), codec );
    }
void UT_CMccJitterCalculator::UT_CMccJitterCalculator_CountPacketLossPercentageL()
    {
    TInt percentage( 0 );
    
    iCalculator->iHomeTime.HomeTime();
    
    // Not active
    iCalculator->JitterObserving();
    
    iCalculator->iPrevFerValue = 0;
    iCalculator->iStartingSeqNum = 80;
    iCalculator->iCurrentSeqNum = 100;
    
    // no packets lost
    iCalculator->iPrevExpectedPackets = 20;
    iCalculator->iReceivedPacketCounter = 20;

    iCalculator->CountPacketLossPercentage();
    
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevFerValue, 0 );
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevExpectedPackets, 20 );
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevPacketsReceived, 20 );
    
    
    // no packets lost, inorder
    iCalculator->iCurrentSeqNum = 102;  
    iCalculator->iPrevExpectedPackets = 22;

    iCalculator->CountPacketLossPercentage();
    
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevFerValue, 0 );
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevExpectedPackets, 22 );
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevPacketsReceived, 20 );
    
	
    // packet  lost - add FER by number of packets lost.
    // 5 packets lost
    iCalculator->iPrevFerValue = 0;
    iCalculator->iStartingSeqNum = 80;
    iCalculator->iCurrentSeqNum = 105;

    iCalculator->iPrevExpectedPackets = 20;
    iCalculator->iReceivedPacketCounter = 20;

    percentage = iCalculator->CountPacketLossPercentage();
    
    EUNIT_ASSERT_EQUALS( percentage, 1 );
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevFerValue, 7952 );
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevExpectedPackets, 25 );
    EUNIT_ASSERT_EQUALS( iCalculator->iPrevPacketsReceived, 20 );
    }
void UT_CG711PayloadFormatWrite::UT_CG711PayloadFormatWrite_SetSinkDataTypeCodeL(  )
{
    TFourCC fourcc;
    TMediaId mediaId( KUidMediaTypeAudio, 1 );
    TMediaId mediaIdVideo( KUidMediaTypeVideo, 1 );

    if ( !iAlloc )
    {
        fourcc = iWrite->SinkDataTypeCode( mediaId );
        EUNIT_ASSERT_EQUALS( iWrite->SetSinkDataTypeCode( fourcc, mediaId ), KErrNone );
        EUNIT_ASSERT_EQUALS( iWrite->SetSinkDataTypeCode( fourcc, mediaIdVideo ), KErrNotSupported );
        fourcc = iWrite->SinkDataTypeCode( mediaIdVideo );
        EUNIT_ASSERT_EQUALS( iWrite->SetSinkDataTypeCode( fourcc, mediaId ), KErrNone );
        EUNIT_ASSERT_EQUALS( iWrite->SetSinkDataTypeCode( fourcc, mediaIdVideo ), KErrNotSupported );


    }

    else
    {
        fourcc = iWrite->SinkDataTypeCode( mediaIdVideo );
        EUNIT_ASSERT_EQUALS( iWrite->SetSinkDataTypeCode( fourcc, mediaIdVideo ), KErrNotSupported );
        EUNIT_ASSERT_EQUALS( iWrite->SetSinkDataTypeCode( fourcc, mediaId ), KErrNone );
        fourcc = iWrite->SinkDataTypeCode( mediaId  );
        EUNIT_ASSERT_EQUALS( iWrite->SetSinkDataTypeCode( fourcc, mediaId ), KErrNone );
        EUNIT_ASSERT_EQUALS( iWrite->SetSinkDataTypeCode( fourcc, mediaIdVideo ), KErrNotSupported );


    }
}
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_TestSendEventL()
    {
    iSource->SourceThreadLogon( *iEventHandler );
    
    // No target payload
    iSource->SendStreamEventToClient( KMccStreamPaused, KErrNone, KMccPTNotDefined );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamPaused );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventNumData, 0 );
    
    // Target payload
    iSource->SendStreamEventToClient( KMccStreamResumed, KErrNone, 100 );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamResumed );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventNumData, KMccPayloadSpecificEvent );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iReserved, 100 );
    
    // No event handler
    iSource->iEventHandler = NULL;
    iSource->SendStreamEventToClient( KMccStreamStopped, KErrNone, KMccPTNotDefined );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamResumed );
    
    // Jitter event when no event handler
    TMccRtpEventDataExtended eventData;
    iSource->SendJitterEvent( eventData, KErrNone );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccStreamResumed );

    // Event handler exists
    iSource->iEventHandler = iEventHandler;
    iSource->SendJitterEvent( eventData, KErrNone );
    EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccMediaQualityStatus );
    }
void UT_CG711PayloadFormatWrite::UT_CG711PayloadFormatWrite_SinkThreadLogonL(  )
{
    if ( !iAlloc )
    {
        EUNIT_ASSERT_EQUALS( iWrite->SinkThreadLogon( *this ), KErrNone );

    }

    else
    {
        EUNIT_ASSERT_EQUALS( iWrite->SinkThreadLogon( *this ), KErrNone );

    }
}
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_SendRTCPSenderReportL()
    {
    // No RTP API set
    EUNIT_ASSERT_EQUALS( iSource->SendRTCPSenderReport(), KErrNotReady );

    TMccRtpSessionParams params;
    params.iRtpAPI = iRtpApi;
    params.iSessionId = iSession;
    params.iEnableRTCP = EFalse;
    params.iRtpKeepalive = iRtpKeepaliveMechanism;
    iSource->SetSessionParamsL( params );

    // Ok
    iSource->iRtpStreamId = 1; // the iStreamID must not be empty
    EUNIT_ASSERT_EQUALS( iSource->SendRTCPSenderReport(), KErrNone );
    }
void UT_CPELogEvent::T_CPELogEvent_SaveL4L(  )
    {
    TLogString test;
    _LIT( KVoipAddress, "*****@*****.**" );

    iMockContext->ExpectCallL( "CPELogInfo::CallState" ).
        ReturnsL<TPEState>( EPEStateIdle );
    
    iMockContext->ExpectCallL( "CPELogHandling::LogStringDelivery" ).
        ReturnsL( test );
    
    iMockContext->ExpectCallL( "CPELogHandling::LogStringMissed" ).
        ReturnsL( test );
    
    iMockContext->ExpectCallL( "CPELogInfo::PhoneNumberId" ).
        ReturnsL( EPEUnknownNumber );
    
    iMockContext->ExpectCallL( "CPELogInfo::EventType" ).
        ReturnsL( CPELogInfo::EPEVideoCallEvent );
  
    iMockContext->ExpectCallL( "CPELogInfo::CurrentLine" ).
        ReturnsL( CCCECallParameters::ECCELineTypeAux );
    
    iMockContext->ExpectCallL( "CPELogInfo::CallDirection" ).
        ReturnsL( RMobileCall::EMobileTerminated ).
        TimesL( 2 );

    iMockContext->ExpectCallL( "CPELogInfo::Name" ).
        ReturnsL( KNullDesC() );
    
    iMockContext->ExpectCallL( "CPELogInfo::PhoneNumber" ).
        ReturnsL( KNullDesC() );
    
    iMockContext->ExpectCallL( "CPELogInfo::VoipAddress" ).
        ReturnsL( KVoipAddress()).
        TimesL( 2 );
    
    iMockContext->ExpectCallL( "CPELogInfo::MyAddress" ).
        ReturnsL( KNullDesC());
    
    iMockContext->ExpectCallL( "CPELogInfo::Duration" ).
        ReturnsL( 0 );

    iMockContext->ExpectCallL( "CPELogInfo::ContactLink").
        ReturnsL( KNullDesC() ).
        TimesL( 4 );
    
    iMockContext->ExpectCallL( "CPELogInfo::CallState" ).
        ReturnsL<TPEState>( EPEStateIdle ).
        TimesL( 2 );
    
    iMockContext->ExpectCallL( "CPELogInfo::MissedCall" ).
        ReturnsL( ETrue );
    
    iMockContext->ExpectCallL( "CPELogHandlingCommand::AddEvent");
     
    iCPELogEvent->SaveL();
       
    EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); 
    }
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_DurationL(  )
    {
    if ( !iAlloc )
        {
        EUNIT_ASSERT_EQUALS( iRead->Duration( KUidMediaTypeAudio ).Int64(), 0 );
        EUNIT_ASSERT_EQUALS( iRead->Duration( KUidMediaTypeMidi ).Int64(), 0 );
        
        
        }
        
    else
        {
        EUNIT_ASSERT_NO_LEAVE( iRead->Duration( KUidMediaTypeAudio ) );
        
        }
    }
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_SetSampleRateL()
    {
    TUint sample = 0;
    if ( !iAlloc )
        {
        sample = iRead->SampleRate(); // 8000
        EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample ), KErrNone );
        EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample + 1 ), KErrNotSupported );
        EUNIT_ASSERT_EQUALS( iRead->SetSampleRate( sample - 8000 ), KErrNotSupported );
        }
    else
        {
        EUNIT_ASSERT_NO_LEAVE( iRead->SetSampleRate( sample ) );
        EUNIT_ASSERT_NO_LEAVE( iRead->SetSampleRate( sample + 1 ) );
        }
    }
void UT_CNATFWCandidate::UT_CNATFWCandidate_SetTransportAddrLL(  )
    {
    TInetAddr address( KInetAddr, 0 );

    NATFW_EUNIT_ASSERT_NO_LEAVE( iCandidate->SetTransportAddrL( address ) );
    EUNIT_ASSERT_EQUALS( KInetAddr, iCandidate->TransportAddr().Address() );
    }
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_SourceDataTypeCodeL(  )
    {
    if ( !iAlloc )
        {
        EUNIT_ASSERT_EQUALS( iRead->SourceDataTypeCode( KUidMediaTypeAudio ), iFourCC );
        EUNIT_ASSERT_EQUALS( iRead->SourceDataTypeCode( KUidMediaTypeVideo ), TFourCC( ) );
        
        }
    
    else 
        {
        EUNIT_ASSERT_EQUALS( iRead->SourceDataTypeCode( KUidMediaTypeAudio ), iFourCC );
        EUNIT_ASSERT_EQUALS( iRead->SourceDataTypeCode( KUidMediaTypeVideo ), TFourCC( ) );
        
        }
    }
void ut_cphoneringingtonecontroller::T_PlayRingingtoneTTS()
{
    // Expected data
    _LIT(KTextToSay, "Mr. Brownstone");
    TBuf<30> texttosay (KTextToSay);
    TBuf<50> ringingtone(KNokiatune);
    CPhoneRingingTone* aAudioVideoRingingTone = CPhoneRingingTone::NewL(ringingtone);
    aAudioVideoRingingTone->SetRingingType(EProfileRingingTypeRinging);
    aAudioVideoRingingTone->SetTtsToneToBePlayed(ETrue);
    aAudioVideoRingingTone->SetVolume(5);
    _LIT8( KMethod, "CPhoneTTSPlayer::NewL" );
    iMockContext->ExpectCallL( KMethod() );
    _LIT8( KMethod2, "CPhoneTTSPlayer::PlayTtsTone" );
    iMockContext->ExpectCallL( KMethod2() ).WithL(KTextToSay(), aAudioVideoRingingTone);   
    _LIT8( KMethod3, "CPhoneRingingtonePlayer::PlayProfileBasedTone" );
    iMockContext->ExpectCallL( KMethod3() ).WithL(aAudioVideoRingingTone);

    TPhoneCmdParamRingTone ringToneParam;
    ringToneParam.SetVolume(5);
    ringToneParam.SetRingingType(EProfileRingingTypeRinging);
    ringToneParam.SetTextToSay(texttosay);
    // Set the profile ring tone
    ringToneParam.SetRingTone( ringingtone);
    ringToneParam.SetType( EPhoneRingToneProfile );

    iRingingtoneplayer->PlayRingToneL( &ringToneParam );
    
    EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
    delete aAudioVideoRingingTone;
}
void UT_CPELogEvent::T_CPELogEvent_SaveLeaveL(  )
    {
    if ( iCPELogEvent->SaveLeave( ) )
        {
        EUNIT_FAIL_TEST( "SaveLeave FAILED wrong return value!");
        }
    EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
    }
void UT_CPELogEvent::T_CPELogEvent_IsCompletedL(  )
    {
    if ( iCPELogEvent->IsCompleted( ) )
        {
        EUNIT_FAIL_TEST( "IsCompleted FAILED return value!");
        }
    EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
    }