diff -r 000000000000 -r bde4ae8d615e os/security/cryptomgmtlibs/securitytestfw/test/testutil/server/testutilsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/security/cryptomgmtlibs/securitytestfw/test/testutil/server/testutilsession.h Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* testutil - server classes +* +*/ + + +/** + @file + @test + @internalComponent +*/ + +#include +#include "testutilfilewatcher.h" + +class CTestUtilServer; + +class MTimeoutClient + { +public: + /** Client's implementation gets called on timer expiry */ + virtual void HandleTimeout() = 0; + }; + +/** Simple timer class which calls a callback on timer expiry */ +class CGenericTimer : public CTimer + { +public: + static CGenericTimer* NewL(MTimeoutClient& aClient); +private: + CGenericTimer(MTimeoutClient& aClient); + void RunL(); +private: + MTimeoutClient& iClient; + }; + +class CTestFileDetector : public CActive, public MTimeoutClient + { +public: + static CTestFileDetector* NewL(const RMessage2& iMessage, RFs& aFs); + CTestFileDetector(const RMessage2& iMessage, RFs& aFs); + ~CTestFileDetector(); + void DetectFile(); +private: + void ConstructL(); + virtual void HandleTimeout(); + void RunL(); + void DoCancel(); + void CheckAndComplete(); +private: + RFs& iFs; + CGenericTimer* iTimer; + HBufC* iFileName; + TInt iTimeInterval; + const RMessage2& iMessage; + }; + +class CTestUtilSession : public CSession2 + { +public: + CTestUtilSession(); + void CreateL(); +private: + ~CTestUtilSession(); + inline CTestUtilServer& Server(); + void ServiceL(const RMessage2& aMessage); + void ServiceError(const RMessage2& aMessage,TInt aError); +private: + RArray iLockedFileHandles; + CFileWatcher* iFileWatcher; + CTestFileDetector* iDetector; + }; + + +inline CTestUtilServer& CTestUtilSession::Server() + {return *static_cast(const_cast(CSession2::Server()));}