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