os/security/cryptoservices/certificateandkeymgmt/tcertstore/T_unifiedcertstorecertstorecount.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 /**
    20  @file
    21 */
    22 
    23 #include "t_unifiedcertstorecertstorecount.h"
    24 #include "t_input.h"
    25 #include "t_certstoredefs.h"
    26 #include "t_certstoreout.h"
    27 
    28 CTestAction* CUnifiedCertStoreCertStoreCount::NewL(RFs& aFs,
    29 												   CConsoleBase& aConsole,
    30 												   Output& aOut, 
    31 												   const TTestActionSpec& aTestActionSpec)
    32 	{
    33 	CUnifiedCertStoreCertStoreCount* self =
    34 		new(ELeave) CUnifiedCertStoreCertStoreCount(aFs, aConsole, aOut);
    35 	CleanupStack::PushL(self);
    36 	self->ConstructL(aTestActionSpec);
    37 	CleanupStack::Pop(self);
    38 	return self;
    39 	}
    40 
    41 CUnifiedCertStoreCertStoreCount::~CUnifiedCertStoreCertStoreCount()
    42 	{
    43 	}
    44 
    45 CUnifiedCertStoreCertStoreCount::CUnifiedCertStoreCertStoreCount(RFs& aFs, CConsoleBase& aConsole,	
    46 																 Output& aOut)
    47 : CUnifiedCertStoreCount(aFs, aConsole, aOut)
    48 	{
    49 	}
    50 
    51 void CUnifiedCertStoreCertStoreCount::ConstructL(const TTestActionSpec& aTestActionSpec)
    52 	{
    53 	TInt err = KErrNone;
    54 	TInt pos = 0;
    55 	CUnifiedCertStoreCount::ConstructL(aTestActionSpec);
    56 	iStoreIndex = Input::ParseElement(aTestActionSpec.iActionBody, KStoreIndexStart, KStoreIndexEnd, pos, err);
    57 	iExpectCount = Input::ParseElement(aTestActionSpec.iActionResult, KNumberOfStoresStart, KNumberOfStoresEnd, pos, err);
    58 	}
    59 
    60 void CUnifiedCertStoreCertStoreCount::DoPerformAction()
    61 	{
    62 	TLex8 lexi(iStoreIndex);
    63 	TUid iIndex;
    64 	TInt index = lexi.Val(iIndex.iUid);
    65 	if (index != KErrNone)
    66 		{
    67 		User::Panic(_L("CUnifiedCertStoreCertStoreCount"), 1);
    68 		}
    69 	iCount = UnifiedCertStore(iIndex.iUid).CertStoreCount();
    70 
    71 	TLex8 lex(iExpectCount);
    72 	TUid uid;
    73 	TInt iu = lex.Val(uid.iUid);
    74 	if (iu != KErrNone)
    75 		{
    76 		User::Panic(_L("CUnifiedCertStoreCertStoreCount"), 1);
    77 		}
    78 	if (iCount == uid.iUid)
    79 		{
    80 		iResult = ETrue;
    81 		}
    82 	else
    83 		{
    84 		iResult = EFalse;
    85 		}
    86 	}
    87 
    88 void CUnifiedCertStoreCertStoreCount::DoWriteResult()
    89 	{
    90 	iConsole.Printf(_L("\tNumber of stores (read-only + writable) :"));
    91 	iOut.writeString(_L("\tNumber of stores (read-only + writable) : "));
    92 	}