sl@0: /* sl@0: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Implements default base classes for captestframework sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: #ifndef CAPTESTUTILITY_H__ sl@0: #define CAPTESTUTILITY_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include "captestframework.h" sl@0: sl@0: // CDefaultCapabilityTest sl@0: class CDefaultCapabilityTest : public CBase, public MCapabilityTest sl@0: { sl@0: public: sl@0: IMPORT_C const TDesC& Name() const; sl@0: IMPORT_C const TDesC& SubName() const; sl@0: sl@0: IMPORT_C TCapabilitySet CapabilitiesRequired() const; sl@0: IMPORT_C TUid VidRequired() const; sl@0: IMPORT_C TUid SidRequired() const; sl@0: sl@0: IMPORT_C ~CDefaultCapabilityTest(); sl@0: sl@0: protected: sl@0: IMPORT_C void SetNameL(const TDesC& aName); sl@0: void SetExpectPermissionDenied(TBool aExpectPermissionDenied = ETrue); sl@0: sl@0: IMPORT_C void SetCapabilityRequired(const TCapability& aCapability); sl@0: IMPORT_C void SetSidRequired(const TUid& aSid); sl@0: IMPORT_C void SetVidRequired(const TUid& aVid); sl@0: sl@0: IMPORT_C TInt CheckFailL(TInt aResult, const TDesC& aTestName); sl@0: IMPORT_C void RunTestL(RFile& aLogFile); sl@0: sl@0: void SetFail() { iFail = ETrue;} sl@0: virtual void RunTestL() =0; sl@0: private: sl@0: HBufC* iTestName; sl@0: HBufC* iTestSubName; sl@0: sl@0: RFile* iLogFile; sl@0: RFileWriteStream* iLogWriteStream; sl@0: TBool iExpectPermissionDenied; sl@0: TCapabilitySet iCapabilitySet; sl@0: TUid iVidRequired; sl@0: TUid iSidRequired; sl@0: TBool iFail; sl@0: }; sl@0: sl@0: // CDefaultCapabilityTestFactory sl@0: class CDefaultCapabilityTestFactory : public CBase, public MCapabilityTestFactory sl@0: sl@0: { sl@0: public: sl@0: IMPORT_C virtual TInt NumberOfTests(); sl@0: IMPORT_C virtual MCapabilityTest* Test(TInt aTestNumber); sl@0: sl@0: IMPORT_C void AddTestL(CDefaultCapabilityTest* aTest); sl@0: sl@0: IMPORT_C ~CDefaultCapabilityTestFactory(); sl@0: sl@0: private: sl@0: RPointerArray iTests; sl@0: }; sl@0: sl@0: // inline functions from CSwiCapabilityTest sl@0: sl@0: inline void CDefaultCapabilityTest::SetExpectPermissionDenied(TBool aExpectPermissionDenied) sl@0: { sl@0: iExpectPermissionDenied = aExpectPermissionDenied; sl@0: } sl@0: sl@0: #endif //#ifndef CAPTESTUTILITY_H__