void CT_KeypadDriverData::ProcessResults()
	{
	INFO_PRINTF1(_L("Processing results"));

	if (iActualStore.Count() == iExpectedStore.Count())
		{
		for(TInt i = 0; i < iActualStore.Count(); i+=2)
			{
			if(	iActualStore[i] != iExpectedStore[i]	)//compare event
				{
				ERR_PRINTF3(_L("Expected event (%d) does not match Actual event (%d)! "), iExpectedStore[i], iActualStore[i]);
				SetBlockResult(EFail);
				}
			else
				{
				INFO_PRINTF2(_L("Expected event was: %d, Actual event matches the expected one."), iExpectedStore[i]);
				}

			if(iActualStore[i+1] == iExpectedStore[i+1])
				{
				INFO_PRINTF2(_L("Expected scancode was: %d. Actual scancode matches the expected one."), iExpectedStore[i+1]);
				}
			else
				{
				ERR_PRINTF3(_L("Actual scancode (%d) != expected scancode (%d)"), iActualStore[i+1], iExpectedStore[i+1]);
				SetBlockResult(EFail);
				}
			}
		}
	else
		{
		ERR_PRINTF3(_L("Actual results array count (%d) != expected results array count (%d)"), iActualStore.Count(), iExpectedStore.Count());
		SetBlockResult(EFail);
		}
	}
/**
Creates a second process, runs the requested test and ensures that
the specified panic occurs.

@param aExecutableName The name of the new process
@param aTestInfo The specification for this test
@param aPanicCategory Descriptor containing the start of the expected panic string e.g. for "ALLOC:xxxxxxxx" this would be "ALLOC"
@leave One of the system wide error codes
*/
void CTGraphicsResourceInternalBase::CreateSecondProcessAndCheckAllocPanicL(const TDesC &aExecutableName, TSgResIntTestInfo& aTestInfo, const TDesC &aPanicCategory)
	{
	// Create a second process
	RProcess process;
	TInt err = process.Create(aExecutableName, KNullDesC);
	TESTEL(KErrNone == err, err);
	CleanupClosePushL(process);

	// Specify the id passed to the second process
	TPckg<TSgResIntTestInfo> ptr(aTestInfo);
	err = process.SetParameter(KSecondProcessParametersSlot, ptr);
	TESTEL(KErrNone == err, err);

	// Kick off the second process and wait for it to complete
	// The actual testing is done in the second process
	TRequestStatus status;
	process.Logon(status);
	process.Resume();
	User::WaitForRequest(status);

	if(EExitPanic != process.ExitType())
		{
		ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, process.ExitType());
		TEST(EFalse);
		}

	TExitCategoryName secondProcessExitCategory = process.ExitCategory();
	if(0 != secondProcessExitCategory.Match(aPanicCategory))
		{
		ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aPanicCategory, &secondProcessExitCategory);
		TEST(EFalse);
		}
	
	CleanupStack::PopAndDestroy();
	}
TBool CUpsClientStep::CheckDialogCreatorResultsL(TInt aIndex)
	{
	TBool checkPassed = ETrue;
	
	// checks return properties from dialog creator.
 	if (iArraySersToRequest[aIndex].iDialogCreatorInvoked != 0)
		{
		TInt instanceDia = iArraySersToRequest[aIndex].iDialogCreatorInvoked;
		TInt dialogError = 0;
		iPropertyReader->GetL(instanceDia,KDc_Error,CUpsProperty::EDialogCreator, dialogError);
		
		// Checks that any error encountered by dialog creator is transmited by UPS to system server
		if(dialogError != iReturnData.iError && dialogError!=KErrNone)
			{
			ERR_PRINTF3(_L("%S: Dialog creator found an error: %d"),&iTEFServerName,dialogError);
			checkPassed = EFalse; 	
			}
		
		TInt clientSidDia=0;
		iPropertyReader->GetL(instanceDia,KDc_ClientSid,CUpsProperty::EDialogCreator, clientSidDia);
	     
	    if(iExpectedClientSid != clientSidDia)
		    {
		    ERR_PRINTF2(_L("%S: Client SID returned by dialog creator is not what is expected"),&iTEFServerName);
			checkPassed = EFalse;
		    }
	    
	    TInt buttonsDisplayed=0;
		iPropertyReader->GetL(instanceDia,KDc_UpsRequestedButtons,CUpsProperty::EDialogCreator, buttonsDisplayed);
	    TInt32 expectedButtonsDisplayed=iArraySersToRequest[aIndex].iButtonsDisplayed;
	    if(expectedButtonsDisplayed != buttonsDisplayed)
		    {
		   	ERR_PRINTF2(_L("%S: Incorrect buttons displayed."),&iTEFServerName);
		   	ERR_PRINTF3(_L("%S: Buttons displayed expected: %d"),&iTEFServerName,expectedButtonsDisplayed);
		   	ERR_PRINTF3(_L("%S: Buttons displayed received: %d"),&iTEFServerName,buttonsDisplayed);
			checkPassed = EFalse;
		    }
	    
	    TInt serverSidDia=0;
		iPropertyReader->GetL(instanceDia,KDc_ServerSid,CUpsProperty::EDialogCreator, serverSidDia);
	     
	    if(iServerId != serverSidDia)
		    {
		   	ERR_PRINTF2(_L("%S: Server SID returned by dialog creator is not what is expected"),&iTEFServerName);
			checkPassed = EFalse;
		    } 
	    
	    TInt serviceSidDia=0;
		iPropertyReader->GetL(instanceDia,KDc_ServiceId,CUpsProperty::EDialogCreator, serviceSidDia);
		if(serviceSidDia != iArraySersToRequest[aIndex].iServiceUID)
		    {
		   	ERR_PRINTF3(_L("%S: Service ID reported by dialog creator is not what is expected: %d"),&iTEFServerName,serviceSidDia);
			checkPassed = EFalse;
		    }  
		}
	
	return checkPassed;
	}  // End of function.
TBool CUpsClientStep::CheckPolicyEvaluatorResultsL(TInt aIndex)
	{
	TBool checkPassed = ETrue;
	
	if (iArraySersToRequest[aIndex].iPolicyEvaluatorInvoked != 0)
		{
		TInt instanceEva = iArraySersToRequest[aIndex].iPolicyEvaluatorInvoked;
		TInt evaluatorError = 0;
		
		// Checks that any error encountered by policy evaluator is transmited by UPS to system server
		iPropertyReader->GetL(instanceEva,KPe_Error,CUpsProperty::EPolicyEvaluator, evaluatorError);
		if(evaluatorError != iReturnData.iError && evaluatorError!=KErrNone)
			{
			ERR_PRINTF3(_L("%S: Policy evaluator found an error: %d"),&iTEFServerName,evaluatorError);
			checkPassed = EFalse; 	
			}
		
		TInt clientSidEva=0;
		iPropertyReader->GetL(instanceEva,KPe_ClientSid,CUpsProperty::EPolicyEvaluator, clientSidEva);
	     
	    if(iExpectedClientSid != clientSidEva)
		    {
		   	ERR_PRINTF2(_L("%S: Client SID returned by policy evaluator is not what is expected"),&iTEFServerName);
			checkPassed = EFalse;
		    }
	    
	    TInt serverSidEva=0;
		iPropertyReader->GetL(instanceEva,KPe_ServerSid,CUpsProperty::EPolicyEvaluator, serverSidEva);
	     
	    if(iServerId != serverSidEva)
		    {
		   	ERR_PRINTF2(_L("%S: Server SID returned by policy evaluator is not what is expected"),&iTEFServerName);
			checkPassed = EFalse;
		    } 
	    
	    TInt serviceSidEva = 0;
		iPropertyReader->GetL(instanceEva,KPe_ServiceId,CUpsProperty::EPolicyEvaluator, serviceSidEva);
		if(serviceSidEva != iArraySersToRequest[aIndex].iServiceUID)
		    {
		   	ERR_PRINTF3(_L("%S: Service ID reported by policy evaluator is not what is expected: %d"),&iTEFServerName,serviceSidEva);
			checkPassed = EFalse;
		    }
	    if( iArraySersToRequest[aIndex].iForcePrompt)
		    {
	    	// Read evaluator info
	    	TInt evaluatorInfo = 0;
			iPropertyReader->GetL(instanceEva,KPe_EvaluatorInfo,CUpsProperty::EPolicyEvaluator, evaluatorInfo);
	    	if(evaluatorInfo != iArraySersToRequest[aIndex].iExpectedEvaluatorInfo)
	    		{
	    		ERR_PRINTF4(_L("%S: incorrect evaluator info:Expected: %d Received: %d"),&iTEFServerName,iArraySersToRequest[aIndex].iExpectedEvaluatorInfo,evaluatorInfo);
	    		checkPassed = EFalse;
	    		}
		    }
		}
		
	return checkPassed;
	}  // End of function.
void CT_DataRSocketServ::DoCmdVersion(const TDesC& aSection)
	{	

	INFO_PRINTF1(_L("Calling RSocketServ::Version()"));			
	TVersion				version = iSocketServ->Version();
	TBuf<KMaxVersionName>	versionName(version.Name());

	INFO_PRINTF2(_L("Version name  : %S"), &versionName);
	INFO_PRINTF2(_L("Version build : %d"), (TInt)version.iBuild);
	INFO_PRINTF2(_L("Version major : %d"), (TInt)version.iMajor);
	INFO_PRINTF2(_L("Version minor : %d"), (TInt)version.iMinor);			 

	TPtrC	expectedVersionName;
	if( GetStringFromConfig(aSection, KExpectedVersionName(), expectedVersionName) )
		{
		if( version.Name() != expectedVersionName )
			{
			ERR_PRINTF3(_L("Expected Version Name (%S) != Actual Version Name (%S)"), &expectedVersionName, &versionName);
			SetBlockResult(EFail);	
			}
		}
		
	TInt	intTemp;
	if( GetIntFromConfig(aSection, KExpectedVersionBuild(), intTemp) )
		{
		if( version.iBuild != intTemp )
			{
			ERR_PRINTF3(_L("Expected Version Build (%d) != Actual Version Build (%d)"), &intTemp, version.iBuild);
			SetBlockResult(EFail);	
			}
		}
		
	if( GetIntFromConfig(aSection, KExpectedVersionMajor(), intTemp) )
		{
		if( version.iMajor != intTemp )
			{
			ERR_PRINTF3(_L("Expected Version Major (%d) != Actual Version Major (%d)"), &intTemp, version.iMajor);
			SetBlockResult(EFail);	
			}
		}
	
	if( GetIntFromConfig(aSection, KExpectedVersionMinor(), intTemp) )
		{
		if( version.iMinor != intTemp )
			{
			ERR_PRINTF3(_L("Expected Version Minor (%d) != Actual Version Minor (%d)"), &intTemp, version.iMinor);
			SetBlockResult(EFail);	
			}
		}

	if (version.Name() == _L("") && version.iBuild == 0 && version.iMajor == 0 && version.iMinor == 0)
		{
		ERR_PRINTF1(_L("Some version fields are not set!"));
		SetBlockResult(EFail);
		}
	}
/**
Test BTAddr()
*/
void CT_InquirySockAddrData::DoCmdBTAddr(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TInquirySockAddr BTAddr Call"));	
	TBTDevAddr btDevAddr = iData->BTAddr();
	
	TBuf<KMaxSockAddrSize> tmpbtDevAddr;
	btDevAddr.GetReadable(tmpbtDevAddr);
	INFO_PRINTF2(_L("Returned BT Addres = (%S)"), &tmpbtDevAddr);		
    TBuf<KMaxSockAddrSize> tmptBTDevAddrData; 

	TPtrC	tBTDevAddrName;
	TBool	foundParameter=EFalse;	
	TBool result = EFalse;
	
	if(GetStringFromConfig(aSection, KTBTDevAddr(), tBTDevAddrName))
		{
		foundParameter=ETrue;			
		TBTDevAddr* tBTDevAddrData=static_cast<TBTDevAddr*>(GetDataObjectL(tBTDevAddrName));

		tBTDevAddrData->GetReadable(tmptBTDevAddrData);
		INFO_PRINTF2(_L("Expected BT address = (%S) from ini file"), &tmptBTDevAddrData);

		result = btDevAddr==(*tBTDevAddrData);
		
		if ( !result )
			{
			ERR_PRINTF3(_L("BT Address (%S) is not as expected (%S)"),&tmpbtDevAddr, &tmptBTDevAddrData);
			SetBlockResult(EFail);
			}
		}
	
	TInt	intBtDevAddr=0;	
	if(GetIntFromConfig(aSection, KIntDevAddr(), intBtDevAddr))
		{
		foundParameter=ETrue;			
		const TBTDevAddr expectedBTAddr(intBtDevAddr);
		
		result = btDevAddr==(expectedBTAddr);
		btDevAddr.GetReadable(tmpbtDevAddr);
		if ( !result )
			{
			ERR_PRINTF3(_L("BT Address (%S) is not as expected (%d)"), &tmpbtDevAddr, intBtDevAddr);
			SetBlockResult(EFail);
			}
		}
		
	if( !foundParameter )
		{
		ERR_PRINTF3(KLogMissingParameters, &KTBTDevAddr(), &KIntDevAddr());
		SetBlockResult(EFail);
		}
	}
/**
  Function : doTestStepL
  Description : Checks the provisioned SNAP information for the POP account settings of a test case.
  @return : TVerdict - Test step result
*/		
TVerdict CT_MsgCheckPopSNAPSetting::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step : CheckPopSNAPSetting"));
	if(ReadIni())
		{
		CEmailAccounts* accounts = CEmailAccounts::NewL();
		CleanupStack::PushL(accounts);
		
		CImIAPPreferences* popIapPrefs = CImIAPPreferences::NewLC();
					
		TPopAccount popAccountId;
		CT_MsgUtilsCentralRepository::GetPopAccountL((TDes&)iPopAccountName,popAccountId);
				
		accounts->LoadPopIapSettingsL(popAccountId, *popIapPrefs);	
		
		TBool actualSNAPDefintion = popIapPrefs->SNAPDefined();
		
		if (actualSNAPDefintion == iExpectedSNAPDefinition)
			{
			if (actualSNAPDefintion)
				{
				TInt expectedSNAPPreference = 0;
				if(!GetIntFromConfig(ConfigSection(), KSNAPPreference, expectedSNAPPreference))
					{
					ERR_PRINTF1(_L("An expected SNAP ID value is not specified"));
					SetTestStepResult(EFail);
					CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts
					return TestStepResult();
					}
				TInt actualSNAPPreference = popIapPrefs->SNAPPreference();
				
				if (actualSNAPPreference != expectedSNAPPreference)
					{
					ERR_PRINTF3(_L("Actual SNAP ID [%d] does not equal Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference);
					SetTestStepResult(EFail);
					}
				else
					{
					INFO_PRINTF3(_L("Actual SNAP ID [%d] equals Expected SNAP ID [%d]"),actualSNAPPreference,expectedSNAPPreference);
					}
				}
			}
		else
			{
			ERR_PRINTF3(_L("Actual SNAP Defintion [%d] does not equal Expected SNAP Defintion [%d]"),actualSNAPDefintion,iExpectedSNAPDefinition);
			SetTestStepResult(EFail);
			}
	
		CleanupStack::PopAndDestroy(2,accounts); // popIapPrefs, accounts
		}
	return TestStepResult();
	}
Beispiel #8
0
/** Calls CFbsFont::HasCharacter() */
void CT_DataFbsFont::DoCmdHasCharacter(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("Calls CFbsFont::HasCharacter()"));

	// get character code from parameters
	TInt	charCode = 0;
	if(!GetIntFromConfig(aSection, KCharCode(), charCode))
		{
		ERR_PRINTF2(_L("No %S"), &KCharCode());
		SetBlockResult(EFail);
		}
	else
		{
		// call HasCharacter()
		TBool	actual = iFbsFont->HasCharacter(charCode);

		TBool	expected;
		if(GetBoolFromConfig(aSection, KExpectedBool(), expected))
			{
		// check that the value is as expected
			if (actual != expected)
				{
				ERR_PRINTF3(_L("The value is not as expected! expected: %d, actual: %d"), expected, actual);
				SetBlockResult(EFail);
				}
			}
		}
	}
Beispiel #9
0
/** Calls CFbsFont::RawTextWidthInPixels() */
void CT_DataFbsFont::DoCmdRawTextWidthInPixels(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("Calls CFbsFont::RawTextWidthInPixels()"));

	// get text from parameters
	TPtrC	text;
	if (!GetStringFromConfig(aSection, KText(), text))
		{
		ERR_PRINTF2(_L("No %S"), &KText());
		SetBlockResult(EFail);
		}
	else
		{
		// call RawTextWidthInPixels()
		TInt	width = iFbsFont->RawTextWidthInPixels(text);

		// check result against MeasureText()
		TInt	measureTextWidth = iFbsFont->MeasureText(text);
		if ( width != measureTextWidth)
			{
			ERR_PRINTF3(_L("The result of RawTextWidthInPixels() is not the same as for MeasureText(): %d, and %d"), width, measureTextWidth);
			SetBlockResult(EFail);
			}
		}
	}
TVerdict CTestStepSDevSoundClientThreadNoCap::DoVerifyResult()
{
    if (iCallbackError != iExpectedValue)
    {
        ERR_PRINTF3 (_L("DevSound ToneFinished returned %d, expected %d"), iCallbackError, iExpectedValue);
        return EFail;
    }
    if (iServerResult != KErrUnderflow)
    {
        ERR_PRINTF2 (_L("DevSound(server-side) ToneFinished returned %d, expected 0"), iServerResult);
        return EFail;
    }
    if (iCallbackArray[EToneFinished] != 1)
    {
        ERR_PRINTF2 (_L("DevSound ToneFinished was called %d times, expected 1"), iCallbackArray[EToneFinished]);
        return EFail;
    }
    TInt tot = GetCallbackTotal();
    if (tot > 1)
    {
        ERR_PRINTF2 (_L("DevSound called %d callbacks, expected 1"), tot);
        return EFail;
    }
    return EPass;
}
/**
 Function : RetriveSearchSortResultL
 Description : Retrieves the search/sort result
 @return : none
 */
void CT_MsgSearchSortByQueryObject::RetriveSearchSortResultL(const TInt aIterationLimit, TMsvSearchSortResultType aResultType)
	{
	// Get the number of messages satisfying the search/sort request
	TInt resultCount = iSharedDataCommon.iSearchSortOperation->GetResultCountL();
	WriteIntToConfig(ConfigSection(), KCountOfResult, resultCount); 
	
	// Get the search/sort result according to user preference
	TMsvId messageId, serviceId;
	TMsvEntry messageEntry;
	iSharedDataCommon.iSearchSortResultArray.Reset(); // Flush out the existing search/sort result
	if (aIterationLimit > 0 && aResultType == EMsvResultAsTMsvId) // Iteration limit is one and result type is TMsvId
		{
		for(TInt index = 0; index < resultCount; ++index)
			{
			iSharedDataCommon.iSearchSortOperation->GetNextResultL(messageId);
			 // Get the corresponding index entry and append the same to array of entries.
			iSharedDataCommon.iSession->GetEntry(messageId, serviceId, messageEntry);
			iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
			}
		}
	else if(aIterationLimit > 0 && aResultType == EMsvResultAsTMsvEntry) // Iteration limit is one and result type is TMsvEntry
		{
		for(TInt index = 0; index < resultCount; ++index)
			{
			iSharedDataCommon.iSearchSortOperation->GetNextResultL(messageEntry);
			iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
			}
		}
	else if (aIterationLimit == 0 && aResultType == EMsvResultAsTMsvId) // No iteration and result type is TMsvId
		{
		RArray<TMsvId> idArray;
		TRAPD(error, iSharedDataCommon.iSearchSortOperation->GetResultsL(idArray));
		if(error == KErrNone)
			{
			// Get the corresponding index entries and create an array of entries.
			for(TInt index = 0; index < idArray.Count(); ++index)
				{
				iSharedDataCommon.iSession->GetEntry(idArray[index], serviceId, messageEntry);
				iSharedDataCommon.iSearchSortResultArray.Append(messageEntry);
				}
			}
		else
			{
			SetTestStepError(error);
			}
		}
	else // No iteration and result type is TMsvEntry
		{
//		RArray<TMsvEntry> entryArray;
		TRAPD(error, iSharedDataCommon.iSearchSortOperation->GetResultsL(iSharedDataCommon.iSearchSortResultArray));
		SetTestStepError(error);
		}
	// Ensure Number of Entries in iSharedDataCommon.iSearchSortResultArray is same as the result count
	if(iSharedDataCommon.iSearchSortResultArray.Count() != resultCount)
		{
		ERR_PRINTF1(_L("MisMatch in Result count and Entries retrieved"));
		ERR_PRINTF3(_L("Search-sort result count= %d Entries retrieved= %d"), resultCount, iSharedDataCommon.iSearchSortResultArray.Count());
		SetTestStepResult(EFail);
		}
	}
Beispiel #12
0
/**
 *
 * Check the config file for a TInt value
 *
 * @param	"const TDesC &aSectName"
 *			Section name to check in
 *
 * @param	"const TDesC &aKeyName"
 *			Key name to check for
 *
 * @param	"TInt &aResult"
 *			TInt returned from config file
 *
 * @return	"TBool"
 *			Result (ETrue if found)
 *
 * @xxxx
 *
 */
EXPORT_C TBool RTestStep::GetIntFromConfig(const TDesC &aSectName, const TDesC &aKeyName, TInt &aResult)
	{
	// check file available
	if ( !iConfigDataAvailable )
		{
		ERR_PRINTF1(_L("No config file available"));
		return EFalse;
		}	

	TBool ret = EFalse;
	TPtrC result;

	// get the value 
	ret = iConfigData->FindVar(aSectName, aKeyName, result);

	// if failed to decode display error
	if (!ret) 
		{
		// display error message
		ERR_PRINTF3(_L("Failed to read section:%S key:%S "),
				&aSectName, &aKeyName );

		// return fail
		return EFalse;
		}

	// use TLex to convert to a TInt
	TLex lex(result);
	if (lex.Val(aResult) == KErrNone)
		return ETrue;
	else
		return EFalse;
}
Beispiel #13
0
/**
 *
 * Check the config file for a boolean value
 *
 * @param	"const TDesC &aSectName"
 *			Section name to check in
 *
 * @param	"const TDesC &aKeyName"
 *			Key name to check for
 *
 * @param	"Bool &aResult"
 *			TBool returned from config file
 *
 * @return	"TBool"
 *			Result (ETrue if found)
 *
 * @xxxx
 *
 */
EXPORT_C TBool RTestStep::GetBoolFromConfig(const TDesC &aSectName, const TDesC &aKeyName, TBool &aResult)
	{
	// check file available
	if (!iConfigDataAvailable)
		{
		ERR_PRINTF1(_L("No config file available"));
		return EFalse;
		}

	TBool ret = EFalse;
	TPtrC result;

	// get the value 
	ret = iConfigData->FindVar(aSectName, aKeyName, result);

	// if failed to decode display error
	if (!ret) 
		{
		// display error message
		ERR_PRINTF3(_L("Failed to read section:%S key:%S "),
				&aSectName, &aKeyName );

		// return fail
		return EFalse;
		}

	// set result as a TBool
	if (result.FindF(_L("true")) == KErrNotFound)
		aResult = EFalse;
	else
		aResult = ETrue;
	// return success
	return ETrue;
	}
/**
doTestStepL()
Reads the expected count from the ini file.
Obtains the count of the POP accounts created and compares against the expected number.

@return
Returns the test step result.
*/
TVerdict CT_MsgVerifyPopAccountsCount::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Step: Verify Pop Accounts Count"));
	TInt expectedCount = -1;
	if(!GetIntFromConfig(ConfigSection(), KExpectedCount, expectedCount) && expectedCount < 0)
		{
		ERR_PRINTF1(_L("ExpectedCount is not Specified or < 0"));
		SetTestStepResult(EFail);
		}
	else
		{
		CEmailAccounts *account = CEmailAccounts::NewLC();	
		RArray<TPopAccount> arrayPopAccounts;
		account->GetPopAccountsL(arrayPopAccounts);
		TInt count = arrayPopAccounts.Count();
		
		CleanupStack::PopAndDestroy(account);
		arrayPopAccounts.Reset();
		
		if (count != expectedCount)
			{
			ERR_PRINTF3(_L("Number of POP accounts do not match ! expected = %d actual = %d"), 
									  expectedCount, count);
			SetTestStepResult(EFail);
			}
		else
			{
			INFO_PRINTF2(_L("Number of POP accounts matched value = %d !"), expectedCount);	
			}			
		}
	return TestStepResult();
	}
/**
Test SetBTAddr()
*/
void CT_InquirySockAddrData::DoCmdSetBTAddr(const TDesC& aSection)
	{	
	TPtrC	tBTDevAddrName;
	TBool	foundParameter=EFalse;	
	
	if(GetStringFromConfig(aSection, KTBTDevAddr(), tBTDevAddrName))
		{
		foundParameter=ETrue;			
		CT_BTDevAddrData* tBTDevAddrData=static_cast<CT_BTDevAddrData*>(GetDataWrapperL(tBTDevAddrName));
		const TBTDevAddr* btDevAddr = tBTDevAddrData->GetAddress();
		
		INFO_PRINTF1(_L("TInquirySockAddr SetBTAddr Call"));
		iData->SetBTAddr(*btDevAddr);
		}
	
	TInt	intBtDevAddr=0;	
	if(GetIntFromConfig(aSection, KIntDevAddr(), intBtDevAddr))
		{
		foundParameter=ETrue;			
		const TBTDevAddr btDevAddr(intBtDevAddr);
		
		INFO_PRINTF1(_L("TInquirySockAddr SetBTAddr Call"));	
		iData->SetBTAddr(btDevAddr);
		}
		
	if( !foundParameter )
		{
		ERR_PRINTF3(KLogMissingParameters, &KTBTDevAddr(), &KIntDevAddr());
		SetBlockResult(EFail);
		}
	}
void CTestDevVideoPlayClock::MmcspuoTick(const TTimeIntervalMicroSeconds& aTime)
	{
	iPeriodicUtilityIteration++;

	TUint currentTime = I64LOW(aTime.Int64());
	TUint predictedTime = iPeriodicUtilityIteration * KTestClock2Seconds;

	if (!TimeComparison(currentTime, predictedTime, KTestClockBigDeviationMS))
		{
		ERR_PRINTF3(_L("Error - Periodic Utility time comparison failed:  Got %u;  Expected %u"), currentTime, predictedTime);
		iPeriodicUtilityTestVerdict = EFail;
		iPeriodicUtility->Stop();
		CActiveScheduler::Stop();
		}
	else
		{
		INFO_PRINTF3(_L("Periodic Utility time comparison passed:  Got %u;  Expected %u"), currentTime, predictedTime);
		}

	if (iPeriodicUtilityIteration >= 5)
		{
		iPeriodicUtility->Stop();
		CActiveScheduler::Stop();
		}
	}
Beispiel #17
0
void CT_DataAnimDll::DoCmdLoad(const TDesC& aSection)
	{
	TInt err = KErrNone;
	
	// Get test data for command input parameter(s)
	TPtrC fileName;
	if(!GetStringFromConfig(aSection, KPlugInFileName(), fileName))
		{
		ERR_PRINTF2(KLogErrMissingPara, &KPlugInFileName());
		SetBlockResult(EFail);
		}
	else
		{	
		// Execute command and log parameters
		if (iAnimDll != NULL)
			{
			INFO_PRINTF1(KLogInfoCmdLoad1);
			err = iAnimDll->Load(fileName);
			}
		
		// Check the command return code
		if(err != KErrNone)
			{
			ERR_PRINTF3(KLogErrLoad, err, &fileName);
			SetError(err);
			}
		}
	}
/**
 *
 * TestInitialize
 * @param aDataType
 * @param aMode
 * @result TVerdict
 *
 */
TVerdict CTestStepSDevSoundPlayDataCap::TestInitialize(TMMFState aMode)
{
    TFourCC pcm16(KMMFFourCCCodePCM16); //default to pcm16 data type

    iCallbackError = KErrNone;
    iExpectedValue = KErrNone;

    ResetCallbacks();
    iAL->InitialiseActiveListener();

    INFO_PRINTF1(_L("Initializing DevSound"));
    // Initialize
    TRAPD(err, iMMFDevSound->InitializeL(*this, pcm16, aMode));
    if (err)
    {
        WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err);
        return EInconclusive;
    }
    else
    {
        CActiveScheduler::Start();
        if (iCallbackError != iExpectedValue)
        {
            ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue);
            return EFail;
        }
        if (iCallbackArray[EInitComplete] != 1)
        {
            ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]);
            return EFail;
        }
    }
    return EPass;
}
void CT_DataRSocketServ::DoCmdNumProtocols(const TDesC& aSection)
	{	
	iNumOfProtocols = 0;
	INFO_PRINTF1(_L("Calling RSocketServ::NumProtocols()"));			
	TInt	err = iSocketServ->NumProtocols(iNumOfProtocols);
	
	if( err!=KErrNone )
		{
		ERR_PRINTF2(_L("RSocketServ::NumProtocols() failed with error %d"), err);
		SetError(err);	
		}
	else
		{
		INFO_PRINTF2(_L("RSocketServ::NumProtocols() = %d"), iNumOfProtocols);			

		TInt	expectedValue;
		if( GetIntFromConfig(aSection, KExpectedValue(), expectedValue) )
			{
			if( (TInt)iNumOfProtocols != expectedValue )
				{
				ERR_PRINTF3(_L("Expected NumProtocols (%d) != Actual NumProtocols (%d)"), expectedValue, iNumOfProtocols);
				SetBlockResult(EFail);	
				}
			}
		}			
	}
void CT_EntryData::DoCmdAssignmentOperatorL( const TDesC& aSection )
/** Assigns another TEntry to this TEntry using "=" operator */
	{
	TPtrC entryObjectName;
	if( GET_MANDATORY_STRING_PARAMETER( KParamObject, aSection, entryObjectName ) )
		{
		INFO_PRINTF2( _L( "Assign a %S to this TEntry" ), &entryObjectName );
		
		TEntry* entryObject = NULL;
		TRAPD( err, entryObject = (TEntry*)GetDataObjectL(entryObjectName));
		if ( err == KErrNone && entryObject)
			{
			*iEntry = iEntry->operator=(*entryObject);
			}
		else
			{
			ERR_PRINTF3( _L( "Object not found or not initialised: %S. Error %d"), &entryObjectName, err );
			SetBlockResult( EFail );
			}
		}

	if ( !FileserverUtil::VerifyTEntryDataFromIniL(*this, aSection, *iEntry))
		{
		SetBlockResult(EFail);
		}
	}
/**
 *
 * InitializeDevSound
 * @param aDataType
 * @param aMode
 * @result TVerdict
 *
 */	
TVerdict CTestStepSDevSound::InitializeDevSound(TFourCC& aDataType, TMMFState aMode)
	{
	iCallbackError = KErrNone;
	iExpectedValue = KErrNone;
	
	iAL->InitialiseActiveListener();
	
	INFO_PRINTF1(_L("Initializing DevSound"));
	// Initialize
	TRAPD(err, iMMFDevSound->InitializeL(*this, aDataType, aMode));
	if (err)
		{
		WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err);
		return EInconclusive;
		}
	else
		{
		CActiveScheduler::Start();
		if (iCallbackError != iExpectedValue)
			{
			ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue);
			return EFail;
			}
		if (iCallbackArray[EInitComplete] != 1)
			{
			ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]);
			return EFail;
			}
		}
	return EPass;
	}
void CT_DataRSocketServ::DoCmdGetProtocolInfo(const TDesC& aSection)
	{	
	TInt	start = 1;
	TInt	end = iNumOfProtocols;
	
	TInt	index;
	if( GetIntFromConfig(aSection, KIndex(), index) )
		{
		start = index;
		end = index;
		}

	for( TInt i=start; i<=end; ++i )
		{
		INFO_PRINTF2(_L("Calling RSocketServ::GetProtocolInfo(%d)"), i);   
		TInt	err = iSocketServ->GetProtocolInfo(i, iProtocolDesc);
		if( err!=KErrNone )
			{
			ERR_PRINTF3(_L("RSocketServ::GetProtocolInfo(%d) failed with error %d"), i, err);
			SetError(err); 
			}
		else
			{
			PrintProtocol(_L("RSocketServ::GetProtocolInfo()"), iProtocolDesc);
			}
		}
	}
TVerdict COomTestStep::ImplOomServerTestL()
	{
	RScsClientBase *client = ClientHandle();
	if(!client)
		{
		ERR_PRINTF1(_L("ClientHandle has returned NULL. The server cannot be tested without the client handle!"));
		User::Leave(KErrArgument);
		}
	TInt err(0);
	for (TInt testCount=0; ; ++testCount)
 		{
 		INFO_PRINTF2(_L("OOM Server Test %d"), testCount);
 		err = client->SetServerHeapFail(testCount+1);
 		if(KErrNone != err)
 			{
 			ERR_PRINTF3(_L("OOM Server Test Result: Failed to set heap fail on iteration %d. Error:%d"), testCount, err);
 			SetTestStepResult(EFail);
 			break;
 			}
 		TRAPD(retStepVal, ImplTestStepL());
 		err = client->ResetServerHeapFail();
 		
 		if(KErrNone != err)
 			{
 			ERR_PRINTF3(_L("ResetServerHeapFail failed on iteration %d with error %d"), testCount, err);
 			SetTestStepResult(EFail);
 			break;
 			}
 					
 		if(KErrNoMemory == retStepVal)
 			{
 			INFO_PRINTF2(_L("Received correct out of memory error on iteration %d"), testCount);
 			}
 		else if (KErrNone == retStepVal)
 			{
 			INFO_PRINTF1(_L("Server OOM Test Finished"));
 			break;
 			}
 		else 
 			{
 			// Propagate all errors apart from KErrNoMemory
 			User::Leave(retStepVal);
 			}
 		}// for
	
	return TestStepResult();
	}
/**
Test GetFlowCtrl()
*/
void CT_RfcommRemotePortParamsData::DoCmdGetFlowCtrl(const TDesC& aSection)
	{
	TBool expected = EFalse;
	TBool param = EFalse;
	TInt	flowCtrlValue = 0;
	TUint8	exp = 0;
    TUint8	flowCtrl = 0;

	INFO_PRINTF1(_L("TRfcommRemotePortParams GetFlowCtrl Call"));
	TBool result = iData->GetFlowCtrl(flowCtrl);
	INFO_PRINTF3(_L("Return result (%d) and flow control on return (%d)"), result, flowCtrl);

	if(GetBoolFromConfig(aSection, KExpected(), expected) )
		{
		param = ETrue;
		if ( result != expected )
			{
			ERR_PRINTF3(_L("Result (%d) is not as expected (%d)"), result, expected);
			SetBlockResult(EFail);
			}
		else 
			{
			if ( result )
				{
				INFO_PRINTF1(_L("Verify that aFlowCtrl has been set with the expected value"));
				if(GetIntFromConfig(aSection, KFlowCtrl(), flowCtrlValue) )
					{
					param = ETrue;
					exp = flowCtrlValue;
				
					if ( flowCtrl != exp )
						{
						ERR_PRINTF3(_L("aFlowCtrl (%d) is not as expected (%d)"), flowCtrl, exp);
						SetBlockResult(EFail);
						}
						
					}
				}
			}
		}
	if ( !param )
		{
		ERR_PRINTF3(KLogMissingParameters, &KExpected(), &KFlowCtrl());
        SetBlockResult(EFail);
		}
	}
/**
DoCompareL()
Comparison of 2 email messages identified by TMsvEntry

@param  aRecvEntry
The recieved email identifier.

@param  aMailInfo
Expected state of the recieved email.

@param  aSentEntry
Identifier of the original sent email foir comparison purposes.

@return
ETrue if emails match EFalse otherwise
*/
TBool CT_MsgComparePopEmailMsgs::DoCompareL(TMsvEntry& aRecvEntry, CExpPop3MailInfo& aMailInfo, TMsvEntry& aSentEntry)
	{
	TBool ret = ETrue;
	TBool footerExists = EFalse;
	TInt footersize = 0;
		
			
	TInt nLines = GetMessageLinesL(aRecvEntry, KUidMsvEmailTextEntry, footerExists, footersize);
	if(nLines != aMailInfo.GetNumLinesBodyText())
		{
		ERR_PRINTF3(_L("Lines of body text wrong actual = %d expected = %d!"), nLines, aMailInfo.GetNumLinesBodyText());
		ret = EFalse;
		}
	nLines = GetMessageLinesL(aRecvEntry, KUidMsvEmailHtmlEntry, footerExists, footersize);

	if(nLines != aMailInfo.GetNumLinesHtml())
		{		
		ERR_PRINTF3(_L("HTML size wrong actual = %d expected = %d!"), nLines, aMailInfo.GetNumLinesHtml());
		ret = EFalse;
		}

	else if(! CheckAttachmentsL(aRecvEntry, aMailInfo, aSentEntry))
		{
		ERR_PRINTF1(_L("Attachment comparison failed !"));
		ret = EFalse;
		}

	else if(! footerExists && aMailInfo.GetFooterExpected())
		{
		ERR_PRINTF1(_L("An expected footer was missing !"));
		ret = EFalse;
		}
	else if(footerExists && ! aMailInfo.GetFooterExpected())
		{
		ERR_PRINTF1(_L("An unexpected footer was found !"));
		ret = EFalse;
		}
	else if(aMailInfo.GetFooterExpected() && aMailInfo.GetFooterSize()!=0 
			&& aMailInfo.GetFooterSize() != footersize)
		{
		ERR_PRINTF3(_L("KB left on server size wrong = %d expected = %d!"), footersize, aMailInfo.GetFooterSize());
		ret = EFalse;			
		}
	return ret;
	}
/**
Test GetXOnChar()
*/
void CT_RfcommRemotePortParamsData::DoCmdGetXOnChar(const TDesC& aSection)
	{
	TBool expected = EFalse;
	TBool param = EFalse;
    TInt xOnCharValue = 0;
	TUint8 exp = 0;
	TUint8	xOnChar = 0;
    
    INFO_PRINTF1(_L("TRfcommRemotePortParams GetXOnChar Call"));
	TBool result = iData->GetXOnChar(xOnChar);
    INFO_PRINTF3(_L("Return result (%d) and XON char on return (%d)"), result, xOnChar);
    
	if(GetBoolFromConfig(aSection, KExpected(), expected) )
		{
		param = ETrue;
		if ( result != expected )
			{
			ERR_PRINTF3(_L("Result (%d) is not as expected (%d)"), result, expected);
			SetBlockResult(EFail);
			}
		else 
			{
			if ( result )
				{
				INFO_PRINTF1(_L("Verify that aXON has been set with the expected value"));
				if(GetIntFromConfig(aSection, KXonChar(), xOnCharValue) )
					{
					param = ETrue;
					exp = xOnCharValue;
				
					if ( xOnChar != exp )
						{
						ERR_PRINTF3(_L("aXON (%d) is not as expected (%d)"), xOnChar, exp);
						SetBlockResult(EFail);
						}
					}
				}
			}
		}
	if ( !param )
		{
		ERR_PRINTF3(KLogMissingParameters, &KExpected(), &KXonChar());
        SetBlockResult(EFail);
		}	
	}
void CT_RMobileCallData::DoCmdOpenNewCall(const TTEFFunction& aSection)
	{
	INFO_PRINTF1(_L("*START*CT_RMobileCallData::DoCmdOpenNewCall"));
	TBool dataOk = ETrue;
	TInt callNameParameter;
	if ( !GetIntFromConfig(aSection, KCallName, callNameParameter ))
		{
		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCallName);
		SetBlockResult(EFail);
		dataOk = EFalse;
		}
	TPtrC mobileLineName;
	if ( !GetStringFromConfig (aSection, KMobileLineKey (), mobileLineName))
		{
		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMobileLineKey );
		SetBlockResult(EFail);
		dataOk = EFalse;
		}
	if ( dataOk )
		{
		CT_RMobileLineData* mobileLineWrapper = static_cast<CT_RMobileLineData*>(GetDataWrapperL(mobileLineName));
		TName* callName;
		TRAPD( error, callName = mobileLineWrapper->GetCallNameL (callNameParameter) );
		if(error != KErrNone)
			{
			ERR_PRINTF2(_L("Left while getting call name with error %d"), error);
			SetError(error);
			}
		else
			{
			INFO_PRINTF1(_L("Open handle to RMobileCall which can be used to receive incoming or dial outgoing call."));
			RMobileLine* mobileLineObject = static_cast<RMobileLine*>(GetDataObjectL(mobileLineName));
			INFO_PRINTF1(_L("Getting mobile call"));
			TRAP(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_PRINTF1(_L("Opening new call"));
				error = iMobileCall->OpenNewCall(*mobileLineObject, *callName);
				if ( error != KErrNone)
					{
					ERR_PRINTF3(_L("OpenNewCall named: %S, failed with error [%d]"), &callName, error);
					SetError (error);
					}
				else
					{
					INFO_PRINTF1(_L("Open new call succeeded"));
					}
				}
			}
		}
	INFO_PRINTF1(_L("*END*CT_RMobileCallData::DoCmdOpenNewCall"));
	}
/**
 *
 * DoTestStepL
 * @result TVerdict
 *
 */
TVerdict CTestStepSDevSoundPlayDualTone::DoTestStepL()
	{
	TInt freq1 = 100;
	TInt freq2 = 200;
	TTimeIntervalMicroSeconds dur(2000000);

	INFO_PRINTF1(_L("Testing Dual Tone Playback"));
	
	//Initialize
	TVerdict initializeOK = InitializeDevSound(EMMFStateTonePlaying);
	if (initializeOK != EPass)
		{
		return EInconclusive;
		}
	
	iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume());
	iExpectedValue = KErrUnderflow;
		
	iCallbackError = KErrNone;
	iCallbackArray.Reset();
	
	// Set request active
	iAL->InitialiseActiveListener();
	INFO_PRINTF1(_L("Playing Dual Tone"));
	TRAPD(err, iMMFDevSound->PlayDualToneL(freq1, freq2, dur));
	// Start the active scheduler and catch the callback
 	CActiveScheduler::Start();
	if (err)
		{
		WARN_PRINTF2 (_L("DevSound PlayDualToneL left with error = %d"), err);
		return EInconclusive;
		}
	else
		{
		if (iCallbackError != iExpectedValue)
			{
			ERR_PRINTF3 (_L("DevSound ToneFinished returned %d, expected %d"), iCallbackError, iExpectedValue);
			return EFail;
			}
		if (iCallbackArray[EToneFinished] != 1)
			{
			ERR_PRINTF2 (_L("DevSound ToneFinished was called %d times, expected 1"), iCallbackArray[EToneFinished]);
			return EFail;
			}
		TInt total = 0;
		for (TInt i = EInitComplete; i < EDeviceMsg; i++)
			{
			total += iCallbackArray[i];
			}
		if (total > 1)
			{
			ERR_PRINTF2 (_L("DevSound called %d callbacks, expected 1"), total);
			return EFail;
			}
		}
	return EPass;
	}
TBool CUpsClientStep::CheckResultsL(TInt aIndex)
	{
	TBool theReturn = ETrue; 
	
	if(iArraySersToRequest[aIndex].iExpectedError == KErrNone)   
		{
		TUpsDecision expectedDecision = StringToTUpsDecision(iArraySersToRequest[aIndex].iAccessGranted);
		if(expectedDecision != iReturnData.iDecision)
	 		{
	 		TPtrC decisionReceived(TUpsDecisionToString(iReturnData.iDecision));
	 		ERR_PRINTF4(_L("%S: Decision expected: %S ,Decision received: %S"),&iTEFServerName, &iArraySersToRequest[aIndex].iAccessGranted, &decisionReceived);  
	 		theReturn=EFalse;	
	 		}		
		}

 	if(iArraySersToRequest[aIndex].iExpectedError != iReturnData.iError) 
 		{
 		// Incorrect error code returned.
 		theReturn=EFalse;
 		ERR_PRINTF3(_L("%S: Error code expected: %d"),&iTEFServerName,iArraySersToRequest[aIndex].iExpectedError);
 		ERR_PRINTF3(_L("%S: Error code Received: %d"),&iTEFServerName,iReturnData.iError);
 		}
 	
 	// checks returned properties from dialog creator & policy evaluator.
 	if ( CheckDialogCreatorResultsL(aIndex) == EFalse || CheckPolicyEvaluatorResultsL(aIndex) == EFalse)
 		{
 			theReturn = EFalse;
 		}

 	// display the request duration and check against the ini file value, if supplied
	INFO_PRINTF3(_L("%S: UPS decision request duration: %u milliseconds"),&iTEFServerName, iReturnData.iRequestDuration);
	if (iArraySersToRequest[aIndex].iRequestDurationThreshold > 0)
		{
		// check whether the request duration was too long
		if (static_cast<TInt>(iReturnData.iRequestDuration) > iArraySersToRequest[aIndex].iRequestDurationThreshold)
			{
	 		ERR_PRINTF3(_L("%S: UPS decision request took too long: %u"), &iTEFServerName, iArraySersToRequest[aIndex].iRequestDurationThreshold);
	 		theReturn = EFalse;
			}
		}

	return theReturn;
	}  // End of function.
/**
Test SEID()
*/
void CT_AvdtpSEPInfoData::DoCmdSEIDL(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TAvdtpSEPInfo SEID() Call."));
	INFO_PRINTF1(_L("Execute SEID()"));
	TSEID actual = iData->SEID();	
	_LIT(KLogSeid,"actual seid: %d");
	INFO_PRINTF2(KLogSeid, actual.SEID());
	_LIT(KLogIslocalTrue, "IsLocal: true");
	_LIT(KLogIslocalFalse, "IsLocal: false");
	if(actual.IsLocal())
		{
		INFO_PRINTF1(KLogIslocalTrue);
		}
	else
		{
		INFO_PRINTF1(KLogIslocalFalse);
		}
	
	TSEID*	expected=NULL;
	TSEID*	setbackSeid=NULL;
	TPtrC	seidName;
	if ( !GetStringFromConfig(aSection, KFldExpected, seidName) )
		{
		if ( !GetStringFromConfig(aSection, KFldSeid, seidName) )
			{
			ERR_PRINTF3(KLogMissingParameter2, &KFldExpected, &KFldSeid);
			SetBlockResult(EFail);
			}
		else
			{
			_LIT(KLogSetSEIDBack,"Set SEID back. Not compare with expected.");
			INFO_PRINTF1(KLogSetSEIDBack);
			setbackSeid = static_cast<TSEID*>(GetDataObjectL(seidName));
			*setbackSeid = actual;
			}	
		}
	else
		{
		expected = static_cast<TSEID*>(GetDataObjectL(seidName));
		
		if(expected != NULL)
			{
			if(actual != (*expected))
				{
				ERR_PRINTF1(KLogNotExpectedValue);
				SetBlockResult(EFail);
				}
			}
		else
			{
			ERR_PRINTF1(_L("TSEID pointer is NULL"));
			SetBlockResult(EFail);			
			}
		}	
	}