os/security/cryptoservices/certificateandkeymgmt/tcertstore/T_unifiedcertstorereadonlycertstorecount.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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_unifiedcertstorereadonlycertstorecount.h"
    24 #include "t_input.h"
    25 #include "t_certstoredefs.h"
    26 #include "t_certstoreout.h"
    27 
    28 CTestAction* CUnifiedCertStoreReadOnlyCertStoreCount::NewL(RFs& aFs,
    29 														   CConsoleBase& aConsole,	
    30 														   Output& aOut, 
    31 														   const TTestActionSpec& aTestActionSpec)
    32 	{
    33 	CUnifiedCertStoreReadOnlyCertStoreCount* self =
    34 		new(ELeave) CUnifiedCertStoreReadOnlyCertStoreCount(aFs, aConsole, aOut);
    35 	CleanupStack::PushL(self);
    36 	self->ConstructL(aTestActionSpec);
    37 	CleanupStack::Pop(self);
    38 	return self;
    39 	}
    40 
    41 CUnifiedCertStoreReadOnlyCertStoreCount::~CUnifiedCertStoreReadOnlyCertStoreCount()
    42 	{
    43 	}
    44 
    45 CUnifiedCertStoreReadOnlyCertStoreCount::CUnifiedCertStoreReadOnlyCertStoreCount(RFs& aFs, CConsoleBase& aConsole,	
    46 																				 Output& aOut)
    47 : CUnifiedCertStoreCount(aFs, aConsole, aOut)
    48 	{
    49 	}
    50 
    51 void CUnifiedCertStoreReadOnlyCertStoreCount::ConstructL(const TTestActionSpec& aTestActionSpec)
    52 	{
    53 	CUnifiedCertStoreCount::ConstructL(aTestActionSpec);
    54 	
    55 	TInt err = KErrNone;
    56 	TInt pos = 0;
    57 
    58 	iStoreIndex = Input::ParseElement(aTestActionSpec.iActionBody, KStoreIndexStart, KStoreIndexEnd, pos, err);
    59 	iExpectCount = Input::ParseElement(aTestActionSpec.iActionResult, KNumberOfStoresStart, KNumberOfStoresEnd, pos, err);
    60 	}
    61 
    62 void CUnifiedCertStoreReadOnlyCertStoreCount::DoPerformAction()
    63 	{
    64 	TLex8 lexi(iStoreIndex);
    65 	TUid iIndex;
    66 	TInt index = lexi.Val(iIndex.iUid);
    67 	if (index != KErrNone)
    68 		{
    69 		User::Panic(_L("CUnifiedCertStoreCertStoreCount"), 1);
    70 		}
    71 	iCount = UnifiedCertStore(iIndex.iUid).ReadOnlyCertStoreCount();
    72 
    73 	TLex8 lex(iExpectCount);
    74 	TUid uid;
    75 	TInt iu = lex.Val(uid.iUid);
    76 	if (iu != KErrNone)
    77 		{
    78 		User::Panic(_L("CUnifiedCertStoreCertStoreCount"), 1);
    79 		}
    80 	if (iCount == uid.iUid)
    81 		{
    82 		iResult = ETrue;
    83 		}
    84 	else
    85 		{
    86 		iResult = EFalse;
    87 		}
    88 	}
    89 
    90 void CUnifiedCertStoreReadOnlyCertStoreCount::DoWriteResult()
    91 	{
    92 	iConsole.Printf(_L("\tNumber of read-only stores:"));
    93 	iOut.writeString(_L("\tNumber of read-only stores: "));
    94 	}