void UT_CMccRtpDataSource::UT_CMccRtpDataSource_ConstructSourceLL() { TUid dummyUid( TUid::Uid( 42 ) ); TBuf8<5> dummyBuf( _L8( "foo" ) ); CMccRtpDataSource* source = static_cast<CMccRtpDataSource*>( CMccRtpDataSource::NewSourceL( dummyUid, dummyBuf ) ); CleanupStack::PushL( source ); MCC_EUNIT_ASSERT_NO_LEAVE( source->ConstructSourceL( KNullDesC8 ) ); CleanupStack::PopAndDestroy( source ); }
void XQAccessPointManagerPrivate::storeWPADataL(const TInt aIapId, const TDesC& aPresharedKey, const XQWLAN& aWlan) { CCommsDbTableView* wLanServiceTable; CApUtils* apUtils = CApUtils::NewLC(*ipCommsDB); TUint32 iapId = apUtils->IapIdFromWapIdL(aIapId); CleanupStack::PopAndDestroy(apUtils); TUint32 serviceId; CCommsDbTableView* iapTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), iapId); User::LeaveIfError(iapTable->GotoFirstRecord()); iapTable->ReadUintL(TPtrC(IAP_SERVICE), serviceId); CleanupStack::PopAndDestroy( iapTable ); wLanServiceTable = ipCommsDB->OpenViewMatchingUintLC(TPtrC(XQ_WLAN_SERVICE), TPtrC(XQ_WLAN_SERVICE_ID), serviceId ); TInt errorCode = wLanServiceTable->GotoFirstRecord(); if (errorCode == KErrNone) { User::LeaveIfError(wLanServiceTable->UpdateRecord()); } else { TUint32 dummyUid(0); User::LeaveIfError(wLanServiceTable->InsertRecord(dummyUid)); wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_SERVICE_ID), aIapId); } CleanupCancelPushL(*wLanServiceTable); TBool usesPsk(aWlan.usesPreSharedKey()); // Save WPA Mode wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_ENABLE_WPA_PSK), usesPsk); // Save security mode wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_SECURITY_MODE), fromQtSecurityModeToS60SecurityMode(aWlan.securityMode())); // Save PreShared Key TBuf8<KWpaKeyMaxLength> keyWPA; //convert to 8 bit keyWPA.Copy(aPresharedKey); wLanServiceTable->WriteTextL(TPtrC(XQ_WLAN_WPA_PRE_SHARED_KEY),keyWPA); // Check and save PreShared Key Length TInt len(keyWPA.Length()); wLanServiceTable->WriteUintL(TPtrC(XQ_WLAN_WPA_KEY_LENGTH),len); User::LeaveIfError(wLanServiceTable->PutRecordChanges()); CleanupStack::Pop(wLanServiceTable); // table rollback... CleanupStack::PopAndDestroy(wLanServiceTable); }
void UT_CMccRtpDataSource::SetupL() { iEventHandler = CMccTestEventHandler::NewL(); iRtpApi = CRtpAPI::NewL( *iEventHandler ); TUid dummyUid( TUid::Uid( 42 ) ); TBuf8<5> dummyBuf( _L8( "foo" ) ); iSource = static_cast<CMccRtpDataSource*>( CMccRtpDataSource::NewSourceL( dummyUid, dummyBuf ) ); TMccRtpSourceSetting setting; setting.iStandByTimerValue = 3000; TMccRtpSourceSettingBuf settingBuf( setting ); iSource->ConstructSourceL( settingBuf ); MAsyncEventHandler* eventHandler = NULL; TRtpId rtpSessionId(0); iRtpKeepaliveMechanism = CMccRtpKeepaliveContainer::NewL( *eventHandler, *iRtpApi, rtpSessionId ); iRtpMediaClock = CMccRtpMediaClock::NewL(); }
TInt CMFPreviewHandlerBase::GetDataType( const TDesC& aFileName, TDataType& aDataType ) { TUid dummyUid( KNullUid ); return iApaSession.AppForDocument( aFileName, dummyUid, aDataType ); }
void UT_CMccRtpDataSource::UT_CMccRtpDataSource_ValidatePacketL() { TRtpId streamId( KNullId ); TRtpRecvHeader header; TBuf8<5> data5; TBuf8<15> data15; data5.Format( _L8( "foo42" ) ); data15.Format( _L8( "foo42foo42foo42" ) ); // Data too big, stream ok, wrong payload type EUNIT_ASSERT_LEAVE( iSource->ValidatePacketL( streamId, header, data15 ) ); // Data ok, stream ok, wrong payload type EUNIT_ASSERT_LEAVE( iSource->ValidatePacketL( streamId, header, data5 ) ); header.iPayloadType = KMccPayloadTypeMax; // header not OK CMMFDataBuffer* buffer = CMMFDataBuffer::NewL(10); CleanupStack::PushL( buffer ); iSource->iBufferToFill = buffer; EUNIT_ASSERT_LEAVE( iSource->ValidatePacketL( streamId, header, data5 ) ); // Get a new source //Teardown(); if( iRtpKeepaliveMechanism ) { delete iRtpKeepaliveMechanism; iRtpKeepaliveMechanism = NULL; } if ( iSource ) { delete iSource; iSource = NULL; } //SetupL(); TUid dummyUid( TUid::Uid( 42 ) ); TBuf8<5> dummyBuf( _L8( "foo" ) ); iSource = static_cast<CMccRtpDataSource*>( CMccRtpDataSource::NewSourceL( dummyUid, dummyBuf ) ); TMccRtpSourceSetting setting; setting.iStandByTimerValue = 3000; TMccRtpSourceSettingBuf settingBuf( setting ); iSource->ConstructSourceL( settingBuf ); MAsyncEventHandler* eventHandler = NULL; TRtpId rtpSessionId(0); iRtpKeepaliveMechanism = CMccRtpKeepaliveContainer::NewL( *eventHandler, *iRtpApi, rtpSessionId ); TMccRtpSessionParams params; params.iRtpAPI = iRtpApi; params.iSessionId = iSession; params.iEnableRTCP = EFalse; params.iRtpKeepalive = iRtpKeepaliveMechanism; EUNIT_ASSERT_NO_LEAVE( iSource->SetSessionParamsL( params ) ); TMccCodecInfo cInfo; cInfo.iFourCC = TFourCC( KMccFourCCIdG711 ); cInfo.iEnableDTX = ETrue; TMccCodecInfoBuffer cInfoBuf( cInfo ); EUNIT_ASSERT_NO_LEAVE( iSource->ConfigureL( cInfoBuf, iRtpMediaClock ) ); header.iPayloadType = KPcmuPayloadType; // Data ok, stream ok, payload type ok CAmrPayloadFormatRead* amrPfRead = CAmrPayloadFormatRead::NewL( NULL ); CleanupStack::PushL( amrPfRead ); RArray<TUint> payloads; CleanupClosePushL( payloads ); payloads.AppendL( KPcmuPayloadType ); iSource->RegisterPayloadTypesL( payloads ); iSource->FillBufferL( buffer, amrPfRead, TMediaId() ); EUNIT_ASSERT_NO_LEAVE( iSource->ValidatePacketL( streamId, header, data5 ) ); CleanupStack::PopAndDestroy( &payloads ); CleanupStack::PopAndDestroy( amrPfRead ); CleanupStack::PopAndDestroy( buffer ); }