1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptomgmtlibs/securitycommonutils/test/inc_private/scstestserver.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,122 @@
1.4 +/*
1.5 +* Copyright (c) 2007-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 +* Test implementation of a session count server tests the base functionality
1.19 +* will work for sessions, subsessions, and asynchronous requests.
1.20 +*
1.21 +*/
1.22 +
1.23 +
1.24 +/**
1.25 + @internalComponent
1.26 + @test
1.27 + @file
1.28 +*/
1.29 +
1.30 +#ifndef SCSTESTSERVER_H
1.31 +#define SCSTESTSERVER_H
1.32 +
1.33 +#include <scs/scsserver.h>
1.34 +#include "scstestcommon.h"
1.35 +
1.36 +// forward declarations
1.37 +class CScsTestSession;
1.38 +class CScsTestSubsession;
1.39 +
1.40 +class CTrebleRequest : public CAsyncRequest
1.41 +/**
1.42 + Trebles a client-side TInt. The request is completed asynchronously,
1.43 + some time after it has been queued.
1.44 + */
1.45 + {
1.46 +public:
1.47 + static CTrebleRequest* NewL(CScsTestSession* aSession, CScsTestSubsession* aSubsession, const RMessage2& aMessage);
1.48 + virtual ~CTrebleRequest();
1.49 +
1.50 + // implement CActive
1.51 + virtual void DoCancel();
1.52 + // implement CActive, override CAsyncRequest
1.53 + virtual void RunL();
1.54 +
1.55 +private:
1.56 + CTrebleRequest(CScsTestSession* aSession, CScsTestSubsession* aSubsession, const RMessage2& aMessage);
1.57 + void ConstructL();
1.58 +
1.59 +private:
1.60 + RTimer iTimer; ///< Provides the delay which makes this request asynchronous.
1.61 + };
1.62 +
1.63 +class CScsTestSession;
1.64 +class CScsTestSubsession : public CScsSubsession
1.65 +/**
1.66 + This subsession class is defined to ensure that requests are
1.67 + routed to, and asynchronous requests associated with, the correct
1.68 + object.
1.69 + */
1.70 + {
1.71 +public:
1.72 + static CScsTestSubsession* NewL(CScsTestSession &aSession, const RMessage2& aMessage);
1.73 + virtual ~CScsTestSubsession();
1.74 +
1.75 + // implement CScsSubsession
1.76 + virtual TBool DoServiceL(TInt aFunction, const RMessage2& aMessage);
1.77 +
1.78 +private:
1.79 + CScsTestSubsession(CScsTestSession &aSession);
1.80 +
1.81 +private:
1.82 + TInt iValue; ///< Value on which this subsession is curried.
1.83 + };
1.84 +
1.85 +class CScsTestServer;
1.86 +class CScsTestSession : public CScsSession
1.87 +/**
1.88 + Tests the underlying session count session implementation by
1.89 + handling requests, asynchronous requests, and creating subsessions.
1.90 + */
1.91 + {
1.92 +public:
1.93 + static CScsTestSession* NewL(CScsTestServer &aServer);
1.94 + virtual ~CScsTestSession();
1.95 +
1.96 + // implement CScsSession
1.97 + virtual TBool DoServiceL(TInt aFunction, const RMessage2& aMessage);
1.98 + // override CScsSession
1.99 + virtual CScsSubsession* DoCreateSubsessionL(TInt aFunction, const RMessage2& aMessage);
1.100 +
1.101 +private:
1.102 + CScsTestSession(CScsTestServer &aServer);
1.103 + };
1.104 +
1.105 +class CScsTestServer : public CScsServer
1.106 +/**
1.107 + This test implementation of the session count server provides
1.108 + the functionality to create sessions and subsessions, and to
1.109 + queue asynchronous requests on each of them.
1.110 + */
1.111 + {
1.112 +public:
1.113 + static CScsTestServer* NewLC();
1.114 + virtual ~CScsTestServer();
1.115 +
1.116 + // implement CScsServer
1.117 + virtual CScsSession* DoNewSessionL(const RMessage2& aMessage);
1.118 +
1.119 +private:
1.120 + CScsTestServer();
1.121 + void ConstructL(TInt aShutdownPeriodUs);
1.122 + };
1.123 +
1.124 +#endif // #ifndef SCSTESTSERVER_H
1.125 +