os/security/cryptomgmtlibs/securitytestfw/test/captestframework/captestutility.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptomgmtlibs/securitytestfw/test/captestframework/captestutility.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,95 @@
     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 +* Implements default base classes for captestframework
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +
    1.24 +
    1.25 +/**
    1.26 + @file
    1.27 +*/
    1.28 +
    1.29 +#ifndef CAPTESTUTILITY_H__
    1.30 +#define CAPTESTUTILITY_H__
    1.31 +
    1.32 +#include <e32base.h>
    1.33 +#include <s32file.h> 
    1.34 +#include "captestframework.h"
    1.35 +
    1.36 +// CDefaultCapabilityTest
    1.37 +class CDefaultCapabilityTest : public CBase, public MCapabilityTest
    1.38 +	{
    1.39 +public:
    1.40 +	IMPORT_C const TDesC& Name() const;
    1.41 +	IMPORT_C const TDesC& SubName() const;
    1.42 +	
    1.43 +	IMPORT_C TCapabilitySet CapabilitiesRequired() const;
    1.44 +	IMPORT_C TUid VidRequired() const;
    1.45 +	IMPORT_C TUid SidRequired() const;
    1.46 +
    1.47 +	IMPORT_C ~CDefaultCapabilityTest();
    1.48 +	
    1.49 +protected:
    1.50 +	IMPORT_C void SetNameL(const TDesC& aName);	
    1.51 +	void SetExpectPermissionDenied(TBool aExpectPermissionDenied = ETrue);	
    1.52 +
    1.53 +	IMPORT_C void SetCapabilityRequired(const TCapability& aCapability);
    1.54 +	IMPORT_C void SetSidRequired(const TUid& aSid);
    1.55 +	IMPORT_C void SetVidRequired(const TUid& aVid);
    1.56 +	
    1.57 +	IMPORT_C TInt CheckFailL(TInt aResult, const TDesC& aTestName);
    1.58 +	IMPORT_C void RunTestL(RFile& aLogFile);
    1.59 +
    1.60 +	void SetFail() { iFail = ETrue;}
    1.61 +	virtual void RunTestL() =0;
    1.62 +private:
    1.63 +	HBufC* iTestName;
    1.64 +	HBufC* iTestSubName;
    1.65 +	
    1.66 +	RFile* iLogFile;
    1.67 +	RFileWriteStream* iLogWriteStream;
    1.68 +	TBool iExpectPermissionDenied;
    1.69 +	TCapabilitySet iCapabilitySet;
    1.70 +	TUid iVidRequired;
    1.71 +	TUid iSidRequired;	
    1.72 +	TBool iFail;
    1.73 +	};
    1.74 +
    1.75 +// CDefaultCapabilityTestFactory
    1.76 +class CDefaultCapabilityTestFactory : public CBase, public MCapabilityTestFactory
    1.77 +
    1.78 +	{
    1.79 +public:
    1.80 +	IMPORT_C virtual TInt NumberOfTests();
    1.81 +	IMPORT_C virtual MCapabilityTest* Test(TInt aTestNumber);
    1.82 +	
    1.83 +	IMPORT_C void AddTestL(CDefaultCapabilityTest* aTest);
    1.84 +
    1.85 +	IMPORT_C ~CDefaultCapabilityTestFactory();
    1.86 +	
    1.87 +private:
    1.88 +	RPointerArray<CDefaultCapabilityTest> iTests;
    1.89 +	};
    1.90 +
    1.91 +// inline functions from CSwiCapabilityTest
    1.92 +
    1.93 +inline void CDefaultCapabilityTest::SetExpectPermissionDenied(TBool aExpectPermissionDenied)
    1.94 +	{
    1.95 +	iExpectPermissionDenied = aExpectPermissionDenied;
    1.96 +	}
    1.97 +
    1.98 +#endif //#ifndef CAPTESTUTILITY_H__