void UT_CMccRtpDataSource::UT_CMccRtpDataSource_SendMediaSignallingLL() { iSource->iEnableRtcp = ETrue; TMccEvent foo; UT_CMccRtpInterface::CreateRtcpEvent( foo ); EUNIT_ASSERT_LEAVE( iSource->SendMediaSignallingL( foo ) ); // No RtpApi foo.iEventCategory = KMccEventCategoryRtcp; foo.iEventType = KMccRtcpControl; TMccRtcpEventData eventData; eventData.iRtcpPacketType = KRtcpRrPacket; TMccRtcpEventDataPackage eventDataPkg( eventData ); foo.iEventData.Copy( eventDataPkg ); EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->SendMediaSignallingL( foo ), KErrNotReady ); // Rr, stream does not exist InitializeL( EFalse, ETrue ); EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->SendMediaSignallingL( foo ), KErrNotReady ); // Stream exists CreateStreamL(); EUNIT_ASSERT_NO_LEAVE( iSource->SendMediaSignallingL( foo ) ); // Sr eventData.iRtcpPacketType = KRtcpSrPacket; eventDataPkg = eventData; foo.iEventData.Copy( eventDataPkg ); EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->SendMediaSignallingL( foo ), KErrArgument ); }
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_CSrtpAuthentication_RCC::UT_AuthenticateL_RFC2202_Test7_ThirtyTwoL( ) { EUNIT_ASSERT_SPECIFIC_LEAVE( iAuthenticator->AuthenticateL(32, *iRFC2202_Test7_Key_640bits, *iRFC2202_Test7_Data_73bits, KNullDesC8), KErrArgument); }
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_ConfigurePayloadFormatL2L( ) { TBuf8<20> buf; buf.Append( _L8("something") ); EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->ConfigurePayloadFormatL( buf ), KErrArgument ); TMccCodecInfo codec; codec.iAlgoUsed = 0; codec.iBitrate = 6400; codec.iCNFrameSize = 0; codec.iCodecMode = 3; codec.iEnableDTX = 1; codec.iFourCC = 31313747; codec.iFrameSize = 0; codec.iHwFrameTime = 20; codec.iMaxPtime = 200; codec.iPayloadType = 8; codec.iPtime = 20; codec.iRedundancyCount = 0; codec.iRedundantPayload = 0; codec.iIsUpdate = ETrue; TMccCodecInfoBuffer buffer( codec ); EUNIT_ASSERT_NO_LEAVE( iRead->ConfigurePayloadFormatL( buffer )); }
void UT_CMceSecureDesStream::UT_CMceSecureDesStream_GenerateCryptoSuiteLineL() { TMceSecureCryptoInfo crypto; TBuf8< KCryptoLineMaxLength > cryptoLine; /*=============Test case 1 ====================================================*/ crypto.iEncAlgms = ESrtpNullAlg; iSecureStream->GenerateCryptoSuiteLineL( cryptoLine, crypto ); EUNIT_ASSERT( iSecureStream->iGnoreSdpMsg ); cryptoLine.Zero(); iSecureStream->iGnoreSdpMsg = EFalse; /*=============Test case 2 ====================================================*/ crypto.iTagLen = KAuthTagLength80; crypto.iEncAlgms = ESrtpEncAES_CM; EUNIT_ASSERT_SPECIFIC_LEAVE( iSecureStream->GenerateCryptoSuiteLineL( cryptoLine, crypto ), KErrArgument); cryptoLine.Zero(); /*=============Test case 3 ====================================================*/ crypto.iTagLen = KAuthTagLength80; crypto.iEncodedKey = KEncodedKey; crypto.iMKIUsed = ETrue; crypto.iMKI = KMKI1 ; cryptoLine.Copy( KNullDesC8); iSecureStream->GenerateCryptoSuiteLineL( cryptoLine, crypto ); EUNIT_ASSERT ( cryptoLine.CompareF( KCryptoLine2 )==0 ); EUNIT_ASSERT( !iSecureStream->iGnoreSdpMsg ); cryptoLine.Zero(); crypto.CryptoDestruct(); }
void UT_CSRTPCryptoHandlerSRTCP::UT_AuthenticateLL( ) { //false cases when auth tage =0 but using HMAC auth HBufC8* encSrtcpPacket =HBufC8::NewLC(KSRTCPPacketNoAuthTag().Length()); *encSrtcpPacket=KSRTCPPacketNoAuthTag; Hex(*encSrtcpPacket); TInt len= KSRTCPPacketNoAuthTag().Length(); encSrtcpPacket->Des().SetLength(len/2); //update crypto handler in the session //Set AuthLen=0 TSrtpCryptoParams crypto; crypto.iSrtcpAuthTagLen=0; iCryptoHandlerSRTCP->Context().UpdateCryptoParams(crypto); iCryptoHandlerSRTCP->InitializeEncryptedPacketL(*encSrtcpPacket); iCryptoHandlerSRTCP->ReceiverPacketIndexL(); iCryptoHandlerSRTCP->CheckMasterKeyIdentifierL(); iCryptoHandlerSRTCP->DeriveSessionKeysL(); // do the authentication (integrity check) EUNIT_ASSERT_SPECIFIC_LEAVE(iCryptoHandlerSRTCP->AuthenticateL(), KErrNotFound); CleanupStack::PopAndDestroy(encSrtcpPacket); }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_FillBufferLL() { EUNIT_ASSERT_NO_LEAVE( iSource->FillBufferL( NULL, NULL, TMediaId() ) ); CMMFDataBuffer* buffer = CMMFDataBuffer::NewL( 100 ); CleanupStack::PushL( buffer ); EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->FillBufferL( buffer, NULL, TMediaId() ), KErrArgument ); CleanupStack::PopAndDestroy( buffer ); }
void UT_CMceSecureDesStream::UT_CMceSecureDesStream_GenerateCryptoLineL() { TInt cryptoCount = 1; TBuf8< KCryptoLineMaxLength > cryptoLine; /*=============Test case 1 ====================================================*/ iSecureStream->GenerateCryptoLineL( cryptoLine, cryptoCount, EFalse ); cryptoLine.Zero(); /*=============Test case 2 ====================================================*/ EUNIT_ASSERT_SPECIFIC_LEAVE ( iSecureStream->GenerateCryptoLineL( cryptoLine, cryptoCount, ETrue ), KErrArgument ); cryptoLine.Zero(); /*=============Test case 3====================================================*/ iSecureStream->iCryptoOuts->At( 0 ).iTagLen = KAuthTagLength32; iSecureStream->iCryptoOuts->At( 0 ).iEncAlgms = ESrtpEncAES_CM; iSecureStream->iCryptoOuts->At( 0 ).iAuthAlgms = ESrtpAuthHMAC_SHA1; iSecureStream->iCryptoOuts->At( 0 ).iCryptoSuite = KAES_SHA1_32; TMceSecureCryptoInfo cryptoIn; iSecureStream->iCryptoIns->AppendL( cryptoIn ); iSecureStream->iCryptoIns->At( 0 ).Copy( iSecureStream->iCryptoOuts->At( 0 ) ); iSecureStream->GenerateCryptoLineL( cryptoLine, cryptoCount, ETrue ); cryptoLine.Zero(); /*=============Test case 4 ====================================================*/ iSecureStream->GenerateCryptoLineL( cryptoLine, cryptoCount, EFalse ); cryptoLine.Zero(); /*=============Test case for iKeyNeedUpdated is true===========================*/ iSecureStream->iCryptoOuts->At( 0 ).iTagLen = KAuthTagLength32; iSecureStream->iCryptoOuts->At( 0 ).iEncAlgms = ESrtpEncAES_CM; iSecureStream->iCryptoOuts->At( 0 ).iAuthAlgms = ESrtpAuthHMAC_SHA1; iSecureStream->iCryptoOuts->At( 0 ).iCryptoSuite = KAES_SHA1_32; TMceSecureCryptoInfo cryptoIn1; iSecureStream->iCryptoIns->AppendL(cryptoIn1); iSecureStream->iCryptoIns->At( 0 ).Copy(iSecureStream->iCryptoOuts->At( 0) ); iSecureSession->iKeyNeedUpdated = ETrue; iSecureStream->GenerateCryptoLineL(cryptoLine, cryptoCount, ETrue); cryptoLine.Zero(); /*=============Test case for iKeyNeedUpdated is false===========================*/ iSecureSession->iKeyNeedUpdated = EFalse; iSecureStream->GenerateCryptoLineL(cryptoLine, cryptoCount, ETrue); cryptoLine.Zero(); /*=============Test case 5====================================================*/ cryptoLine.Copy( KNullDesC8); iSecureStream->GenerateCryptoLineL( cryptoLine, cryptoCount, EFalse ); EUNIT_ASSERT ( cryptoLine.Length() == KCryptoLine3().Length() ); cryptoLine.Zero(); }
void UT_CMceSecureDesStream::UT_CMceSecureDesStream_ValidateAnswerByOfferLL( ) { /*=============Test case 1 ====================================================*/ //no iCryptoOuts found iSecureStream->ValidateAnswerByOfferL( KSecAttrValue1 ); EUNIT_ASSERT( iSecureStream->iGnoreSdpMsg ); /*=============Test case 2 ====================================================*/ iSecureStream->SetPreferedCryptoL(); iSecureStream->iCryptoOuts->At(0).iMKIUsed=ETrue; iSecureStream->iCryptoOuts->At(1).iMKIUsed=ETrue; iSecureStream->ValidateAnswerByOfferL( KSecAttrValue1 ); EUNIT_ASSERT( !iSecureStream->iGnoreSdpMsg ); EUNIT_ASSERT(iSecureStream->iCryptoIn.iMKIUsed==ETrue); EUNIT_ASSERT(iSecureStream->iCryptoIn.iMKI==KMKI1); TUint64 mkiLiftTime = 1048576;//2^20 EUNIT_ASSERT(iSecureStream->iCryptoIn.iMKLifeTime == mkiLiftTime); /*=============Test case 3 ====================================================*/ iSecureStream->ValidateAnswerByOfferL( KSecAttrValue5 ); EUNIT_ASSERT( !iSecureStream->iGnoreSdpMsg ); EUNIT_ASSERT(iSecureStream->iCryptoIn.iMKI==KMKI2); TReal result = 0; Math::Pow(result, 2, 10); EUNIT_ASSERT( iSecureStream->iCryptoIn.iMKLifeTime == (TUint64 ) result); /*=============Test case 3 ====================================================*/ EUNIT_ASSERT_SPECIFIC_LEAVE( iSecureStream->ValidateAnswerByOfferL( KSecAttrNotValidLength ), KErrArgument ); /*=============Test case 4 ====================================================*/ EUNIT_ASSERT_SPECIFIC_LEAVE( iSecureStream->ValidateAnswerByOfferL( KSecAttrNoInline ), KErrArgument ); /*=============Test case 5 ====================================================*/ EUNIT_ASSERT_SPECIFIC_LEAVE( iSecureStream->ValidateAnswerByOfferL( KSecAttrNotValidKey ), KErrArgument ); /*=============Test case 6 ====================================================*/ iSecureStream->ValidateAnswerByOfferL( KSecAttrCryptoNotSupport ); EUNIT_ASSERT( iSecureStream->iGnoreSdpMsg ); /*=============Test case 7 ====================================================*/ iSecureStream->iGnoreSdpMsg = EFalse; iSecureStream->ValidateAnswerByOfferL( KSecAttrOnlyKey ); EUNIT_ASSERT( !iSecureStream->iGnoreSdpMsg ); /*==========================================================================*/ }
void UT_CG711PayloadFormatWrite::UT_CG711PayloadFormatWrite_EmptyBufferLL( ) { TMediaId mediaId( KUidMediaTypeAudio, 1 ); TMediaId mediaIdVideo( KUidMediaTypeVideo, 1 ); if ( !iAlloc ) { EUNIT_ASSERT_NO_LEAVE( iWrite->EmptyBufferL( iBuffer, iUlSink, mediaId ) ); EUNIT_ASSERT_SPECIFIC_LEAVE( iWrite->EmptyBufferL( iBuffer, iUlSink, mediaIdVideo ), KErrNotSupported ); } else { EUNIT_ASSERT_NO_LEAVE( iWrite->EmptyBufferL( iBuffer, iUlSink, mediaId ) ); EUNIT_ASSERT_SPECIFIC_LEAVE( iWrite->EmptyBufferL( iBuffer, iUlSink, mediaIdVideo ), KErrNotSupported ); } }
void UT_CG711PayloadFormatWrite::UT_CG711PayloadFormatWrite_CreateSinkBufferLL( ) { TMediaId mediaId( KUidMediaTypeAudio, 1 ); TMediaId mediaIdVideo( KUidMediaTypeVideo, 1 ); TBool reference; if ( !iAlloc ) { EUNIT_ASSERT_NO_LEAVE( iBuf = iWrite->CreateSinkBufferL( mediaId, reference ) ); EUNIT_ASSERT_SPECIFIC_LEAVE( iBuf = iWrite->CreateSinkBufferL( mediaIdVideo, reference ), KErrNotSupported ); } else { EUNIT_ASSERT_SPECIFIC_LEAVE( iWrite->CreateSinkBufferL( mediaId, reference ), KErrNoMemory ); EUNIT_ASSERT_SPECIFIC_LEAVE( iWrite->CreateSinkBufferL( mediaIdVideo, reference ), KErrNotSupported ); } }
void UT_CMceSecureDesStream::UT_CMceSecureDesStream_DecodeSecureSdpAnswerLL( ) { /*===========Test case 1 ==================================================*/ //state ==ERefresh or Eupdate Real Decode if ( !iSession->iClientCryptoSuites.Count() ) { User::LeaveIfError ( iSession->iClientCryptoSuites.Append(EAES_CM_128_HMAC_SHA1_32)); User::LeaveIfError ( iSession->iClientCryptoSuites.Append(EAES_CM_128_HMAC_SHA1_80)); } CSdpMediaField* mediaOffer = CSdpMediaField::DecodeL( KMceTestMeidaNoCrypto ); CleanupStack::PushL( mediaOffer ); iSecureStream->Session().iIsSecureSession = ETrue; iSecureSession->iCryptoContextUpdate = ETrue; iSecureStream->EncodeSecureSdpL( *mediaOffer, EFalse ); EUNIT_ASSERT( iSecureStream->Session().iIsSecureSession ); CSdpMediaField* mediaAnswer1 = CSdpMediaField::DecodeL( KMceTestMeidaCryptoSAVPF ); CleanupStack::PushL( mediaAnswer1 ); iSecureStream->DecodeSecureSdpAnswerL( *mediaAnswer1 ); EUNIT_ASSERT( iSecureStream->Session().iIsSecureSession ); CleanupStack::PopAndDestroy(mediaAnswer1); CleanupStack::PopAndDestroy(mediaOffer); /*===========Test case 2 ==================================================*/ mediaOffer = CSdpMediaField::DecodeL( KMceTestMeidaNoCrypto ); CleanupStack::PushL( mediaOffer ); iSecureSession->iCryptoContextUpdate = ETrue; iSecureStream->EncodeSecureSdpL(*mediaOffer, EFalse); EUNIT_ASSERT( iSecureStream->Session().iIsSecureSession ); CSdpMediaField* mediaAnswer2 = CSdpMediaField::DecodeL( KMceTestMeidaCryptoWrongProtocol ); CleanupStack::PushL( mediaAnswer2 ); //iCryptoOut crypto is not set iSecureStream->DecodeSecureSdpAnswerL(*mediaAnswer2); EUNIT_ASSERT( !iSecureStream->Session().iIsSecureSession ); EUNIT_ASSERT( iSecureStream->iCryptoIn.iMKLifeTime == 32 ); EUNIT_ASSERT( iSecureStream->iCryptoOut.iMKLifeTime == KDefalutMaterKeysLifeTime ); CleanupStack::PopAndDestroy(mediaAnswer2); CleanupStack::PopAndDestroy(mediaOffer); /*===========Test case 3 ==================================================*/ mediaOffer = CSdpMediaField::DecodeL( KMceTestMeidaNoCrypto ); CleanupStack::PushL( mediaOffer ); iSecureSession->iCryptoContextUpdate = ETrue; iSecureStream->EncodeSecureSdpL(*mediaOffer, EFalse ); EUNIT_ASSERT( !iSecureStream->Session().iIsSecureSession ); CSdpMediaField* mediaAnswer3 = CSdpMediaField::DecodeL( KMceTestMeidaCryptoMultiple ); CleanupStack::PushL( mediaAnswer3 ); EUNIT_ASSERT_SPECIFIC_LEAVE ( iSecureStream->DecodeSecureSdpAnswerL(*mediaAnswer3), KErrArgument ); CleanupStack::PopAndDestroy(mediaAnswer3); CleanupStack::PopAndDestroy(mediaOffer); }
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_CreateSourceBufferL_1L( ) { TBool refO( ETrue ); TBool refV( EFalse ); if ( !iAlloc ) { EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, *iBuffi, refO ) ); EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, *iBuffi, refV ) ); EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeVideo, *iBuffi, refO ), KErrNotSupported ); } else { EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, *iBuffi, refO ) ); EUNIT_ASSERT_NO_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, *iBuffi, refV ) ); EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeVideo, *iBuffi, refO ), KErrNotSupported ); } }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_StartInactivityTimerLL() { TUint32 time( 0 ); // Invalid time EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->StartInactivityTimerL( time ), KErrArgument ); time = 5000; // Ok MCC_EUNIT_ASSERT_NO_LEAVE( iSource->StartInactivityTimerL( time ) ); }
void UT_CMccResourceItem::UT_CMccResourceItem_GetMultiplexerLL( ) { CMccMultiplexer* multiplexer = NULL; EUNIT_ASSERT_SPECIFIC_LEAVE( multiplexer = iItem->GetMultiplexerL(), KErrNotReady ); EUNIT_ASSERT( multiplexer == NULL ); delete iItem; iItem = NULL; iItem = CMccResourceItem::NewL( 0, NULL, iSourceStub, 1, ETrue ); EUNIT_ASSERT_NO_LEAVE(multiplexer = iItem->GetMultiplexerL()); EUNIT_ASSERT( multiplexer != NULL ); }
void T_CSPSettingsEngine::T_CSPSettingsEngine_AddEntryLL( ) { CSPEntry* entry = CSPEntry::NewLC(); TServiceId id = entry->GetServiceId(); EUNIT_ASSERT_SPECIFIC_LEAVE( iCSPSettingsEngine->AddEntryL( *entry ), KErrArgument ) ; User::LeaveIfError( entry->SetServiceName( _L("Nimi") ) ); iCSPSettingsEngine->AddEntryL( *entry ); EUNIT_ASSERT( id != entry->GetServiceId() ); CleanupStack::PopAndDestroy( entry ); }
void UT_CIceHostResolver::UT_CICEHostResolver_GetConnectionIdLL() { UT_CICEHostResolver_FetchCandidateLL(); // test with host, stun & relay candidates TInt hostCandidateInd( KErrNotFound ); TUint connectionId( 0 ); for ( TInt i(0); i < iLocalCandidates.Count(); ++i ) { if ( TIceTestUtils::AllocTestEnabled() ) { iResolver->GetConnectionIdL( *iLocalCandidates[i], connectionId ); } else { if ( CNATFWCandidate::EHost == iLocalCandidates[i]->Type() ) { hostCandidateInd = i; EUNIT_ASSERT_NO_LEAVE( iResolver->GetConnectionIdL( *iLocalCandidates[i], connectionId ) ); } else { EUNIT_ASSERT_SPECIFIC_LEAVE( iResolver->GetConnectionIdL( *iLocalCandidates[i], connectionId ), KErrNotFound ); } } } // test with peer reflexive candidate if ( KErrNotFound != hostCandidateInd ) { CNATFWCandidate* peerCandidate = CNATFWCandidate::NewLC( *iLocalCandidates[hostCandidateInd] ); peerCandidate->SetType( CNATFWCandidate::EPeerReflexive ); if ( TIceTestUtils::AllocTestEnabled() ) { iResolver->GetConnectionIdL( *peerCandidate, connectionId ); } else { EUNIT_ASSERT_NO_LEAVE( iResolver->GetConnectionIdL( *peerCandidate, connectionId ) ); } CleanupStack::PopAndDestroy( peerCandidate ); } }
void T_CSPSettingsEngine::T_CSPSettingsEngine_PropertyNameArrayFromItemTypeLL( ) { RPropertyArray* propertyArray = new (ELeave) RPropertyArray( 3 ); CleanupStack::PushL( propertyArray ); EUNIT_ASSERT_SPECIFIC_LEAVE( iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeNotDefined, *propertyArray ), KErrArgument ); iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeVoIPSubProperty, *propertyArray ); iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypePresenceSubProperty, *propertyArray ); iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeIMSubProperty, *propertyArray ); iCSPSettingsEngine->FindSubServicePropertiesL( 0, EItemTypeVMBXSubProperty, *propertyArray ); CleanupStack::PopAndDestroy( propertyArray ); }
void UT_CSRTPCryptoHandlerSRTCP::UT_CheckMasterKeyIdentifierLL( ) { HBufC8* encSrtcpPacket =HBufC8::NewLC(KSRTCPPacketWrongMKI().Length()); *encSrtcpPacket=KSRTCPPacketWrongMKI; Hex(*encSrtcpPacket); TInt len= KSRTCPPacketWrongMKI().Length(); encSrtcpPacket->Des().SetLength(len/2); iCryptoHandlerSRTCP->InitializeEncryptedPacketL(*encSrtcpPacket); iCryptoHandlerSRTCP->ReceiverPacketIndexL(); //giving packet different MKI from the one in the master key EUNIT_ASSERT_SPECIFIC_LEAVE(iCryptoHandlerSRTCP->CheckMasterKeyIdentifierL(), KErrNotFound); CleanupStack::PopAndDestroy(encSrtcpPacket); }
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_BufferFilledLL( ) { TRtpRecvHeader test; test.iPayloadType = 13; if ( !iAlloc ) { CMMFBuffer* buf = NULL; EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->DataBufferFilledL( buf, test ), KErrArgument ); CMMFDataBuffer* buffi = CMMFDataBuffer::NewL( 150 ); buf = buffi; CleanupStack::PushL( buf ); iRtpDataSourceStub->FillBufferL( buf, iConsumer, KUidMediaTypeAudio ); EUNIT_ASSERT_NO_LEAVE( iRead->DataBufferFilledL( iRead->iSourceBuffer, test ) ); buffi->Data().Append( _L("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" )); EUNIT_ASSERT_NO_LEAVE( iRead->DataBufferFilledL( iRead->iSourceBuffer, test ) ); CleanupStack::PopAndDestroy( buf ); } else { CMMFBuffer* buf = NULL; EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->DataBufferFilledL( buf, test ), KErrArgument ); CMMFDataBuffer* buffi = CMMFDataBuffer::NewL( 150 ); buf = buffi; CleanupStack::PushL( buf ); iRtpDataSourceStub->FillBufferL( buf, iConsumer, KUidMediaTypeAudio ); EUNIT_ASSERT_NO_LEAVE( iRead->DataBufferFilledL( iRead->iSourceBuffer, test ) ); buffi->Data().Append( _L("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" )); EUNIT_ASSERT_NO_LEAVE( iRead->DataBufferFilledL( iRead->iSourceBuffer, test ) ); CleanupStack::PopAndDestroy( buf ); } }
void UT_CSRTPCryptoHandlerSRTCP::UT_ReplayProtectionL4L( ) { //Set stored PktIndx number to bigger than the one in the sequence number //and outside the Replay window iCryptoHandlerSRTCP->iReplayPktIndex= KTestSeqNr65536; HBufC8* encSrtcpPacket1 =HBufC8::NewLC(KSRTCPPacket1().Length()); *encSrtcpPacket1=KSRTCPPacket1; Hex(*encSrtcpPacket1); TInt len= KSRTCPPacket1().Length(); encSrtcpPacket1->Des().SetLength(len/2); iCryptoHandlerSRTCP->InitializeEncryptedPacketL(*encSrtcpPacket1); iCryptoHandlerSRTCP->ReceiverPacketIndexL(); // do the replay protection EUNIT_ASSERT_SPECIFIC_LEAVE( iCryptoHandlerSRTCP->ReplayProtectionL(), KErrArgument ); CleanupStack::PopAndDestroy(encSrtcpPacket1); }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_StandbyL() { EUNIT_ASSERT_EQUALS( iSource->StandBy( EForceStandby, 100 ), KErrNotFound ); // Standby force when properly initialized InitializeL(); EUNIT_ASSERT_EQUALS( iSource->iUsers.Count(), 2 ); EUNIT_ASSERT_EQUALS( iSource->StandBy( EForceStandby, KPcmuPayloadType ), KErrNone ); iSource->iState = MMccRtpInterface::ERtpStatePlaying; EUNIT_ASSERT_EQUALS( iSource->StandBy( EForceStandby, KPcmuPayloadType ), KErrNone ); EUNIT_ASSERT( iSource->iUsers[ 0 ].iStandbyState == EInactive ); // Test activation when already inactive EUNIT_ASSERT_EQUALS( iSource->StandBy( EActivateStandby, KPcmuPayloadType ), KErrNone ); EUNIT_ASSERT( iSource->iUsers[ 0 ].iStandbyState == EInactive ); // Test activation when activating iSource->iUsers[ 0 ].iStandbyState = EActivating; EUNIT_ASSERT_EQUALS( iSource->StandBy( EActivateStandby, KPcmuPayloadType ), KErrNone ); EUNIT_ASSERT( iSource->iUsers[ 0 ].iStandbyState == EActivating ); // Test activation when inactive iSource->iUsers[ 0 ].iStandbyState = EActive; EUNIT_ASSERT_EQUALS( iSource->StandBy( EActivateStandby, KPcmuPayloadType ), KErrNone ); EUNIT_ASSERT( iSource->iUsers[ 0 ].iStandbyState == EInactive ); // Test deactivation EUNIT_ASSERT_EQUALS( iSource->StandBy( EDeactivateStandby, KPcmuPayloadType ), KErrNone ); EUNIT_ASSERT( iSource->iUsers[ 0 ].iStandbyState == ETurnedOff ); // Test activation when standby is turned off (timer expires) iSource->iUsers[ 0 ].iTimerId = 2; EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->TimerExpiredL( 2, NULL ), KErrNotSupported ); // Test timer expiration for inactivity iSource->iInactivityTimerId = 3; iSource->TimerExpiredL( 3, NULL ); EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccInactivityEvent ); }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_SRTPMasterKeyStaleEvent1L() { //SetUp SecureSession TInetAddr destination; destination.Input(_L("127.0.0.1") ); iSecSession = CSRTPSession::NewL( destination ); //Set up MCCparams TMccRtpSessionParams params; params.iRtpAPI = iRtpApi; params.iSecSession = iSecSession; params.iSessionId = iSession; params.iEnableRTCP = EFalse; params.iRtpKeepalive = iRtpKeepaliveMechanism; EUNIT_ASSERT_NO_LEAVE( iSource->SetSessionParamsL( params ) ); iSource->SourceThreadLogon( *iEventHandler ); iSource->SRTPMasterKeyStaleEvent( *iSecSession ); EUNIT_ASSERT( iSource->iSecureKeyExpired ); EUNIT_ASSERT_EQUALS( iEventHandler->iLastEvent.iEventType, KMccMasterKeyStaled ); EUNIT_ASSERT_SPECIFIC_LEAVE( iSource->SourcePlayL(), KErrGeneral ); }
// ----------------------------------------------------------------------------- // CCalenExporterTest::ExportVCalTestL // Test exporting ICAL // ----------------------------------------------------------------------------- // void CCalenExporterTest::ExportVCalTestL() { //uid _LIT8( KTestUid, "123544"); //entry CCalEntry* entry = NULL; entry = CCalEntry::NewL(CCalEntry::EEvent, KTestUid().AllocL(), CCalEntry::EMethodNone, 0 ); CleanupStack::PushL( entry ); CBufFlat* buf = CBufFlat::NewL( 100 ); CleanupStack::PushL(buf); RBufWriteStream writeStream; writeStream.Open(*buf); CleanupClosePushL(writeStream); RPointerArray<CCalEntry> array; array.Append( entry ); //should not leave EUNIT_ASSERT_NO_LEAVE( iCalenExporter->ExportVCalL( array, writeStream) ); array.Append( entry ); //should leave with KErrNotSupported EUNIT_ASSERT_SPECIFIC_LEAVE( iCalenExporter->ExportVCalL( array, writeStream), KErrNotSupported ); array.Close(); CleanupStack::PopAndDestroy(&writeStream); CleanupStack::PopAndDestroy(buf); CleanupStack::PopAndDestroy( entry ); }
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_FillBufferLL( ) { if ( !iAlloc ) { iRead->iCurrentBuffer = iRead->EBufferOne; EUNIT_ASSERT_NO_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeAudio ) ); EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeVideo ), KErrNotSupported ); // KErrNotSupported iRead->iCurrentBuffer = iRead->EBufferTwo; EUNIT_ASSERT_NO_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeAudio ) ); iRead->iBufferToReadExists = ETrue; EUNIT_ASSERT_NO_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeAudio ) ); EUNIT_ASSERT_LEAVE( iRead->FillBufferL( NULL, iDLDataPathStub, KUidMediaTypeAudio ) ); } else { EUNIT_ASSERT_LEAVE( iRead->FillBufferL( iBuffi, iDLDataPathStub, KUidMediaTypeMidi ) ); } }
void UT_CIceConnectivityCheck::UT_CICEConnectivityCheck_PerformConnCheckL4L() { const TUint priority = 100; if ( TIceTestUtils::AllocTestEnabled() ) { EUNIT_ASSERT_SPECIFIC_LEAVE( iConnCheck->PerformConnCheckL( CIceConnectivityCheck::EIceCheckTypePeriodic, priority, KTaTimerValueForChecks ), KErrNoMemory ); } else { iLocalCand->SetType( CNATFWCandidate::ERelay ); delete iConnCheck; iConnCheck = NULL; iConnCheck = CIceConnectivityCheck::NewL( *this, *iLocalCand, *iRemoteCand, *iConnHandler, *iCandStorage ); CNATFWPluginApi* turnPlugin = iPluginContainer->PluginByType( KNatPluginTypeTurn() ); turnPlugin->FetchCandidateL( 1, 100, iLocalCand->TransportAddr() ); // Test succesfull case iCandStorage->AddLocalCandidateL( CNATFWCandidate::NewL( *iLocalCand ) ); iConnCheck->PerformConnCheckL( CIceConnectivityCheck::EIceCheckTypePeriodic, priority, KTaTimerValueForChecks ); EUNIT_ASSERT( iConnCheck->iRemotePriority == 0 ); EUNIT_ASSERT( iConnCheck->iRemoteFavored == EFalse ); EUNIT_ASSERT( CIceConnectivityCheck::EIceCheckInProgress == iConnCheck->State() ); TInetAddr localAddr = iLocalCand->TransportAddr(); TInetAddr peerAddr = iRemoteCand->TransportAddr(); TInetAddr mappedAddr( KLocalAddr ); mappedAddr.SetPort( KLocalPort ); mappedAddr.SetFamily( KAfInet ); EUNIT_ASSERT_NO_LEAVE( iConnCheck->ConnCheckCompletedL( KErrNone, localAddr, peerAddr, mappedAddr ) ); EUNIT_ASSERT( iValidatedPair && !iValidatedPair->Selected() ); delete iValidatedPair; iValidatedPair = NULL; EUNIT_ASSERT_NO_LEAVE( iConnCheck->PerformNominationL( 0 ) ); EUNIT_ASSERT_NO_LEAVE( iConnCheck->ConnCheckCompletedL( KErrNone, localAddr, peerAddr, mappedAddr ) ); EUNIT_ASSERT( KErrNone == iCheckResult ); EUNIT_ASSERT( iValidatedPair && iValidatedPair->Selected() ); /*EUNIT_ASSERT( iValidatedPair->LocalCandidate().Priority() == iLocalCand->Priority() );*/ EUNIT_ASSERT( iValidatedPair->RemoteCandidate().Priority() == iRemoteCand->Priority() ); // remote has seen some our local candidate, which was signaled EUNIT_ASSERT( iValidatedPair->LocalCandidate() .TransportAddr().CmpAddr( mappedAddr ) ); delete iValidatedPair; iValidatedPair = NULL; } }
void UT_CDTMFPayloadFormatRead::UT_CDTMFPayloadFormatRead_ConfigurePayloadFormatLL( ) { TBuf8<10> buf; EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->ConfigurePayloadFormatL( buf ), KErrArgument ); TMccCodecInfo codec; codec.iFourCC.Set( TFourCC( 'D','T','M','F' ) ); codec.iBitrate = 12200; codec.iCodecMode = KDtmfModeEvent; codec.iPtime = 20; codec.iMaxPtime = 200; codec.iPayloadType = 96; codec.iRedundancyCount = 0; codec.iEnableDTX = EFalse; codec.iRedundantPayload = 0; codec.iHwFrameTime = 0; codec.iAlgoUsed = 0; TMccCodecInfoBuffer buffer( codec ); iRead->ConfigurePayloadFormatL( buffer ); delete iRead->iPayloadDecoder; iRead->iPayloadDecoder = NULL; iRead->ConfigurePayloadFormatL( buffer ); codec.iAlgoUsed = 2; codec.iRedundancyCount = 1; codec.iRedundantPayload = 99; codec.iHwFrameTime = 1; buffer = codec; iRead->ConfigurePayloadFormatL( buffer ); codec.iAlgoUsed = 1; codec.iRedundancyCount = 3; codec.iRedundantPayload = 99; codec.iHwFrameTime = 1; buffer = codec; iRead->iCInfo.iAlgoUsed = 1; TRAPD( err, iRead->ConfigurePayloadFormatL( buffer ) ) if ( err == KErrNoMemory ) { User::Leave( err ); } EUNIT_ASSERT_EQUALS( KErrArgument, err ); codec.iAlgoUsed = 2; codec.iRedundancyCount = 3; codec.iRedundantPayload = 99; codec.iHwFrameTime = 1; iRead->iCInfo.iAlgoUsed = 2; buffer = codec; iRead->ConfigurePayloadFormatL( buffer ); buffer = codec; CDTMFPayloadFormatRead* read = CDTMFPayloadFormatRead::NewL( iRtpDataSourceStub ); CleanupStack::PushL( read ); read->ConfigurePayloadFormatL( buffer ); CleanupStack::PopAndDestroy( read ); }
void UT_CDTMFPayloadFormatRead::UT_CDTMFPayloadFormatRead_CreateSourceBufferLL( ) { TBool ref( EFalse ); EUNIT_ASSERT_SPECIFIC_LEAVE( iRead->CreateSourceBufferL( KUidMediaTypeAudio, ref ), KErrNotSupported ); }
void UT_CG729PayloadFormatRead::UT_CG729PayloadFormatRead_NewLL() { CG729PayloadFormatRead* read = CG729PayloadFormatRead::NewL( iRtpDataSourceStub ); delete read; EUNIT_ASSERT_SPECIFIC_LEAVE( CG729PayloadFormatRead::NewL( NULL), KErrArgument ); }
void UT_CG711PayloadFormatWrite::UT_CG711PayloadFormatWrite_NewLL( ) { CG711PayloadFormatWrite* write = CG711PayloadFormatWrite::NewL( iRtpDataSinkStub ); delete write; EUNIT_ASSERT_SPECIFIC_LEAVE( CG711PayloadFormatWrite* write2 = CG711PayloadFormatWrite::NewL( NULL ), KErrArgument ); }