os/security/cryptomgmtlibs/securitycommonutils/test/inc_private/scstestserver.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 * Test implementation of a session count server tests the base functionality
    16 * will work for sessions, subsessions, and asynchronous requests.
    17 *
    18 */
    19 
    20 
    21 /**
    22  @internalComponent
    23  @test
    24  @file
    25 */
    26 
    27 #ifndef SCSTESTSERVER_H
    28 #define SCSTESTSERVER_H
    29 
    30 #include <scs/scsserver.h>
    31 #include "scstestcommon.h"
    32 
    33 // forward declarations
    34 class CScsTestSession;
    35 class CScsTestSubsession;
    36 
    37 class CTrebleRequest : public CAsyncRequest
    38 /**
    39 	Trebles a client-side TInt.  The request is completed asynchronously,
    40 	some time after it has been queued.
    41  */
    42 	{
    43 public:
    44 	static CTrebleRequest* NewL(CScsTestSession* aSession, CScsTestSubsession* aSubsession, const RMessage2& aMessage);
    45 	virtual ~CTrebleRequest();
    46 	
    47 	// implement CActive
    48 	virtual void DoCancel();
    49 	// implement CActive, override CAsyncRequest
    50 	virtual void RunL();
    51 	
    52 private:
    53 	CTrebleRequest(CScsTestSession* aSession, CScsTestSubsession* aSubsession, const RMessage2& aMessage);
    54 	void ConstructL();
    55 	
    56 private:
    57 	RTimer iTimer;	///< Provides the delay which makes this request asynchronous.
    58 	};
    59 
    60 class CScsTestSession;
    61 class CScsTestSubsession : public CScsSubsession
    62 /**
    63 	This subsession class is defined to ensure that requests are
    64 	routed to, and asynchronous requests associated with, the correct
    65 	object.
    66  */
    67 	{
    68 public:
    69 	static CScsTestSubsession* NewL(CScsTestSession &aSession, const RMessage2& aMessage);
    70 	virtual ~CScsTestSubsession();
    71 	
    72 	// implement CScsSubsession
    73 	virtual TBool DoServiceL(TInt aFunction, const RMessage2& aMessage);
    74 
    75 private:
    76 	CScsTestSubsession(CScsTestSession &aSession);
    77 
    78 private:
    79 	TInt iValue;			///< Value on which this subsession is curried.
    80 	};
    81 
    82 class CScsTestServer;
    83 class CScsTestSession : public CScsSession
    84 /**
    85 	Tests the underlying session count session implementation by
    86 	handling requests, asynchronous requests, and creating subsessions.
    87  */
    88 	{
    89 public:
    90 	static CScsTestSession* NewL(CScsTestServer &aServer);
    91 	virtual ~CScsTestSession();
    92 
    93 	// implement CScsSession
    94 	virtual TBool DoServiceL(TInt aFunction, const RMessage2& aMessage);
    95 	// override CScsSession
    96 	virtual CScsSubsession* DoCreateSubsessionL(TInt aFunction, const RMessage2& aMessage);
    97 	
    98 private:
    99 	CScsTestSession(CScsTestServer &aServer);
   100 	};
   101 
   102 class CScsTestServer : public CScsServer
   103 /**
   104 	This test implementation of the session count server provides
   105 	the functionality to create sessions and subsessions, and to
   106 	queue asynchronous requests on each of them.
   107  */
   108 	{
   109 public:
   110 	static CScsTestServer* NewLC();
   111 	virtual ~CScsTestServer();
   112 
   113 	// implement CScsServer
   114 	virtual CScsSession* DoNewSessionL(const RMessage2& aMessage);
   115 
   116 private:
   117 	CScsTestServer();
   118 	void ConstructL(TInt aShutdownPeriodUs);
   119 	};
   120 
   121 #endif	// #ifndef SCSTESTSERVER_H
   122