/**
@SYMTestCaseID BA-CTSY-TRCH-CSTC-0002
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobileCall::SetTrafficChannel for data calls
@SYMTestPriority High
@SYMTestActions Invokes RMobileCall::SetTrafficChannel for data calls
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyTrafficChannelFU::TestSetTrafficChannel0006L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	TestSetTrafficChannelNotSupportedL(KMmTsyDataLineName);

	CleanupStack::PopAndDestroy(this);
	
	}
/**
@SYMTestCaseID BA-CTSY-ALLS-MGAL-0005
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetALSLine with timeout
@SYMTestPriority High
@SYMTestActions Invokes RMobilePhone::GetALSLine and tests for timeout
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyAlternateLineServiceFU::TestGetALSLine0005L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RBuf8 data;
	CleanupClosePushL(data);

	TRequestStatus requestStatus;
	TInt ret(-1);

	//-------------------------------------------------------------------------
	// Test A: Test timeout of RMobilePhone::GetALSLine
 	//-------------------------------------------------------------------------

	// create centRep to change repository 
	CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine );
	CleanupStack::PushL(centRep);
    
	// setting environment (set KCtsyMEAlsSupported in repository to ETrue)
	ret = centRep->Set( KCtsyMEAlsSupported, ETrue );
	ASSERT_EQUALS(KErrNone, ret);

	// setting environment (set alsLine to EAlternateLinePrimary)
	iMockLTSY.NotifyTerminated(requestStatus);
	RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLineUnknown);
	TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine);
	alsLineData.SerialiseL(data);
	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();
	
	// test setting and execute
	iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNone);
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrTimedOut, ret);
	ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineNotAvailable);
	AssertMockLtsyStatusL();

	// Done !
	// return repository KCtsyMEAlsSupported to EFalse (initial state)
	ret = centRep->Set( KCtsyMEAlsSupported, EFalse );
	ASSERT_EQUALS(KErrNone, ret);

	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(1); // iCentRep
	CleanupStack::PopAndDestroy(2, this); // data, this

	}
/**
Returns true if settigns table exists. 
(Non-secure databases prior version 3 don't have settings table)

@param aDbName Logical database name: "main" for the main database or attached database name.
*/
TBool TSqlDbSysSettings::SettingsTableExistsL(const TDesC& aDbName)
	{
	HBufC* buf = HBufC::NewLC(sizeof(KSettingsTableCheckSql) + aDbName.Length());
	TPtr sql = buf->Des();
	sql.Format(KSettingsTableCheckSql(), &aDbName);
	sqlite3_stmt* stmtHandle = ::StmtPrepare16L(iDbHandle, sql);
	CleanupStack::PushL(TCleanupItem(&FinalizeStatementHandle, stmtHandle));
	TInt rc = ::StmtNext(stmtHandle);
	CleanupStack::PopAndDestroy();//cleanupItem (statement handle)
	CleanupStack::PopAndDestroy(buf);
	__SQLLEAVE_IF_ERROR(rc);
	return rc == KSqlAtRow;
	}
EXPORT_C void CMemSpyEngineOutputSink::OutputPrefixSetLC( const TDesC& aPrefix )
{
    __ASSERT_ALWAYS( aPrefix.Length() <= iPrefix->Des().MaxLength(), User::Invariant() );
    TPtr pPrefix( iPrefix->Des() );
    pPrefix.Zero();

    if  ( IsPrefixAllowed( aPrefix ) )
    {
        pPrefix.Copy( aPrefix );
    }

    CleanupStack::PushL( TCleanupItem( ClearPrefix, this ) );
}
Esempio n. 5
0
CVJDeCompressorIf* CPppNcpIp::LoadVJDeCompressorL(TInt aMaxVJSlots)
	{
	CVJCompFactory*		Factory=NULL;
	CVJDeCompressorIf*	VJDeCompressor;
											 
	Factory = (CVJCompFactory*)FindPppFactoryL(KVjComp, TUid::Uid(KSharedLibraryUidValue), *iVJDeCompressorCon);
	CleanupStack::PushL(TCleanupItem(CNifFactory::Cleanup, Factory));
	VJDeCompressor = Factory->NewVJDeCompressorL(aMaxVJSlots);
	CleanupStack::PopAndDestroy(); // Close extra reference on Factory

	return VJDeCompressor;

	}
void CCTsySessionManagementFU::AuxReferenceCountL(const TDesC &aName)
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));

	OpenPhoneL();

    TName lineName(aName);    
    RLine line;
    
    TInt ret  = line.Open(iPhone, lineName);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(line);  
    
    TName name;
	RCall call;
    
    ret = OpenNewCall(line, call, lineName, name);    
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call);    

	// test on successful completion
	TInt count = call.ReferenceCount();
    ASSERT_EQUALS(1, count);

	AssertMockLtsyStatusL();

	// test on successful completion, increasing count
	RCall call2;
	
	ret = call2.OpenExistingCall(line, name);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call2);  
	
	count = call.ReferenceCount();
    ASSERT_EQUALS(2, count);

	AssertMockLtsyStatusL();

	// test on successful completion, decreasing count
	CleanupStack::PopAndDestroy(1);

	count = call.ReferenceCount();
    ASSERT_EQUALS(1, count);


	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(3, this); 
	
	}
/**
Read security policies from security policy table.

The method does not guarantee that either the security policies will be read from the 
security table and stored in aSecurityPolicy parameter or aSecurityPolicy argument 
stays unchanged in a case of failure.

@param aSecurityPolicyCon Security policies container which needs to be initializeed with 
						  the database security policies.

@leave KErrNoMemory, an out of memory condition has occurred;
	   KErrGeneral, missing or invalid data in the system tables;
                  Note that the function may also leave with some other database specific 
                  errors categorised as ESqlDbError, and other system-wide error codes.
@panic SqlDb 2 In _DEBUG mode if iDbHandle is NULL (uninitialized TSqlDbSysSettings object).
*/
void TSqlDbSysSettings::LoadSecurityPolicyL(CSqlSecurityPolicy& aSecurityPolicyCon)
	{
	__ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj));
	//Even if the version of the system settings is bigger than the current one (KSqlSystemVersion constant),
	//I think that all future modifications of the system tables shall not affect the already existing
	//fields. So it is correct to think that all information available in version 1 should be available 
	//(and accessible) in all future versions of the system settings.
	//Note: no attempt shall be made here to modify the system tables structure! There may be more than one 
	//      connection to the database being processed!
	//
	//Prepare statement handle
	sqlite3_stmt* stmtHandle = ::StmtPrepare8L(iDbHandle, KGetSecuritySql());
	CleanupStack::PushL(TCleanupItem(&FinalizeStatementHandle, stmtHandle));
	//Read the security policies
	TBool defaultPolicySet = EFalse;
	TInt dbPolicySetFlag = 0;
	TInt err;
	while((err = ::StmtNext(stmtHandle)) == KSqlAtRow)
		{
		TInt objType = KDefaultObjType - 1;
		TPtrC objName(KNullDesC);
		TInt policyType = RSqlSecurityPolicy::ESchemaPolicy - 1;
		TSecurityPolicy policy = ReadCurrSecurityPolicyL(stmtHandle, objType, objName, policyType);
		switch(objType)
			{
			case KDefaultObjType:
				if(defaultPolicySet)
					{
					__SQLLEAVE(KErrGeneral);//two "default policy" records in the table
					}
				StoreDefaultSecurityPolicy(aSecurityPolicyCon, policy, dbPolicySetFlag);
				defaultPolicySet = ETrue;
				break;
			case KDbObjType:
				StoreDbSecurityPolicyL(aSecurityPolicyCon, policyType, policy, dbPolicySetFlag);
				break;
			case RSqlSecurityPolicy::ETable:
				StoreDbObjSecurityPolicyL(aSecurityPolicyCon, objType, objName, policyType, policy);
				break;
			default:
				__SQLLEAVE(KErrGeneral);
				break;
			}//end of "switch(aObjType)"
		}
	CleanupStack::PopAndDestroy();//cleanupItem (statement handle)
	__SQLLEAVE_IF_ERROR(err);
	if(!defaultPolicySet)
		{
		__SQLLEAVE(KErrGeneral);//no default policy
		}
	}
/**
@SYMTestCaseID BA-CTSY-TRCH-CNTCC-0001
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobileCall::NotifyTrafficChannelConfirmation for voice calls
@SYMTestPriority High
@SYMTestActions Invokes RMobileCall::NotifyTrafficChannelConfirmation for voice calls
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyTrafficChannelFU::TestNotifyTrafficChannelConfirmation0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	TestNotifyTrafficChannelConfirmationNotSupportedL(KMmTsyVoice1LineName);

	TestNotifyTrafficChannelConfirmationNotSupportedL(KMmTsyVoice2LineName);

	CleanupStack::PopAndDestroy(this);

	}
/** Reads all groups in user defined time zone database into the specified CTzLocalizedCityGroupArray. 
Note that each time zone is formed as an individule CTzLocalizedCityGroup object since they do not belong to the same group.
If the database is empty the returned array will contain no elements.
@param aCities Array of groups.
@internalTechnology
*/
void CTzLocalizationUserDataReader::ReadAllGroupsL(CTzLocalizedCityGroupArray& aCities)
	{
	RPointerArray<CTzId> tzids;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyTzIdArray, &tzids));
	iUserData->GetTzIdsL(tzids);
	TInt count = tzids.Count();
	aCities.ReserveL(count + aCities.Count());
	for(TInt ii=0; ii<count; ++ii)
		{
		CTzLocalizedCityGroup* group = GetLocalizedCityGroupL(tzids[ii]->TimeZoneNumericID());
		aCities.AppendL(group);
		}
	CleanupStack::PopAndDestroy(&tzids);
	}
Esempio n. 10
0
// -----------------------------------------------------------------------------
// TUpnpSoapParser::UpdateActionWithRequestL
// Update action with all necessary information from
// a SOAP request message.
// -----------------------------------------------------------------------------
//
void TUpnpSoapParser::UpdateActionWithRequestL(
    CUpnpSoapMessage* aMessage, CUpnpAction* aAction )
    {
    if ( NULL == aMessage )
        {
        return;
        }
    RPointerArray<CUpnpDescriptionProperty> parsedArguments;
    CleanupStack::PushL( TCleanupItem( CleanupResetAndDestroy, &parsedArguments ) );

    UpdateActionL( aMessage, aAction, parsedArguments );
    ProcessActionArgumentsL( parsedArguments, aAction );
    CleanupStack::PopAndDestroy( &parsedArguments );
    }
/** Uid instance iterator ConstructL

Fetches all the related entries to the UID and sets the currently indexed time

@internalComponent
*/
void CCalInstanceIteratorUid::ConstructL(const TDesC8& aUid, const TCalTime& aInstanceTime, TCalCollectionId aCollectionId)
	{
	// record the time to use for undated todos
	TTime now;
	now.HomeTime();
	iUndatedTodoTime.SetTimeLocalL(now);
	
	// Fetch all the entries that relate to the instance
	RPointerArray<CAgnSimpleEntry> simpleEntries;
	TCleanSimpleEntryArray cleanSimpleEntryArray(simpleEntries, iInstanceViewImpl.GetServ());
	CleanupStack::PushL(TCleanupItem(CCalInstanceViewImpl::DestroySimpleEntryArray, &cleanSimpleEntryArray));
	RArray<TInt> fileIds;
	iInstanceViewImpl.GetShortFileIdLC(fileIds);//It is in order 
	iInstanceViewImpl.GetServ().FetchSimpleEntriesByGuidL(aUid, simpleEntries, fileIds);
	CleanupStack::PopAndDestroy(&fileIds);
	
	const TInt KEntryCount(simpleEntries.Count());
	
	// There must be entries associated with this UID
	__ASSERT_ALWAYS(KEntryCount != 0, User::Leave(KErrNotFound));
	
	TBool instanceExists(EFalse);
	
	for (TInt i(0) ; i < KEntryCount ; ++i)
		{
		CCalLiteEntry* liteEntry = CCalLiteEntry::NewL(*simpleEntries[0], iInstanceViewImpl.GetServ());
		liteEntry->IncrementRefCount();
		simpleEntries.Remove(0);
		TInt appendError = iCalLiteEntries.Append(liteEntry);	
		if (appendError != KErrNone)
			{
			liteEntry->DecrementRefCount();
			User::Leave(appendError);
			}
		
		if (iInstanceViewImpl.IsValidInstanceL(liteEntry->LiteEntry(), aInstanceTime))
			{//Add the index of the entry which has the same time as aInstanceTime into iEntryWithSameTime
			if(liteEntry->LiteEntry().CollectionId() == aCollectionId)
				{
				instanceExists = ETrue;
				iCurrentIndexTime = aInstanceTime;
				iCurrentIndex = iEntryWithSameTime.Count();
				}
			iEntryWithSameTime.AppendL(i);
			}
		}
	
	__ASSERT_ALWAYS(instanceExists, User::Leave(KErrNotFound));
	CleanupStack::PopAndDestroy(); // simpleEntries
	}
/** Read all time zones stored in user database
@internalTechnology
@param aTimeZones array of localized time zones.
*/
void CTzLocalizationUserDataReader::ReadAllTimeZonesL(CTzLocalizedTimeZoneArray& aTimeZones)
	{
	RPointerArray<CTzId> tzids;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyTzIdArray, &tzids));
	iUserData->GetTzIdsL(tzids);
	const TInt count = tzids.Count();
	aTimeZones.ReserveL(count + aTimeZones.Count());
	for(TInt ii=0; ii<count; ++ii)
		{
		CTzLocalizedTimeZone* localizedTz = GetLocalizedTimeZoneL(tzids[ii]->TimeZoneNumericID());
		aTimeZones.AppendL(localizedTz);
		}
	CleanupStack::PopAndDestroy(&tzids);
	}
/**
@SYMTestCaseID BA-CTSY-SESMG-TSEEG-0001
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RTelServer::SetExtendedErrorGranularity
@SYMTestPriority High
@SYMTestActions Invokes RTelServer::SetExtendedErrorGranularity
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsySessionManagementFU::TestSetExtendedErrorGranularity0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));

	RTelServer::TErrorGranularity granularity(RTelServer::EErrorExtended);

	TInt ret = iTelServer.SetExtendedErrorGranularity(granularity);
	ASSERT_EQUALS(KErrNone, ret);

	CleanupStack::PopAndDestroy(1, this); 
	
	}
// -----------------------------------------------------------------------------
// COMASUPLProtocolManager::LoadOMASUPLPluginsL
// 
// -----------------------------------------------------------------------------
//
void COMASUPLProtocolManager::LoadOMASUPLPluginsL()
    {
	iTrace->Trace(_L("COMASUPLProtocolManager::LoadOMASUPLPlugins"), KTraceFileName, __LINE__); 
	
    const TUid KOMASUPLProtocolInterfaceUid 		= {0x102073CB};
    
    const TUid KOMASuplProtocolImplementationUid1 	= {0x2002678D};
    
    const TUid KOMASuplProtocolImplementationUid2 	= {0x2002678E};
    
    RImplInfoPtrArray pluginArray;
    
    REComSession& EComServerSession = REComSession::OpenL();
    
    CleanupStack::PushL(TCleanupItem(*ResetAndDestroy, &pluginArray));
    REComSession::ListImplementationsL(KOMASUPLProtocolInterfaceUid, pluginArray);
    
    if(pluginArray.Count() > 0)    
        {         
        TRAPD(err1,iOMASuplProtocolHandler1 = 
        				CSUPLProtocolManagerBase::NewL(KOMASuplProtocolImplementationUid1));
        				
        TBuf<64> buf(_L("OMA SUPL 1.0 Plugin loaded with error : "));
        buf.AppendNum(err1);
        iTrace->Trace(buf,KTraceFileName, __LINE__);        	

        TRAPD(err2,iOMASuplProtocolHandler2 = 
        				CSUPLProtocolManagerBase::NewL(KOMASuplProtocolImplementationUid2));
        				
        buf.Copy(_L("OMA SUPL 2.0 Plugin loaded with error : "));
        buf.AppendNum(err2);
        iTrace->Trace(buf,KTraceFileName, __LINE__);

        // if PH1 is not available but PH2 is,then use PH2 whenever there is reference to PH1.
        if( KErrNone != err1 && KErrNone == err2 )
            {
            isPH2Shared = ETrue;
            iOMASuplProtocolHandler1 = iOMASuplProtocolHandler2;
            }
        }
    else
        {
        iTrace->Trace(_L("No Plugins Found for OMA Implementation..."), KTraceFileName, __LINE__);
        User::LeaveIfError(KErrArgument);
        }   
        
    CleanupStack::PopAndDestroy(1);
    EComServerSession.Close();
    }
Esempio n. 15
0
EXPORT_C void CSDL::SuspendRequestsLC(TInt aRunFirst)
    {
    TInt requestCount = 0;
    while(RThread().RequestCount())
        {
        User::WaitForAnyRequest();
        TInt err;
        /*potential problem is that idle objects may keep this
         * loop busy*/
        while(CActiveScheduler::RunIfReady(err, aRunFirst))
            {}
        ++requestCount;
        }
    CleanupStack::PushL(TCleanupItem(ReRequest, reinterpret_cast<TAny*>(requestCount)));
    }
/**
@SYMTestCaseID BA-CTSY-ATD-MGATD-0001
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetAirTimeDuration
@SYMTestPriority High
@SYMTestActions Invokes RMobilePhone::GetAirTimeDuration
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyAirTimeDurationFU::TestGetAirTimeDuration0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	TTimeIntervalSeconds time;
	TInt ret(iPhone.GetAirTimeDuration(time));
	ASSERT_EQUALS(KErrNotSupported, ret);

	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(this); 
	
	}
/**
Returns true if at least one index using aCollationName exists.

@param aDbName Logical database name: "main" for the main database or attached database name,
@param aCollationName SQLITE collation name.
*/
TBool TSqlDbSysSettings::IndexExistsL(const TDesC& aDbName, const TDesC& aCollationName)
	{
	//KGetIndexSql will contain '%<CollationName>%' search pattern, while Symbian OS search patterns use '*' symbol by default.
	//This time the '%' is OK because the serach is performed in the SQLITE master table and before installing the
	//user-defined Like() function.
	HBufC* buf = HBufC::NewLC(sizeof(KGetIndexSql) + aDbName.Length() + aCollationName.Length());
	TPtr sql = buf->Des();
	sql.Format(KGetIndexSql(), &aDbName, &aCollationName);
	sqlite3_stmt* stmtHandle = ::StmtPrepare16L(iDbHandle, sql);
	CleanupStack::PushL(TCleanupItem(&FinalizeStatementHandle, stmtHandle));
	TInt rc = ::StmtNext(stmtHandle);
	CleanupStack::PopAndDestroy(2);//buf, cleanupItem (statement handle)
	__SQLLEAVE_IF_ERROR(rc);
	return rc == KSqlAtRow;
	}
/**
@SYMTestCaseID BA-CTSY-ALTC-MGACC-0001
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetAlternatingCallCaps
@SYMTestPriority High
@SYMTestActions Invokes RMobilePhone::GetAlternatingCallCaps
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyAlternatingCallFU::TestGetAlternatingCallCaps0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	TUint32 caps(0);
	TInt ret = iPhone.GetAlternatingCallCaps(caps);
	ASSERT_EQUALS(KErrNotSupported, ret);

	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(this); // this
	
	}
/**
@SYMTestCaseID BA-CTSY-SESMG-PO-0003
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RPhone::Open with bad parameter data
@SYMTestPriority High
@SYMTestActions Invokes RPhone::Open with bad parameter data
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsySessionManagementFU::TestOpen0003L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));

	//"::" needed to cover some branches in name analyze
	_LIT(KBadPhoneName, "::Bad::Phone::Name::");

	TInt err = iPhone.Open(iTelServer, KBadPhoneName);
	ASSERT_EQUALS(KErrNotFound, err);
	
	CleanupStack::PopAndDestroy(1, this); 

	}
/**
Updates the listtype and favouritename. Only, these 2 properties can be modified.

@param aUriPropsId Property ID which uniquely identifies the row in the URIPropertiesTbl
@param aListType New Listtype 
@param aFavouriteName New favourite name for the URI
*/
void CUriListInterface::UpdateUriL ( TInt aUriPropsId, InetUriList::TListType aListType, const TDesC8& aFavouriteName )
	{	
	iDbAccessor->BeginTransactionL ();
	// This is not to delete the object rather to do a rollback operation incase of a failure
	CleanupStack::PushL ( TCleanupItem ( CUriListInterface::RollbackTrans, iDbAccessor ) );

	// Only update List Type & Favourite Name. Other properties are not allowed to update.
	if ( UpdateL ( KUriPropsTblName(), aUriPropsId, aListType, aFavouriteName ) == 0 )
		User::Leave ( InetUriList::KErrUriNotFound );

	User::LeaveIfError ( UpdateL ( KViewName(), aUriPropsId, aListType, aFavouriteName ) );
	
	iDbAccessor->CommitTransactionL ();
	CleanupStack::Pop (); // iDbAccessor	
	}
Esempio n. 21
0
CNifFactory* MPppRecvr::FindPppFactoryL(const TDesC& aFilename, TUid aUid2, CObjectCon& aCon)
//
// Basically this is all the stuff required to load a DLL appart from the
// Factory->CreatMe call
//
	{
	CNifFactory* Factory=NULL;
	TParse parse;
	User::LeaveIfError(parse.Set(aFilename, 0, 0));

	TName dummy1;
	TInt find=0;

	if(aCon.FindByName(find, parse.Name(), dummy1)!=KErrNone)
		{

	    // Else load the module
		TAutoClose<RLibrary> lib;
		User::LeaveIfError(lib.iObj.Load(aFilename));
		lib.PushL();

		// The Uid check
		if(lib.iObj.Type()[1]!=aUid2)
			User::Leave(KErrBadLibraryEntryPoint);

		TPppFactoryNewL libEntry=(TPppFactoryNewL)lib.iObj.Lookup(1);
		if (libEntry==NULL)
			User::Leave(KErrNoMemory);

		Factory =(*libEntry)(); // Opens CObject
		if (!Factory)
			User::Leave(KErrBadDriver);

		CleanupStack::PushL(TCleanupItem(CNifFactory::Cleanup, Factory));
		Factory->InitL(lib.iObj, aCon); // Transfers the library object if successful

		// Can pop the library now - auto close will have no effect because handle is null
		CleanupStack::Pop();
		lib.Pop();

		}
	else
		{
		Factory=(CNifFactory*)aCon.At(find);
		Factory->Open();
		}
		return Factory;
	}
/**
Store the entry in the calendar file
@param aCalEntryView Pointer to the CCalEntryView
@param aCalEntry Pointer to CCalEntry
*/
void CTestCalInterimApiSuiteStepBase::StoreCalendarEntryL(CCalEntryView* aCalEntryView, CCalEntry* aCalEntry)
	{
	RPointerArray<CCalEntry>	entriesStored;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyEntryArray, &entriesStored));
	entriesStored.AppendL(aCalEntry);
	TInt	numOfEntries(0);
	aCalEntryView->StoreL(entriesStored, numOfEntries);

	if( entriesStored.Count() != numOfEntries )
		{
		ERR_PRINTF1(KErrEntryNotStored);
		SetTestStepResult(EFail);
		}
	CleanupStack::Pop(&entriesStored);
	entriesStored.Close();
	}
/**
@SYMTestCaseID BA-CTSY-MCC-MSMP-0001
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetMulticallParams
@SYMTestPriority High
@SYMTestActions Invokes RMobilePhone::SetMulticallParams
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyMulticallCallControlFU::TestSetMulticallParams0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	TRequestStatus reqStatus;
	iPhone.SetMulticallParams(reqStatus, 2);
	User::WaitForRequest(reqStatus);
	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());

	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(this);
	
	}
Esempio n. 24
0
/**
Create a new database.
*/
EXPORT_C void CPplContactsFile::CreateL(const TDesC& aFileName, TPlCreateMode aMode)
{
    TFileName fileName;
    GetPhysicalFileNameL(fileName, aFileName);

    TUint attVal;
    LocalFsL();
    TInt err = iLocalFs.Att(fileName, attVal);
    TBool fileExists = (err == KErrNone);

    if (fileExists)
    {
        switch (aMode)
        {
        case EPlLeaveIfExist:
            User::Leave(KErrAlreadyExists);
            break;

        case EPlOverwrite:
            err = iLocalFs.Delete(fileName);
            break;
        }
    }

    // If the database is not created propertly delete the database file using
    // the cleanup item.
    TFileCleanup cleanupData(iDatabase, iLocalFs, fileName);
    CleanupStack::PushL(TCleanupItem(TFileCleanup::Cleanup,&cleanupData));

    if ((err != KErrNone) && (err != KErrNotFound))
    {
        User::LeaveIfError(err);
    }

    User::LeaveIfError(iDatabase.Create(fileName, iConfigureStr));
    iItemManager->CreateTablesL();

    // If the folder exists recreate it since the database is new
    TRAP_IGNORE(TCntImageRescaleUtility::DeleteImageDirectoryL());
    TRAP_IGNORE(TCntImageRescaleUtility::CreateImageDirectoryL());

    iContactProperties.SystemTemplateManager().RecreateSystemTemplateL();

    CleanupStack::Pop(); // The TCleanupItem.

    iDatabase.Close();
}
// -----------------------------------------------------------------------------
// CRegBindingImplementation::DoUpdateL
// -----------------------------------------------------------------------------
//
CSIPClientTransaction*
CRegBindingImplementation::DoUpdateL(CSIPMessageElements* aElements,
                            	     TUint* aExpirationValue)
    {
    __TEST_INVARIANT;    
    CheckConnectionL();

    CSIPClientTransaction* ta = CSIPClientTransaction::NewLC(
    					SIPStrings::StringF(SipStrConsts::ERegister),		                
		                *this);

	CSIPMessageElements* elem = aElements;
    if (!aElements)
        {
        elem = CSIPMessageElements::NewLC();
        }

    if (aExpirationValue)
        {
        iContact->SetExpiresParameterL(*aExpirationValue);
        }

    //Put contact temporarily to elem. Once REGISTER is sent, clear it from elem
	CleanupStack::PushL(TCleanupItem(DetachContactHeader, elem));
    elem->AddHeaderL(iContact);

    TUint32 requestId(0);
    iConnection->Implementation().ClientConnectionL().UpdateRegistrationL(
    													iRegistrationId,
                                                        requestId,
                                                        elem);
	CleanupStack::PopAndDestroy(); //TCleanupItem
    if (aElements)
        {
        delete aElements;
        }
    else
        {
        CleanupStack::PopAndDestroy(elem);
        }

    CleanupStack::Pop(ta);
	ta->SetRequestId(requestId);

    __TEST_INVARIANT;
    return ta;
    }
void CDummyCalendarApp::ExtractNonExistentEntryL()
	{
	RPointerArray<CCalEntry> entryArray;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyCalEntryArray, &entryArray));
	
	// Passing string type UID parameter and expecting entryArray to be empty
	iEntryView->FetchL( _L8("myuid"), entryArray);
	test(entryArray.Count() == 0);
	entryArray.Reset();
	
	// Passing integer type UID parameter and expecting entryArray to be empty
	iEntryView->FetchL( _L8("10"), entryArray);
	test(entryArray.Count() == 0);
	
	CleanupStack::Pop(); // TCleanupItem(ResetAndDestroyCalEntryArray, &entryArray)
	entryArray.ResetAndDestroy();
	}
/**
@SYMTestCaseID BA-CTSY-ATD-MNATDC-0001
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyAirTimeDurationChange
@SYMTestPriority High
@SYMTestActions Invokes RMobilePhone::NotifyAirTimeDurationChange
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyAirTimeDurationFU::TestNotifyAirTimeDurationChange0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	TRequestStatus requestStatus;
	TTimeIntervalSeconds time;
	iPhone.NotifyAirTimeDurationChange(requestStatus, time);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
	
	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(this); 
	
	}
void CLayerTestSsmEventObserver::TestSecurityEventObserver4L()
	{
	_LIT(KTESTLOG, "TestSecurityEventObserver4L");
	INFO_PRINTF1(KTESTLOG);
	CStrtSecurityEventObserver* securityEventObserver = static_cast<CStrtSecurityEventObserver*> (CStrtSecurityEventObserver::NewL());
	CleanupStack::PushL(TCleanupItem(ReleaseSecurityEventObserver, securityEventObserver));
	securityEventObserver->InitializeL();

	securityEventObserver->iEvent = RMobilePhone::EUSIMAppPinRequired;
	iRequest = &(securityEventObserver->iController->iStatus);
	securityEventObserver->StartL();
	securityEventObserver->Cancel();
	TestStartSecurityEventObserverSchedulerL();

	//Release will panic in case of any pending AO objects
	CleanupStack::PopAndDestroy(securityEventObserver);
	}
/**
Inserts the data into the TLDTbl. 

@return Returns the number of rows inserted. Normally 1. Otherwise returns with
		system-wide error code.
*/
TInt CUriListInterface::InsertIntoTldTblL ( const CTldProperties& aTldProps )
	{
	_LIT8 ( KTldTblInsertStmt, "INSERT INTO %S VALUES ( :V1, :V2, :V3 )" );
	RBuf8 sqlStmt;
	sqlStmt.CreateL ( KMaxDbStmtLen );
	CleanupClosePushL ( sqlStmt );
	sqlStmt.Format ( KTldTblInsertStmt(), &(KTldTblName()) );
	MDBTransaction* dbTrans = iDbAccessor->PrepareTransactionL ( sqlStmt );
	CleanupStack::PushL ( TCleanupItem ( CUriListInterface::DestroyTransObj, dbTrans ) );
	dbTrans->BindTextL ( TLDLIST::ETLDName, aTldProps.TldName() );
	TInt lt = static_cast<TInt> ( aTldProps.ListType() ) ;
	dbTrans->BindIntL ( TLDLIST::EListType, lt );
	dbTrans->BindTextL ( TLDLIST::ECharacterSet, aTldProps.CharacterSet() );
	TInt result = dbTrans->ExecuteL ();
	CleanupStack::PopAndDestroy (2); // sqlStmt, dbTrans
	return result;
	}
/**
Inserts the information into TLDTbl. Checks whether
the URI is already present in the storage and applies the blacklist/whitelist rule
before insertion. 

@param aTldPolicydata Tld information object.
*/
void CUriListInterface::InsertTldPolicyDataL ( CTldProperties& aTldPolicydata )
	{
	//First check whether such row is available
	//if yes dont insert.
	// Now the TLD Policy data can be added.
	iDbAccessor->BeginTransactionL ();
	// This is not to delete the object rather to do a rollback operation incase of a failure
	CleanupStack::PushL ( TCleanupItem ( CUriListInterface::RollbackTrans, iDbAccessor ) );
	//Inserts unique row 
	if( !IsDuplicateEntryL( aTldPolicydata )   )
		{
		InsertIntoTldTblL ( aTldPolicydata );
		}

	iDbAccessor->CommitTransactionL ();			
	CleanupStack::Pop (); // iDbAccessor	
	}