os/security/cryptoservices/certificateandkeymgmt/tcertstore/T_unifiedcertstorewritablecertstorecount.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/tcertstore/T_unifiedcertstorewritablecertstorecount.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,93 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 +*/
    1.25 +
    1.26 +#include "t_unifiedcertstorewritablecertstorecount.h"
    1.27 +#include "t_input.h"
    1.28 +#include "t_certstoredefs.h"
    1.29 +#include "t_certstoreout.h"
    1.30 +
    1.31 +CTestAction* CUnifiedCertStoreWritableCertStoreCount::NewL(RFs& aFs,
    1.32 +														   CConsoleBase& aConsole,	
    1.33 +														   Output& aOut, 
    1.34 +														   const TTestActionSpec& aTestActionSpec)
    1.35 +	{
    1.36 +	CUnifiedCertStoreWritableCertStoreCount* self =
    1.37 +		new(ELeave) CUnifiedCertStoreWritableCertStoreCount(aFs, aConsole, aOut);
    1.38 +	CleanupStack::PushL(self);
    1.39 +	self->ConstructL(aTestActionSpec);
    1.40 +	CleanupStack::Pop(self);
    1.41 +	return self;
    1.42 +	}
    1.43 +
    1.44 +CUnifiedCertStoreWritableCertStoreCount::~CUnifiedCertStoreWritableCertStoreCount()
    1.45 +	{
    1.46 +	}
    1.47 +
    1.48 +CUnifiedCertStoreWritableCertStoreCount::CUnifiedCertStoreWritableCertStoreCount(RFs& aFs, CConsoleBase& aConsole,	
    1.49 +																				 Output& aOut)
    1.50 +: CUnifiedCertStoreCount(aFs, aConsole, aOut)
    1.51 +	{
    1.52 +	}
    1.53 +
    1.54 +void CUnifiedCertStoreWritableCertStoreCount::ConstructL(const TTestActionSpec& aTestActionSpec)
    1.55 +	{
    1.56 +	CUnifiedCertStoreCount::ConstructL(aTestActionSpec);
    1.57 +
    1.58 +	TInt err = KErrNone;
    1.59 +	TInt pos = 0;
    1.60 +	iStoreIndex = Input::ParseElement(aTestActionSpec.iActionBody, KStoreIndexStart, KStoreIndexEnd, pos, err);
    1.61 +	iExpectCount = Input::ParseElement(aTestActionSpec.iActionResult, KNumberOfStoresStart, KNumberOfStoresEnd, pos, err);
    1.62 +	}
    1.63 +
    1.64 +void CUnifiedCertStoreWritableCertStoreCount::DoPerformAction()
    1.65 +	{
    1.66 +	TLex8 lexi(iStoreIndex);
    1.67 +	TUid iIndex;
    1.68 +	TInt index = lexi.Val(iIndex.iUid);
    1.69 +	if (index != KErrNone)
    1.70 +		{
    1.71 +		User::Panic(_L("CUnifiedCertStoreCertStoreCount"), 1);
    1.72 +		}
    1.73 +	iCount = UnifiedCertStore(iIndex.iUid).WritableCertStoreCount();
    1.74 +
    1.75 +	TLex8 lex(iExpectCount);
    1.76 +	TUid uid;
    1.77 +	TInt iu = lex.Val(uid.iUid);
    1.78 +	if (iu != KErrNone)
    1.79 +		{
    1.80 +		User::Panic(_L("CUnifiedCertStoreCertStoreCount"), 1);
    1.81 +		}
    1.82 +	if (iCount == uid.iUid)
    1.83 +		{
    1.84 +		iResult = ETrue;
    1.85 +		}
    1.86 +	else
    1.87 +		{
    1.88 +		iResult = EFalse;
    1.89 +		}
    1.90 +	}
    1.91 +
    1.92 +void CUnifiedCertStoreWritableCertStoreCount::DoWriteResult()
    1.93 +	{
    1.94 +	iConsole.Printf(_L("\tNumber of writable stores:"));
    1.95 +	iOut.writeString(_L("\tNumber of writable stores: "));
    1.96 +	}