|
1 /* |
|
2 * Copyright (c) 2005-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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Definitions of classes local to TestExecuteUtils |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file TestExecuteServerUtils.h |
|
22 */ |
|
23 |
|
24 #if (!defined __SERVER_UTILS_H__) |
|
25 #define __SERVER_UTILS_H__ |
|
26 #include <test/testexecuteserverbase.h> |
|
27 #include <test/testexecutestepbase.h> |
|
28 |
|
29 class CActiveBase : public CActive |
|
30 /** |
|
31 @internalTechnology |
|
32 @test |
|
33 */ |
|
34 { |
|
35 public: |
|
36 inline TRequestStatus& Status(); |
|
37 inline void SetActive(); |
|
38 inline void Kick(); |
|
39 inline void Prime(); |
|
40 inline void Complete(TInt aCode); |
|
41 inline virtual ~CActiveBase(); |
|
42 inline TDes& Error(); |
|
43 inline TBool& TimedOut(); |
|
44 protected: |
|
45 inline CActiveBase(); |
|
46 TBuf<KMaxTestExecuteNameLength> iError; |
|
47 TBool iTimeOut; |
|
48 }; |
|
49 |
|
50 class CControlBase : public CActiveBase |
|
51 /** |
|
52 @internalTechnology |
|
53 @test |
|
54 */ |
|
55 { |
|
56 public: |
|
57 inline CControlBase(CTestServer& aServer); |
|
58 inline void DoCancel(); |
|
59 virtual void Stop() =0; |
|
60 inline CTestServer& Server(); |
|
61 inline TDes& Args(); |
|
62 inline RMessage2& Message(); |
|
63 inline RThread& WorkerThread(); |
|
64 private: |
|
65 CTestServer& iServer; |
|
66 RMessage2 iMessage; |
|
67 RThread iWorkerThread; |
|
68 TBuf<KMaxTestExecuteCommandLength> iArgs; |
|
69 }; |
|
70 |
|
71 |
|
72 class CStepControlBase : public CControlBase |
|
73 /** |
|
74 @internalTechnology |
|
75 @test |
|
76 */ |
|
77 { |
|
78 public: |
|
79 inline CStepControlBase(CTestServer& aServer); |
|
80 virtual void StartL(const RMessage2& aMessage,const TDesC& aStepArgs) = 0; |
|
81 inline TDes& StepName(); |
|
82 private: |
|
83 RMessage2 iMessage; |
|
84 RThread iWorkerThread; |
|
85 TBuf<KMaxTestStepNameLength> iStepName; |
|
86 }; |
|
87 |
|
88 class CBlockControlBase : public CControlBase |
|
89 /** |
|
90 @internalTechnology |
|
91 @test |
|
92 */ |
|
93 { |
|
94 public: |
|
95 inline CBlockControlBase(CTestServer& aServer); |
|
96 ~CBlockControlBase(); |
|
97 virtual void StartL(const RMessage2& aMessage,const TDesC& aArgs, const TDesC8& aBlockArrayPtr) = 0; |
|
98 virtual TTEFItemArray* BlockArray() const; |
|
99 |
|
100 protected: |
|
101 virtual void CreateBlockArrayL( const TDesC8& aBlockArrayPtr ); |
|
102 virtual HBufC8* CreateBlockArrayPckgLC(); |
|
103 |
|
104 private: |
|
105 TTEFItemArray* iBlockArray; |
|
106 RMessage2 iMessage; |
|
107 RThread iWorkerThread; |
|
108 TBuf<KMaxTestExecuteCommandLength> iBlockArgs; |
|
109 }; |
|
110 |
|
111 class CStepControl : public CStepControlBase |
|
112 /** |
|
113 @internalTechnology |
|
114 @test |
|
115 */ |
|
116 { |
|
117 public: |
|
118 CStepControl(CTestServer& aServer, const TDesC& aStepName); |
|
119 void RunL(); |
|
120 void StartL(const RMessage2& aMessage,const TDesC& aStepArgs); |
|
121 void Stop(); |
|
122 ~CStepControl(); |
|
123 private: |
|
124 }; |
|
125 |
|
126 class CBlockControl : public CBlockControlBase |
|
127 /** |
|
128 @internalTechnology |
|
129 @test |
|
130 */ |
|
131 { |
|
132 public: |
|
133 CBlockControl(CTestServer& aServer); |
|
134 void RunL(); |
|
135 void StartL(const RMessage2& aMessage,const TDesC& aArgs, const TDesC8& aBlockArrayPtr); |
|
136 void Stop(); |
|
137 ~CBlockControl(); |
|
138 }; |
|
139 |
|
140 class CWorkerMonitor; |
|
141 class CWorkerControl; |
|
142 class CPersistentStepControl : public CStepControlBase |
|
143 /** |
|
144 @internalTechnology |
|
145 @test |
|
146 */ |
|
147 { |
|
148 public: |
|
149 CPersistentStepControl(CTestServer& aServer); |
|
150 virtual ~CPersistentStepControl(); |
|
151 void StartL(const RMessage2& aMessage,const TDesC& aStepArgs); |
|
152 void RunL(); |
|
153 void Stop(); |
|
154 inline void ChildCompletion(); |
|
155 private: |
|
156 CWorkerControl* iWorkerControl; |
|
157 CWorkerMonitor* iWorkerMonitor; |
|
158 TBool iInitialised; |
|
159 }; |
|
160 |
|
161 class CBlockWorkerControl; |
|
162 class CPersistentBlockControl : public CBlockControlBase |
|
163 /** |
|
164 @internalTechnology |
|
165 @test |
|
166 */ |
|
167 { |
|
168 public: |
|
169 CPersistentBlockControl(CTestServer& aServer); |
|
170 virtual ~CPersistentBlockControl(); |
|
171 void StartL(const RMessage2& aMessage,const TDesC& aArgs, const TDesC8& aBlockArrayPtr); |
|
172 void RunL(); |
|
173 void Stop(); |
|
174 inline void ChildCompletion(); |
|
175 |
|
176 private: |
|
177 CBlockWorkerControl* iWorkerControl; |
|
178 CWorkerMonitor* iWorkerMonitor; |
|
179 TBool iInitialised; |
|
180 }; |
|
181 |
|
182 class CWorkerMonitor : public CActiveBase |
|
183 /** |
|
184 @internalTechnology |
|
185 @test |
|
186 */ |
|
187 { |
|
188 public: |
|
189 inline CWorkerMonitor(TRequestStatus& aParentStatus); |
|
190 inline virtual ~CWorkerMonitor(); |
|
191 inline void RunL(); |
|
192 inline void DoCancel(); |
|
193 private: |
|
194 TRequestStatus& iParentStatus; |
|
195 }; |
|
196 |
|
197 class CWorkerControl : public CActiveBase |
|
198 /** |
|
199 @internalTechnology |
|
200 @test |
|
201 */ |
|
202 { |
|
203 public: |
|
204 inline CWorkerControl(CTestServer& aServer,TRequestStatus& aParentStatus); |
|
205 inline ~CWorkerControl(); |
|
206 inline void RunL(); |
|
207 inline void DoCancel(); |
|
208 inline TRequestStatus& WorkerStatus(); |
|
209 inline RThread& ControllerThread(); |
|
210 inline RSemaphore& Semaphore(); |
|
211 inline CTestServer& Server(); |
|
212 inline TInt& Result(); |
|
213 inline TPtrC& Args(); |
|
214 inline TPtrC& StepName(); |
|
215 inline TDes& PersistentError(); |
|
216 //defect 116046 |
|
217 inline void SetCleanupPtr(CTrapCleanup* aCleanup); |
|
218 inline void Cleanup(); |
|
219 //END defect 116046 |
|
220 private: |
|
221 CTestServer& iServer; |
|
222 TRequestStatus& iParentStatus; |
|
223 RSemaphore iSemaphore; |
|
224 TRequestStatus iWorkerStatus; |
|
225 RThread iControllerThread; |
|
226 TPtrC iArgs; |
|
227 TPtrC iStepName; |
|
228 TInt iResult; |
|
229 TBuf<KMaxTestExecuteNameLength> iPersistentError; |
|
230 //defect 116046 |
|
231 CTrapCleanup* iCleanup; |
|
232 //END defect 116046 |
|
233 }; |
|
234 |
|
235 class CBlockWorkerControl : public CWorkerControl |
|
236 /** |
|
237 @internalTechnology |
|
238 @test |
|
239 */ |
|
240 { |
|
241 public: |
|
242 inline CBlockWorkerControl(CTestServer& aServer,TRequestStatus& iParentStatus ); |
|
243 inline ~CBlockWorkerControl(); |
|
244 inline void SetBlockArray( TTEFItemArray* aBlockArray ); |
|
245 inline TTEFItemArray* BlockArray() const; |
|
246 |
|
247 private: |
|
248 TTEFItemArray* iBlockArray; |
|
249 }; |
|
250 |
|
251 class CTestSession : public CSession2 |
|
252 /** |
|
253 @publishedPartner |
|
254 @test |
|
255 */ |
|
256 { |
|
257 public: |
|
258 IMPORT_C CTestSession(); |
|
259 IMPORT_C virtual ~CTestSession(); |
|
260 IMPORT_C virtual void ServiceL(const RMessage2& aMessage); |
|
261 private: |
|
262 CPersistentStepControl* iPersistentStepControl; |
|
263 CPersistentBlockControl* iPersistentBlockControl; |
|
264 TTEFItemArray* iBlockArray; |
|
265 }; |
|
266 |
|
267 #include <test/testexecuteserverutils.inl> |
|
268 #endif |
|
269 |