os/security/cryptoservices/certificateandkeymgmt/tcertstore/T_unifiedcertstoreactiongetcert.cpp
Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
23 #include "t_unifiedcertstoreactiongetcert.h"
25 #include "t_certstoredefs.h"
26 #include "t_certstoreout.h"
28 CTestAction* CUnifiedCertStoreGetCert::NewL(RFs& aFs, CConsoleBase& aConsole,
30 const TTestActionSpec& aTestActionSpec)
33 CUnifiedCertStoreGetCert* self = new(ELeave) CUnifiedCertStoreGetCert(aFs, aConsole, aOut);
34 CleanupStack::PushL(self);
35 self->ConstructL(aTestActionSpec);
36 CleanupStack::Pop(self);
41 CUnifiedCertStoreGetCert::~CUnifiedCertStoreGetCert()
47 CUnifiedCertStoreGetCert::CUnifiedCertStoreGetCert(RFs& aFs, CConsoleBase& aConsole,
49 : CCertStoreTestAction(aFs, aConsole, aOut),
54 void CUnifiedCertStoreGetCert::ConstructL(const TTestActionSpec& aTestActionSpec)
56 CCertStoreTestAction::ConstructL(aTestActionSpec);
59 TLex8 lex(Input::ParseElement(aTestActionSpec.iActionBody, KTokenTypeStart, KTokenTypeEnd, pos, err));
65 lex.Val(uid.iUid); // check for error
68 lex = TLex8(Input::ParseElement(aTestActionSpec.iActionBody, KTokenStart, KTokenEnd, pos, err));
72 lex = TLex8(Input::ParseElement(aTestActionSpec.iActionBody, KObjectStart, KObjectEnd, pos, err));
75 iHandle = TCTTokenObjectHandle(TCTTokenHandle(uid, token), object);
79 HBufC* result = HBufC::NewLC(aTestActionSpec.iActionResult.Length());
80 TPtr(result->Des()).Copy(aTestActionSpec.iActionResult);
81 Input::GetExpectedResultL(Input::ParseElement(*result, KReturnStart, KReturnEnd), iExpectedResult);
82 CleanupStack::PopAndDestroy(result);
85 void CUnifiedCertStoreGetCert::PerformAction(TRequestStatus& aStatus)
90 CertStore().GetCert(iCertInfo, iHandle, aStatus);
96 if (aStatus == iExpectedResult)
105 TRequestStatus* status = &aStatus;
106 User::RequestComplete(status, KErrNone);
110 // The initial state is set to EGetCert and the default case would
115 TRequestStatus* status = &aStatus;
116 User::RequestComplete(status, KErrNotSupported);
121 void CUnifiedCertStoreGetCert::PerformCancel()
125 void CUnifiedCertStoreGetCert::Reset()
127 __ASSERT_DEBUG(EFalse, User::Panic(_L("CUnifiedCertStoreGetCert::Reset()"), 1));
130 void CUnifiedCertStoreGetCert::DoReportAction()
132 //iOut.writeString(_L("Setting trust settings..."));
133 iOut.writeHex(iHandle.iTokenHandle.iTokenTypeUid.iUid);
134 //iOut.writeNewLine();
135 //iOut.writeString(_L("\tLabel = "));
136 // iOut.writeString(iLabel);
137 // iOut.writeNewLine();
138 //iOut.writeString(_L("\tTrusters = "));
139 //TInt count = iTrusters->Count();
140 //for (TInt i = 0; i < count; i++)
142 // iOut.writeNum((*iTrusters)[i].iUid);
143 // iOut.writeString(_L(" "));
145 //iOut.writeNewLine();
146 //iOut.writeNewLine();
149 void CUnifiedCertStoreGetCert::DoCheckResult(TInt /*aError*/)