/**
  @return - ETrue if enum was resolved to integral value, else EFalse
  @param - aSectName Enum file section to be read
  @param - aKeyName  Key/Enum to be read
  @param - aResult   Updated enum's integral value
  */
TBool CAppfwkDscStoreTestStepBase::GetEnumFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult)
	{
	_LIT(KEnumFileNotSet, "EnumFile");
	__ASSERT_ALWAYS(iEnumData, User::Panic(KEnumFileNotSet, KErrNotFound));
	
	TBool readResult = EFalse;
	TPtrC enumString;
	
	readResult = GetStringFromConfig(aSectName, aKeyName, enumString);
	
	if (readResult)
		{
		readResult = iEnumData->FindVar(KEnums, enumString, aResult);
		}
	else
		{
		_LIT(KEnumKeyNotfound, "EnumKey %S not found");
		WARN_PRINTF2(KEnumKeyNotfound, &aKeyName);
		}
	
	return readResult;
	}
void CDataWrapperBase::InitialiseL()
	{
	CDataWrapper::InitialiseL();

	TBuf<KMaxTestExecuteCommandLength>	tempStore;
	TPtrC		fileName;
	TBool		moreData=ETrue;
	TBool		index=0;
	while ( moreData )
		{
		tempStore.Format(KFile(), ++index);
		moreData=GetStringFromConfig(KIncludeSection, tempStore, fileName);
		
		if (moreData)
			{
			CIniData*	iniData=CIniData::NewL(fileName);
			CleanupStack::PushL(iniData);
			iInclude.Append(iniData);
			CleanupStack::Pop(iniData);
			}
		}
	}
/**
 *
 * Test step Preamble.
 *
 * @xxxx
 * 
 */
enum TVerdict CTestStepPlayerAllocFailOpenDesc::DoTestStepPreambleL(void)
	{
	 enum TVerdict verdict;
	 // this installs the scheduler
	 verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();

	// Printing to the console and log file
	INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0105-CP"));
	INFO_PRINTF1(_L("this is Alloc failure test of CMdaAudioPlayerUtility::OpenDesL"));

	iError = KErrNone; //KErrTimedOut;

	if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName7"), iFileName))
		{
		//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
		return EInconclusive;
		}

	// load the contents of an audio file to a Descriptor
	TInt fSize;

	iFs.Connect();
	if ( iFile.Open(iFs, iFileName, EFileRead) != KErrNone )
		return EInconclusive;
	iFile.Size(fSize);
	// load the sound from the file to a Descriptor
	iBuf = HBufC8::NewL( fSize );
	TPtr8 buf = iBuf->Des();
	iFile.Read(buf);

	iFile.Close();
	iFs.Close();

	// create a CMdaAudioPlayerUtility
	if ( (iPlayer = CMMFMdaAudioPlayerUtility::NewL(*this)) == NULL )
		verdict = EInconclusive;

	return verdict;
	}
/**
 *
 * Test step Preamble.
 *
 * @xxxx
 * 
 */
enum TVerdict CTestStepRecorderSendCustomCommandAsync::DoTestStepPreambleL(void)
	{
	enum TVerdict verdict;
	// this installs the scheduler
	verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
	if (verdict != EPass)
		return verdict;

	if(!GetStringFromConfig(_L("SectionOne"), _L("AudioFNameTestController"), iFileName))
		{
		 //INFO_PRINTF2(_L("file name %s not found..."), fileptr);
		 return EInconclusive;
		}
		
	iAsyncObserver = new (ELeave) CAsyncObserver;

	// Printing to the console and log file
	INFO_PRINTF1(iTestStepName);
	INFO_PRINTF1(_L("this test is a test of CMMFMdaAudioRecorderUtility::CustomCommandAsync()"));

	return verdict;
	}
/*
   This function performs operations based on sequence specified in the ini file
   @param  None
   @return None
*/
void CTestRControlChannel::SequenceOperationsL()
	{
	_LIT(KInfoLogFile, "CTestRControlChannel::SequenceOperationsL().... \n");
	INFO_PRINTF1(KInfoLogFile);
	RArray<TPtrC> sequenceList;
	CleanupClosePushL(sequenceList);
	TPtrC listOfSequences;
	_LIT(KListOfSequences, "listofsequences");
	GetStringFromConfig(ConfigSection(), KListOfSequences, listOfSequences);

	TokenizeStringL(listOfSequences, sequenceList);
	TInt numOperations = sequenceList.Count();

	for(TInt i(0); i < numOperations; i++)
		{
//		SetCurrentSection(sequenceList[i]);
		PerformDesiredOperationsL(sequenceList[i]);
		}
	CleanupStack::PopAndDestroy(); 
	_LIT(KInfoLogFile1, "CTestRControlChannel::SequenceOperationsL() End.... \n");
	INFO_PRINTF1(KInfoLogFile1);
	}
TInt CEsockTest29::OpenSockets()
// Func to open the sockets
	{
	iSockServ.Connect();
	GetStringFromConfig(KSection29, KTestSocketType, iProtocol);
	TInt err = OpenDummySocket();
	if(err != KErrNone)	
		{
		return err;
		}
	if( iProtocol.Compare(KUdp) == 0 )
		{
		err = OpenTestUdpSocket();
		INFO_PRINTF1( _L("UDP Test Socket Opened") );
		}
	else
		{
		err = OpenTestTcpSocket();	
		INFO_PRINTF1( _L("TCP Test Socket Opened") );	
		}
	return err;
	}
/** Compare the various character sets
@test
*/		
void CTestHtmlToCrtConverterBufferStep::ComparisonForVariousCharsetsL()
	{
	// Get different character sets from the ini file
	TPtrC	sourceData;
	GetStringFromConfig(ConfigSection(), KSourceText, sourceData);
	
	HBufC8*	tempSource = HBufC8::NewLC(sourceData.Length());
	tempSource->Des().Copy(sourceData);
	TPtr8	source(tempSource->Des());
	
	// Compare the source text with the text converted by the characterset converter
	if ( DoComparisonL(source) == 0 )
		{
		INFO_PRINTF1(KInfoComparisionSuccessful);
		}
	else
		{
		ERR_PRINTF1(KErrInComparison);
		SetTestStepResult(EFail);
		}
	CleanupStack::PopAndDestroy(tempSource);
	}
/**
 *
 * Test step Preamble.
 *
 * @xxxx
 * 
 */
enum TVerdict CTestStepRecorderPlayEOF::DoTestStepPreambleL(void)
	{
	 enum TVerdict verdict;
	 // this installs the scheduler
	 verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();

	// Printing to the console and log file
	INFO_PRINTF1(iTestStepName);
	INFO_PRINTF1(_L("this is a test of CMdaAudioRecorderUtility..."));
	INFO_PRINTF1(_L("Play a clip from the middle to EOF, then set the position to the clip's"));
	INFO_PRINTF1(_L("duration, call play and then immediately read the position and check it's"));
	INFO_PRINTF1(_L("not longer than the file's duration"));

	if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName2"), iFileName))
		{
		INFO_PRINTF2(_L("file name %S not found..."), &iFileName);
		return EInconclusive;
		}

	// create the Recorder utility
	if ( (iRecorder = CMMFMdaAudioRecorderUtility::NewL(*this)) == NULL )
		return EInconclusive;

	iRecorder->OpenFileL( iFileName );
	CActiveScheduler::Start(); 

	if (iRecorder == NULL ||
		iError != KErrNone ||
		iRecorder->State() != CMdaAudioRecorderUtility::EOpen)
		return EInconclusive;
	
	// initialize a callback timer
	TRAPD(err, iTimer = CCallbackTimer::NewL(*this));
	if (err != KErrNone)
		return EInconclusive;
	CActiveScheduler::Add(iTimer);

	return verdict;
	}
/**
Test SetAction()
*/
void CT_InquirySockAddrData::DoCmdSetAction(const TDesC& aSection)
	{
	TBool	foundParameter=EFalse;
	TPtrC	flagName;
	TInt	flagValue=0;
	if (GetStringFromConfig(aSection, KFlag(), flagName) )
		{
		foundParameter=ETrue;
		if (CT_BTUtil::GetIntValue(flagName, flagValue))
			{
			INFO_PRINTF3(_L("The flag to set: %S , its value: %d" ), &flagName, flagValue);
			
			INFO_PRINTF1(_L("TInquirySockAddr SetAction Call"));
			iData->SetAction(KHostResInquiry | KHostResName);
			}
		}
	
	if ( !foundParameter )
		{
		ERR_PRINTF2(KLogMissingParameter, &KFlag());
		SetBlockResult(EFail);		
		}
	}
/** Creates an instance of CT_DataLinkedTypefaceSpecification class */
void CT_DataLinkedTypefaceSpecification::DoCmdNewL(const TDesC& aSection)
	{
	// cleanup if any
	DestroyData();

	// call new operator
	TPtrC name;
	if (!GetStringFromConfig(aSection, KFldTypefaceName, name))
		{
		ERR_PRINTF2(KLogMissingParameter, &KFldTypefaceName);
		SetBlockResult(EFail);
		}
	else
		{
		INFO_PRINTF1(_L("execute CLinkedTypefaceSpecification::NewLC"));
		TRAPD(err, iSpec = CLinkedTypefaceSpecification::NewLC(name); CleanupStack::Pop(iSpec));
		if (err != KErrNone)
			{
			ERR_PRINTF2(KLogError, err);
			SetError(err);
			}
		}
	}
Esempio n. 11
0
TBool CDataWrapperBase::GetFontSpecFromConfig(const TDesC& aSectName,const TDesC& aKeyName,TFontSpec& aResult)
	{
	TBuf<KMaxTestExecuteCommandLength>	tempStore;


	TPtrC	name;
	tempStore.Format(KFormatEntryField, &aKeyName, &KTagFontSpecName);
	TBool	ret=GetStringFromConfig(aSectName, tempStore, name);

	TInt	height;
	tempStore.Format(KFormatEntryField, &aKeyName, &KTagFontSpecHeight);
	if ( !GetIntFromConfig(aSectName, tempStore, height) )
		{
		ret=EFalse;
		}

	if ( ret )
		{
		aResult=TFontSpec(name, height);
		}

	return ret;
	}
TVerdict CTimeZoneOffsetCheck::doTestStepPreambleL()
	{	
	_LIT(KLocationTag,"City");
	_LIT(KOldOffsetTag, "OldOffset");
	_LIT(KNewOffsetTag, "NewOffset");
	
	TPtrC ptr;
	
	// read the time zone by name 
	GetStringFromConfig(ConfigSection(), KLocationTag, ptr);
	iLocation.Copy(ptr);
	
	// read the expected offsets 
	TInt offsetInMins;
	GetIntFromConfig(ConfigSection(), KOldOffsetTag, offsetInMins);
	iOldOffset = offsetInMins;
	
	offsetInMins = 0;
	GetIntFromConfig(ConfigSection(), KNewOffsetTag, offsetInMins);
	iNewOffset = offsetInMins;
	
	return TestStepResult();
	}	
Esempio n. 13
0
void CT_DataSdpAgent::DoCmdNewL(const TDesC& aSection)
	{
	DestroyData();
	TPtrC	tBTDevAddrName;
	TBool	foundParameter=EFalse;	
	INFO_PRINTF1(_L("CSdpAgent NewL call"));
	if( GetStringFromConfig(aSection, KTBTDevAddr(), tBTDevAddrName))
		{
		foundParameter=ETrue;			
		CT_BTDevAddrData* tBTDevAddrData=static_cast<CT_BTDevAddrData*>(GetDataWrapperL(tBTDevAddrName));
		const TBTDevAddr* btDevAddr = tBTDevAddrData->GetAddress();
		TRAPD(err, iSdpAgent = CSdpAgent::NewL(*this, *btDevAddr));
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("CSdpAgent NewL failed with error %d"), err);
			SetError(err);
			}
   		}
   	TInt	intBtDevAddr=0;	
	if( GetIntFromConfig(aSection, KIntDevAddr(), intBtDevAddr))
		{
		foundParameter=ETrue;			
		const TBTDevAddr btDevAddr(intBtDevAddr);
		TRAPD(err, iSdpAgent = CSdpAgent::NewL(*this, btDevAddr));
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("CSdpAgent NewL failed with error %d"), err);
			SetError(err);
			}
   		}  	
   		
	if( !foundParameter )
		{
		ERR_PRINTF2(_L("Missing parameter %S"), &KIntDevAddr());
		SetBlockResult(EFail);
		}
	}
/**
 * Updates the specified number of contact items from the database
 */
void CTestContactViewCRUDOperationsStep::UpdateContactEntriesL()
	{
	_LIT(KNumOfContactsToBeUpdated, "NumOfContactsToBeUpdated");
	TInt numOfContactToBeUpdated;
	GetIntFromConfig(ConfigSection(), KNumOfContactsToBeUpdated, numOfContactToBeUpdated);

	TPtrC deleteContactInGroups;
	_LIT(KDeleteContactInGroups, "grouplist");
	GetStringFromConfig(ConfigSection(), KDeleteContactInGroups, deleteContactInGroups);


	if(deleteContactInGroups != KNullDesC)
		{
		UpdateContactsInGroupL(numOfContactToBeUpdated, deleteContactInGroups);
		}
	else
		{
		CCntFilter* filter = CCntFilter::NewL();
		CleanupStack::PushL(filter);
		filter->SetContactFilterTypeCard(ETrue);
		DatabaseReference().FilterDatabaseL(*filter);

		for(TInt i = 0; i < numOfContactToBeUpdated; ++i)
			{
			TContactItemId contactItemId = (*filter->iIds)[i];
			CContactItem* contactItem = DatabaseReference().ReadContactL(contactItemId);
			CleanupStack::PushL(contactItem);
			UpdateFieldsL(*contactItem);
			CContactItem* updatedContactItem = DatabaseReference().UpdateContactLC(contactItemId, contactItem);
			CleanupStack::PopAndDestroy(updatedContactItem);
			CleanupStack::PopAndDestroy(contactItem);
			}

		CleanupStack::PopAndDestroy(filter);
		}
	}
void CTestCalIndexFileAddEntryStep::GetEntryInfoFromConfigL(RPointerArray<CConfigTestEntryInfo>& aEntriesInfo, TInt& aNumEntries, TBool aPerformCrudOps)
	{
	// first get the default entries from the file
	CTestCalIndexFileStepBase::GetEntryInfoFromConfigL(aEntriesInfo, aNumEntries, aPerformCrudOps);
	
	if (aPerformCrudOps)
		{
		// now add the new entry info to the list
		TPtrC entryString;
		TBool readRes = EFalse;
		readRes = GetStringFromConfig(ConfigSection(), KAddEntry, entryString);
		if (!readRes)
			{
			INFO_PRINTF1(_L("Error in CTestCalIndexFileAddEntryStep::GetEntryInfoFromConfigL - entrytoadd not found in config file"));
			User::Leave(KErrNotFound);
			}
		CConfigTestEntryInfo* inf = new(ELeave)CConfigTestEntryInfo();
		CleanupStack::PushL(inf);
		ParseEntryStringL(*inf, entryString);
		aEntriesInfo.Append(inf);
		CleanupStack::Pop(inf); // now held in array
		aNumEntries++;
		}
	}
TVerdict CUpnpResponseComposerTest::doTestStepL()
	{
	TBool responseBodyPresence;
	TInt responseStatusCode;
	TPtrC responseStatusText;
	TInt noOfHdrValPairs;
	TInt noOfHdrParamValPairs;
	RMemoryAllocator allocator ( iMBufMgr );
	
	if( !GetIntFromConfig(ConfigSection(), KResponseStatusCode, responseStatusCode) ||
		!GetStringFromConfig(ConfigSection(), KResponseStatusText, responseStatusText) ||
		!GetBoolFromConfig(ConfigSection(), KResponseBodyPresence, responseBodyPresence) ||
		!GetIntFromConfig(ConfigSection(), KNoOfHdrValPairs, noOfHdrValPairs) ||
		!GetIntFromConfig(ConfigSection(), KNoOfHdrParamValPairs, noOfHdrParamValPairs)
			)
		{
		ERR_PRINTF6(_L("===> Problem in reading values from ini.			\
				\nExpected fields are: \n%S\n%S\n%S\n%S\n%S <==="
			  ), &KResponseStatusCode, &KResponseStatusText, &KResponseBodyPresence,
			  &KNoOfHdrValPairs, &KNoOfHdrParamValPairs);
		
		SetTestStepResult(EFail);
		return TestStepResult();
		}
void CT_DataRSubConParameterBundle::DoCmdFindFamily( const TDesC& aSection )
/**
Test code for RSubConParameterBundle FindFamily

Ini file options:
	subconparameterfamily	- a CSubConParameterFamily dictionary entry

@internalComponent
*/
	{
	TPtrC		subConParameterFamilyName;

	if( !GetStringFromConfig(aSection, KSubConParameterFamily(), subConParameterFamilyName) )
		{
		MissingParamError( KSubConParameterFamily() );
		}
	else
		{
		CSubConParameterFamily*	subConParameterFamily = static_cast<CSubConParameterFamily*>(GetDataObjectL(subConParameterFamilyName));

		if (subConParameterFamily == NULL)
			{
			ERR_PRINTF1(_L("CSubConParameterBundle DoCmdFindFamily - CSubConParameterFamily is NULL"));
			SetBlockResult(EFail);
			}

		INFO_PRINTF1(_L("Calling RSubConParameterBundle FindFamily"));
		TRAPD (err, subConParameterFamily = iSubConParameterBundle->FindFamily(KSubConQoSFamily));

		if( err != KErrNone )
			{
			ERR_PRINTF2(_L("FindFamily() failed with error %d"), err);
			SetError(err);
			}
		}
	}
/**
 *
 * Test step Preamble.
 *
 * @xxxx
 * 
 */
enum TVerdict CTestStepRecorderPlayFF::DoTestStepPreambleL(void)
	{
	 enum TVerdict verdict;
	 // this installs the scheduler
	 verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();

	// Printing to the console and log file
	INFO_PRINTF1(iTestStepName);
	INFO_PRINTF1(_L("this is a test of CMdaAudioRecorderUtility::PlayL(), Rewind & Fast forward"));

	if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName2"), iFileName))
		{
		INFO_PRINTF2(_L("file name %S not found..."), &iFileName);
		return EInconclusive;
		}

	// create the Recorder utility
	if ( (iRecorder = CMMFMdaAudioRecorderUtility::NewL(*this)) == NULL )
		return EInconclusive;

	iRecorder->OpenFileL( iFileName );
	CActiveScheduler::Start(); 

	if (iRecorder == NULL ||
		iError != KErrNone ||
		iRecorder->State() != CMdaAudioRecorderUtility::EOpen)
		return EInconclusive;
	
	// initialize a callback timer
	TRAPD(err, iTimer = CCallbackTimer::NewL(*this));
	if (err != KErrNone)
		return EInconclusive;
	CActiveScheduler::Add(iTimer);

	return verdict;
	}
Esempio n. 19
0
TBool CDataWrapperBase::GetWsGraphicIdFromConfigL(const TDesC& aSectName, const TDesC& aKeyName, TWsGraphicId& aResult)
	{
	TBuf<KMaxTestExecuteCommandLength>	tempStore;

	TInt	id;
	tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdUid);
	TBool	ret=GetIntFromConfig(aSectName, tempStore, id);

	if ( ret )
		{
		TUid	uid=TUid::Uid(id);
		aResult.Set(uid);
		}
	else
		{
		tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdId);
		ret=GetIntFromConfig(aSectName, tempStore, id);
		if ( ret )
			{
			aResult.Set(id);
			}
		else
			{
			tempStore.Format(KFormatEntryField, &aKeyName, &KTagWsGraphicIdName);
			TPtrC	name;
			ret=GetStringFromConfig(aSectName, tempStore, name);
			if ( ret )
				{
				CDataWrapperBase*	wrapper=static_cast<CDataWrapperBase*>(GetDataWrapperL(name));
				aResult=wrapper->GetId();
				}
			}
		}

	return ret;
	}
Esempio n. 20
0
TInt CTestIfioctls::TestIfNameToIndex(  )
	{
	TInt ret = KErrNone;
	char IfName[30];
	TPtrC String;
	_LIT( KString, "String" );
    TBool res = GetStringFromConfig(ConfigSection(), KString, String );
    if(!res)  
		{
     	_LIT(Kerr , "Failed to read interface name from ini file.") ;
     	INFO_PRINTF1(Kerr) ;
     	return KErrGeneral ;
		}
	TBuf8<256> asciiBuffer;
	asciiBuffer.Copy(String);

	TInt len = asciiBuffer.Length();
	Mem::Copy(IfName, asciiBuffer.Ptr(), len);
	IfName[len] = 0;	
	StripStar(IfName);
	if_nametoindex(IfName);
	
	return ret;
	}
void CTestBlockController::CommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex)
	{
	// Retrieve the object name from the ini file
	TPtrC	name;
	if( 0 != aCommand.iCommand.iObject.Compare(KTEFNull) &&
		GetStringFromConfig(aCommand.iCommand.iObject, KName, name) )
		{
		CDataWrapper*	data = iDataDictionary.GetDataL(name);
		if( data!=NULL )
			{
			TBool cmdExists = EFalse;
			TRAPD(err, cmdExists = data->DoCommandL(aCommand.iCommand.iFunction, aCommand.iSection, aAsyncErrorIndex));
			if (KErrNone != err)
				{
				ERR_PRINTF4(_L("Command \"%S\" of the object \"%S\" leaves with error code %d"), &aCommand.iCommand.iFunction, &aCommand.iCommand.iObject, err);
				aCommand.iError = err;
				SetBlockResult(EFail);
				}
			else if( !cmdExists )
				{
				ERR_PRINTF1(KErrNoFunction);
				aCommand.iError = KErrNotFound;
				}
			}
		else
			{
			ERR_PRINTF1(KErrNotExist);
			aCommand.iError = KErrNotFound;
			}
		}
	else
		{
		ERR_PRINTF1(KErrNoName);
		aCommand.iError = KErrNotFound;
		}
	}
/**
 Dial out to given phone number using previously opened RMobileCall
 @param aSection
 @param KCallName
 @param KPhoneNumber
 @param KCallTimeout
 @return error - Symbian error code. KErrNone if successful
 */
void CT_RMobileCallData::DoCmdDial(const TTEFFunction& aSection, const TInt aAsyncErrorIndex)
	{
	INFO_PRINTF1(_L("*START*CT_RMobileCallData::DoCmdDial"));
	TBool dataOk = ETrue;
	if ( !GetStringFromConfig( aSection, KPhoneNumber, iPhoneNumber ))
		{
		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPhoneNumber);
		SetBlockResult(EFail);
		dataOk = EFalse;
		}
	TInt callNameParameter;
	if ( !GetIntFromConfig(aSection, KCallName, callNameParameter ))
		{
		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCallName);
		SetBlockResult(EFail);
		dataOk = EFalse;
		}
	if ( dataOk )
		{
		INFO_PRINTF1(_L("Getting mobile call"));
		TRAPD( error, iMobileCall = GetMobileCallL(callNameParameter) );
		if(error != KErrNone)
			{
			ERR_PRINTF2(_L("GetMobileCallL left when trying to obtain the MobileCall with error %d"), error);
			SetBlockResult(EFail);
			}
		else
			{
			INFO_PRINTF2(_L("Dialing \"%S\""), &iPhoneNumber);
			iMobileCall->Dial (iActiveCallback->iStatus, iPhoneNumber);
			iActiveCallback->Activate(aAsyncErrorIndex);
			IncOutstanding ();
			}
		}
	INFO_PRINTF1(_L("*END*CT_RMobileCallData::DoCmdDial"));
	}
TVerdict CT_LbsHybridCombinedStep_Tracking02::doTestStepL()
	{
 	INFO_PRINTF1(_L("CT_LbsHybridCombinedStep_Tracking02::doTestStepL()"));	
	// Stop the test if the preable failed
	TESTL(TestStepResult() == EPass);
	const TInt KTimeOut = 80*1000*1000;

	// data declarations common to MOLR & MTLR
    TBool emergency = EFalse;
    TInt reason = KErrNone;
    MLbsNetworkProtocolObserver::TLbsNetProtocolService service = MLbsNetworkProtocolObserver::EServiceSelfLocation;
    TLbsNetPosRequestQuality quality = ArgUtils::Quality();
    TLbsNetPosRequestMethod method   = ArgUtils::RequestHybridMethod();
    TPositionSatelliteInfo* getPositionInfo = NULL;
    MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask serviceMask1 = MLbsNetworkProtocolObserver::EServiceSelfLocation;
    MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask serviceMask2 = MLbsNetworkProtocolObserver::EServiceNone;
    TLbsNetPosRequestPrivacy privacy    = ArgUtils::Privacy();
    TLbsExternalRequestInfo requestInfo = ArgUtils::RequestInfo();
    TNetProtocolResponseType mType;
    
    // Protocol Module receives the cababilities message as LBS starts up...
    TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgGetCurrentCapabilitiesResponse);
	
	CLbsNetworkProtocolBase::TLbsSystemStatus status;
	TInt cleanupCnt;
	cleanupCnt = iProxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status);
	TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone);
	CleanupStack::PopAndDestroy(cleanupCnt);
    INFO_PRINTF1(_L("ENetMsgGetCurrentCapabilitiesResponse got"));
	// Create Client Objects...
	RPositionServer server;
	TInt connectError = server.Connect();
	TESTL(KErrNone == connectError);
	CleanupClosePushL(server);	
	RPositioner pos;
	TESTL(KErrNone == pos.Open(server));
	CleanupClosePushL(pos);
	CPosServerWatcher *pWatch = CPosServerWatcher::NewLC(pos, *this);
	
	// set client update options
	TBool trackingEnabled = ETrue;
	if (trackingEnabled)
	{
		T_LbsUtils utils;
	    TPtrC configFileName;
	    _LIT(KUpdateOptionsFile, "agps_module_update_file");
	    GetStringFromConfig(ConfigSection(), KUpdateOptionsFile, configFileName);
	    utils.GetConfigured_ModuleUpdateOptionsL(configFileName, ConfigSection(), iUpdateOpts);
	    pos.SetUpdateOptions(iUpdateOpts);
	}
	
	// Client Send - self locate request... TB mode selected in Admin...
	pWatch->IssueNotifyPositionUpdate();
    INFO_PRINTF1(_L("NotifyPositionUpdate sent"));
    // Get current time.
    iClientInitialRequestTime.UniversalTime();
	
	// LBS->PM :: RequestSelfLocation()
	TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRequestSelfLocation);
    INFO_PRINTF1(_L("RequestSelfLocation got"));

	// check the Client AGPS Usage Flag is as expected at the NPE Hybrid GPS module...
	
        // Process the response.
        TLbsNetSessionId* 					sessionId = NULL;
        TLbsNetPosRequestOptionsAssistance*	opts = NULL;
        cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestSelfLocation, &sessionId, &opts);
        TBool qualitycheck = 	ArgUtils::CompareQuality(	opts, 
                                                            ETrue, 
                                                            KMinHorizontalAcc, 
                                                            KMinVerticalAcc, 
                                                            KTestMaxFixTime,
                                                            0, 
														EAssistanceDataReferenceTime, 
														(TPositionModuleInfo::ETechnologyTerminal 
														| TPositionModuleInfo::ETechnologyAssisted)
													);
		
        TESTL(qualitycheck);
        
        iSessionId.SetSessionNum(sessionId->SessionNum());
        iSessionId.SetSessionOwner(sessionId->SessionOwner());
        CleanupStack::PopAndDestroy(cleanupCnt);
        sessionId = NULL;
        opts = NULL;

    // PM->LBS ProcessStatusUpdate(EServiceSelfLocation)
    serviceMask1 = MLbsNetworkProtocolObserver::EServiceSelfLocation;
    iProxy->CallL(ENetMsgProcessStatusUpdate, &serviceMask1);
    INFO_PRINTF1(_L("ProcessStatusUpdate sent"));
    // PM->LBS ProcessLocationUpdate(SessionId, RefPosition)
    TPositionInfo refPosInfo = ArgUtils::MolrReferencePositionInfo();
    iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &refPosInfo);
    INFO_PRINTF1(_L("ProcessLocationUpdate sent"));
    // LBS->CLIENT OnNotifyPositionUpdate()
    CheckForObserverEventTestsL(KTimeOut, *this);
    TEST(iClientPosUpdateCount==1);
    
    // second request... the interval is 5 seconds..
    // CLIENT->LBS IssueNotifyPositionUpdate();
    pWatch->IssueNotifyPositionUpdate();
    INFO_PRINTF1(_L("second NotifyPositionUpdate sent"));
    
        // an MTLR now happens with Max Fix Time before the client interval expires..
        //    (max fix time == 12 seconds)
    
        // << ProcessStatusUpdate()
        serviceMask1 |= MLbsNetworkProtocolObserver::EServiceMobileTerminated;
        iProxy->CallL(ENetMsgProcessStatusUpdate, &serviceMask1);
        INFO_PRINTF1(_L("ProcessStatusUpdate sent"));
        // PM->LBS ProcessPrivacyRequest()
        emergency = ETrue;
        privacy    = ArgUtils::Privacy();
        requestInfo = ArgUtils::RequestInfo();
        iProxy->CallL(ENetMsgProcessPrivacyRequest, &iSessionId2, &emergency, &privacy, &requestInfo);
        INFO_PRINTF1(_L("ProcessPrivacyRequest sent"));
        // LBS->NRH Callback from RespondNetworkLocationRequest(ERequestAccepted)
        CheckForObserverEventTestsL(KTimeOut, *this);
        
        // NRH->PM Respond Privacy Request
        TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRespondPrivacyRequest);
        INFO_PRINTF1(_L("RespondPrivacyRequest got")); 
		
        TLbsNetSessionId* getSessionId = NULL;
        CLbsNetworkProtocolBase::TLbsPrivacyResponse getPrivacy;
        cleanupCnt = 0;
        cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondPrivacyRequest, &getSessionId, &getPrivacy);
        TESTL(getSessionId->SessionNum()==iSessionId2.SessionNum());
        TESTL(getPrivacy==CLbsNetworkProtocolBase::EPrivacyResponseAccepted);
        CleanupStack::PopAndDestroy(cleanupCnt);
    
        // PM->LBS ProcessLocationUpdate()
        TPositionInfo positionInfo = ArgUtils::ReferencePositionInfo();
        iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId2, &positionInfo);
        INFO_PRINTF1(_L("ProcessLocationUpdate sent"));
        // PM->LBS ProcessAssistanceData()
        TLbsAsistanceDataGroup dataRequestMask = EAssistanceDataReferenceTime;
        RLbsAssistanceDataBuilderSet assistanceData2;
        ArgUtils::PopulateLC(assistanceData2);
        reason = KErrNone;
        iProxy->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData2, &reason);
        CleanupStack::PopAndDestroy();
        INFO_PRINTF1(_L("ProcessAssistanceData sent"));
        
		// PM->LBS ProcessLocationRequest(TB) (max fix time == 12 seconds)
        service = MLbsNetworkProtocolObserver::EServiceMobileTerminated;
        quality = ArgUtils::QualityAlpha2(); 
        method   = ArgUtils::RequestTerminalBasedMethod();
        iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId2, &emergency, &service, &quality, &method);
        INFO_PRINTF1(_L("PM->LBS ProcessLocationRequest(TB) sent"));
            
        // LBS->NRH Callback from ProcessNetworkPostionUpdate(refPosition)
        CheckForObserverEventTestsL(KTimeOut, *this);
        
        // LBS->NRH Callback from ProcessNetworkPostionUpdate(GPS Location)
        CheckForObserverEventTestsL(KTimeOut, *this);
        // check the Client AGPS Usage Flag is as expected at the NPE Hybrid GPS module...
        
        // LBS->PM RequestAssistanceData(0)
        TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
        INFO_PRINTF1(_L("RequestAssistanceData got"));
		TLbsAsistanceDataGroup dataGroup;
        CleanupStack::PopAndDestroy(iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataGroup));
        TESTL(dataGroup == EAssistanceDataNone);
    
        // LBS->PM RespondLocationRequest()
        TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRespondLocationRequest); 
        getSessionId = NULL;
        TInt getReason = KErrNone;
        getPositionInfo = NULL;
        cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo);
        TESTL(getSessionId->SessionNum() == iSessionId2.SessionNum());
        TESTL(getReason == KErrNone);
        CleanupStack::PopAndDestroy(cleanupCnt);
        INFO_PRINTF1(_L("RespondLocationRequest got"));
        // PM->LBS ProcessSessionComplete()
        reason = KErrNone;
        iProxy->CallL(ENetMsgProcessSessionComplete, &iSessionId2, &reason);
        INFO_PRINTF1(_L("ProcessSessionComplete sent"));
        // PM->LBS ProcessStatusUpdate() - still doing the self locate...
        serviceMask2 = MLbsNetworkProtocolObserver::EServiceSelfLocation; 
        iProxy->CallL(ENetMsgProcessStatusUpdate, &serviceMask2);
        INFO_PRINTF1(_L("ProcessStatusUpdate sent"));
        // LBS->NRH Callback from ProcessRequestComplete()
        CheckForObserverEventTestsL(KTimeOut, *this);

        
    // the GPS Module should wait *nearly* 10 seconds (the tracking interval
    // for this test) before continuing to process the location request...

    // LBS->PM CurrentCapabilitiesResponse - informing the PM we're tracking...
    mType = iProxy->WaitForResponse(KTimeOut);
    TESTL(mType == ENetMsgGetCurrentCapabilitiesResponse);
    
    // LBS->PM RequestAssistanceData()
    TLbsAsistanceDataGroup dataMask;    
    mType = iProxy->WaitForResponse(KTimeOut);
    TESTL(mType == ENetMsgRequestAssistanceData); 
    cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
    TESTL(dataMask == EAssistanceDataNone);
    CleanupStack::PopAndDestroy(cleanupCnt);
    
    // check the Client AGPS Usage Flag is as expected at the NPE Hybrid GPS module...

    // PM->LBS ProcessAssistanceData()
    dataMask = EAssistanceDataReferenceTime;
    RLbsAssistanceDataBuilderSet assistanceData;
    ArgUtils::PopulateLC(assistanceData);
    reason = KErrNone;
    iProxy->CallL(ENetMsgProcessAssistanceData, &dataMask, &assistanceData, &reason);
    CleanupStack::PopAndDestroy(); // assistanceData
    
    // PM->LBS ProcessLocationRequest() (NRH Request)
    service = MLbsNetworkProtocolObserver::EServiceSelfLocation;
    quality = ArgUtils::Quality();
    method   = ArgUtils::RequestHybridMethod();
    iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);

    // LBS->PM RequestAssistanceData()
    TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
    cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
    TESTL(dataMask == EAssistanceDataNone);
    CleanupStack::PopAndDestroy(cleanupCnt);
    
    // check the Client AGPS Usage Flag is as expected at the NPE Hybrid GPS module...

    // LBS->PM RespondLocationRequest()
    TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRespondLocationRequest);
    sessionId = NULL;
    reason = KErrNone;
    getPositionInfo = NULL;
    cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &getPositionInfo);
    TESTL(sessionId->SessionNum() == iSessionId.SessionNum());
    TESTL(reason == KErrNone);

    // PM->LBS ProcessLocationUpdate(SessionId, FinalNetworkPosition)
    iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, getPositionInfo);

    CleanupStack::PopAndDestroy(cleanupCnt);
    
    // Client recv - the gps position determined by the gps module.
    CheckForObserverEventTestsL(KTimeOut, *this);
    TESTL(iClientPosUpdateCount==2);
    
    // End of second client request ********************
 
    // close the client session
    pos.Close();
    
    // LBS->PM CurrentCapabilitiesResponse - informing the PM we're no longer tracking...
    TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgGetCurrentCapabilitiesResponse);

    // LBS->PM CurrentCapabilitiesResponse - cancel the self location request.
    TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgCancelSelfLocation);

    // PM->LBS ProcessSessionComplete()
    reason = KErrNone;
    iProxy->CallL(ENetMsgProcessSessionComplete, &iSessionId, &reason);

    // PM->LBS ProcessStatusUpdate()
    serviceMask2 = MLbsNetworkProtocolObserver::EServiceNone; 
    iProxy->CallL(ENetMsgProcessStatusUpdate, &serviceMask2);
    
    // Wait for 10 seconds to ensure no additional responses turn up.
    TInt delta = 10 * 1000 * 1000;
    mType = iProxy->WaitForResponse(delta);
    TESTL(mType == ENetMsgTimeoutExpired);
    
    
    // Done. Now cleanup...
    // all associated with MOLR Positioning Client 
    CleanupStack::PopAndDestroy(pWatch);
    CleanupStack::PopAndDestroy(); // pos
    CleanupStack::PopAndDestroy(); // server
    
	return TestStepResult();
	}
Esempio n. 24
0
TVerdict CTestMacrosTestStep::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
	{
	TPtrC macro;
	GetStringFromConfig(ConfigSection(), KMacro, macro);
	if (macro == KTest)
		{
		TBool parameter;
		TInt parameter2;
		TInt expectedResult;
		GetBoolFromConfig(ConfigSection(), KParameter, parameter);
		GetIntFromConfig(ConfigSection(), KParameter2, parameter2);
		GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult);
		_LIT(KStartInfo, "Start to run %S test of macros TEST(E) & TEST(E)L");
		INFO_PRINTF2(KStartInfo, POS_NEG_SEL);
		TEST(parameter);
		TESTE(parameter, parameter2);
		if (expectedResult != TestStepResult())
			{
			ERR_PRINTF2(_L("The %S test of macro TEST(E) test is failed!"), POS_NEG_SEL);
			SetTestStepResult(EFail);
			}
		else
			{
			SetTestStepResult(EPass);
			INFO_PRINTF3(_L("The %S test of macro TEST(E) is passed. Start to run %S test of macro TEST(E)L"), POS_NEG_SEL, POS_NEG_SEL);
			
			TRAPD(err, TESTL(parameter));
			TRAPD(err1, TESTEL(parameter, parameter2));
			if ((expectedResult==EPass && KErrNone!=err) || (expectedResult==EFail && TEST_ERROR_CODE!=err && parameter2!=err1))
				{
				ERR_PRINTF2(_L("The %S test of macro TEST(E)L test is failed!"), POS_NEG_SEL);
				SetTestStepResult(EFail);
				}
			else
				{
				INFO_PRINTF2(_L("The %S test of macro TEST(E)L is passed."), POS_NEG_SEL);
				SetTestStepResult(EPass);
				}
			}
		}
	else if (macro == KTest1)
		{
		TBool parameter;
		TBool parameter2;
		TInt parameter3;
		TInt initState;
		TInt expectedResult;
		GetBoolFromConfig(ConfigSection(), KParameter, parameter);
		GetBoolFromConfig(ConfigSection(), KParameter2, parameter2);
		GetIntFromConfig(ConfigSection(), KParameter3, parameter3);
		GetIntFromConfig(ConfigSection(), KInitState, initState);
		GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult);
		SetTestStepResult((TVerdict)initState);
		_LIT(KStartInfo, "Start to run %S test of macros TEST(E)1 & TEST(E)1L");
		INFO_PRINTF2(KStartInfo, POS_NEG_SEL);
		TEST1(parameter, parameter2);
		TESTE1(parameter, parameter3, parameter2);
		if (expectedResult != TestStepResult())
			{
			ERR_PRINTF1(_L("Macro TEST(E)1 test failed!"));
			SetTestStepResult(EFail);
			}
		else
			{
			SetTestStepResult(EPass);
			INFO_PRINTF3(_L("The %S test of macro TEST(E)1 has passed. Start to run %S test of macro TEST(E)1L"), POS_NEG_SEL, POS_NEG_SEL);
			
			TRAPD(err, TEST1L(parameter, parameter2));
			TRAP_IGNORE(TESTE1L(parameter, parameter3, parameter2));
			if ((expectedResult==EPass && KErrNone!=err) || ((expectedResult==EFail) && (parameter && ((TEST_ERROR_CODE==err)||(parameter3==err))) || (!parameter && TEST_ERROR_CODE!=err && parameter3!=err)))
				{
				ERR_PRINTF1(_L("Macro TEST(E)1L test failed!"));
				SetTestStepResult(EFail);
				}
			else
				{
				INFO_PRINTF2(_L("The %S test of macro TEST(E)1L has passed."), POS_NEG_SEL);
				SetTestStepResult(EPass);
				}
			}
		}

	else if (macro == KTestCheckL)
		{
		TInt parameter;
		TInt parameter1;
		TPtrC parameter2;
		TInt expectedResult;
		GetIntFromConfig(ConfigSection(), KParameter, parameter1);
		GetStringFromConfig(ConfigSection(), KParameter2, parameter2);
		GetIntFromConfig(ConfigSection(), KExpectedResult, expectedResult);
		
		parameter = (parameter1==expectedResult);
		INFO_PRINTF3(_L("Start %S test of macro %S"), POS_NEG_SEL, &KTestCheckL());
		
		TRAPD(err, TEST_CHECKL(parameter1, expectedResult, parameter2));
		_LIT(KPassInfo, "This test should be passed!");
		_LIT(KFailInfo, "This test should be failed!");
		if ((KErrNone==err && parameter2==KPassInfo()) || (parameter1==err && parameter2==KFailInfo()))
			{
			INFO_PRINTF2(_L("The macro %S test is passed!"), &KTestCheckL());
			SetTestStepResult(EPass);
			}
		else
			{
			ERR_PRINTF2(_L("The macro %S test is failed!"), &KTestCheckL());
			SetTestStepResult(EFail);
			}
		}
	else
		{
		WARN_PRINTF2(_L("Unrecognized Marco %S"), macro);
		}
	
	return TestStepResult();
	}
TVerdict CIPEventNotifier1Step_ReceiveMFlag::doTestStepL()
	{
    SetTestStepResult(EFail);	
              
    _LIT(KReadingConfig,"CIPEventNotifier1Step_ReceiveMFlag::doTestStepL() reading config..");
	INFO_PRINTF1(KReadingConfig);
	if(!GetBoolFromConfig(ConfigSection(),KTe_IPENMFlagExpectedResultBool,iExpectedMFlagValue) ||
	   !GetStringFromConfig(ConfigSection(),KTe_IPENNetworkInterfacePrefixToMonitor, iNetworkInterfacePrefixToMonitor))
	    {
		User::Leave(KErrNotFound);
		}
		
	_LIT(KShowSettings,"The expected M flag is %d, on 1st interface starting with %S");
	INFO_PRINTF3(KShowSettings,iExpectedMFlagValue,&iNetworkInterfacePrefixToMonitor);
						


	_LIT(KGetIfName,"Getting full interface name..");
	INFO_PRINTF1(KGetIfName);
	TName fullName = GetFullInterfaceNameL(iNetworkInterfacePrefixToMonitor);
	_LIT(KDeclEv,"OK. declaring event..");
	INFO_PRINTF1(KDeclEv);
	NetSubscribe::TEvent event( this, SignalHandler );
	_LIT(KSubscribing,"OK. Subscribing..");
	INFO_PRINTF1(KSubscribing);
	CDhcpSignal::SubscribeL( fullName, IPEvent::EMFlagReceived, event );
	_LIT(KOkWaiting,"OK. Waiting for M flag..");
	INFO_PRINTF1(KOkWaiting);


	CTimeout *timeout = CTimeout::NewLC(this);

	// a Router Advertisement is set to go out every 3 seconds on the test network
	//
	timeout->After(KFiveSecondDelayToCatchRouterAdvertisementEveryThreeSeconds);

	TRAPD(res,CActiveScheduler::Start())
	if(res != KErrNone)
		{
		if(res == KErrTimedOut)
			{
			_LIT(KTimedOut,"Timed out! Subscriber isn't working or network isn't publishing Router Advertisements");
			INFO_PRINTF1(KTimedOut);
			}
		else
			{
			_LIT(KUnexpectedErrCode,"Received unexpected error code: %d");
			INFO_PRINTF2(KUnexpectedErrCode,res);
			}
		SetTestStepResult(EFail);
		}
	
	_LIT(KOkTidyingUp,"OK. Tidying up..");
	INFO_PRINTF1(KOkTidyingUp);

	timeout->Cancel();
	CleanupStack::PopAndDestroy(timeout);
	if (iQuery && iQuery->iHandle)
		{
		CDhcpSignal::UnsubscribeL( event );
		}

	_LIT(KOkDone,"OK. Done.");
	INFO_PRINTF1(KOkDone);
	return TestStepResult();
	}
/**
LoadParametersL()
Loads the test parameters 

@leave KErrNotReady
@return
ETrue if parameters loaded, Efalse on failure.
*/
TBool CT_MsgComparePopEmailMsgs::LoadParametersL()
	{
	TPtrC sentFolder;
	_LIT(KSentFolder, "SentFolder");
	if(!GetStringFromConfig(ConfigSection(), KSentFolder, sentFolder))
		{
		ERR_PRINTF1(_L("No Input for Sent Folder"));
		User::Leave(KErrNotReady);
		}
			
	iSentSelectionList = CT_MsgUtils ::CreateChildrenSelectionL(iSharedDataPOP.iSession, CT_MsgUtilsEnumConverter::FindFolderIdByName(sentFolder));
	if(! iSentSelectionList)
		{
		ERR_PRINTF1(_L("Invalid sentSelectionList"));
		SetTestStepResult(EFail);
		return EFalse;
		}
	
	TPtrC inboxFolder;
	_LIT(KInboxFolder, "InboxFolder");
	if(!GetStringFromConfig(ConfigSection(), KInboxFolder, inboxFolder))
		{
		ERR_PRINTF1(_L("No Input for Inbox Folder"));
		User::Leave(KErrNotReady);
		}
	
	
	TPtrC popAccountName;
	if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName))
		{
		ERR_PRINTF1(_L("Account name not specified"));
		SetTestStepResult(EFail);
		}
	if (CT_MsgUtilsEnumConverter::FindFolderIdByName(inboxFolder) == KMsvLocalServiceIndexEntryId)
		{
		// We are expecting to get a selection of remote Folder(which is the serviceId)
		TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName);
		
		CMsvEntry* entry = iSharedDataPOP.iSession->GetEntryL(popServiceId);
		CleanupStack::PushL(entry);
		
		entry->SetEntryL(popServiceId); // Setting the context to remote folder.
		
		iInboxSelectionList = CT_MsgUtils ::CreateChildrenSelectionL(iSharedDataPOP.iSession, popServiceId);
		
		CleanupStack::PopAndDestroy(entry);
		}
	else
		{
		iInboxSelectionList = CT_MsgUtils ::CreateChildrenSelectionL(iSharedDataPOP.iSession, CT_MsgUtilsEnumConverter::FindFolderIdByName(inboxFolder));
		}

	if(! iInboxSelectionList)
		{
		ERR_PRINTF1(_L("Invalid inboxSelectionList"));
		SetTestStepResult(EFail);
		return EFalse;
		}
	//Starting the comparision
	if(iInboxSelectionList->Count() != iSentSelectionList->Count())
		{
		ERR_PRINTF3(_L("iInboxSelectionList->Count(%d) != iSentSelectionList->Count(%d)"),
								 iInboxSelectionList->Count(), iSentSelectionList->Count());
		SetTestStepResult(EFail);
		return EFalse;
		}

	TInt comInt = -1;
	_LIT(KNumTest, "NumTest");
	if (!GetIntFromConfig(ConfigSection(), KNumTest, comInt))
		{
		ERR_PRINTF1(_L("No Input for NumTests"));
		User::Leave(KErrNotReady);
		}
	TInt numTests = comInt;
	if(numTests != iInboxSelectionList->Count())
		{
		ERR_PRINTF1(_L("iNumTests != iInboxSelectionList"));
		SetTestStepResult(EFail);
		return EFalse;
		}
		
	iExpResults.Reset();
	for(TInt i = 0;i < numTests; i++) 
		{
		
		CExpPop3MailInfo* pExp = GetExpPop3MailInfoLC(i);
		if(! pExp)
			{
			ERR_PRINTF1(_L("Invalid expected mail Info"));
			SetTestStepResult(EFail);
			return EFalse;
			}
		else
			{
			CleanupStack::Pop(pExp); // pExp			
			iExpResults.Append(pExp);
			}
		}
	return ETrue;
	}
/**
GetExpPop3MailInfoLC()
Sets the CExpPop3MailInfo attributes reading from the INI file

@param  aIndx
Index in the selection list.

@leave KErrNotReady

@return
A pointer to an object of type CExpPop3MailInfo
*/
CExpPop3MailInfo* CT_MsgComparePopEmailMsgs::GetExpPop3MailInfoLC(TInt aIndx)
	{
	CExpPop3MailInfo* expMailInfo  = new (ELeave) CExpPop3MailInfo;
	CleanupStack::PushL(expMailInfo);
	
	TInt comInt = -1;
	_LIT(KNumOfLines,"NumOfLines%d");
	TBuf<256> param;
	param.Format(KNumOfLines,aIndx);
	
	if (!GetIntFromConfig(ConfigSection(), param, comInt))
		{
		ERR_PRINTF1(_L("No Input for NumOfLines"));
		User::Leave(KErrNotReady);
		}
	
	expMailInfo->SetNumLinesBodyText(comInt);
	comInt = -1;
	
	_LIT(KFooterExpected, "FooterExpected%d");
	param.Format(KFooterExpected,aIndx);
	if (!GetIntFromConfig(ConfigSection(), param, comInt))
		{
		ERR_PRINTF1(_L("No Input for Footer Expected"));
		User::Leave(KErrNotReady);
		}
	expMailInfo->SetFooterExpected(comInt);
	
	comInt = -1;
	_LIT(KNumOfLinesHtml, "NumOfLinesHtml%d");
	param.Format(KNumOfLinesHtml, aIndx);
	if (!GetIntFromConfig(ConfigSection(), param, comInt))
		{
		ERR_PRINTF1(_L("No Input For NumOfLinesHtml"));
		User::Leave(KErrNotReady);
		}
	expMailInfo->SetNumLinesHtml(comInt);
	
	TPtrC ptrDes;
	_LIT(KDescription, "Description%d");
	param.Format(KDescription, aIndx);
	if(!GetStringFromConfig(ConfigSection(), param, ptrDes))
		{
		ERR_PRINTF1(_L("No Input for Description"));
		User::Leave(KErrNotReady);
		}
	expMailInfo->SetDescription(ptrDes);
		
	_LIT(KNumOfAttachments, "NumOfAttachments%d");
	param.Format(KNumOfAttachments, aIndx);
	if (!GetIntFromConfig(ConfigSection(), param, comInt))
		{
		ERR_PRINTF1(_L("No Input for NumOfAttachments"));
		User::Leave(KErrNotReady);
		}
	expMailInfo->SetNumAttachments(comInt);
	
	comInt = -1;
	if(expMailInfo->GetFooterExpected())
		{
		_LIT(KFooterSize, "FooterSize%d");
		param.Format(KFooterSize, aIndx);
		if (!GetIntFromConfig(ConfigSection(), param, comInt))
			{
			ERR_PRINTF1(_L("No Input for FooterSize"));
			User::Leave(KErrNotReady);
			}
		expMailInfo->SetFooterSize(comInt);
		}
	else
		{
		expMailInfo->SetFooterSize(0);
		}
	
	return expMailInfo;
	}
/** 
Get the calculation to be performed from the ini file and carry out that
particular calculation
1. 	If SetGreater is specified in the ini file then the function SetToGreater 
	is called the set the cluster count to a value greater than it actually is
2. 	If ComputeFatSize is specified in the ini file then the function 
	ComputeFatSize is called to computer the size of each FAT
3. 	If ClusterCount is specified in the ini file, then the function 
	ClusterCount is called to return the clutser count of the volume

@return EPass if test passes and EFail if test fails
*/ 
TVerdict CBaseTestFat32Calculate::doTestStepL()
	{
	SetTestStepResult(EFail);
	_LIT(KCalculation,"Calculation");
	TBufC<6> calculationType;
	TPtrC16 calculation = calculationType;	
	TBool alright = GetStringFromConfig(ConfigSection(), KCalculation, calculation);
	if(alright)
		{
		if (calculation == _L("SetGreater"))
			{
			TInt r = SetToGreater(iClusterCount, 1000);
			if (r != KErrNone)
				{
				_LIT(KFailClusterCount, "Failed to Set to a greater cluster count - r=%d");
				INFO_PRINTF2(KFailClusterCount, r);
				return TestStepResult();
				}	
			}
		if (calculation == _L("ComputeFatSize"))
			{
			TInt r = ComputeFatSize();
			if (r != KErrNone)
				{
				_LIT(KFailComputeFatSz, "Failed to compute FatSz - r=%d");
				INFO_PRINTF2(KFailComputeFatSz, r);
				return TestStepResult();
				}	
			}
		if (calculation == _L("ClusterCount"))
			{
			TInt r = CheckClusterCount(iClusterCount);
			if (r != KErrNone)
				{
				_LIT(KFailComputeClusCnt, "Failed to compute ClusterCount - r=%d");
				INFO_PRINTF2(KFailComputeClusCnt, r);
				return TestStepResult();
				}	
			}
		if (calculation == _L("CheckFSInfo"))
			{
			TInt r = CheckFSInfo(0x3E8);
			if (r != KErrNone)
				{
				_LIT(KFailCheckFSInfo, "Failed FSInfo check - r=%d");
				INFO_PRINTF2(KFailCheckFSInfo, r);
				return TestStepResult();
				}	
			}
		}
	else
		{
		_LIT(KIniFileError, "Failed to read calculation type from ini file");
		INFO_PRINTF1(KIniFileError);
		return TestStepResult();
		}
	
	SetTestStepResult(EPass);
	_LIT(KWritePass, "Calculation Pass");
	INFO_PRINTF1(KWritePass);
	return TestStepResult();
	}
/**
 * Load and initialise an audio file.
 */
TVerdict CTestMmfVclntOpenFile0522::DoTestStepL()
	{
	TVerdict ret = EFail;

	INFO_PRINTF1(_L("Test : Video Recorder - OpenFileL(RFile&)"));

	RFs		fs;
	RFile	file;

	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);
	User::LeaveIfError(fs.ShareProtected());

	iError = KErrTimedOut;

	TPtrC filename;
	if(!GetStringFromConfig(iSectName,iKeyName,filename))
		{
		return EInconclusive;
		}

	User::LeaveIfError(file.Open(fs,filename,EFileWrite));
	CleanupClosePushL(file);
	CVideoRecorderUtility* rec = CVideoRecorderUtility::NewL(*this);
	CleanupStack::PushL(rec);

	const TUid KVidTstControllerUid = {KMmfVideoTestControllerUid};
	TRAP(iError,rec->OpenFileL(file, NULL, KVidTstControllerUid, KUidMdaBmpClipFormat));

	if(iError == KErrNone)
		{
		INFO_PRINTF1(_L("CVideoRecorderUtility: Open file"));
		// Wait for initialisation callback
		CActiveScheduler::Start();
		}

	if(iError == KErrNotSupported)
		{
		ret = EPass;
		}

	// Check for errors.
	if ((iError == KErrNone) && (rec != NULL))
		{
		rec->Prepare();
		CActiveScheduler::Start();
		if(iError != KErrNone)
			{
			INFO_PRINTF2(_L("Prepare callback : error %d"), iError);
			return EInconclusive;
			}

		if(iRec)
			{
			iError = KErrTimedOut;
			rec->Record();
			INFO_PRINTF1(_L("CVideoRecorderUtility: Record"));
			// Wait for init callback
			CActiveScheduler::Start();
			if(iError == KErrNone)
				{
				ret = EPass;
				}
			User::After(1000000);
			rec->Stop();
			}
		else
			{
			ret = EPass;
			}
		}

	rec->Close();
	
	INFO_PRINTF1(_L("CVideoRecorderUtility: Destroy"));
	CleanupStack::PopAndDestroy(rec);
	User::After(KOneSecond); // wait for deletion to shut down devsound
	if(iError != KErrNone)
		{
		ERR_PRINTF2( _L("CVideoRecorderUtility failed with error %d"),iError );
		}

	CleanupStack::PopAndDestroy(2,&fs);
	
	return	ret;
	}
/**
 Function : doTestStepL
 Description : Verify if message part(s) of the message entries returned by sort mechanism are
			   in the intended order.
 @return : TVerdict - Test step result
 */
TVerdict CT_MsgVerifySortResult::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step : VerifySortResult"));
	TPtrC fieldName;
	TBuf<1> buf;
	TBool sortedByTo = ETrue;
	TBool sortedByFrom = ETrue;
	TBool sortedByCc = ETrue;
	TBool sortedByBcc = ETrue;
	TBool sortedBySubject = ETrue;
	TBool sortedByUnRead = ETrue;
	TBool sortedByDetails = ETrue;
	TBool sortedByDescription = ETrue;
	TBool sortedByDate = ETrue;
	TBool sortedBySize = ETrue;
	TBool sortedByAttachment = ETrue;
	TBool sortedByPriority = ETrue;
	TBool sortedById = ETrue;
	TBool sortedByNewFlag = ETrue;

	TInt expectedSearchResultCount = 0;
	GetIntFromConfig(ConfigSection(), KExpectedResultCount, expectedSearchResultCount); // Read search result count

	TInt resultCount = 0;
	GetIntFromConfig(ConfigSection(), KCountOfResult, resultCount); // Read search result count

	if(expectedSearchResultCount > 0 && resultCount == 0)
		{
		ERR_PRINTF2(_L("Expected SORT Result Count > 0 and Actual SORT result count = %d"), resultCount);		
		SetTestStepResult(EFail);
		}
	else if(expectedSearchResultCount == 0 && resultCount == 0)
		{
		SetTestStepResult(EPass);
		}
	else
		{
		RArray<TMsvEntry> messageEntries = iSharedDataCommon.iSearchSortResultArray;
		INFO_PRINTF2(_L("Number of entries to be verified = %d"), messageEntries.Count());
		DisplayMsgEntryList(messageEntries); // Log the message entry details
		if ( !GetStringFromConfig( ConfigSection(), KSortMsgPart, fieldName))
			{
			ERR_PRINTF1(_L("Message part to be verified for is not specified"));
			SetTestStepResult (EFail);
			}
		TMsvMessagePart msgPartValue = CT_MsgUtilsEnumConverter::ConvertDesToMessagePart(fieldName);		

		TPtrC sortOrder;
		GetStringFromConfig(ConfigSection(), KSortOrder, sortOrder);
		TMsvSortOrder sortOption = CT_MsgUtilsEnumConverter::ConvertDesToSortOrder(sortOrder);

		CMsvEntry *entry = CMsvEntry::NewL(*iSharedDataCommon.iSession, KMsvRootIndexEntryId, TMsvSelectionOrdering());
		CleanupStack::PushL(entry);

		switch(msgPartValue)
			{
		case EMsvTo:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByTo; ++j)
					{
					entry->SetEntryL(messageEntries[j].Id());
					CMsvStore* store1 = entry->ReadStoreL();
					CleanupStack::PushL(store1);
					CImHeader* header1 = CImHeader::NewLC(); 
					header1->RestoreL(*store1); // Retrieves the email message header
					
					HBufC* address1=HBufC::NewL(50); 
					if(header1->ToRecipients().Count())
						{
						address1 = (header1->ToRecipients()[0]).AllocL();					
						}
	
					CleanupStack::PopAndDestroy(2,store1);
					
					entry->SetEntryL(messageEntries[j+1].Id());
					CMsvStore* store2 = entry->ReadStoreL();
					CleanupStack::PushL(store2);
					CImHeader* header2 = CImHeader::NewLC(); 
					header2->RestoreL(*store2); // Retrieves the email message header
					
					HBufC* address2=HBufC::NewL(50); 
					//  FIx when no fields are there
					if(header2->ToRecipients().Count())
						{
						 address2 = (header2->ToRecipients()[0]).AllocL();
						}
					CleanupStack::PopAndDestroy(2,store2);	

					if(address1->CompareF(*address2) > 0)// Checks if any messages is not in Ascending order   w.r.t to TO field
						{
						ERR_PRINTF1(_L("Sorting by TO: Not in Ascending order"));
						sortedByTo = EFalse;
						SetTestStepResult(EFail);
						}
					delete address2;
					delete address1;	
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByTo; ++j)
					{
					entry->SetEntryL(messageEntries[j].Id());
					CMsvStore* store1 = entry->ReadStoreL();
					CleanupStack::PushL(store1);
					CImHeader* header1 = CImHeader::NewLC(); 
					header1->RestoreL(*store1); // Retrieves the email message header
					HBufC* address1=HBufC::NewL(50); 
					if(header1->ToRecipients().Count())
						{
						address1 = (header1->ToRecipients()[0]).AllocL();					
						}
					CleanupStack::PopAndDestroy(2,store1);
					
					entry->SetEntryL(messageEntries[j+1].Id());
					CMsvStore* store2 = entry->ReadStoreL();
					CleanupStack::PushL(store2);
					CImHeader* header2 = CImHeader::NewLC(); 
					header2->RestoreL(*store2); // Retrieves the email message header
					HBufC* address2=HBufC::NewL(50); 
					//  FIx when no fields are there
					if(header2->ToRecipients().Count())
						{
						 address2 = (header2->ToRecipients()[0]).AllocL();
						}
					CleanupStack::PopAndDestroy(2,store2);	

					if(address1->CompareF(*address2) < 0)// Checks if any messages is not in Descending order  w.r.t to TO field
						{
						ERR_PRINTF1(_L("Sorting by TO: Not in Descending order"));
						sortedByTo = EFalse;
						SetTestStepResult(EFail);
						}
					delete address2;
					delete address1;	
					}
				break;
				}
			break;
		case EMsvFrom:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByFrom; ++j)
					{
					entry->SetEntryL(messageEntries[j].Id());
					CMsvStore* store1 = entry->ReadStoreL();
					CleanupStack::PushL(store1);
					CImHeader* header1 = CImHeader::NewLC(); 
					header1->RestoreL(*store1); // Retrieves the email message header
					HBufC* address1 = header1->From().AllocL();
					CleanupStack::PopAndDestroy(2,store1);

					entry->SetEntryL(messageEntries[j+1].Id());
					CMsvStore* store2 = entry->ReadStoreL();
					CleanupStack::PushL(store2);
					CImHeader* header2 = CImHeader::NewLC(); 
					header2->RestoreL(*store2); // Retrieves the email message header
					HBufC* address2 = header2->From().AllocL();
					CleanupStack::PopAndDestroy(2,store2);	

					if(address1->CompareF(*address2) > 0)// Checks if any messages is not in Ascending order w.r.t to FROM field
						{
						ERR_PRINTF1(_L("Sorting by From: Not in Ascending order"));
						sortedByFrom = EFalse;
						SetTestStepResult(EFail);
						}
					delete address2;
					delete address1;	
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByFrom; ++j)
					{
					entry->SetEntryL(messageEntries[j].Id());
					CMsvStore* store1 = entry->ReadStoreL();
					CleanupStack::PushL(store1);
					CImHeader* header1 = CImHeader::NewLC(); 
					header1->RestoreL(*store1); // Retrieves the email message header
					HBufC* address1 = header1->From().AllocL();
					CleanupStack::PopAndDestroy(2,store1);
					
					entry->SetEntryL(messageEntries[j+1].Id());
					CMsvStore* store2 = entry->ReadStoreL();
					CleanupStack::PushL(store2);
					CImHeader* header2 = CImHeader::NewLC(); 
					header2->RestoreL(*store2); // Retrieves the email message header
					HBufC* address2 = header2->From().AllocL();
					CleanupStack::PopAndDestroy(2,store2);	

					if(address1->CompareF(*address2) < 0)// Checks if any messages is not in Descending order w.r.t to FROM field
						{
						ERR_PRINTF1(_L("Sorting by From: Not in Descending order"));
						sortedByFrom = EFalse;
						SetTestStepResult(EFail);
						}
					delete address2;
					delete address1;	
					}
				break;
				}
			break;
		case EMsvCc:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByCc; ++j)
					{
					HBufC* address1 = HBufC::NewL(50); 
					entry->SetEntryL(messageEntries[j].Id());
					CMsvStore* store1 = entry->ReadStoreL();
					CleanupStack::PushL(store1);
					CImHeader* header1 = CImHeader::NewLC(); 
					header1->RestoreL(*store1); // Retrieves the email message header
					
					if(header1->CcRecipients().Count())
						{
						address1 = (header1->CcRecipients()[0]).AllocL();					
						}
					CleanupStack::PopAndDestroy(2,store1);
					
					HBufC* address2 = HBufC::NewL(50); 
					entry->SetEntryL(messageEntries[j+1].Id());
					CMsvStore* store2 = entry->ReadStoreL();
					CleanupStack::PushL(store2);
					CImHeader* header2 = CImHeader::NewLC(); 
					header2->RestoreL(*store2); // Retrieves the email message header
				
					if(header2->CcRecipients().Count())
						{
						address2 = (header2->CcRecipients()[0]).AllocL();					
						}
					CleanupStack::PopAndDestroy(2,store2);
				
					if(address1->CompareF(*address2) > 0)// Checks if any messages is not in Ascending order w.r.t to CC field
						{
						ERR_PRINTF1(_L("Sorting by CC: Not in Ascending order"));
						sortedByCc = EFalse;
						SetTestStepResult(EFail);
						}
					delete address2;
					delete address1;	
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByCc; ++j)
					{
					HBufC* address1 = HBufC::NewL(50); 
					entry->SetEntryL(messageEntries[j].Id());
					CMsvStore* store1 = entry->ReadStoreL();
					CleanupStack::PushL(store1);
					CImHeader* header1 = CImHeader::NewLC(); 
					header1->RestoreL(*store1); // Retrieves the email message header
					
					if(header1->CcRecipients().Count())
						{
						address1 = (header1->CcRecipients()[0]).AllocL();					
						}
					CleanupStack::PopAndDestroy(2,store1);
					
					
					HBufC* address2 = HBufC::NewL(50); 
					entry->SetEntryL(messageEntries[j+1].Id());
					CMsvStore* store2 = entry->ReadStoreL();
					CleanupStack::PushL(store2);
					CImHeader* header2 = CImHeader::NewLC(); 
					header2->RestoreL(*store2); // Retrieves the email message header
				
					if(header2->CcRecipients().Count())
						{
						address2 = (header2->CcRecipients()[0]).AllocL();					
						}
					CleanupStack::PopAndDestroy(2,store2);
				
									
					if(address1->CompareF(*address2) < 0)// Checks if any messages is not in Descending order w.r.t to CC field
						{
						ERR_PRINTF1(_L("Sorting by CC: Not in Descending order"));
						sortedByCc = EFalse;
						SetTestStepResult(EFail);
						}
					delete address2;
					delete address1;	
					}
				break;
				}
			break;
		case EMsvBcc:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByBcc; ++j)
					{
					HBufC* address1 = HBufC::NewL(50); 
					if(messageEntries[j].iMtm != KUidMsgTypeSMS)
						{
						entry->SetEntryL(messageEntries[j].Id());
						CMsvStore* store1 = entry->ReadStoreL();
						CleanupStack::PushL(store1);
						CImHeader* header1 = CImHeader::NewLC(); 
						header1->RestoreL(*store1); // Retrieves the email message header
						if(header1->BccRecipients().Count())
							{
							address1 = (header1->BccRecipients()[0]).AllocL();					
							}
						CleanupStack::PopAndDestroy(2,store1);
						}
					else
						{
						buf.Copy(_L(""));
						address1 = buf.AllocL();
						}
					
					HBufC* address2 = HBufC::NewL(50); 
					if(messageEntries[j+1].iMtm != KUidMsgTypeSMS)
						{
						entry->SetEntryL(messageEntries[j+1].Id());
						CMsvStore* store2 = entry->ReadStoreL();
						CleanupStack::PushL(store2);
						CImHeader* header2 = CImHeader::NewLC(); 
						header2->RestoreL(*store2); // Retrieves the email message header
						if(header2->BccRecipients().Count())
							{
							address2 = (header2->BccRecipients()[0]).AllocL();					
							}
						CleanupStack::PopAndDestroy(2,store2);
						}
					else
						{
						buf.Copy(_L(""));
						address2 = buf.AllocL();
						}

					if(address1->CompareF(*address2) > 0)// Checks if any messages is not in Ascending order w.r.t to BCC field
						{
						ERR_PRINTF1(_L("Sorting by BCC: Not in Ascending order"));
						sortedByBcc = EFalse;
						SetTestStepResult(EFail);
						}
					delete address2;
					delete address1;	
					}
				break;
				
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByBcc; ++j)
					{
					HBufC* address1 = HBufC::NewL(50); 
					if(messageEntries[j].iMtm != KUidMsgTypeSMS)
						{
						entry->SetEntryL(messageEntries[j].Id());
						CMsvStore* store1 = entry->ReadStoreL();
						CleanupStack::PushL(store1);
						CImHeader* header1 = CImHeader::NewLC(); 
						header1->RestoreL(*store1); // Retrieves the email message header
						if(header1->BccRecipients().Count())
							{
							address1 = (header1->BccRecipients()[0]).AllocL();					
							}
						CleanupStack::PopAndDestroy(2,store1);
						}
					else
						{
						buf.Copy(_L(""));
						address1 = buf.AllocL();
						}
					HBufC* address2 = HBufC::NewL(50); 
					if(messageEntries[j].iMtm != KUidMsgTypeSMS)
						{
						entry->SetEntryL(messageEntries[j+1].Id());
						CMsvStore* store2 = entry->ReadStoreL();
						CleanupStack::PushL(store2);
						CImHeader* header2 = CImHeader::NewLC(); 
						header2->RestoreL(*store2); // Retrieves the email message header
						if(header2->BccRecipients().Count())
							{
							address2 = (header2->BccRecipients()[0]).AllocL();					
							}
						CleanupStack::PopAndDestroy(2,store2);
						}
					else
						{
						buf.Copy(_L(""));
						address2 = buf.AllocL();
						}

					if(address1->CompareF(*address2) < 0)// Checks if any messages is not in Descending order w.r.t to BCC field
						{
						ERR_PRINTF1(_L("Sorting by BCC: Not in Descending order"));
						sortedByBcc = EFalse;
						SetTestStepResult(EFail);
						}
					delete address2;
					delete address1;	
					}
				break;
				}
			break;
		case EMsvSubject:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedBySubject; ++j)
					{
					entry->SetEntryL(messageEntries[j].Id());
					CMsvStore* store1 = entry->ReadStoreL();
					CleanupStack::PushL(store1);
					CImHeader* header1 = CImHeader::NewLC(); 
					header1->RestoreL(*store1); // Retrieves the email message header
					HBufC* subject1 = header1->Subject().AllocL();
					CleanupStack::PopAndDestroy(2,store1);

					entry->SetEntryL(messageEntries[j+1].Id());
					CMsvStore* store2 = entry->ReadStoreL();
					CleanupStack::PushL(store2);
					CImHeader* header2 = CImHeader::NewLC(); 
					header2->RestoreL(*store2); // Retrieves the email message header
					HBufC* subject2 = header2->Subject().AllocL();
					CleanupStack::PopAndDestroy(2,store2);

					if(subject1->CompareF(*subject2) > 0)// Checks if any messages is not in Ascending order w.r.t to SUBJECT field
						{
						ERR_PRINTF1(_L("Sorting by Subject: Not in Ascending order"));
						sortedBySubject = EFalse;
						SetTestStepResult(EFail);
						}
					delete subject2;
					delete subject1;	
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedBySubject; ++j)
					{
					entry->SetEntryL(messageEntries[j].Id());
					CMsvStore* store1 = entry->ReadStoreL();
					CleanupStack::PushL(store1);
					CImHeader* header1 = CImHeader::NewLC(); 
					header1->RestoreL(*store1); // Retrieves the email message header
					
					entry->SetEntryL(messageEntries[j+1].Id());
					CMsvStore* store2 = entry->ReadStoreL();
					CleanupStack::PushL(store2);
					CImHeader* header2 = CImHeader::NewLC(); 
					header2->RestoreL(*store2); // Retrieves the email message header

					if(header1->Subject().CompareF(header2->Subject()) < 0)// Checks if any messages is not in Descending order w.r.t to SUBJECT field
						{
						ERR_PRINTF1(_L("Sorting by Subject: Not in Descending order"));
						sortedBySubject = EFalse;
						SetTestStepResult(EFail);
						}
					CleanupStack::PopAndDestroy(4, store1);	
					}
				break;
				}
			break;
		case EMsvUnreadMessages:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByUnRead; ++j)
					{
					if(messageEntries[j].Unread() > messageEntries[j+1].Unread()) // Checks if any messages is not in Ascending order
						{
						ERR_PRINTF1(_L("Sorting by UnReadFlag: Not in Ascending order"));
						sortedByUnRead = EFalse;
						SetTestStepResult(EFail);
						}
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByUnRead; ++j)
					{
					if(messageEntries[j].Unread() < messageEntries[j+1].Unread()) // Checks if any messages is not in Descending order
						{
						ERR_PRINTF1(_L("Sorting by UnReadFlag: Not in Descending order"));
						sortedByUnRead = EFalse;
						SetTestStepResult(EFail);
						}
					}
				}
			break;
		case EMsvDetails:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDetails; ++j)
					{
					if(messageEntries[j].iDetails.CompareF(messageEntries[j+1].iDetails) > 0)// Checks if any messages is not in Ascending order
						{
						ERR_PRINTF1(_L("Sorting by Details: Not in Ascending order"));
						sortedByDetails = EFalse;
						SetTestStepResult(EFail);
						}
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDetails; ++j)
					{
					if(messageEntries[j].iDetails.CompareF(messageEntries[j+1].iDetails) < 0) // Checks if any messages is not in Descending order
						{
						ERR_PRINTF1(_L("Sorting by Details: Not in Descending order"));
						sortedByDetails = EFalse;
						SetTestStepResult(EFail);
						}
					}
				}
			break;
		case EMsvDescription:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDescription; ++j)
					{
					if(messageEntries[j].iDescription.CompareF(messageEntries[j+1].iDescription) > 0)// Checks if any messages is not in Ascending order
						{
						ERR_PRINTF1(_L("Sorting by Description: Not in Ascending order"));
						sortedByDescription = EFalse;
						SetTestStepResult(EFail);
						}
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDescription; ++j)
					{
					if(messageEntries[j].iDescription.CompareF(messageEntries[j+1].iDescription) < 0) // Checks if any messages is not in Descending order
						{
						ERR_PRINTF1(_L("Sorting by Description: Not in Descending order"));
						sortedByDescription = EFalse;
						SetTestStepResult(EFail);
						}
					}
				}
			break;
		case EMsvDate:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDate; ++j)
					{
					if(messageEntries[j].iDate > messageEntries[j+1].iDate) // Checks if any messages is not in Ascending order
						{
						ERR_PRINTF1(_L("Sorting by Date: Not in Ascending order"));
						sortedByDate = EFalse;
						SetTestStepResult(EFail);
						}
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDate; ++j)
					{
					if(messageEntries[j].iDate < messageEntries[j+1].iDate) // Checks if any messages is not in Descending order
						{
						ERR_PRINTF1(_L("Sorting by Date: Not in Descending order"));
						sortedByDate = EFalse;
						SetTestStepResult(EFail);
						}
					}
				}
			break;
		case EMsvSize:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedBySize; ++j)
					{
					if(messageEntries[j].iSize > messageEntries[j+1].iSize) // Checks if any messages is not in Ascending order
						{
						ERR_PRINTF1(_L("Sorting by Size: Not in Ascending order"));
						sortedBySize = EFalse;
						SetTestStepResult(EFail);
						}
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedBySize; ++j)
					{
					if(messageEntries[j].iSize < messageEntries[j+1].iSize) // Checks if any messages is not in Descending order
						{
						ERR_PRINTF1(_L("Sorting by Size: Not in Descending order"));
						sortedBySize = EFalse;
						SetTestStepResult(EFail);
						}
					}
				}
			break;
		case EMsvAttachment:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByAttachment; ++j)
					{
					if(messageEntries[j].Attachment() > messageEntries[j+1].Attachment()) // Checks if any messages is not in Ascending order
						{
						ERR_PRINTF1(_L("Sorting by AttachmentFlag: Not in Ascending order"));
						sortedByAttachment = EFalse;
						SetTestStepResult(EFail);
						}
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByAttachment; ++j)
					{
					if(messageEntries[j].Attachment() < messageEntries[j+1].Attachment()) // Checks if any messages is not in Descending order
						{
						ERR_PRINTF1(_L("Sorting by AttachmentFlag: Not in Descending order"));
						sortedByAttachment = EFalse;
						SetTestStepResult(EFail);
						}
					}
				}
			break;
		case EMsvNew:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByNewFlag; ++j)
					{
					if(messageEntries[j].New() < messageEntries[j+1].New()) // Checks if any messages is not in Ascending order
						{
						ERR_PRINTF1(_L("Sorting by NewFlag: Not in Ascending order"));
						sortedByNewFlag = EFalse;
						SetTestStepResult(EFail);
						}
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByNewFlag; ++j)
					{
					if(messageEntries[j].New() > messageEntries[j+1].New()) // Checks if any messages is not in Descending order
						{
						ERR_PRINTF1(_L("Sorting by NewFlag: Not in Descending order"));
						sortedByNewFlag = EFalse;
						SetTestStepResult(EFail);
						}
					}
				}
			break;
		case EMsvBody:
			SetTestStepError(KErrNotSupported);
			break;
		case EMsvPriority:
			switch(sortOption)
				{
			case EMsvSortAscending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByPriority; ++j)
					{
					if(messageEntries[j].Priority() < messageEntries[j+1].Priority()) // Checks if any messages is not in Ascending order
						{
						ERR_PRINTF1(_L("Sorting by AttachmentFlag: Not in Ascending order"));
						sortedByPriority = EFalse;
						SetTestStepResult(EFail);
						}
					}
				break;
			case EMsvSortDescending:
				for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByPriority; ++j)
					{
					if(messageEntries[j].Priority() > messageEntries[j+1].Priority()) // Checks if any messages is not in Descending order
						{
						ERR_PRINTF1(_L("Sorting by AttachmentFlag: Not in Descending order"));
						sortedByPriority = EFalse;
						SetTestStepResult(EFail);
						}
					}
				}
			break;
		case EMsvMtmTypeUID:
			break;
			}
		CleanupStack::PopAndDestroy(1, entry);
		}
	return TestStepResult();	
	}