First public contribution.
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.
15 * CExtensionTest class implementation
25 #ifndef __EXTENSIONTEST_H
26 #define __EXTENSIONTEST_H
28 #include <x509certext.h>
30 #include "t_testaction.h"
31 #include "tcertwriter.h"
33 class CExtensionTest : public CTestAction
36 static CTestAction* NewL(RFs& aFs, CConsoleBase& aConsole,
37 Output& aOut, const TTestActionSpec& aTestActionSpec);
38 static CTestAction* NewLC(RFs& aFs, CConsoleBase& aConsole,
39 Output& aOut, const TTestActionSpec& aTestActionSpec);
40 void TestValidation(TRequestStatus& aStatus);
43 void PerformAction(TRequestStatus& aStatus);
44 void DoReportAction();
45 void DoCheckResult(TInt aError);
48 CExtensionTest(RFs& aFs, CConsoleBase& aConsole, Output& aOut);
49 void ConstructL(const TTestActionSpec& aTestActionSpec);
51 // compares arrays of things returning true if they are equal
52 TBool IsEqual(const RArray<TInt>& aArray1, const RArray<TInt>& aArray2);
53 TBool IsEqual(const RPointerArray<HBufC>& aArray1, const RPointerArray<HBufC>& aArray2);
55 // return true if the extension data matches the expected value
56 void CheckExtensionsL(const CX509Certificate& cert, TBool& match, TBool& result);
57 TBool CheckDeviceIdListL(const CX509Certificate& cert);
58 TBool CheckSidListL(const CX509Certificate& cert);
59 TBool CheckVidListL(const CX509Certificate& cert);
60 TBool CheckCapabilitiesL(const CX509Certificate& cert);
62 // populate expected value data structures from scritps
63 void BuildIntList(RArray<TInt>& aInts, const TDesC& aBuf, const TDesC& aTag);
64 void BuildStringListL(RPointerArray<HBufC>& aStrings, const TDesC& aBuf, const TDesC& aTag);
65 void BuildCapabilitySet(TCapabilitySet& aCapabilitySet, const TDesC& aBuf);
67 void PrintLine(const TDesC& aText);
68 void Print(const TDesC& aText);
72 TFileName iCertFileName;
74 // Whether the input data is expeceted to match the certificate extension.
77 // Whether the parsing of extension is expected to fail.
78 TBool iExpectedCorrupt;
80 // Whether the constraints are expected within the certificate
81 TBool iDeviceIdsPresent;
84 TBool iCapabilitiesPresent;
86 // The expected values associated with the extensions
87 RPointerArray<HBufC> iExpectedDeviceIdList;
88 RArray<TInt> iExpectedSidList;
89 RArray<TInt> iExpectedVidList;
90 TCapabilitySet iExpectedCapabilities;