cryptoservices/filebasedcertificateandkeystores/test/tkeystore/t_list.cpp
changeset 15 da2ae96f639b
parent 8 35751d3474b7
--- a/cryptoservices/filebasedcertificateandkeystores/test/tkeystore/t_list.cpp	Fri Oct 02 13:15:59 2009 +0300
+++ b/cryptoservices/filebasedcertificateandkeystores/test/tkeystore/t_list.cpp	Mon Oct 12 10:17:04 2009 +0300
@@ -50,6 +50,7 @@
 	{
 	iKeys.Close();
 	iKeysToFind.Close();
+	delete iListStatus;
 	}
 
 CListKeys::CListKeys(RFs& aFs, CConsoleBase& aConsole, Output& aOut)
@@ -77,7 +78,7 @@
 	buf.Set(Input::ParseElement(aTestActionSpec.iActionBody, KListCountStart, KListCountEnd, pos, err));
 	if (err == KErrNone)
 		SetListCount(buf);
-
+	
 	do
 		{
 		buf.Set(Input::ParseElement(aTestActionSpec.iActionBody, 
@@ -86,6 +87,13 @@
 			AddFoundKeyL(buf);
 		} 
 	while (err == KErrNone);
+	
+	// set default outcome as success for listing keys
+	SetListStatus(KErrListingSuccess);
+	buf.Set(Input::ParseElement(aTestActionSpec.iActionBody, KListingStatusStart, KListingStatusEnd, pos, err ));
+		if (err == KErrNone)
+			SetListStatus(buf);
+
 }
 
 
@@ -103,6 +111,16 @@
 	lexer.Val(iResultCount);
 	}
 
+void CListKeys::SetListStatus(const TDesC8& aListStatus)
+	{
+	if(iListStatus != NULL)
+		{
+		delete iListStatus;
+		iListStatus = NULL;
+		}
+	iListStatus = aListStatus.AllocL();
+	}
+
 void CListKeys::AddFoundKeyL(const TDesC8& aFoundKey)
 	{
 	HBufC* buf = HBufC::NewLC(aFoundKey.Length());
@@ -128,16 +146,22 @@
 			{
 			TRequestStatus* status = &aStatus;
 			User::RequestComplete(status, aStatus.Int());
-			if (aStatus == iExpectedResult && (iResultCount < 0 ||
-											   iResultCount == iKeys.Count()))
+			if( iListStatus->Compare(KErrListingFailure) == 0 )
 				{
 				iResult = ETrue;
 				}
 			else
 				{
-				iResult = EFalse;
+				if (aStatus == iExpectedResult && (iResultCount < 0 ||
+												   iResultCount == iKeys.Count()))
+					{
+					iResult = ETrue;
+					}
+				else
+					{
+					iResult = EFalse;
+					}
 				}
-			
 			iActionState = EPostrequisite;				
 			}
 		}
@@ -205,7 +229,7 @@
 				iOut.writeNewLine();
 
 				TRAPD(err,PrintKeyInfoL(*iKeys[i])); 
-				_LIT(KFailed, "!!!Key listing failure!!!\n");
+				_LIT(KFailed, "!!!Key listing success!!!\n");
 				iConsole.Write(KFailed);
 				iOut.writeString(KFailed);
 				iOut.writeNum(err);