sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <f32file.h>
|
sl@0
|
17 |
#include <e32test.h>
|
sl@0
|
18 |
#include <bautils.h>
|
sl@0
|
19 |
#include <hal.h>
|
sl@0
|
20 |
#include <e32std.h>
|
sl@0
|
21 |
#include <bsul/bsul.h>
|
sl@0
|
22 |
#include "t_clientmessagetestserver.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
using namespace BSUL;
|
sl@0
|
25 |
|
sl@0
|
26 |
|
sl@0
|
27 |
LOCAL_D RTest Test (_L("T_ClientMessage"));
|
sl@0
|
28 |
LOCAL_D RFs TheFs;
|
sl@0
|
29 |
|
sl@0
|
30 |
_LIT(KServerName,"ClientMessageTestServer");
|
sl@0
|
31 |
_LIT(KServer2Name,"SecondTestServer");
|
sl@0
|
32 |
_LIT(KServerFileName,"T_ClientMessageTestServer.exe");
|
sl@0
|
33 |
|
sl@0
|
34 |
struct TExitDetails
|
sl@0
|
35 |
{
|
sl@0
|
36 |
TExitCategoryName iCategory;
|
sl@0
|
37 |
TExitType iExitType;
|
sl@0
|
38 |
TInt iReason;
|
sl@0
|
39 |
};
|
sl@0
|
40 |
|
sl@0
|
41 |
typedef void (*TestFunction)();
|
sl@0
|
42 |
|
sl@0
|
43 |
|
sl@0
|
44 |
/*RClientMessageTestSession client side interface to
|
sl@0
|
45 |
* CClientMessageTestServer server. This is used to pass
|
sl@0
|
46 |
* messages to the server to testthe Client Message Framework.
|
sl@0
|
47 |
*/
|
sl@0
|
48 |
class RClientMessageTestSession : public RSessionBase
|
sl@0
|
49 |
{
|
sl@0
|
50 |
public:
|
sl@0
|
51 |
TInt Connect();
|
sl@0
|
52 |
|
sl@0
|
53 |
TInt TestFunction0(TInt aArg0);
|
sl@0
|
54 |
TInt TestFunction0(TInt aArg0, TInt aArg1);
|
sl@0
|
55 |
TInt TestFunction0(TInt aArg0, TInt aArg1, TInt aArg2);
|
sl@0
|
56 |
TInt TestFunction0(const TDesC8& aData0, const TDesC& aData1);
|
sl@0
|
57 |
TInt TestFunction1(TInt aArg0, TInt aArg1);
|
sl@0
|
58 |
TInt TestFunction2(TInt aArg0, TInt aArg1);
|
sl@0
|
59 |
TInt TestFunction3(TInt aArg0, TInt aArg1);
|
sl@0
|
60 |
|
sl@0
|
61 |
TInt TestFunction4(const TDesC8& aData0, const TDesC& aData1);
|
sl@0
|
62 |
TInt TestFunction4(const TDesC& aData0, const TDesC8& aData1);
|
sl@0
|
63 |
TInt TestFunction4(const TDesC8& aData0);
|
sl@0
|
64 |
TInt TestFunction5(const TDesC8& aData0, const TDesC& aData1);
|
sl@0
|
65 |
TInt TestFunction6(const TDesC8& aData0, const TDesC& aData1);
|
sl@0
|
66 |
TInt TestFunction7(const TDesC8& aData0, const TDesC& aData1);
|
sl@0
|
67 |
TInt TestFunction8(const TDesC8& aData0, const TDesC& aData1);
|
sl@0
|
68 |
|
sl@0
|
69 |
TInt TestFunction9(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1);
|
sl@0
|
70 |
TInt TestFunction9(TDes& aData0,TInt aOffset0, TDes8& aData1,TInt aOffset1);
|
sl@0
|
71 |
TInt TestFunction10(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1);
|
sl@0
|
72 |
TInt TestFunction11(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1);
|
sl@0
|
73 |
TInt TestFunction12(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1);
|
sl@0
|
74 |
TInt TestFunction13(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1);
|
sl@0
|
75 |
TInt TestFunction14(const TDesC8& aData0,TInt aOffset0, TDes8& aData1);
|
sl@0
|
76 |
TInt TestFunction15(const TDesC& aData0,TInt aOffset0, TDes& aData1);
|
sl@0
|
77 |
|
sl@0
|
78 |
TInt TestFunction16(TAny* aData);
|
sl@0
|
79 |
TInt TestFunction17(TAny* aData);
|
sl@0
|
80 |
|
sl@0
|
81 |
TInt TestFunction18(TDes8& aData);
|
sl@0
|
82 |
TInt TestFunction18(TDes16& aData);
|
sl@0
|
83 |
TInt TestFunction19(TDes8& aData);
|
sl@0
|
84 |
|
sl@0
|
85 |
TInt TestFunction20(TInt aArg0, TInt aArg1);
|
sl@0
|
86 |
TInt TestFunction21(TInt aArg0, TInt aArg1);
|
sl@0
|
87 |
TInt TestFunction22(TInt aArg0, TInt aArg1);
|
sl@0
|
88 |
TInt TestFunction23(TInt aArg0, TInt aArg1);
|
sl@0
|
89 |
TInt TestFunction24(TInt aArg0, TInt aArg1);
|
sl@0
|
90 |
|
sl@0
|
91 |
TInt TestFunction25();
|
sl@0
|
92 |
TInt TestFunction26();
|
sl@0
|
93 |
TInt TestFunction27();
|
sl@0
|
94 |
TInt TestFunction28(TInt aArg0);
|
sl@0
|
95 |
TInt TestFunction29(TDes& aData);
|
sl@0
|
96 |
TInt TestFunction30(TDes8& aData);
|
sl@0
|
97 |
TInt TestFunction31(TInt aArg0);
|
sl@0
|
98 |
TInt TestFunction32(TDes8& aData);
|
sl@0
|
99 |
|
sl@0
|
100 |
TInt TestInvalidFunction(TInt aFn);
|
sl@0
|
101 |
|
sl@0
|
102 |
|
sl@0
|
103 |
};
|
sl@0
|
104 |
|
sl@0
|
105 |
/*RClientMessageTestSession2 client side interface to
|
sl@0
|
106 |
* CClientMessageTestServer2 server. This is used to pass
|
sl@0
|
107 |
* messages to the server to testthe Client Message Framework.
|
sl@0
|
108 |
*/
|
sl@0
|
109 |
class RClientMessageTestSession2 : public RSessionBase
|
sl@0
|
110 |
{
|
sl@0
|
111 |
public:
|
sl@0
|
112 |
TInt Connect();
|
sl@0
|
113 |
|
sl@0
|
114 |
TInt TestFunction0(TInt aArg0, TInt aArg1);
|
sl@0
|
115 |
|
sl@0
|
116 |
TInt TestFunction1(const TDesC& aData0);
|
sl@0
|
117 |
|
sl@0
|
118 |
};
|
sl@0
|
119 |
|
sl@0
|
120 |
//Global process that is accessible in test code to determine the
|
sl@0
|
121 |
//exit reason and category on termination
|
sl@0
|
122 |
RProcess serverProcess;
|
sl@0
|
123 |
|
sl@0
|
124 |
//Launch the server process
|
sl@0
|
125 |
static TInt LaunchServer()
|
sl@0
|
126 |
{
|
sl@0
|
127 |
TInt err = serverProcess.Create(KServerFileName,_L(""));
|
sl@0
|
128 |
|
sl@0
|
129 |
if(err == KErrNone)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
TRequestStatus serverStat;
|
sl@0
|
132 |
|
sl@0
|
133 |
serverProcess.SetJustInTime(EFalse);
|
sl@0
|
134 |
serverProcess.Rendezvous(serverStat);
|
sl@0
|
135 |
serverProcess.Resume();
|
sl@0
|
136 |
User::WaitForRequest(serverStat);
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
return err;
|
sl@0
|
140 |
}
|
sl@0
|
141 |
|
sl@0
|
142 |
|
sl@0
|
143 |
/* Connect to the CClientMessageTestServer, launching
|
sl@0
|
144 |
* the sevrer process if necessary
|
sl@0
|
145 |
*/
|
sl@0
|
146 |
TInt RClientMessageTestSession::Connect()
|
sl@0
|
147 |
{
|
sl@0
|
148 |
TInt retry = 2;
|
sl@0
|
149 |
for(;;)
|
sl@0
|
150 |
{
|
sl@0
|
151 |
TInt r = CreateSession(KServerName,TVersion(1,0,0));
|
sl@0
|
152 |
|
sl@0
|
153 |
if((r != KErrNotFound)&&(r != KErrServerTerminated))
|
sl@0
|
154 |
{
|
sl@0
|
155 |
return r;
|
sl@0
|
156 |
}
|
sl@0
|
157 |
|
sl@0
|
158 |
if(--retry == 0)
|
sl@0
|
159 |
{
|
sl@0
|
160 |
return r;
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
r = LaunchServer();
|
sl@0
|
164 |
if((r != KErrNone)&&(r != KErrAlreadyExists))
|
sl@0
|
165 |
{
|
sl@0
|
166 |
return r;
|
sl@0
|
167 |
}
|
sl@0
|
168 |
}
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
/* These functions are used to send IPC messages to the server.
|
sl@0
|
172 |
* The messages are sent with different parameters to test the
|
sl@0
|
173 |
* ClientMessage framework handling of bad messages
|
sl@0
|
174 |
*/
|
sl@0
|
175 |
TInt RClientMessageTestSession::TestFunction0(TInt aArg0, TInt aArg1)
|
sl@0
|
176 |
{
|
sl@0
|
177 |
return SendReceive(ETestMessage0,TIpcArgs(aArg0,aArg1));
|
sl@0
|
178 |
}
|
sl@0
|
179 |
|
sl@0
|
180 |
TInt RClientMessageTestSession::TestFunction0(TInt aArg0)
|
sl@0
|
181 |
{
|
sl@0
|
182 |
return SendReceive(ETestMessage0,TIpcArgs(aArg0));
|
sl@0
|
183 |
}
|
sl@0
|
184 |
|
sl@0
|
185 |
TInt RClientMessageTestSession::TestFunction0(TInt aArg0, TInt aArg1, TInt aArg2)
|
sl@0
|
186 |
{
|
sl@0
|
187 |
return SendReceive(ETestMessage0,TIpcArgs(aArg0,aArg1,aArg2));
|
sl@0
|
188 |
}
|
sl@0
|
189 |
|
sl@0
|
190 |
TInt RClientMessageTestSession::TestFunction0(const TDesC8& aData0, const TDesC& aData1)
|
sl@0
|
191 |
{
|
sl@0
|
192 |
//Call the function passing invalid arguments
|
sl@0
|
193 |
return SendReceive(ETestMessage0,TIpcArgs(&aData0,&aData1));
|
sl@0
|
194 |
}
|
sl@0
|
195 |
|
sl@0
|
196 |
TInt RClientMessageTestSession::TestFunction1(TInt aArg0, TInt aArg1)
|
sl@0
|
197 |
{
|
sl@0
|
198 |
return SendReceive(ETestMessage1,TIpcArgs(aArg0,aArg1));
|
sl@0
|
199 |
}
|
sl@0
|
200 |
|
sl@0
|
201 |
TInt RClientMessageTestSession::TestFunction2(TInt aArg0, TInt aArg1)
|
sl@0
|
202 |
{
|
sl@0
|
203 |
return SendReceive(ETestMessage2,TIpcArgs(aArg0,aArg1));
|
sl@0
|
204 |
}
|
sl@0
|
205 |
|
sl@0
|
206 |
TInt RClientMessageTestSession::TestFunction3(TInt aArg0, TInt aArg1)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
return SendReceive(ETestMessage3,TIpcArgs(aArg0,aArg1));
|
sl@0
|
209 |
}
|
sl@0
|
210 |
|
sl@0
|
211 |
TInt RClientMessageTestSession::TestFunction4(const TDesC8& aData0, const TDesC& aData1)
|
sl@0
|
212 |
{
|
sl@0
|
213 |
return SendReceive(ETestMessage4,TIpcArgs(&aData0,&aData1));
|
sl@0
|
214 |
}
|
sl@0
|
215 |
|
sl@0
|
216 |
TInt RClientMessageTestSession::TestFunction4(const TDesC& aData0, const TDesC8& aData1)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
return SendReceive(ETestMessage4,TIpcArgs(&aData0,&aData1));
|
sl@0
|
219 |
}
|
sl@0
|
220 |
|
sl@0
|
221 |
TInt RClientMessageTestSession::TestFunction4(const TDesC8& aData0)
|
sl@0
|
222 |
{
|
sl@0
|
223 |
return SendReceive(ETestMessage4,TIpcArgs(&aData0));
|
sl@0
|
224 |
}
|
sl@0
|
225 |
|
sl@0
|
226 |
TInt RClientMessageTestSession::TestFunction5(const TDesC8& aData0, const TDesC& aData1)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
return SendReceive(ETestMessage5,TIpcArgs(&aData0,&aData1));
|
sl@0
|
229 |
}
|
sl@0
|
230 |
|
sl@0
|
231 |
TInt RClientMessageTestSession::TestFunction6(const TDesC8& aData0, const TDesC& aData1)
|
sl@0
|
232 |
{
|
sl@0
|
233 |
return SendReceive(ETestMessage6,TIpcArgs(&aData0,&aData1));
|
sl@0
|
234 |
}
|
sl@0
|
235 |
|
sl@0
|
236 |
TInt RClientMessageTestSession::TestFunction7(const TDesC8& aData0, const TDesC& aData1)
|
sl@0
|
237 |
{
|
sl@0
|
238 |
return SendReceive(ETestMessage7,TIpcArgs(&aData0,&aData1));
|
sl@0
|
239 |
}
|
sl@0
|
240 |
|
sl@0
|
241 |
TInt RClientMessageTestSession::TestFunction8(const TDesC8& aData0, const TDesC& aData1)
|
sl@0
|
242 |
{
|
sl@0
|
243 |
return SendReceive(ETestMessage8,TIpcArgs(&aData0,&aData1));
|
sl@0
|
244 |
}
|
sl@0
|
245 |
|
sl@0
|
246 |
TInt RClientMessageTestSession::TestFunction9(TDes& aData0,TInt aOffset0, TDes8& aData1,TInt aOffset1)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
return SendReceive(ETestMessage9,TIpcArgs(&aData0,aOffset0,&aData1,aOffset1));
|
sl@0
|
249 |
}
|
sl@0
|
250 |
|
sl@0
|
251 |
TInt RClientMessageTestSession::TestFunction9(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
return SendReceive(ETestMessage9,TIpcArgs(&aData0,aOffset0,&aData1,aOffset1));
|
sl@0
|
254 |
}
|
sl@0
|
255 |
|
sl@0
|
256 |
TInt RClientMessageTestSession::TestFunction10(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1)
|
sl@0
|
257 |
{
|
sl@0
|
258 |
return SendReceive(ETestMessage10,TIpcArgs(&aData0,aOffset0,&aData1,aOffset1));
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
TInt RClientMessageTestSession::TestFunction11(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
return SendReceive(ETestMessage11,TIpcArgs(&aData0,aOffset0,&aData1,aOffset1));
|
sl@0
|
264 |
}
|
sl@0
|
265 |
|
sl@0
|
266 |
TInt RClientMessageTestSession::TestFunction12(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1)
|
sl@0
|
267 |
{
|
sl@0
|
268 |
return SendReceive(ETestMessage12,TIpcArgs(&aData0,aOffset0,&aData1,aOffset1));
|
sl@0
|
269 |
}
|
sl@0
|
270 |
|
sl@0
|
271 |
TInt RClientMessageTestSession::TestFunction13(TDes8& aData0,TInt aOffset0, TDes& aData1,TInt aOffset1)
|
sl@0
|
272 |
{
|
sl@0
|
273 |
return SendReceive(ETestMessage13,TIpcArgs(&aData0,aOffset0,&aData1,aOffset1));
|
sl@0
|
274 |
}
|
sl@0
|
275 |
|
sl@0
|
276 |
TInt RClientMessageTestSession::TestFunction14(const TDesC8& aData0,TInt aOffset0, TDes8& aData1)
|
sl@0
|
277 |
{
|
sl@0
|
278 |
return SendReceive(ETestMessage14,TIpcArgs(&aData0,aOffset0,&aData1));
|
sl@0
|
279 |
}
|
sl@0
|
280 |
|
sl@0
|
281 |
TInt RClientMessageTestSession::TestFunction15(const TDesC& aData0,TInt aOffset0, TDes& aData1)
|
sl@0
|
282 |
{
|
sl@0
|
283 |
return SendReceive(ETestMessage15,TIpcArgs(&aData0,aOffset0,&aData1));
|
sl@0
|
284 |
}
|
sl@0
|
285 |
|
sl@0
|
286 |
TInt RClientMessageTestSession::TestFunction16(TAny* aData)
|
sl@0
|
287 |
{
|
sl@0
|
288 |
return SendReceive(ETestMessage16,TIpcArgs(aData));
|
sl@0
|
289 |
}
|
sl@0
|
290 |
|
sl@0
|
291 |
TInt RClientMessageTestSession::TestFunction17(TAny* aData)
|
sl@0
|
292 |
{
|
sl@0
|
293 |
return SendReceive(ETestMessage17,TIpcArgs(aData));
|
sl@0
|
294 |
}
|
sl@0
|
295 |
|
sl@0
|
296 |
TInt RClientMessageTestSession::TestFunction18(TDes8& aData)
|
sl@0
|
297 |
{
|
sl@0
|
298 |
return SendReceive(ETestMessage18,TIpcArgs(&aData));
|
sl@0
|
299 |
}
|
sl@0
|
300 |
|
sl@0
|
301 |
TInt RClientMessageTestSession::TestFunction18(TDes& aData)
|
sl@0
|
302 |
{
|
sl@0
|
303 |
return SendReceive(ETestMessage18,TIpcArgs(&aData));
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
TInt RClientMessageTestSession::TestFunction19(TDes8& aData)
|
sl@0
|
307 |
{
|
sl@0
|
308 |
return SendReceive(ETestMessage19,TIpcArgs(&aData));
|
sl@0
|
309 |
}
|
sl@0
|
310 |
|
sl@0
|
311 |
TInt RClientMessageTestSession::TestFunction20(TInt aArg0, TInt aArg1)
|
sl@0
|
312 |
{
|
sl@0
|
313 |
return SendReceive(ETestMessage20,TIpcArgs(aArg0,aArg1));
|
sl@0
|
314 |
}
|
sl@0
|
315 |
|
sl@0
|
316 |
TInt RClientMessageTestSession::TestFunction21(TInt aArg0, TInt aArg1)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
return SendReceive(ETestMessage21,TIpcArgs(aArg0,aArg1));
|
sl@0
|
319 |
}
|
sl@0
|
320 |
|
sl@0
|
321 |
TInt RClientMessageTestSession::TestFunction22(TInt aArg0, TInt aArg1)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
return SendReceive(ETestMessage22,TIpcArgs(aArg0,aArg1));
|
sl@0
|
324 |
}
|
sl@0
|
325 |
|
sl@0
|
326 |
TInt RClientMessageTestSession::TestFunction23(TInt aArg0, TInt aArg1)
|
sl@0
|
327 |
{
|
sl@0
|
328 |
return SendReceive(ETestMessage23,TIpcArgs(aArg0,aArg1));
|
sl@0
|
329 |
}
|
sl@0
|
330 |
|
sl@0
|
331 |
TInt RClientMessageTestSession::TestFunction24(TInt aArg0, TInt aArg1)
|
sl@0
|
332 |
{
|
sl@0
|
333 |
return SendReceive(ETestMessage24,TIpcArgs(aArg0,aArg1));
|
sl@0
|
334 |
}
|
sl@0
|
335 |
|
sl@0
|
336 |
TInt RClientMessageTestSession::TestFunction25()
|
sl@0
|
337 |
{
|
sl@0
|
338 |
return SendReceive(ETestMessage25,TIpcArgs());
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
TInt RClientMessageTestSession::TestFunction26()
|
sl@0
|
342 |
{
|
sl@0
|
343 |
return SendReceive(ETestMessage26,TIpcArgs());
|
sl@0
|
344 |
}
|
sl@0
|
345 |
|
sl@0
|
346 |
TInt RClientMessageTestSession::TestFunction27()
|
sl@0
|
347 |
{
|
sl@0
|
348 |
return SendReceive(ETestMessage27,TIpcArgs());
|
sl@0
|
349 |
}
|
sl@0
|
350 |
|
sl@0
|
351 |
TInt RClientMessageTestSession::TestFunction28(TInt aArg0)
|
sl@0
|
352 |
{
|
sl@0
|
353 |
return SendReceive(ETestMessage28,TIpcArgs(aArg0));
|
sl@0
|
354 |
}
|
sl@0
|
355 |
|
sl@0
|
356 |
TInt RClientMessageTestSession::TestFunction29(TDes& aData)
|
sl@0
|
357 |
{
|
sl@0
|
358 |
return SendReceive(ETestMessage29,TIpcArgs(&aData));
|
sl@0
|
359 |
}
|
sl@0
|
360 |
|
sl@0
|
361 |
TInt RClientMessageTestSession::TestFunction30(TDes8& aData)
|
sl@0
|
362 |
{
|
sl@0
|
363 |
return SendReceive(ETestMessage30,TIpcArgs(&aData));
|
sl@0
|
364 |
}
|
sl@0
|
365 |
|
sl@0
|
366 |
TInt RClientMessageTestSession::TestFunction31(TInt aArg0)
|
sl@0
|
367 |
{
|
sl@0
|
368 |
return SendReceive(ETestMessage31,TIpcArgs(aArg0));
|
sl@0
|
369 |
}
|
sl@0
|
370 |
|
sl@0
|
371 |
TInt RClientMessageTestSession::TestFunction32(TDes8& aData)
|
sl@0
|
372 |
{
|
sl@0
|
373 |
return SendReceive(ETestMessage32,TIpcArgs(&aData));
|
sl@0
|
374 |
}
|
sl@0
|
375 |
|
sl@0
|
376 |
TInt RClientMessageTestSession::TestInvalidFunction(TInt aFn)
|
sl@0
|
377 |
{
|
sl@0
|
378 |
return SendReceive(aFn,TIpcArgs());
|
sl@0
|
379 |
}
|
sl@0
|
380 |
|
sl@0
|
381 |
/* This function is the entry point for a new thread. It calls the
|
sl@0
|
382 |
* function passed to it as a TAny*.
|
sl@0
|
383 |
*/
|
sl@0
|
384 |
TInt TestFunctionLauncherL(TAny* aTestFunction)
|
sl@0
|
385 |
{
|
sl@0
|
386 |
CTrapCleanup* cleanup=CTrapCleanup::New();
|
sl@0
|
387 |
TInt r=KErrNoMemory;
|
sl@0
|
388 |
if (cleanup)
|
sl@0
|
389 |
{
|
sl@0
|
390 |
TestFunction function = (TestFunction)aTestFunction;
|
sl@0
|
391 |
|
sl@0
|
392 |
__UHEAP_MARK;
|
sl@0
|
393 |
TRAP(r,function());
|
sl@0
|
394 |
__UHEAP_MARKEND;
|
sl@0
|
395 |
|
sl@0
|
396 |
delete cleanup;
|
sl@0
|
397 |
}
|
sl@0
|
398 |
return r;
|
sl@0
|
399 |
}
|
sl@0
|
400 |
|
sl@0
|
401 |
/* This function creates a new thread and passes through the test function
|
sl@0
|
402 |
* to be called. It also monitors and returns the exit reason for the launched
|
sl@0
|
403 |
* thread.
|
sl@0
|
404 |
*/
|
sl@0
|
405 |
TExitDetails LaunchTestThreadL(const TDesC& aThreadName, TestFunction aFunction)
|
sl@0
|
406 |
{
|
sl@0
|
407 |
RThread thread;
|
sl@0
|
408 |
TInt err = thread.Create(aThreadName, &TestFunctionLauncherL, KDefaultStackSize, NULL, (TAny*)aFunction);
|
sl@0
|
409 |
|
sl@0
|
410 |
if(err != KErrAlreadyExists)
|
sl@0
|
411 |
{
|
sl@0
|
412 |
User::LeaveIfError(err);
|
sl@0
|
413 |
}
|
sl@0
|
414 |
|
sl@0
|
415 |
TRequestStatus threadStat;
|
sl@0
|
416 |
thread.Logon(threadStat);
|
sl@0
|
417 |
|
sl@0
|
418 |
TBool jit = User::JustInTime();
|
sl@0
|
419 |
User::SetJustInTime(EFalse);
|
sl@0
|
420 |
|
sl@0
|
421 |
thread.Resume();
|
sl@0
|
422 |
User::WaitForRequest(threadStat);
|
sl@0
|
423 |
|
sl@0
|
424 |
User::SetJustInTime(jit);
|
sl@0
|
425 |
|
sl@0
|
426 |
TExitDetails exitDetails;
|
sl@0
|
427 |
exitDetails.iCategory = thread.ExitCategory();
|
sl@0
|
428 |
exitDetails.iReason = thread.ExitReason();
|
sl@0
|
429 |
exitDetails.iExitType = thread.ExitType();
|
sl@0
|
430 |
|
sl@0
|
431 |
return exitDetails;
|
sl@0
|
432 |
}
|
sl@0
|
433 |
|
sl@0
|
434 |
|
sl@0
|
435 |
/*
|
sl@0
|
436 |
This test function accepts 2 integer parameters as defined below
|
sl@0
|
437 |
{EParamInt,-10,100},{EParamInt,0,200}
|
sl@0
|
438 |
Any calls to this function with parameters outside the ranges
|
sl@0
|
439 |
defined above should fail with KErrBadParameter
|
sl@0
|
440 |
*/
|
sl@0
|
441 |
void TestFunction0AL()
|
sl@0
|
442 |
{
|
sl@0
|
443 |
RClientMessageTestSession session;
|
sl@0
|
444 |
|
sl@0
|
445 |
TInt err = session.Connect();
|
sl@0
|
446 |
Test(err == KErrNone);
|
sl@0
|
447 |
|
sl@0
|
448 |
CleanupClosePushL(session);
|
sl@0
|
449 |
|
sl@0
|
450 |
err = session.TestFunction0( 0, 100);
|
sl@0
|
451 |
Test(err == KErrNone);
|
sl@0
|
452 |
|
sl@0
|
453 |
err = session.TestFunction0( 100, 0);
|
sl@0
|
454 |
Test(err == KErrNone);
|
sl@0
|
455 |
|
sl@0
|
456 |
err = session.TestFunction0( -5, 10);
|
sl@0
|
457 |
Test(err == KErrNone);
|
sl@0
|
458 |
|
sl@0
|
459 |
err = session.TestFunction0( -5, -10);
|
sl@0
|
460 |
Test(err == KErrBadParameter);
|
sl@0
|
461 |
|
sl@0
|
462 |
err = session.TestFunction0( -15, 10);
|
sl@0
|
463 |
Test(err == KErrBadParameter);
|
sl@0
|
464 |
|
sl@0
|
465 |
err = session.TestFunction0( -10, 200);
|
sl@0
|
466 |
Test(err == KErrNone);
|
sl@0
|
467 |
|
sl@0
|
468 |
err = session.TestFunction0( 101, 102);
|
sl@0
|
469 |
Test(err == KErrBadParameter);
|
sl@0
|
470 |
|
sl@0
|
471 |
err = session.TestFunction0(11, 56, 43);
|
sl@0
|
472 |
Test(err == KErrNone);
|
sl@0
|
473 |
|
sl@0
|
474 |
err = session.TestFunction0( _L8("Des8"), _L("Des"));
|
sl@0
|
475 |
Test(err == KErrBadParameter);
|
sl@0
|
476 |
|
sl@0
|
477 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
478 |
}
|
sl@0
|
479 |
|
sl@0
|
480 |
|
sl@0
|
481 |
/*
|
sl@0
|
482 |
This test function accepts 2 integer parameters as defined below
|
sl@0
|
483 |
{EParamInt,-10,100},{EParamInt,0,200}
|
sl@0
|
484 |
In the server, this function tries to access a ptr type from
|
sl@0
|
485 |
an int argument. This is a programming error and should result
|
sl@0
|
486 |
in the server panicking with ECMPanicWrongParameterType in UDEB
|
sl@0
|
487 |
or returning KErrWrongParameterType in UREL
|
sl@0
|
488 |
*/
|
sl@0
|
489 |
void TestFunction1L()
|
sl@0
|
490 |
{
|
sl@0
|
491 |
RClientMessageTestSession session;
|
sl@0
|
492 |
|
sl@0
|
493 |
TInt err = session.Connect();
|
sl@0
|
494 |
Test(err == KErrNone);
|
sl@0
|
495 |
|
sl@0
|
496 |
CleanupClosePushL(session);
|
sl@0
|
497 |
|
sl@0
|
498 |
err = session.TestFunction1(10,100);
|
sl@0
|
499 |
|
sl@0
|
500 |
#ifdef _DEBUG
|
sl@0
|
501 |
Test(err == KErrServerTerminated);
|
sl@0
|
502 |
|
sl@0
|
503 |
TInt type = serverProcess.ExitType();
|
sl@0
|
504 |
Test(type == EExitPanic);
|
sl@0
|
505 |
|
sl@0
|
506 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
507 |
Test(reason == ECMPanicWrongParameterType);
|
sl@0
|
508 |
#else
|
sl@0
|
509 |
Test(err == KErrWrongParameterType);
|
sl@0
|
510 |
#endif
|
sl@0
|
511 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
512 |
}
|
sl@0
|
513 |
|
sl@0
|
514 |
/*
|
sl@0
|
515 |
This test function accepts 1 integer parameter as defined below
|
sl@0
|
516 |
{EParamInt,100,10}
|
sl@0
|
517 |
As can be seen above, the schema is incorrectly defined as iMin is
|
sl@0
|
518 |
greater than iMax. This is a programming error and should result
|
sl@0
|
519 |
in the server panicking with ECMPanicBadMessageSchema in UDEB
|
sl@0
|
520 |
or returning KErrBadParameter in UREL
|
sl@0
|
521 |
*/
|
sl@0
|
522 |
void TestFunction2L()
|
sl@0
|
523 |
{
|
sl@0
|
524 |
RClientMessageTestSession session;
|
sl@0
|
525 |
|
sl@0
|
526 |
TInt err = session.Connect();
|
sl@0
|
527 |
Test(err == KErrNone);
|
sl@0
|
528 |
|
sl@0
|
529 |
CleanupClosePushL(session);
|
sl@0
|
530 |
|
sl@0
|
531 |
//this function is incorrectly defined in the
|
sl@0
|
532 |
//message schema. This should result in the
|
sl@0
|
533 |
//server panicking
|
sl@0
|
534 |
err = session.TestFunction2(10,100);
|
sl@0
|
535 |
|
sl@0
|
536 |
//In debug builds the server should panic.
|
sl@0
|
537 |
//In release builds KErrBadParameter should be returned
|
sl@0
|
538 |
#ifdef _DEBUG
|
sl@0
|
539 |
Test(err == KErrServerTerminated);
|
sl@0
|
540 |
|
sl@0
|
541 |
TInt type = serverProcess.ExitType();
|
sl@0
|
542 |
Test(type == EExitPanic);
|
sl@0
|
543 |
|
sl@0
|
544 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
545 |
Test(reason == ECMPanicBadMessageSchema);
|
sl@0
|
546 |
#else
|
sl@0
|
547 |
Test(err == KErrBadParameter);
|
sl@0
|
548 |
#endif
|
sl@0
|
549 |
|
sl@0
|
550 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
551 |
}
|
sl@0
|
552 |
|
sl@0
|
553 |
/*
|
sl@0
|
554 |
This test function accepts 1 integer parameter as defined below
|
sl@0
|
555 |
{EParamInt,-10,-20}
|
sl@0
|
556 |
As can be seen above, the schema is incorrectly defined as iMin is
|
sl@0
|
557 |
greater than iMax. This is a programming error and should result
|
sl@0
|
558 |
in the server panicking with ECMPanicBadMessageSchema in UDEB
|
sl@0
|
559 |
or returning KErrBadParameter in UREL
|
sl@0
|
560 |
*/
|
sl@0
|
561 |
void TestFunction3L()
|
sl@0
|
562 |
{
|
sl@0
|
563 |
RClientMessageTestSession session;
|
sl@0
|
564 |
|
sl@0
|
565 |
TInt err = session.Connect();
|
sl@0
|
566 |
Test(err == KErrNone);
|
sl@0
|
567 |
|
sl@0
|
568 |
CleanupClosePushL(session);
|
sl@0
|
569 |
|
sl@0
|
570 |
//this function is incorrectly defined in the
|
sl@0
|
571 |
//message schema. This should result in the
|
sl@0
|
572 |
//server panicking
|
sl@0
|
573 |
err = session.TestFunction3(10,100);
|
sl@0
|
574 |
|
sl@0
|
575 |
//In debug builds the server should panic.
|
sl@0
|
576 |
//In release builds KErrBadParameter should be returned
|
sl@0
|
577 |
#ifdef _DEBUG
|
sl@0
|
578 |
Test(err == KErrServerTerminated);
|
sl@0
|
579 |
|
sl@0
|
580 |
TInt type = serverProcess.ExitType();
|
sl@0
|
581 |
Test(type == EExitPanic);
|
sl@0
|
582 |
|
sl@0
|
583 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
584 |
Test(reason == ECMPanicBadMessageSchema);
|
sl@0
|
585 |
#else
|
sl@0
|
586 |
Test(err == KErrBadParameter);
|
sl@0
|
587 |
#endif
|
sl@0
|
588 |
|
sl@0
|
589 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
590 |
}
|
sl@0
|
591 |
|
sl@0
|
592 |
/*
|
sl@0
|
593 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
594 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
595 |
Any calls to this function with parameters outside the constraints
|
sl@0
|
596 |
defined above should result in the client being panicked with
|
sl@0
|
597 |
KErrBadDescriptor
|
sl@0
|
598 |
*/
|
sl@0
|
599 |
void TestFunction4AL()
|
sl@0
|
600 |
{
|
sl@0
|
601 |
RClientMessageTestSession session;
|
sl@0
|
602 |
_LIT8(KDes8, "Des8");
|
sl@0
|
603 |
_LIT8(KShortDes8, "De");
|
sl@0
|
604 |
_LIT(KDes16, "Des16");
|
sl@0
|
605 |
_LIT(KLongDes16, "Des16 - A longer version");
|
sl@0
|
606 |
|
sl@0
|
607 |
TInt err = session.Connect();
|
sl@0
|
608 |
Test(err == KErrNone);
|
sl@0
|
609 |
|
sl@0
|
610 |
CleanupClosePushL(session);
|
sl@0
|
611 |
|
sl@0
|
612 |
err = session.TestFunction4(KDes8,KDes16);
|
sl@0
|
613 |
Test(err == KErrNone);
|
sl@0
|
614 |
|
sl@0
|
615 |
err = session.TestFunction4(KShortDes8,KLongDes16);
|
sl@0
|
616 |
Test(err == KErrNone);
|
sl@0
|
617 |
|
sl@0
|
618 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
619 |
}
|
sl@0
|
620 |
|
sl@0
|
621 |
/*
|
sl@0
|
622 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
623 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
624 |
Any calls to this function with parameters outside the constraints
|
sl@0
|
625 |
defined above should result in the client being panicked with
|
sl@0
|
626 |
KErrBadDescriptor
|
sl@0
|
627 |
*/
|
sl@0
|
628 |
void TestFunction4BL()
|
sl@0
|
629 |
{
|
sl@0
|
630 |
RClientMessageTestSession session;
|
sl@0
|
631 |
_LIT8(KDes8, "Des8");
|
sl@0
|
632 |
_LIT(KDes16, "Des16");
|
sl@0
|
633 |
|
sl@0
|
634 |
TInt err = session.Connect();
|
sl@0
|
635 |
Test(err == KErrNone);
|
sl@0
|
636 |
|
sl@0
|
637 |
CleanupClosePushL(session);
|
sl@0
|
638 |
|
sl@0
|
639 |
//This should result in the server panicking the client
|
sl@0
|
640 |
err = session.TestFunction4(KDes16,KDes8);
|
sl@0
|
641 |
|
sl@0
|
642 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
643 |
}
|
sl@0
|
644 |
|
sl@0
|
645 |
/*
|
sl@0
|
646 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
647 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
648 |
Any calls to this function with parameters outside the constraints
|
sl@0
|
649 |
defined above should result in the client being panicked with
|
sl@0
|
650 |
KErrBadDescriptor
|
sl@0
|
651 |
*/
|
sl@0
|
652 |
void TestFunction4CL()
|
sl@0
|
653 |
{
|
sl@0
|
654 |
RClientMessageTestSession session;
|
sl@0
|
655 |
_LIT(KDes16, "Des16");
|
sl@0
|
656 |
_LIT8(KLongDes8, "This is a long Des8");
|
sl@0
|
657 |
|
sl@0
|
658 |
TInt err = session.Connect();
|
sl@0
|
659 |
Test(err == KErrNone);
|
sl@0
|
660 |
|
sl@0
|
661 |
CleanupClosePushL(session);
|
sl@0
|
662 |
|
sl@0
|
663 |
//This should result in the server panicing the client
|
sl@0
|
664 |
err = session.TestFunction4(KLongDes8,KDes16);
|
sl@0
|
665 |
|
sl@0
|
666 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
667 |
}
|
sl@0
|
668 |
|
sl@0
|
669 |
/*
|
sl@0
|
670 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
671 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
672 |
Any calls to this function with parameters outside the constraints
|
sl@0
|
673 |
defined above should result in the client being panicked with
|
sl@0
|
674 |
KErrBadDescriptor
|
sl@0
|
675 |
*/
|
sl@0
|
676 |
void TestFunction4DL()
|
sl@0
|
677 |
{
|
sl@0
|
678 |
RClientMessageTestSession session;
|
sl@0
|
679 |
_LIT8(KDes8, "Des8");
|
sl@0
|
680 |
_LIT(KLongDes16, "This is a long Des16 that should cause an issue");
|
sl@0
|
681 |
|
sl@0
|
682 |
TInt err = session.Connect();
|
sl@0
|
683 |
Test(err == KErrNone);
|
sl@0
|
684 |
|
sl@0
|
685 |
CleanupClosePushL(session);
|
sl@0
|
686 |
|
sl@0
|
687 |
//This should result in the server panicing the client
|
sl@0
|
688 |
err = session.TestFunction4(KDes8,KLongDes16);
|
sl@0
|
689 |
|
sl@0
|
690 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
691 |
}
|
sl@0
|
692 |
|
sl@0
|
693 |
/*
|
sl@0
|
694 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
695 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
696 |
Any calls to this function with parameters outside the constraints
|
sl@0
|
697 |
defined above should result in the client being panicked with
|
sl@0
|
698 |
KErrBadDescriptor
|
sl@0
|
699 |
*/
|
sl@0
|
700 |
void TestFunction4EL()
|
sl@0
|
701 |
{
|
sl@0
|
702 |
RClientMessageTestSession session;
|
sl@0
|
703 |
_LIT(KDes16, "Des16");
|
sl@0
|
704 |
_LIT8(KEmptyDes8, "");
|
sl@0
|
705 |
TInt err = session.Connect();
|
sl@0
|
706 |
Test(err == KErrNone);
|
sl@0
|
707 |
|
sl@0
|
708 |
CleanupClosePushL(session);
|
sl@0
|
709 |
|
sl@0
|
710 |
//This should result in the server panicing the client
|
sl@0
|
711 |
//as the function expects a descriptor of minimum length 2
|
sl@0
|
712 |
err = session.TestFunction4(KEmptyDes8,KDes16);
|
sl@0
|
713 |
|
sl@0
|
714 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
715 |
}
|
sl@0
|
716 |
|
sl@0
|
717 |
/*
|
sl@0
|
718 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
719 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
720 |
Any calls to this function with parameters outside the constraints
|
sl@0
|
721 |
defined above should result in the client being panicked with
|
sl@0
|
722 |
KErrBadDescriptor
|
sl@0
|
723 |
*/
|
sl@0
|
724 |
void TestFunction4FL()
|
sl@0
|
725 |
{
|
sl@0
|
726 |
RClientMessageTestSession session;
|
sl@0
|
727 |
_LIT8(KDes8, "Des8");
|
sl@0
|
728 |
TInt err = session.Connect();
|
sl@0
|
729 |
Test(err == KErrNone);
|
sl@0
|
730 |
|
sl@0
|
731 |
CleanupClosePushL(session);
|
sl@0
|
732 |
|
sl@0
|
733 |
//This should result in the server panicing the client
|
sl@0
|
734 |
//as the function expects 2 descriptor arguments
|
sl@0
|
735 |
err = session.TestFunction4(KDes8);
|
sl@0
|
736 |
|
sl@0
|
737 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
738 |
}
|
sl@0
|
739 |
|
sl@0
|
740 |
|
sl@0
|
741 |
/*
|
sl@0
|
742 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
743 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
744 |
The server attempts to read from the first descriptor but passes
|
sl@0
|
745 |
in a buffer that is too small. This is a programming error and
|
sl@0
|
746 |
should result in the server panicking with ECMPanicBadDescriptor in UDEB
|
sl@0
|
747 |
and returning KErrNone in UREL
|
sl@0
|
748 |
KErrBadDescriptor
|
sl@0
|
749 |
*/
|
sl@0
|
750 |
void TestFunction5L()
|
sl@0
|
751 |
{
|
sl@0
|
752 |
RClientMessageTestSession session;
|
sl@0
|
753 |
_LIT8(KDes8, "Des8");
|
sl@0
|
754 |
_LIT(KDes16, "Des16");
|
sl@0
|
755 |
|
sl@0
|
756 |
TInt err = session.Connect();
|
sl@0
|
757 |
Test(err == KErrNone);
|
sl@0
|
758 |
|
sl@0
|
759 |
CleanupClosePushL(session);
|
sl@0
|
760 |
|
sl@0
|
761 |
err = session.TestFunction5(KDes8,KDes16);
|
sl@0
|
762 |
#ifdef _DEBUG
|
sl@0
|
763 |
Test(err == KErrServerTerminated);
|
sl@0
|
764 |
|
sl@0
|
765 |
TInt type = serverProcess.ExitType();
|
sl@0
|
766 |
Test(type == EExitPanic);
|
sl@0
|
767 |
|
sl@0
|
768 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
769 |
Test(reason == ECMPanicBadDescriptor);
|
sl@0
|
770 |
#else
|
sl@0
|
771 |
Test(err == KErrNone);
|
sl@0
|
772 |
#endif
|
sl@0
|
773 |
|
sl@0
|
774 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
775 |
}
|
sl@0
|
776 |
|
sl@0
|
777 |
/*
|
sl@0
|
778 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
779 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
780 |
Any calls to this function with parameters outside the constraints
|
sl@0
|
781 |
defined above should result in the client being panicked with
|
sl@0
|
782 |
KErrBadDescriptor
|
sl@0
|
783 |
*/
|
sl@0
|
784 |
void TestFunction6L()
|
sl@0
|
785 |
{
|
sl@0
|
786 |
RClientMessageTestSession session;
|
sl@0
|
787 |
_LIT8(KDes8, "Des8");
|
sl@0
|
788 |
_LIT(KDes16, "Des16");
|
sl@0
|
789 |
|
sl@0
|
790 |
TInt err = session.Connect();
|
sl@0
|
791 |
Test(err == KErrNone);
|
sl@0
|
792 |
|
sl@0
|
793 |
CleanupClosePushL(session);
|
sl@0
|
794 |
|
sl@0
|
795 |
err = session.TestFunction6(KDes8,KDes16);
|
sl@0
|
796 |
Test(err == KErrArgument);
|
sl@0
|
797 |
|
sl@0
|
798 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
799 |
}
|
sl@0
|
800 |
|
sl@0
|
801 |
/*
|
sl@0
|
802 |
This test function accepts 2 descriptor parameters as defined below
|
sl@0
|
803 |
{EParamDes8Read,2,16},{EParamDes16Read,0,32}
|
sl@0
|
804 |
Any calls to this function with parameters outside the constraints
|
sl@0
|
805 |
defined above should result in the client being panicked with
|
sl@0
|
806 |
KErrBadDescriptor
|
sl@0
|
807 |
*/
|
sl@0
|
808 |
void TestFunction7L()
|
sl@0
|
809 |
{
|
sl@0
|
810 |
RClientMessageTestSession session;
|
sl@0
|
811 |
_LIT8(KDes8, "Descriptor8");
|
sl@0
|
812 |
_LIT(KDes16, "Descriptor16");
|
sl@0
|
813 |
|
sl@0
|
814 |
TInt err = session.Connect();
|
sl@0
|
815 |
Test(err == KErrNone);
|
sl@0
|
816 |
|
sl@0
|
817 |
CleanupClosePushL(session);
|
sl@0
|
818 |
|
sl@0
|
819 |
err = session.TestFunction7(KDes8,KDes16);
|
sl@0
|
820 |
Test(err == KErrNone);
|
sl@0
|
821 |
|
sl@0
|
822 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
823 |
}
|
sl@0
|
824 |
|
sl@0
|
825 |
/*
|
sl@0
|
826 |
This test function accepts 1 descriptor parameter as defined below
|
sl@0
|
827 |
{EParamDes8Read,0,-16}
|
sl@0
|
828 |
As can be seen above, the schema is incorrectly defined as iMax is
|
sl@0
|
829 |
negative. This is a programming error and should result
|
sl@0
|
830 |
in the server panicking with ECMPanicBadMessageSchema in UDEB
|
sl@0
|
831 |
or the client being panicked with KErrBadDescriptor in UREL
|
sl@0
|
832 |
*/
|
sl@0
|
833 |
void TestFunction8L()
|
sl@0
|
834 |
{
|
sl@0
|
835 |
RClientMessageTestSession session;
|
sl@0
|
836 |
_LIT8(KDes8, "Descriptor8");
|
sl@0
|
837 |
_LIT(KDes16, "Descriptor16");
|
sl@0
|
838 |
|
sl@0
|
839 |
TInt err = session.Connect();
|
sl@0
|
840 |
Test(err == KErrNone);
|
sl@0
|
841 |
|
sl@0
|
842 |
CleanupClosePushL(session);
|
sl@0
|
843 |
|
sl@0
|
844 |
//this function is incorrectly defined in the
|
sl@0
|
845 |
//message schema. This should result in the
|
sl@0
|
846 |
//server panicking
|
sl@0
|
847 |
err = session.TestFunction8(KDes8,KDes16);
|
sl@0
|
848 |
|
sl@0
|
849 |
//In debug builds the server should panic.
|
sl@0
|
850 |
//In release builds the client will be panicked
|
sl@0
|
851 |
#ifdef _DEBUG
|
sl@0
|
852 |
Test(err == KErrServerTerminated);
|
sl@0
|
853 |
|
sl@0
|
854 |
TInt type = serverProcess.ExitType();
|
sl@0
|
855 |
Test(type == EExitPanic);
|
sl@0
|
856 |
|
sl@0
|
857 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
858 |
Test(reason == ECMPanicBadMessageSchema);
|
sl@0
|
859 |
#endif
|
sl@0
|
860 |
|
sl@0
|
861 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
862 |
}
|
sl@0
|
863 |
|
sl@0
|
864 |
|
sl@0
|
865 |
/*
|
sl@0
|
866 |
This test function accepts 2 descriptor parameters and 2 TInt
|
sl@0
|
867 |
parameters as defined below
|
sl@0
|
868 |
{EParamDes8,64,64},{EParamInt,0,64},{EParamDes16,128,128},{EParamInt,0,128}
|
sl@0
|
869 |
Any calls to this function with descriptor parameters outside the constraints
|
sl@0
|
870 |
defined above should result in the client being paniced with
|
sl@0
|
871 |
KErrBadDescriptor or KErrOverflow
|
sl@0
|
872 |
*/
|
sl@0
|
873 |
void TestFunction9AL()
|
sl@0
|
874 |
{
|
sl@0
|
875 |
TBuf8<64> buf8;
|
sl@0
|
876 |
TBuf<128> buf;
|
sl@0
|
877 |
TBuf8<64> buf82;
|
sl@0
|
878 |
TBuf<128> buf2;
|
sl@0
|
879 |
|
sl@0
|
880 |
RClientMessageTestSession session;
|
sl@0
|
881 |
|
sl@0
|
882 |
TInt err = session.Connect();
|
sl@0
|
883 |
Test(err == KErrNone);
|
sl@0
|
884 |
|
sl@0
|
885 |
CleanupClosePushL(session);
|
sl@0
|
886 |
|
sl@0
|
887 |
err = session.TestFunction9(buf8,0,buf,0);
|
sl@0
|
888 |
Test(err == KErrNone);
|
sl@0
|
889 |
Test(buf8.Find(_L8("CClientMessageTest")) == 0);
|
sl@0
|
890 |
Test(buf.Find(_L("CClientMessageTest")) == 0);
|
sl@0
|
891 |
|
sl@0
|
892 |
err = session.TestFunction9(buf82,7,buf2,73);
|
sl@0
|
893 |
Test(err == KErrNone);
|
sl@0
|
894 |
Test(buf82.Find(_L8("CClientMessageTest")) == 7);
|
sl@0
|
895 |
Test(buf2.Find(_L("CClientMessageTest")) == 73);
|
sl@0
|
896 |
|
sl@0
|
897 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
898 |
}
|
sl@0
|
899 |
|
sl@0
|
900 |
/*
|
sl@0
|
901 |
This test function accepts 2 descriptor parameters and 2 TInt
|
sl@0
|
902 |
parameters as defined below
|
sl@0
|
903 |
{EParamDes8,64,64},{EParamInt,0,64},{EParamDes16,128,128},{EParamInt,0,128}
|
sl@0
|
904 |
Any calls to this function with descriptor parameters outside the constraints
|
sl@0
|
905 |
defined above should result in the client being paniced with
|
sl@0
|
906 |
KErrBadDescriptor
|
sl@0
|
907 |
*/
|
sl@0
|
908 |
void TestFunction9BL()
|
sl@0
|
909 |
{
|
sl@0
|
910 |
|
sl@0
|
911 |
TBuf8<32> smallBuf8;
|
sl@0
|
912 |
TBuf<32> smallBuf;
|
sl@0
|
913 |
|
sl@0
|
914 |
RClientMessageTestSession session;
|
sl@0
|
915 |
|
sl@0
|
916 |
TInt err = session.Connect();
|
sl@0
|
917 |
Test(err == KErrNone);
|
sl@0
|
918 |
|
sl@0
|
919 |
CleanupClosePushL(session);
|
sl@0
|
920 |
|
sl@0
|
921 |
//this should result in a client panic with KErrBadDescriptor
|
sl@0
|
922 |
err = session.TestFunction9(smallBuf8,0,smallBuf,0);
|
sl@0
|
923 |
|
sl@0
|
924 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
925 |
}
|
sl@0
|
926 |
|
sl@0
|
927 |
/*
|
sl@0
|
928 |
This test function accepts 2 descriptor parameters and 2 TInt
|
sl@0
|
929 |
parameters as defined below
|
sl@0
|
930 |
{EParamDes8,64,64},{EParamInt,0,64},{EParamDes16,128,128},{EParamInt,0,128}
|
sl@0
|
931 |
The server function attempts to write to the supplied descriptors at the
|
sl@0
|
932 |
offsets specified by the two TInt values. In this test the server will
|
sl@0
|
933 |
attempt to write to the first buffer with an offset of 60 which should
|
sl@0
|
934 |
result in the client being panicked with KErrOverflow
|
sl@0
|
935 |
*/
|
sl@0
|
936 |
void TestFunction9CL()
|
sl@0
|
937 |
{
|
sl@0
|
938 |
|
sl@0
|
939 |
TBuf8<64> buf8;
|
sl@0
|
940 |
TBuf<128> buf;
|
sl@0
|
941 |
|
sl@0
|
942 |
RClientMessageTestSession session;
|
sl@0
|
943 |
|
sl@0
|
944 |
TInt err = session.Connect();
|
sl@0
|
945 |
Test(err == KErrNone);
|
sl@0
|
946 |
|
sl@0
|
947 |
CleanupClosePushL(session);
|
sl@0
|
948 |
|
sl@0
|
949 |
//this will attempt to write a descriptor with an offset of 60
|
sl@0
|
950 |
//which should tresult in a client panic KErrOverflow
|
sl@0
|
951 |
err = session.TestFunction9(buf8,60,buf,10);
|
sl@0
|
952 |
|
sl@0
|
953 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
954 |
}
|
sl@0
|
955 |
|
sl@0
|
956 |
/*
|
sl@0
|
957 |
This test function accepts 2 descriptor parameters and 2 TInt
|
sl@0
|
958 |
parameters as defined below
|
sl@0
|
959 |
{EParamDes8,64,64},{EParamInt,0,64},{EParamDes16,128,128},{EParamInt,0,128}
|
sl@0
|
960 |
The test function below calls this function but passed the 8 and 16 bit
|
sl@0
|
961 |
descriptors in the wrong order which should result in the client being
|
sl@0
|
962 |
panicked with KErrBadDescriptor
|
sl@0
|
963 |
*/
|
sl@0
|
964 |
void TestFunction9DL()
|
sl@0
|
965 |
{
|
sl@0
|
966 |
TBuf8<64> buf8;
|
sl@0
|
967 |
TBuf<128> buf;
|
sl@0
|
968 |
|
sl@0
|
969 |
RClientMessageTestSession session;
|
sl@0
|
970 |
|
sl@0
|
971 |
TInt err = session.Connect();
|
sl@0
|
972 |
Test(err == KErrNone);
|
sl@0
|
973 |
|
sl@0
|
974 |
CleanupClosePushL(session);
|
sl@0
|
975 |
|
sl@0
|
976 |
//this should result in a client panic as the descriptors
|
sl@0
|
977 |
//are passed in in the wrong order
|
sl@0
|
978 |
err = session.TestFunction9(buf,0,buf8,10);
|
sl@0
|
979 |
|
sl@0
|
980 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
981 |
}
|
sl@0
|
982 |
|
sl@0
|
983 |
/*
|
sl@0
|
984 |
This test function accepts 2 descriptor parameters and 2 TInt
|
sl@0
|
985 |
parameters as defined below
|
sl@0
|
986 |
{EParamDes8,64,64},{EParamInt,0,64},{EParamDes16,128,128},{EParamInt,0,128}
|
sl@0
|
987 |
The server function attempts to write a descriptor that is larger than the
|
sl@0
|
988 |
buffer supplied by the client which should result in the client being
|
sl@0
|
989 |
panicked with KErrOverflow
|
sl@0
|
990 |
*/
|
sl@0
|
991 |
void TestFunction10L()
|
sl@0
|
992 |
{
|
sl@0
|
993 |
|
sl@0
|
994 |
TBuf8<64> buf8;
|
sl@0
|
995 |
TBuf<128> buf;
|
sl@0
|
996 |
|
sl@0
|
997 |
RClientMessageTestSession session;
|
sl@0
|
998 |
|
sl@0
|
999 |
TInt err = session.Connect();
|
sl@0
|
1000 |
Test(err == KErrNone);
|
sl@0
|
1001 |
|
sl@0
|
1002 |
CleanupClosePushL(session);
|
sl@0
|
1003 |
|
sl@0
|
1004 |
//This function tries to write a descriptor
|
sl@0
|
1005 |
//that is larger than the declared buffer
|
sl@0
|
1006 |
//this should result in a panic
|
sl@0
|
1007 |
err = session.TestFunction10(buf8,0,buf,0);
|
sl@0
|
1008 |
|
sl@0
|
1009 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1010 |
}
|
sl@0
|
1011 |
|
sl@0
|
1012 |
/*
|
sl@0
|
1013 |
This test function accepts 2 descriptor parameters and 2 TInt
|
sl@0
|
1014 |
parameters as defined below
|
sl@0
|
1015 |
{EParamDes8,64,64},{EParamInt,0,64},{EParamDes16,128,128},{EParamInt,0,128}
|
sl@0
|
1016 |
The server function attempts to read from a descriptor that is smaller
|
sl@0
|
1017 |
than the specified minimum length. This is a programming error and
|
sl@0
|
1018 |
should result in the server panicking with ECMPanicBadDescriptor in UDEB
|
sl@0
|
1019 |
and returning KErrNone in UREL
|
sl@0
|
1020 |
*/
|
sl@0
|
1021 |
void TestFunction11L()
|
sl@0
|
1022 |
{
|
sl@0
|
1023 |
_LIT8(KLongDes8,"This descriptor is longer than 32 characters");
|
sl@0
|
1024 |
TBuf8<64> buf8(KLongDes8);
|
sl@0
|
1025 |
TBuf<128> buf;
|
sl@0
|
1026 |
|
sl@0
|
1027 |
RClientMessageTestSession session;
|
sl@0
|
1028 |
|
sl@0
|
1029 |
TInt err = session.Connect();
|
sl@0
|
1030 |
Test(err == KErrNone);
|
sl@0
|
1031 |
|
sl@0
|
1032 |
CleanupClosePushL(session);
|
sl@0
|
1033 |
|
sl@0
|
1034 |
//This function tries to read from a descriptor
|
sl@0
|
1035 |
//into a buffer that is smaller than the allowed min length
|
sl@0
|
1036 |
//this should result in a server panic
|
sl@0
|
1037 |
err = session.TestFunction11(buf8,0,buf,0);
|
sl@0
|
1038 |
#ifdef _DEBUG
|
sl@0
|
1039 |
Test(err == KErrServerTerminated);
|
sl@0
|
1040 |
|
sl@0
|
1041 |
TInt type = serverProcess.ExitType();
|
sl@0
|
1042 |
Test(type == EExitPanic);
|
sl@0
|
1043 |
|
sl@0
|
1044 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
1045 |
Test(reason == ECMPanicBadDescriptor);
|
sl@0
|
1046 |
#else
|
sl@0
|
1047 |
Test(err == KErrNone);
|
sl@0
|
1048 |
#endif
|
sl@0
|
1049 |
|
sl@0
|
1050 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1051 |
}
|
sl@0
|
1052 |
|
sl@0
|
1053 |
/*
|
sl@0
|
1054 |
This test function accepts 1 descriptor parameter as defined below
|
sl@0
|
1055 |
{EParamDes8,-64,64}
|
sl@0
|
1056 |
As can be seen above, the schema is incorrectly defined as iMin is
|
sl@0
|
1057 |
negative. This is a programming error and should result
|
sl@0
|
1058 |
in the server panicking with ECMPanicBadMessageSchema in UDEB
|
sl@0
|
1059 |
or returning KErrNone in UREL
|
sl@0
|
1060 |
*/
|
sl@0
|
1061 |
void TestFunction12L()
|
sl@0
|
1062 |
{
|
sl@0
|
1063 |
|
sl@0
|
1064 |
TBuf8<64> buf8;
|
sl@0
|
1065 |
TBuf<128> buf;
|
sl@0
|
1066 |
|
sl@0
|
1067 |
RClientMessageTestSession session;
|
sl@0
|
1068 |
|
sl@0
|
1069 |
TInt err = session.Connect();
|
sl@0
|
1070 |
Test(err == KErrNone);
|
sl@0
|
1071 |
|
sl@0
|
1072 |
CleanupClosePushL(session);
|
sl@0
|
1073 |
|
sl@0
|
1074 |
//this function is incorrectly defined in the
|
sl@0
|
1075 |
//message schema. This should result in the
|
sl@0
|
1076 |
//server panicking in debug builds
|
sl@0
|
1077 |
//In release builds KErrNone should be returned
|
sl@0
|
1078 |
err = session.TestFunction12(buf8,0,buf,0);
|
sl@0
|
1079 |
|
sl@0
|
1080 |
#ifdef _DEBUG
|
sl@0
|
1081 |
Test(err == KErrServerTerminated);
|
sl@0
|
1082 |
|
sl@0
|
1083 |
TInt type = serverProcess.ExitType();
|
sl@0
|
1084 |
Test(type == EExitPanic);
|
sl@0
|
1085 |
|
sl@0
|
1086 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
1087 |
Test(reason == ECMPanicBadMessageSchema);
|
sl@0
|
1088 |
#else
|
sl@0
|
1089 |
Test(err == KErrNone);
|
sl@0
|
1090 |
#endif
|
sl@0
|
1091 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1092 |
}
|
sl@0
|
1093 |
|
sl@0
|
1094 |
/*
|
sl@0
|
1095 |
This test function accepts 1 descriptor parameter as defined below
|
sl@0
|
1096 |
{EParamDes8,64,-64}
|
sl@0
|
1097 |
As can be seen above, the schema is incorrectly defined as iMax is
|
sl@0
|
1098 |
negative. This is a programming error and should result
|
sl@0
|
1099 |
in the server panicking with ECMPanicBadMessageSchema in UDEB
|
sl@0
|
1100 |
or panicking the client with KErrBadDescriptor in UREL
|
sl@0
|
1101 |
*/
|
sl@0
|
1102 |
void TestFunction13L()
|
sl@0
|
1103 |
{
|
sl@0
|
1104 |
|
sl@0
|
1105 |
TBuf8<64> buf8;
|
sl@0
|
1106 |
TBuf<128> buf;
|
sl@0
|
1107 |
|
sl@0
|
1108 |
RClientMessageTestSession session;
|
sl@0
|
1109 |
|
sl@0
|
1110 |
TInt err = session.Connect();
|
sl@0
|
1111 |
Test(err == KErrNone);
|
sl@0
|
1112 |
|
sl@0
|
1113 |
CleanupClosePushL(session);
|
sl@0
|
1114 |
|
sl@0
|
1115 |
//this function is incorrectly defined in the
|
sl@0
|
1116 |
//message schema. This should result in the
|
sl@0
|
1117 |
//server panicking in debug builds
|
sl@0
|
1118 |
err = session.TestFunction13(buf8,0,buf,0);
|
sl@0
|
1119 |
|
sl@0
|
1120 |
#ifdef _DEBUG
|
sl@0
|
1121 |
Test(err == KErrServerTerminated);
|
sl@0
|
1122 |
|
sl@0
|
1123 |
TInt type = serverProcess.ExitType();
|
sl@0
|
1124 |
Test(type == EExitPanic);
|
sl@0
|
1125 |
|
sl@0
|
1126 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
1127 |
Test(reason == ECMPanicBadMessageSchema);
|
sl@0
|
1128 |
#endif
|
sl@0
|
1129 |
|
sl@0
|
1130 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1131 |
}
|
sl@0
|
1132 |
|
sl@0
|
1133 |
/*
|
sl@0
|
1134 |
This test function accepts 2 8bit descriptor parameters and 1 TInt
|
sl@0
|
1135 |
parameter as defined below
|
sl@0
|
1136 |
{EParamDes8Read,0,16},{EParamInt,0,16},{EParamDes8,16,16}
|
sl@0
|
1137 |
The server function attempts reads from the first descriptor and
|
sl@0
|
1138 |
then writes into the second descriptor at the offset supplied by
|
sl@0
|
1139 |
the TInt value. The test function below checks that the reading
|
sl@0
|
1140 |
and writing with offset occurs as expected by checking the strings
|
sl@0
|
1141 |
written by the server.
|
sl@0
|
1142 |
*/
|
sl@0
|
1143 |
void TestFunction14L()
|
sl@0
|
1144 |
{
|
sl@0
|
1145 |
|
sl@0
|
1146 |
_LIT8(KDes8, "Descriptor8");
|
sl@0
|
1147 |
TBuf8<16> buf;
|
sl@0
|
1148 |
|
sl@0
|
1149 |
RClientMessageTestSession session;
|
sl@0
|
1150 |
|
sl@0
|
1151 |
TInt err = session.Connect();
|
sl@0
|
1152 |
Test(err == KErrNone);
|
sl@0
|
1153 |
|
sl@0
|
1154 |
CleanupClosePushL(session);
|
sl@0
|
1155 |
|
sl@0
|
1156 |
err = session.TestFunction14(KDes8,0,buf);
|
sl@0
|
1157 |
Test(err == KErrNone);
|
sl@0
|
1158 |
Test(buf.Find(_L8("Descriptor8")) == 0);
|
sl@0
|
1159 |
|
sl@0
|
1160 |
err = session.TestFunction14(KDes8,3,buf);
|
sl@0
|
1161 |
Test(err == KErrNone);
|
sl@0
|
1162 |
Test(buf.Find(_L8("criptor8")) == 0);
|
sl@0
|
1163 |
|
sl@0
|
1164 |
err = session.TestFunction14(KDes8,8,buf);
|
sl@0
|
1165 |
Test(err == KErrNone);
|
sl@0
|
1166 |
Test(buf.Find(_L8("or8")) == 0);
|
sl@0
|
1167 |
|
sl@0
|
1168 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1169 |
}
|
sl@0
|
1170 |
|
sl@0
|
1171 |
/*
|
sl@0
|
1172 |
This test function accepts 2 16bit descriptor parameters and 1 TInt
|
sl@0
|
1173 |
parameter as defined below
|
sl@0
|
1174 |
{EParamDes16Read,0,64},{EParamInt,0,64},{EParamDes16,64,64}
|
sl@0
|
1175 |
The server function attempts reads from the first descriptor and
|
sl@0
|
1176 |
then writes into the second descriptor at the offset supplied by
|
sl@0
|
1177 |
the TInt value. The test function below checks that the reading
|
sl@0
|
1178 |
and writing with offset occurs as expected by checking the strings
|
sl@0
|
1179 |
written by the server.
|
sl@0
|
1180 |
*/
|
sl@0
|
1181 |
void TestFunction15L()
|
sl@0
|
1182 |
{
|
sl@0
|
1183 |
|
sl@0
|
1184 |
_LIT(KDes, "Descriptor");
|
sl@0
|
1185 |
TBuf<64> buf;
|
sl@0
|
1186 |
|
sl@0
|
1187 |
RClientMessageTestSession session;
|
sl@0
|
1188 |
|
sl@0
|
1189 |
TInt err = session.Connect();
|
sl@0
|
1190 |
Test(err == KErrNone);
|
sl@0
|
1191 |
|
sl@0
|
1192 |
CleanupClosePushL(session);
|
sl@0
|
1193 |
|
sl@0
|
1194 |
err = session.TestFunction15(KDes,0,buf);
|
sl@0
|
1195 |
Test(err == KErrNone);
|
sl@0
|
1196 |
Test(buf.Find(_L("Descriptor")) == 0);
|
sl@0
|
1197 |
|
sl@0
|
1198 |
err = session.TestFunction15(KDes,3,buf);
|
sl@0
|
1199 |
Test(err == KErrNone);
|
sl@0
|
1200 |
Test(buf.Find(_L("criptor")) == 0);
|
sl@0
|
1201 |
|
sl@0
|
1202 |
err = session.TestFunction15(KDes,8,buf);
|
sl@0
|
1203 |
Test(err == KErrNone);
|
sl@0
|
1204 |
Test(buf.Find(_L("or")) == 0);
|
sl@0
|
1205 |
|
sl@0
|
1206 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1207 |
}
|
sl@0
|
1208 |
|
sl@0
|
1209 |
|
sl@0
|
1210 |
/*
|
sl@0
|
1211 |
This test function accepts a single TAny* parameter as below
|
sl@0
|
1212 |
{EParamPtr,0,0}
|
sl@0
|
1213 |
The server function reads the pointer value.
|
sl@0
|
1214 |
*/
|
sl@0
|
1215 |
void TestFunction16L()
|
sl@0
|
1216 |
{
|
sl@0
|
1217 |
RClientMessageTestSession session;
|
sl@0
|
1218 |
|
sl@0
|
1219 |
TInt err = session.Connect();
|
sl@0
|
1220 |
Test(err == KErrNone);
|
sl@0
|
1221 |
|
sl@0
|
1222 |
CleanupClosePushL(session);
|
sl@0
|
1223 |
|
sl@0
|
1224 |
err = session.TestFunction16(0);
|
sl@0
|
1225 |
Test(err == KErrNone);
|
sl@0
|
1226 |
|
sl@0
|
1227 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1228 |
}
|
sl@0
|
1229 |
|
sl@0
|
1230 |
|
sl@0
|
1231 |
/*
|
sl@0
|
1232 |
This test function accepts a single TAny* parameter as below
|
sl@0
|
1233 |
{EParamPtr,0,0}
|
sl@0
|
1234 |
The server function attempts to call CMessageParameterBase::WriteL
|
sl@0
|
1235 |
which is not defined for a Ptr type. This is a programming error and
|
sl@0
|
1236 |
should result in the server panicking with ECMPanicWrongParameterType
|
sl@0
|
1237 |
in UDEB or returning KErrWrongParameterType in UREL
|
sl@0
|
1238 |
*/
|
sl@0
|
1239 |
void TestFunction17L()
|
sl@0
|
1240 |
{
|
sl@0
|
1241 |
RClientMessageTestSession session;
|
sl@0
|
1242 |
|
sl@0
|
1243 |
TInt err = session.Connect();
|
sl@0
|
1244 |
Test(err == KErrNone);
|
sl@0
|
1245 |
|
sl@0
|
1246 |
CleanupClosePushL(session);
|
sl@0
|
1247 |
|
sl@0
|
1248 |
//This should result in the server panicking with ECMPanicWrongParameterType
|
sl@0
|
1249 |
//in UDEB or returning KErrWrongParameterType in UREL
|
sl@0
|
1250 |
err = session.TestFunction17(0);
|
sl@0
|
1251 |
#ifdef _DEBUG
|
sl@0
|
1252 |
Test(err == KErrServerTerminated);
|
sl@0
|
1253 |
|
sl@0
|
1254 |
TInt type = serverProcess.ExitType();
|
sl@0
|
1255 |
Test(type == EExitPanic);
|
sl@0
|
1256 |
|
sl@0
|
1257 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
1258 |
Test(reason == ECMPanicWrongParameterType);
|
sl@0
|
1259 |
#else
|
sl@0
|
1260 |
Test(err == KErrWrongParameterType);
|
sl@0
|
1261 |
#endif
|
sl@0
|
1262 |
|
sl@0
|
1263 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1264 |
}
|
sl@0
|
1265 |
|
sl@0
|
1266 |
/*
|
sl@0
|
1267 |
This test function accepts a single custom TPckg parameter as below
|
sl@0
|
1268 |
{EParamCustom1,sizeof(CMTestStruct2),sizeof(CMTestStruct2)}.
|
sl@0
|
1269 |
CMTestStruct2 is defined as follows:
|
sl@0
|
1270 |
|
sl@0
|
1271 |
struct CMTestStruct1
|
sl@0
|
1272 |
{
|
sl@0
|
1273 |
TInt iInt;
|
sl@0
|
1274 |
TBuf<32> iDes;
|
sl@0
|
1275 |
};
|
sl@0
|
1276 |
|
sl@0
|
1277 |
struct CMTestStruct2
|
sl@0
|
1278 |
{
|
sl@0
|
1279 |
TInt iCount;
|
sl@0
|
1280 |
CMTestStruct1* iStruct;
|
sl@0
|
1281 |
TCMTestEnum iEnum;
|
sl@0
|
1282 |
TBuf<32> iDes;
|
sl@0
|
1283 |
};
|
sl@0
|
1284 |
|
sl@0
|
1285 |
The EParamCustom1 parameter type is validated using a custom validation
|
sl@0
|
1286 |
function defined in the testclientmessageschema.cpp. The validation
|
sl@0
|
1287 |
function checks that iEnum is in the valid range for TCMTestEnum,
|
sl@0
|
1288 |
that iCount >= 0 and that iDes.Length() > 0. If any of these checks
|
sl@0
|
1289 |
fail the server should return KErrBadParameter.
|
sl@0
|
1290 |
*/
|
sl@0
|
1291 |
void TestFunction18AL()
|
sl@0
|
1292 |
{
|
sl@0
|
1293 |
RClientMessageTestSession session;
|
sl@0
|
1294 |
|
sl@0
|
1295 |
TInt err = session.Connect();
|
sl@0
|
1296 |
Test(err == KErrNone);
|
sl@0
|
1297 |
|
sl@0
|
1298 |
CleanupClosePushL(session);
|
sl@0
|
1299 |
|
sl@0
|
1300 |
CMTestStruct1 struct1;
|
sl@0
|
1301 |
struct1.iInt = 7;
|
sl@0
|
1302 |
struct1.iDes = _L("Test Struct");
|
sl@0
|
1303 |
|
sl@0
|
1304 |
CMTestStruct2 struct2;
|
sl@0
|
1305 |
struct2.iCount = 1;
|
sl@0
|
1306 |
struct2.iStruct = &struct1;
|
sl@0
|
1307 |
struct2.iEnum = ETestVal1;
|
sl@0
|
1308 |
struct2.iDes = _L("Test Struct 2");
|
sl@0
|
1309 |
|
sl@0
|
1310 |
TPckg<CMTestStruct2> pData(struct2);
|
sl@0
|
1311 |
|
sl@0
|
1312 |
err = session.TestFunction18(pData);
|
sl@0
|
1313 |
Test(err == KErrNone);
|
sl@0
|
1314 |
|
sl@0
|
1315 |
Test(struct2.iCount == 0);
|
sl@0
|
1316 |
|
sl@0
|
1317 |
CMTestStruct1 struct3;
|
sl@0
|
1318 |
struct3.iInt = -1;
|
sl@0
|
1319 |
struct3.iDes = _L("");
|
sl@0
|
1320 |
|
sl@0
|
1321 |
CMTestStruct2 struct4;
|
sl@0
|
1322 |
struct4.iCount = 1;
|
sl@0
|
1323 |
struct4.iStruct = &struct3;
|
sl@0
|
1324 |
struct4.iEnum = -1;
|
sl@0
|
1325 |
struct4.iDes = _L("Test Struct 2");
|
sl@0
|
1326 |
|
sl@0
|
1327 |
TPckg<CMTestStruct2> pData2(struct4);
|
sl@0
|
1328 |
|
sl@0
|
1329 |
//As iEnum is not in the valid range this validation should fail
|
sl@0
|
1330 |
err = session.TestFunction18(pData2);
|
sl@0
|
1331 |
Test(err == KErrBadParameter);
|
sl@0
|
1332 |
|
sl@0
|
1333 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1334 |
}
|
sl@0
|
1335 |
|
sl@0
|
1336 |
/*
|
sl@0
|
1337 |
This test function accepts a single custom TPckg parameter as below
|
sl@0
|
1338 |
{EParamCustom1,sizeof(CMTestStruct2),sizeof(CMTestStruct2)}.
|
sl@0
|
1339 |
CMTestStruct2 is defined above.
|
sl@0
|
1340 |
The test function below passes in a TPckg<CMTestStruct1> which is an
|
sl@0
|
1341 |
incorrect type. The server should return KErrBadDescriptor
|
sl@0
|
1342 |
*/
|
sl@0
|
1343 |
void TestFunction18BL()
|
sl@0
|
1344 |
{
|
sl@0
|
1345 |
RClientMessageTestSession session;
|
sl@0
|
1346 |
|
sl@0
|
1347 |
TInt err = session.Connect();
|
sl@0
|
1348 |
Test(err == KErrNone);
|
sl@0
|
1349 |
|
sl@0
|
1350 |
CleanupClosePushL(session);
|
sl@0
|
1351 |
|
sl@0
|
1352 |
CMTestStruct1 struct1;
|
sl@0
|
1353 |
struct1.iInt = 0;
|
sl@0
|
1354 |
struct1.iDes = _L("Test Struct");
|
sl@0
|
1355 |
|
sl@0
|
1356 |
TPckg<CMTestStruct1> pData(struct1);
|
sl@0
|
1357 |
|
sl@0
|
1358 |
//This should result in a panic
|
sl@0
|
1359 |
err = session.TestFunction18(pData);
|
sl@0
|
1360 |
|
sl@0
|
1361 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1362 |
}
|
sl@0
|
1363 |
|
sl@0
|
1364 |
/*
|
sl@0
|
1365 |
This test function accepts a single custom TPckg parameter as below
|
sl@0
|
1366 |
{EParamCustom1,sizeof(CMTestStruct2),sizeof(CMTestStruct2)}.
|
sl@0
|
1367 |
CMTestStruct2 is defined above.
|
sl@0
|
1368 |
The test function below passes in an Empty TBuf the same size as a
|
sl@0
|
1369 |
CMTestStruct2. As this wont contain any valid data, the server should
|
sl@0
|
1370 |
panic the client with KErrBadParameter.
|
sl@0
|
1371 |
*/
|
sl@0
|
1372 |
void TestFunction18CL()
|
sl@0
|
1373 |
{
|
sl@0
|
1374 |
RClientMessageTestSession session;
|
sl@0
|
1375 |
|
sl@0
|
1376 |
TInt err = session.Connect();
|
sl@0
|
1377 |
Test(err == KErrNone);
|
sl@0
|
1378 |
|
sl@0
|
1379 |
CleanupClosePushL(session);
|
sl@0
|
1380 |
|
sl@0
|
1381 |
TBuf<sizeof(CMTestStruct2)> buf;
|
sl@0
|
1382 |
buf.SetLength(sizeof(CMTestStruct2));
|
sl@0
|
1383 |
|
sl@0
|
1384 |
//This should result in a panic
|
sl@0
|
1385 |
err = session.TestFunction18(buf);
|
sl@0
|
1386 |
|
sl@0
|
1387 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1388 |
}
|
sl@0
|
1389 |
|
sl@0
|
1390 |
/*
|
sl@0
|
1391 |
This test function accepts a single custom TPckg parameter as below
|
sl@0
|
1392 |
{EParamCustom2,sizeof(CMTestStruct1),sizeof(CMTestStruct1)}.
|
sl@0
|
1393 |
CMTestStruct1 is defined as follows:
|
sl@0
|
1394 |
|
sl@0
|
1395 |
struct CMTestStruct1
|
sl@0
|
1396 |
{
|
sl@0
|
1397 |
TInt iInt;
|
sl@0
|
1398 |
TBuf<32> iDes;
|
sl@0
|
1399 |
};
|
sl@0
|
1400 |
|
sl@0
|
1401 |
The EParamCustom1 parameter type is validated using a custom validation
|
sl@0
|
1402 |
function defined in the testclientmessageschema.cpp. The validation
|
sl@0
|
1403 |
function checks that iInt is > 0. If this check fails the server
|
sl@0
|
1404 |
should return KErrBadParameter.
|
sl@0
|
1405 |
The test function below passes the data to the server in a TPckgBuf
|
sl@0
|
1406 |
*/
|
sl@0
|
1407 |
void TestFunction19L()
|
sl@0
|
1408 |
{
|
sl@0
|
1409 |
RClientMessageTestSession session;
|
sl@0
|
1410 |
|
sl@0
|
1411 |
TInt err = session.Connect();
|
sl@0
|
1412 |
Test(err == KErrNone);
|
sl@0
|
1413 |
|
sl@0
|
1414 |
CleanupClosePushL(session);
|
sl@0
|
1415 |
|
sl@0
|
1416 |
CMTestStruct1 struct1;
|
sl@0
|
1417 |
struct1.iInt = 4;
|
sl@0
|
1418 |
struct1.iDes = _L("Test Struct");
|
sl@0
|
1419 |
|
sl@0
|
1420 |
TPckgBuf<CMTestStruct1> pData(struct1);
|
sl@0
|
1421 |
|
sl@0
|
1422 |
err = session.TestFunction19(pData);
|
sl@0
|
1423 |
Test(err == KErrNone);
|
sl@0
|
1424 |
|
sl@0
|
1425 |
struct1.iInt = -4;
|
sl@0
|
1426 |
TPckgBuf<CMTestStruct1> pData2(struct1);
|
sl@0
|
1427 |
|
sl@0
|
1428 |
err = session.TestFunction19(pData2);
|
sl@0
|
1429 |
Test(err == KErrBadParameter);
|
sl@0
|
1430 |
|
sl@0
|
1431 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1432 |
}
|
sl@0
|
1433 |
|
sl@0
|
1434 |
/*
|
sl@0
|
1435 |
This test function does not expect any parameters.
|
sl@0
|
1436 |
The schema defines a single placeholder parameter
|
sl@0
|
1437 |
{EParamNull,0,0}
|
sl@0
|
1438 |
but the number of parameters is set to 0
|
sl@0
|
1439 |
*/
|
sl@0
|
1440 |
void TestFunction25L()
|
sl@0
|
1441 |
{
|
sl@0
|
1442 |
RClientMessageTestSession session;
|
sl@0
|
1443 |
|
sl@0
|
1444 |
TInt err = session.Connect();
|
sl@0
|
1445 |
Test(err == KErrNone);
|
sl@0
|
1446 |
|
sl@0
|
1447 |
CleanupClosePushL(session);
|
sl@0
|
1448 |
|
sl@0
|
1449 |
err = session.TestFunction25();
|
sl@0
|
1450 |
Test(err == KErrNone);
|
sl@0
|
1451 |
|
sl@0
|
1452 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1453 |
}
|
sl@0
|
1454 |
|
sl@0
|
1455 |
/*
|
sl@0
|
1456 |
This test function does not expect any parameters.
|
sl@0
|
1457 |
The schema defines a single placeholder parameter
|
sl@0
|
1458 |
{EParamNull,0,0}
|
sl@0
|
1459 |
The schema is incorrectly defined as the number of parameters is
|
sl@0
|
1460 |
listed as 1 instead of 0. This is a programming error and should result
|
sl@0
|
1461 |
in the server panicking with ECMPanicBadMessageSchema in UDEB
|
sl@0
|
1462 |
or the client being panicked with KErrBadDescriptor in UREL
|
sl@0
|
1463 |
*/
|
sl@0
|
1464 |
void TestFunction26L()
|
sl@0
|
1465 |
{
|
sl@0
|
1466 |
RClientMessageTestSession session;
|
sl@0
|
1467 |
|
sl@0
|
1468 |
TInt err = session.Connect();
|
sl@0
|
1469 |
Test(err == KErrNone);
|
sl@0
|
1470 |
|
sl@0
|
1471 |
CleanupClosePushL(session);
|
sl@0
|
1472 |
|
sl@0
|
1473 |
err = session.TestFunction26();
|
sl@0
|
1474 |
//In debug builds the server should panic.
|
sl@0
|
1475 |
//In release builds KErrBadParameter should be returned
|
sl@0
|
1476 |
#ifdef _DEBUG
|
sl@0
|
1477 |
Test(err == KErrServerTerminated);
|
sl@0
|
1478 |
|
sl@0
|
1479 |
TInt type = serverProcess.ExitType();
|
sl@0
|
1480 |
Test(type == EExitPanic);
|
sl@0
|
1481 |
|
sl@0
|
1482 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
1483 |
Test(reason == ECMPanicBadMessageSchema);
|
sl@0
|
1484 |
#else
|
sl@0
|
1485 |
Test(err == KErrBadMessageSchema);
|
sl@0
|
1486 |
#endif
|
sl@0
|
1487 |
|
sl@0
|
1488 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1489 |
}
|
sl@0
|
1490 |
|
sl@0
|
1491 |
/*
|
sl@0
|
1492 |
This test function does not expect any parameters.
|
sl@0
|
1493 |
The schema defines a single placeholder parameter
|
sl@0
|
1494 |
{453,0,0}
|
sl@0
|
1495 |
The schema is incorrectly defined as it contains an invalid
|
sl@0
|
1496 |
parameter type. This is a programming error and should result
|
sl@0
|
1497 |
in the server panicking with ECMPanicBadMessageSchema in UDEB
|
sl@0
|
1498 |
or returning KErrBadParameter in UREL
|
sl@0
|
1499 |
*/
|
sl@0
|
1500 |
void TestFunction27L()
|
sl@0
|
1501 |
{
|
sl@0
|
1502 |
RClientMessageTestSession session;
|
sl@0
|
1503 |
|
sl@0
|
1504 |
TInt err = session.Connect();
|
sl@0
|
1505 |
Test(err == KErrNone);
|
sl@0
|
1506 |
|
sl@0
|
1507 |
CleanupClosePushL(session);
|
sl@0
|
1508 |
|
sl@0
|
1509 |
err = session.TestFunction27();
|
sl@0
|
1510 |
//In debug builds the server should panic.
|
sl@0
|
1511 |
//In release builds KErrBadMessageSchema should be returned
|
sl@0
|
1512 |
#ifdef _DEBUG
|
sl@0
|
1513 |
Test(err == KErrServerTerminated);
|
sl@0
|
1514 |
|
sl@0
|
1515 |
TInt type = serverProcess.ExitType();
|
sl@0
|
1516 |
Test(type == EExitPanic);
|
sl@0
|
1517 |
|
sl@0
|
1518 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
1519 |
Test(reason == ECMPanicBadMessageSchema);
|
sl@0
|
1520 |
#else
|
sl@0
|
1521 |
Test(err == KErrBadMessageSchema);
|
sl@0
|
1522 |
#endif
|
sl@0
|
1523 |
|
sl@0
|
1524 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1525 |
}
|
sl@0
|
1526 |
|
sl@0
|
1527 |
/*
|
sl@0
|
1528 |
This test function accepts a single integer parameter with a
|
sl@0
|
1529 |
custom validation function.
|
sl@0
|
1530 |
{EParamCustom3,0,0}
|
sl@0
|
1531 |
The validation functions checks that the value passed in is a
|
sl@0
|
1532 |
multiple of 4.
|
sl@0
|
1533 |
Any calls to this function with a parameter that is not divisible
|
sl@0
|
1534 |
by 4 should fail with KErrBadParameter
|
sl@0
|
1535 |
*/
|
sl@0
|
1536 |
void TestFunction28L()
|
sl@0
|
1537 |
{
|
sl@0
|
1538 |
RClientMessageTestSession session;
|
sl@0
|
1539 |
|
sl@0
|
1540 |
TInt err = session.Connect();
|
sl@0
|
1541 |
Test(err == KErrNone);
|
sl@0
|
1542 |
|
sl@0
|
1543 |
CleanupClosePushL(session);
|
sl@0
|
1544 |
|
sl@0
|
1545 |
err = session.TestFunction28(4);
|
sl@0
|
1546 |
Test(err == KErrNone);
|
sl@0
|
1547 |
|
sl@0
|
1548 |
err = session.TestFunction28(128);
|
sl@0
|
1549 |
Test(err == KErrNone);
|
sl@0
|
1550 |
|
sl@0
|
1551 |
err = session.TestFunction28(73);
|
sl@0
|
1552 |
Test(err == KErrBadParameter);
|
sl@0
|
1553 |
|
sl@0
|
1554 |
err = session.TestFunction28(-1);
|
sl@0
|
1555 |
Test(err == KErrBadParameter);
|
sl@0
|
1556 |
|
sl@0
|
1557 |
err = session.TestFunction28(44444444);
|
sl@0
|
1558 |
Test(err == KErrNone);
|
sl@0
|
1559 |
|
sl@0
|
1560 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1561 |
}
|
sl@0
|
1562 |
|
sl@0
|
1563 |
/*
|
sl@0
|
1564 |
This test function accepts a single descriptor parameter with a
|
sl@0
|
1565 |
custom validation function.
|
sl@0
|
1566 |
{EParamCustom4,0,0}
|
sl@0
|
1567 |
The validation functions checks that the descriptor passed in
|
sl@0
|
1568 |
contains the string 'Expected Data'
|
sl@0
|
1569 |
Any calls to this function with a descriptor that is not 'Expected Data'
|
sl@0
|
1570 |
should fail with KErrBadParameter
|
sl@0
|
1571 |
*/
|
sl@0
|
1572 |
void TestFunction29L()
|
sl@0
|
1573 |
{
|
sl@0
|
1574 |
RClientMessageTestSession session;
|
sl@0
|
1575 |
|
sl@0
|
1576 |
TInt err = session.Connect();
|
sl@0
|
1577 |
Test(err == KErrNone);
|
sl@0
|
1578 |
|
sl@0
|
1579 |
CleanupClosePushL(session);
|
sl@0
|
1580 |
|
sl@0
|
1581 |
TBuf<32> data = _L("Expected Data");
|
sl@0
|
1582 |
|
sl@0
|
1583 |
err = session.TestFunction29(data);
|
sl@0
|
1584 |
Test(err == KErrNone);
|
sl@0
|
1585 |
|
sl@0
|
1586 |
data.SetLength(5);
|
sl@0
|
1587 |
|
sl@0
|
1588 |
err = session.TestFunction29(data);
|
sl@0
|
1589 |
Test(err == KErrBadParameter);
|
sl@0
|
1590 |
|
sl@0
|
1591 |
data = _L("expected data");
|
sl@0
|
1592 |
|
sl@0
|
1593 |
err = session.TestFunction29(data);
|
sl@0
|
1594 |
Test(err == KErrBadParameter);
|
sl@0
|
1595 |
|
sl@0
|
1596 |
data.Zero();
|
sl@0
|
1597 |
|
sl@0
|
1598 |
err = session.TestFunction29(data);
|
sl@0
|
1599 |
Test(err == KErrBadParameter);
|
sl@0
|
1600 |
|
sl@0
|
1601 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1602 |
}
|
sl@0
|
1603 |
|
sl@0
|
1604 |
/*
|
sl@0
|
1605 |
This test function accepts a single custom TPckg parameter as below
|
sl@0
|
1606 |
{EParamPckg,sizeof(CMTestStruct1),sizeof(CMTestStruct1)}.
|
sl@0
|
1607 |
CMTestStruct1 is defined as follows:
|
sl@0
|
1608 |
|
sl@0
|
1609 |
struct CMTestStruct1
|
sl@0
|
1610 |
{
|
sl@0
|
1611 |
TInt iInt;
|
sl@0
|
1612 |
TBuf<32> iDes;
|
sl@0
|
1613 |
};
|
sl@0
|
1614 |
|
sl@0
|
1615 |
The EParamCustom1 parameter type is validated using the default validation
|
sl@0
|
1616 |
function. This checks that the size of the TPckg passed in is
|
sl@0
|
1617 |
exactly that defined in the schema. If this check fails the server
|
sl@0
|
1618 |
should panic the client with KErrBadDescriptor.
|
sl@0
|
1619 |
*/
|
sl@0
|
1620 |
void TestFunction30L()
|
sl@0
|
1621 |
{
|
sl@0
|
1622 |
RClientMessageTestSession session;
|
sl@0
|
1623 |
|
sl@0
|
1624 |
TInt err = session.Connect();
|
sl@0
|
1625 |
Test(err == KErrNone);
|
sl@0
|
1626 |
|
sl@0
|
1627 |
CleanupClosePushL(session);
|
sl@0
|
1628 |
|
sl@0
|
1629 |
CMTestStruct1 struct1;
|
sl@0
|
1630 |
struct1.iInt = 4;
|
sl@0
|
1631 |
struct1.iDes = _L("Test Struct");
|
sl@0
|
1632 |
|
sl@0
|
1633 |
TPckg<CMTestStruct1> pData(struct1);
|
sl@0
|
1634 |
|
sl@0
|
1635 |
err = session.TestFunction30(pData);
|
sl@0
|
1636 |
Test(err == KErrNone);
|
sl@0
|
1637 |
|
sl@0
|
1638 |
TBuf8<16> data;
|
sl@0
|
1639 |
//This should cause a panic
|
sl@0
|
1640 |
err = session.TestFunction30(data);
|
sl@0
|
1641 |
|
sl@0
|
1642 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1643 |
}
|
sl@0
|
1644 |
|
sl@0
|
1645 |
/*
|
sl@0
|
1646 |
This test function accepts an Intergeer parameter and a TAny* parameter
|
sl@0
|
1647 |
{EParamInt,EGetIntL,EWrite16L},{EParamPtr,0,0}
|
sl@0
|
1648 |
|
sl@0
|
1649 |
The server function checks the value passed in the TInt parameter and calls
|
sl@0
|
1650 |
an appropriate CMessageParameterBase function on the second parameter.
|
sl@0
|
1651 |
As none of the functions called are defined for a pointer parameter, the
|
sl@0
|
1652 |
call defaults to the CMessageParameterBase implementation which panics the
|
sl@0
|
1653 |
client with ECMPanicWrongParameterType in UDEB or returns
|
sl@0
|
1654 |
KErrWrongParameterType in UREL
|
sl@0
|
1655 |
*/
|
sl@0
|
1656 |
void DoTest31L(TInt aType)
|
sl@0
|
1657 |
{
|
sl@0
|
1658 |
RClientMessageTestSession session;
|
sl@0
|
1659 |
|
sl@0
|
1660 |
TInt err = session.Connect();
|
sl@0
|
1661 |
Test(err == KErrNone);
|
sl@0
|
1662 |
|
sl@0
|
1663 |
CleanupClosePushL(session);
|
sl@0
|
1664 |
|
sl@0
|
1665 |
err = session.TestFunction31(aType);
|
sl@0
|
1666 |
#ifdef _DEBUG
|
sl@0
|
1667 |
Test(err == KErrServerTerminated);
|
sl@0
|
1668 |
|
sl@0
|
1669 |
TInt type = serverProcess.ExitType();
|
sl@0
|
1670 |
Test(type == EExitPanic);
|
sl@0
|
1671 |
|
sl@0
|
1672 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
1673 |
Test(reason == ECMPanicWrongParameterType);
|
sl@0
|
1674 |
#else
|
sl@0
|
1675 |
Test(err == KErrWrongParameterType);
|
sl@0
|
1676 |
#endif
|
sl@0
|
1677 |
|
sl@0
|
1678 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1679 |
}
|
sl@0
|
1680 |
|
sl@0
|
1681 |
void TestFunction31AL()
|
sl@0
|
1682 |
{
|
sl@0
|
1683 |
DoTest31L(EGetIntL);
|
sl@0
|
1684 |
}
|
sl@0
|
1685 |
|
sl@0
|
1686 |
void TestFunction31BL()
|
sl@0
|
1687 |
{
|
sl@0
|
1688 |
DoTest31L(EGetDes8L);
|
sl@0
|
1689 |
}
|
sl@0
|
1690 |
|
sl@0
|
1691 |
void TestFunction31CL()
|
sl@0
|
1692 |
{
|
sl@0
|
1693 |
DoTest31L(EGetDes16L);
|
sl@0
|
1694 |
}
|
sl@0
|
1695 |
|
sl@0
|
1696 |
void TestFunction31DL()
|
sl@0
|
1697 |
{
|
sl@0
|
1698 |
DoTest31L(EGetDesLengthL);
|
sl@0
|
1699 |
}
|
sl@0
|
1700 |
|
sl@0
|
1701 |
void TestFunction31EL()
|
sl@0
|
1702 |
{
|
sl@0
|
1703 |
DoTest31L(EGetDesMaxLengthL);
|
sl@0
|
1704 |
}
|
sl@0
|
1705 |
|
sl@0
|
1706 |
void TestFunction31FL()
|
sl@0
|
1707 |
{
|
sl@0
|
1708 |
DoTest31L(ERead8L);
|
sl@0
|
1709 |
}
|
sl@0
|
1710 |
|
sl@0
|
1711 |
void TestFunction31GL()
|
sl@0
|
1712 |
{
|
sl@0
|
1713 |
DoTest31L(ERead16L);
|
sl@0
|
1714 |
}
|
sl@0
|
1715 |
|
sl@0
|
1716 |
void TestFunction31HL()
|
sl@0
|
1717 |
{
|
sl@0
|
1718 |
DoTest31L(EWrite8L);
|
sl@0
|
1719 |
}
|
sl@0
|
1720 |
|
sl@0
|
1721 |
void TestFunction31IL()
|
sl@0
|
1722 |
{
|
sl@0
|
1723 |
DoTest31L(EWrite16L);
|
sl@0
|
1724 |
}
|
sl@0
|
1725 |
/*
|
sl@0
|
1726 |
This test function accepts a single custom parameter as below
|
sl@0
|
1727 |
{EParamCustom5,sizeof(CMTestStruct1),sizeof(CMTestStruct1)}
|
sl@0
|
1728 |
CMTestStruct1 is defined as follows:
|
sl@0
|
1729 |
|
sl@0
|
1730 |
struct CMTestStruct1
|
sl@0
|
1731 |
{
|
sl@0
|
1732 |
TInt iInt;
|
sl@0
|
1733 |
TBuf<32> iDes;
|
sl@0
|
1734 |
};
|
sl@0
|
1735 |
|
sl@0
|
1736 |
The EParamCustom5 parameter type enum value is defined as
|
sl@0
|
1737 |
(0x90000 | EParamPckg). The upper 16 bits are the index of
|
sl@0
|
1738 |
the validation function in the array supplied by the server.
|
sl@0
|
1739 |
The array only contains 5 values so the above definition is
|
sl@0
|
1740 |
incorrect. Calling this messge should result in the server
|
sl@0
|
1741 |
panicking with ECMPanicBadMessageSchema in UDEB or returning
|
sl@0
|
1742 |
KErrBadMessageSchema in UREL
|
sl@0
|
1743 |
*/
|
sl@0
|
1744 |
void TestFunction32L()
|
sl@0
|
1745 |
{
|
sl@0
|
1746 |
RClientMessageTestSession session;
|
sl@0
|
1747 |
|
sl@0
|
1748 |
TInt err = session.Connect();
|
sl@0
|
1749 |
Test(err == KErrNone);
|
sl@0
|
1750 |
|
sl@0
|
1751 |
CleanupClosePushL(session);
|
sl@0
|
1752 |
|
sl@0
|
1753 |
CMTestStruct1 struct1;
|
sl@0
|
1754 |
TPckg<CMTestStruct1> pData(struct1);
|
sl@0
|
1755 |
|
sl@0
|
1756 |
err = session.TestFunction32(pData);
|
sl@0
|
1757 |
|
sl@0
|
1758 |
#ifdef _DEBUG
|
sl@0
|
1759 |
Test(err == KErrServerTerminated);
|
sl@0
|
1760 |
|
sl@0
|
1761 |
TInt type = serverProcess.ExitType();
|
sl@0
|
1762 |
Test(type == EExitPanic);
|
sl@0
|
1763 |
|
sl@0
|
1764 |
TInt reason = serverProcess.ExitReason();
|
sl@0
|
1765 |
Test(reason == ECMPanicBadMessageSchema);
|
sl@0
|
1766 |
#else
|
sl@0
|
1767 |
Test(err == KErrBadMessageSchema);
|
sl@0
|
1768 |
#endif
|
sl@0
|
1769 |
|
sl@0
|
1770 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
1771 |
}
|
sl@0
|
1772 |
|
sl@0
|
1773 |
/* Connect to the CClientMessageTestServer, launching
|
sl@0
|
1774 |
* the server process if necessary
|
sl@0
|
1775 |
*/
|
sl@0
|
1776 |
TInt RClientMessageTestSession2::Connect()
|
sl@0
|
1777 |
{
|
sl@0
|
1778 |
TInt retry = 2;
|
sl@0
|
1779 |
for(;;)
|
sl@0
|
1780 |
{
|
sl@0
|
1781 |
TInt r = CreateSession(KServer2Name,TVersion(1,0,0));
|
sl@0
|
1782 |
|
sl@0
|
1783 |
if((r != KErrNotFound)&&(r != KErrServerTerminated))
|
sl@0
|
1784 |
{
|
sl@0
|
1785 |
return r;
|
sl@0
|
1786 |
}
|
sl@0
|
1787 |
|
sl@0
|
1788 |
if(--retry == 0)
|
sl@0
|
1789 |
{
|
sl@0
|
1790 |
return r;
|
sl@0
|
1791 |
}
|
sl@0
|
1792 |
|
sl@0
|
1793 |
r = LaunchServer();
|
sl@0
|
1794 |
if((r != KErrNone)&&(r != KErrAlreadyExists))
|
sl@0
|
1795 |
{
|
sl@0
|
1796 |
return r;
|
sl@0
|
1797 |
}
|
sl@0
|
1798 |
}
|
sl@0
|
1799 |
}
|
sl@0
|
1800 |
|
sl@0
|
1801 |
|
sl@0
|
1802 |
|
sl@0
|
1803 |
/* These functions are used to send IPC messages to the server.
|
sl@0
|
1804 |
* The messages are sent with different parameters to test the
|
sl@0
|
1805 |
* ClientMessage framework handling of bad messages
|
sl@0
|
1806 |
*/
|
sl@0
|
1807 |
TInt RClientMessageTestSession2::TestFunction0(TInt aArg0, TInt aArg1)
|
sl@0
|
1808 |
{
|
sl@0
|
1809 |
return SendReceive(ETestMessage0,TIpcArgs(aArg0,aArg1));
|
sl@0
|
1810 |
}
|
sl@0
|
1811 |
|
sl@0
|
1812 |
TInt RClientMessageTestSession2::TestFunction1(const TDesC& aData0)
|
sl@0
|
1813 |
{
|
sl@0
|
1814 |
return SendReceive(ETestMessage1,TIpcArgs(&aData0));
|
sl@0
|
1815 |
}
|
sl@0
|
1816 |
|
sl@0
|
1817 |
|
sl@0
|
1818 |
/**
|
sl@0
|
1819 |
@SYMTestCaseID SYSLIB-BAFL-CT-4040
|
sl@0
|
1820 |
@SYMTestCaseDesc Tests CClientMessage handling of EParamInt type parameters
|
sl@0
|
1821 |
@SYMTestPriority High
|
sl@0
|
1822 |
@SYMTestActions Call a series of test functions expecting integer parameters.
|
sl@0
|
1823 |
Various argument values and types are passed to these functions.
|
sl@0
|
1824 |
The Server should only accept messages containing integer
|
sl@0
|
1825 |
values that fall within the bounds defined in the message schema.
|
sl@0
|
1826 |
@SYMTestExpectedResults The Server should return KErrNone if the message is
|
sl@0
|
1827 |
accepted or KErrBadParameter if the int parameters are outside
|
sl@0
|
1828 |
the bounds defined in the schema. If the message is incorrectly
|
sl@0
|
1829 |
defined in the mssage schema or the server code incorrectly uses
|
sl@0
|
1830 |
the parameter type the server should panic.
|
sl@0
|
1831 |
@SYMDEF INC117370
|
sl@0
|
1832 |
*/
|
sl@0
|
1833 |
void DoIntParameterTestsL()
|
sl@0
|
1834 |
{
|
sl@0
|
1835 |
TExitDetails exitDetails;
|
sl@0
|
1836 |
|
sl@0
|
1837 |
exitDetails = LaunchTestThreadL(_L("TestFunction0"), &TestFunction0AL);
|
sl@0
|
1838 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1839 |
|
sl@0
|
1840 |
exitDetails = LaunchTestThreadL(_L("TestFunction1"), &TestFunction1L);
|
sl@0
|
1841 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1842 |
|
sl@0
|
1843 |
exitDetails = LaunchTestThreadL(_L("TestFunction2"), &TestFunction2L);
|
sl@0
|
1844 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1845 |
|
sl@0
|
1846 |
exitDetails = LaunchTestThreadL(_L("TestFunction3"), &TestFunction3L);
|
sl@0
|
1847 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1848 |
|
sl@0
|
1849 |
exitDetails = LaunchTestThreadL(_L("TestFunction28"), &TestFunction28L);
|
sl@0
|
1850 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1851 |
}
|
sl@0
|
1852 |
|
sl@0
|
1853 |
/**
|
sl@0
|
1854 |
@SYMTestCaseID SYSLIB-BAFL-CT-4041
|
sl@0
|
1855 |
@SYMTestCaseDesc Tests CClientMessage handling of EParamDes8Read and
|
sl@0
|
1856 |
EParamDes16Read type parameters
|
sl@0
|
1857 |
@SYMTestPriority High
|
sl@0
|
1858 |
@SYMTestActions Call a series of test functions expecting Des*Read parameters.
|
sl@0
|
1859 |
Various argument values and types are passed to these functions.
|
sl@0
|
1860 |
The Server should only accept messages containing Des*Read
|
sl@0
|
1861 |
values that fall within the bounds defined in the message schema.
|
sl@0
|
1862 |
@SYMTestExpectedResults The Server should return KErrNone if the message is
|
sl@0
|
1863 |
accepted or panic the client with KErrBadDescriptor if the
|
sl@0
|
1864 |
descriptor parameters are outside the bounds defined in the schema.
|
sl@0
|
1865 |
If the message is incorrectly defined in the mssage schema or the
|
sl@0
|
1866 |
server code incorrectly uses the parameter type the server should panic.
|
sl@0
|
1867 |
@SYMDEF INC117370
|
sl@0
|
1868 |
*/
|
sl@0
|
1869 |
void DoDesReadParameterTestsL()
|
sl@0
|
1870 |
{
|
sl@0
|
1871 |
TExitDetails exitDetails;
|
sl@0
|
1872 |
|
sl@0
|
1873 |
exitDetails = LaunchTestThreadL(_L("TestFunction4A"), &TestFunction4AL);
|
sl@0
|
1874 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1875 |
|
sl@0
|
1876 |
exitDetails = LaunchTestThreadL(_L("TestFunction4B"), &TestFunction4BL);
|
sl@0
|
1877 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1878 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1879 |
|
sl@0
|
1880 |
exitDetails = LaunchTestThreadL(_L("TestFunction4C"), &TestFunction4CL);
|
sl@0
|
1881 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1882 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1883 |
|
sl@0
|
1884 |
exitDetails = LaunchTestThreadL(_L("TestFunction4D"), &TestFunction4DL);
|
sl@0
|
1885 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1886 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1887 |
|
sl@0
|
1888 |
exitDetails = LaunchTestThreadL(_L("TestFunction4E"), &TestFunction4EL);
|
sl@0
|
1889 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1890 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1891 |
|
sl@0
|
1892 |
exitDetails = LaunchTestThreadL(_L("TestFunction4F"), &TestFunction4FL);
|
sl@0
|
1893 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1894 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1895 |
|
sl@0
|
1896 |
exitDetails = LaunchTestThreadL(_L("TestFunction5"), &TestFunction5L);
|
sl@0
|
1897 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1898 |
|
sl@0
|
1899 |
exitDetails = LaunchTestThreadL(_L("TestFunction6"), &TestFunction6L);
|
sl@0
|
1900 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1901 |
|
sl@0
|
1902 |
exitDetails = LaunchTestThreadL(_L("TestFunction7"), &TestFunction7L);
|
sl@0
|
1903 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1904 |
|
sl@0
|
1905 |
exitDetails = LaunchTestThreadL(_L("TestFunction8"), &TestFunction8L);
|
sl@0
|
1906 |
#ifdef _DEBUG
|
sl@0
|
1907 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1908 |
#else
|
sl@0
|
1909 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1910 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1911 |
#endif
|
sl@0
|
1912 |
|
sl@0
|
1913 |
exitDetails = LaunchTestThreadL(_L("TestFunction29"), &TestFunction29L);
|
sl@0
|
1914 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1915 |
|
sl@0
|
1916 |
}
|
sl@0
|
1917 |
|
sl@0
|
1918 |
/**
|
sl@0
|
1919 |
@SYMTestCaseID SYSLIB-BAFL-CT-4042
|
sl@0
|
1920 |
@SYMTestCaseDesc Tests CClientMessage handling of EParamDes8 and
|
sl@0
|
1921 |
EParamDes16 type parameters
|
sl@0
|
1922 |
@SYMTestPriority High
|
sl@0
|
1923 |
@SYMTestActions Call a series of test functions expecting Des* parameters.
|
sl@0
|
1924 |
Various argument values and types are passed to these functions.
|
sl@0
|
1925 |
The Server should only accept messages containing Des*
|
sl@0
|
1926 |
values that fall within the bounds defined in the message schema.
|
sl@0
|
1927 |
@SYMTestExpectedResults The Server should return KErrNone if the message is
|
sl@0
|
1928 |
accepted or panic the client with KErrBadDescriptor or KErrOverflow if the
|
sl@0
|
1929 |
descriptor parameters are outside the bounds defined in the schema.
|
sl@0
|
1930 |
If the message is incorrectly defined in the mssage schema or the
|
sl@0
|
1931 |
server code incorrectly uses the parameter type the server should panic.
|
sl@0
|
1932 |
@SYMDEF INC117370
|
sl@0
|
1933 |
*/
|
sl@0
|
1934 |
void DoDesParameterTestsL()
|
sl@0
|
1935 |
{
|
sl@0
|
1936 |
TExitDetails exitDetails;
|
sl@0
|
1937 |
exitDetails = LaunchTestThreadL(_L("TestFunction9A"), &TestFunction9AL);
|
sl@0
|
1938 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1939 |
|
sl@0
|
1940 |
exitDetails = LaunchTestThreadL(_L("TestFunction9B"), &TestFunction9BL);
|
sl@0
|
1941 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1942 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1943 |
|
sl@0
|
1944 |
exitDetails = LaunchTestThreadL(_L("TestFunction9C"), &TestFunction9CL);
|
sl@0
|
1945 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1946 |
Test(exitDetails.iReason == KErrOverflow);
|
sl@0
|
1947 |
|
sl@0
|
1948 |
exitDetails = LaunchTestThreadL(_L("TestFunction9D"), &TestFunction9DL);
|
sl@0
|
1949 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1950 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1951 |
|
sl@0
|
1952 |
exitDetails = LaunchTestThreadL(_L("TestFunction10"), &TestFunction10L);
|
sl@0
|
1953 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1954 |
Test(exitDetails.iReason == KErrOverflow);
|
sl@0
|
1955 |
|
sl@0
|
1956 |
exitDetails = LaunchTestThreadL(_L("TestFunction11"), &TestFunction11L);
|
sl@0
|
1957 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1958 |
|
sl@0
|
1959 |
exitDetails = LaunchTestThreadL(_L("TestFunction12"), &TestFunction12L);
|
sl@0
|
1960 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1961 |
|
sl@0
|
1962 |
exitDetails = LaunchTestThreadL(_L("TestFunction13"), &TestFunction13L);
|
sl@0
|
1963 |
#ifdef _DEBUG
|
sl@0
|
1964 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1965 |
#else
|
sl@0
|
1966 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
1967 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
1968 |
#endif
|
sl@0
|
1969 |
|
sl@0
|
1970 |
exitDetails = LaunchTestThreadL(_L("TestFunction14"), &TestFunction14L);
|
sl@0
|
1971 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1972 |
|
sl@0
|
1973 |
exitDetails = LaunchTestThreadL(_L("TestFunction15"), &TestFunction15L);
|
sl@0
|
1974 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1975 |
}
|
sl@0
|
1976 |
|
sl@0
|
1977 |
/**
|
sl@0
|
1978 |
@SYMTestCaseID SYSLIB-BAFL-CT-4043
|
sl@0
|
1979 |
@SYMTestCaseDesc Tests CClientMessage handling of EParamPtr type parameters
|
sl@0
|
1980 |
@SYMTestPriority High
|
sl@0
|
1981 |
@SYMTestActions Call test functions accepting ptr parameter types
|
sl@0
|
1982 |
@SYMTestExpectedResults The Server should return KErrNone if the message is
|
sl@0
|
1983 |
accepted. If the message is incorrectly defined in the message
|
sl@0
|
1984 |
schema or the server code incorrectly uses the parameter type
|
sl@0
|
1985 |
the server should panic
|
sl@0
|
1986 |
expected
|
sl@0
|
1987 |
@SYMDEF INC117370
|
sl@0
|
1988 |
*/
|
sl@0
|
1989 |
void DoPtrParameterTestsL()
|
sl@0
|
1990 |
{
|
sl@0
|
1991 |
TExitDetails exitDetails;
|
sl@0
|
1992 |
exitDetails = LaunchTestThreadL(_L("TestFunction16"), &TestFunction16L);
|
sl@0
|
1993 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1994 |
|
sl@0
|
1995 |
exitDetails = LaunchTestThreadL(_L("TestFunction17"), &TestFunction17L);
|
sl@0
|
1996 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
1997 |
}
|
sl@0
|
1998 |
|
sl@0
|
1999 |
/**
|
sl@0
|
2000 |
@SYMTestCaseID SYSLIB-BAFL-CT-4044
|
sl@0
|
2001 |
@SYMTestCaseDesc Tests CClientMessage handling of EParamPckg type parameters
|
sl@0
|
2002 |
@SYMTestPriority High
|
sl@0
|
2003 |
@SYMTestActions Call a series of test functions expecting Pckg parameters.
|
sl@0
|
2004 |
Various argument values and types are passed to these functions.
|
sl@0
|
2005 |
The Server should only accept messages containing Pckg
|
sl@0
|
2006 |
values that fall within the bounds defined in the message schema.
|
sl@0
|
2007 |
@SYMTestExpectedResults The Server should return KErrNone if the message is
|
sl@0
|
2008 |
accepted, return KErrBadParameter if the packaged parameter is
|
sl@0
|
2009 |
outside the bounds described in the schema or panic the client with
|
sl@0
|
2010 |
KErrBadDescriptor if the descriptor parameter is outside the bounds
|
sl@0
|
2011 |
defined in the schema.
|
sl@0
|
2012 |
@SYMDEF INC117370
|
sl@0
|
2013 |
*/
|
sl@0
|
2014 |
void DoPckgParameterTestsL()
|
sl@0
|
2015 |
{
|
sl@0
|
2016 |
TExitDetails exitDetails;
|
sl@0
|
2017 |
exitDetails = LaunchTestThreadL(_L("TestFunction18A"), &TestFunction18AL);
|
sl@0
|
2018 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2019 |
|
sl@0
|
2020 |
exitDetails = LaunchTestThreadL(_L("TestFunction18B"), &TestFunction18BL);
|
sl@0
|
2021 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
2022 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
2023 |
|
sl@0
|
2024 |
exitDetails = LaunchTestThreadL(_L("TestFunction18C"), &TestFunction18CL);
|
sl@0
|
2025 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
2026 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
2027 |
|
sl@0
|
2028 |
exitDetails = LaunchTestThreadL(_L("TestFunction19"), &TestFunction19L);
|
sl@0
|
2029 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2030 |
|
sl@0
|
2031 |
exitDetails = LaunchTestThreadL(_L("TestFunction30"), &TestFunction30L);
|
sl@0
|
2032 |
Test(exitDetails.iExitType == EExitPanic);
|
sl@0
|
2033 |
Test(exitDetails.iReason == KErrBadDescriptor);
|
sl@0
|
2034 |
|
sl@0
|
2035 |
exitDetails = LaunchTestThreadL(_L("TestFunction32"), &TestFunction32L);
|
sl@0
|
2036 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2037 |
}
|
sl@0
|
2038 |
|
sl@0
|
2039 |
|
sl@0
|
2040 |
/**
|
sl@0
|
2041 |
@SYMTestCaseID SYSLIB-BAFL-CT-4045
|
sl@0
|
2042 |
@SYMTestCaseDesc Tests CClientMessage handling of EParamNull type parameters
|
sl@0
|
2043 |
@SYMTestPriority High
|
sl@0
|
2044 |
@SYMTestActions Call a series of test functions expecting no parameters.
|
sl@0
|
2045 |
@SYMTestExpectedResults The Server should return KErrNone if the message is
|
sl@0
|
2046 |
accepted. If the message is incorrectly defined in the message
|
sl@0
|
2047 |
schema or the server code incorrectly uses the parameter type
|
sl@0
|
2048 |
the server should panic.
|
sl@0
|
2049 |
@SYMDEF INC117370
|
sl@0
|
2050 |
*/
|
sl@0
|
2051 |
void DoNullParameterTestsL()
|
sl@0
|
2052 |
{
|
sl@0
|
2053 |
|
sl@0
|
2054 |
TExitDetails exitDetails;
|
sl@0
|
2055 |
exitDetails = LaunchTestThreadL(_L("TestFunction25"), &TestFunction25L);
|
sl@0
|
2056 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2057 |
|
sl@0
|
2058 |
exitDetails = LaunchTestThreadL(_L("TestFunction26"), &TestFunction26L);
|
sl@0
|
2059 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2060 |
|
sl@0
|
2061 |
exitDetails = LaunchTestThreadL(_L("TestFunction27"), &TestFunction27L);
|
sl@0
|
2062 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2063 |
|
sl@0
|
2064 |
}
|
sl@0
|
2065 |
|
sl@0
|
2066 |
/**
|
sl@0
|
2067 |
@SYMTestCaseID SYSLIB-BAFL-CT-4046
|
sl@0
|
2068 |
@SYMTestCaseDesc Tests CClientMessage handling of Security policies
|
sl@0
|
2069 |
@SYMTestPriority High
|
sl@0
|
2070 |
@SYMTestActions Call several test functions with varying security policies and
|
sl@0
|
2071 |
verify that the ClientMessage framework handles each case as
|
sl@0
|
2072 |
expected
|
sl@0
|
2073 |
@SYMTestExpectedResults The server should return KErrNone if the client has
|
sl@0
|
2074 |
the required security policy, otherwise return KErrPermissionDenied
|
sl@0
|
2075 |
@SYMDEF INC117370
|
sl@0
|
2076 |
*/
|
sl@0
|
2077 |
void DoSecurityPolicyTestsL()
|
sl@0
|
2078 |
{
|
sl@0
|
2079 |
RClientMessageTestSession session;
|
sl@0
|
2080 |
|
sl@0
|
2081 |
TInt err = session.Connect();
|
sl@0
|
2082 |
|
sl@0
|
2083 |
CleanupClosePushL(session);
|
sl@0
|
2084 |
|
sl@0
|
2085 |
//This function is incorrectly defined in the message table
|
sl@0
|
2086 |
//for this server and so the CClientMessage Object creation will fail
|
sl@0
|
2087 |
//This should reult in the server panicking
|
sl@0
|
2088 |
RDebug::Print(_L("Testing Always Fail Policy..."));
|
sl@0
|
2089 |
err = session.TestFunction20(0,0);
|
sl@0
|
2090 |
Test(err == KErrPermissionDenied);
|
sl@0
|
2091 |
|
sl@0
|
2092 |
RDebug::Print(_L("Testing Valid SID Policy..."));
|
sl@0
|
2093 |
err = session.TestFunction21(0,0);
|
sl@0
|
2094 |
Test(err == KErrNone);
|
sl@0
|
2095 |
|
sl@0
|
2096 |
RDebug::Print(_L("Testing Invalid SID Policy..."));
|
sl@0
|
2097 |
err = session.TestFunction22(0,0);
|
sl@0
|
2098 |
Test(err == KErrPermissionDenied);
|
sl@0
|
2099 |
|
sl@0
|
2100 |
RDebug::Print(_L("Testing Valid Capability Policy..."));
|
sl@0
|
2101 |
err = session.TestFunction23(0,0);
|
sl@0
|
2102 |
Test(err == KErrNone);
|
sl@0
|
2103 |
|
sl@0
|
2104 |
RDebug::Print(_L("Testing Invalid Capability Policy..."));
|
sl@0
|
2105 |
err = session.TestFunction24(0,0);
|
sl@0
|
2106 |
Test(err == KErrPermissionDenied);
|
sl@0
|
2107 |
|
sl@0
|
2108 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
2109 |
}
|
sl@0
|
2110 |
|
sl@0
|
2111 |
/**
|
sl@0
|
2112 |
@SYMTestCaseID SYSLIB-BAFL-CT-4047
|
sl@0
|
2113 |
@SYMTestCaseDesc Tests CClientMessage handling of undefined messagess
|
sl@0
|
2114 |
@SYMTestPriority High
|
sl@0
|
2115 |
@SYMTestActions Call a test function which sends an unknown message request to the
|
sl@0
|
2116 |
server.
|
sl@0
|
2117 |
@SYMTestExpectedResults The ClientMessage framework should return KErrInvalidFunction
|
sl@0
|
2118 |
@SYMDEF INC117370
|
sl@0
|
2119 |
*/
|
sl@0
|
2120 |
void DoInvalidMessageTestsL()
|
sl@0
|
2121 |
{
|
sl@0
|
2122 |
RClientMessageTestSession session;
|
sl@0
|
2123 |
|
sl@0
|
2124 |
TInt err = session.Connect();
|
sl@0
|
2125 |
|
sl@0
|
2126 |
CleanupClosePushL(session);
|
sl@0
|
2127 |
|
sl@0
|
2128 |
//This function is not defined in the message table
|
sl@0
|
2129 |
//for this server and so the CClientMessage Object creation will fail
|
sl@0
|
2130 |
//This should result in the server panicking
|
sl@0
|
2131 |
err = session.TestInvalidFunction(45);
|
sl@0
|
2132 |
Test(err == KErrInvalidFunction);
|
sl@0
|
2133 |
|
sl@0
|
2134 |
err = session.TestInvalidFunction(5);
|
sl@0
|
2135 |
Test(err == KErrInvalidFunction);
|
sl@0
|
2136 |
|
sl@0
|
2137 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
2138 |
}
|
sl@0
|
2139 |
|
sl@0
|
2140 |
/**
|
sl@0
|
2141 |
@SYMTestCaseID SYSLIB-BAFL-CT-4050
|
sl@0
|
2142 |
@SYMTestCaseDesc Tests CMessageParameterBase default implementation of message access functions
|
sl@0
|
2143 |
@SYMTestPriority High
|
sl@0
|
2144 |
@SYMTestActions Calls test functions which signal the server to call one
|
sl@0
|
2145 |
of the Message access methods on a EParamPtr parameter type.
|
sl@0
|
2146 |
As none of these methods are explicitly defined for a EParamPtr
|
sl@0
|
2147 |
type the call will be delegated to the base class implementation
|
sl@0
|
2148 |
which will panic the client in UDEB and return an error in UREL
|
sl@0
|
2149 |
@SYMTestExpectedResults The server should panic the client with ECMPanicWrongParameterType
|
sl@0
|
2150 |
in UDEB and return KErrWrongParameterType in UREL
|
sl@0
|
2151 |
@SYMDEF INC117370
|
sl@0
|
2152 |
*/
|
sl@0
|
2153 |
void DoCMessageParameterBaseTestL()
|
sl@0
|
2154 |
{
|
sl@0
|
2155 |
|
sl@0
|
2156 |
TExitDetails exitDetails;
|
sl@0
|
2157 |
exitDetails = LaunchTestThreadL(_L("TestFunction31A"), &TestFunction31AL);
|
sl@0
|
2158 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2159 |
|
sl@0
|
2160 |
exitDetails = LaunchTestThreadL(_L("TestFunction31B"), &TestFunction31BL);
|
sl@0
|
2161 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2162 |
|
sl@0
|
2163 |
exitDetails = LaunchTestThreadL(_L("TestFunction31C"), &TestFunction31CL);
|
sl@0
|
2164 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2165 |
|
sl@0
|
2166 |
exitDetails = LaunchTestThreadL(_L("TestFunction31D"), &TestFunction31DL);
|
sl@0
|
2167 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2168 |
|
sl@0
|
2169 |
exitDetails = LaunchTestThreadL(_L("TestFunction31E"), &TestFunction31EL);
|
sl@0
|
2170 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2171 |
|
sl@0
|
2172 |
exitDetails = LaunchTestThreadL(_L("TestFunction31F"), &TestFunction31FL);
|
sl@0
|
2173 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2174 |
|
sl@0
|
2175 |
exitDetails = LaunchTestThreadL(_L("TestFunction31G"), &TestFunction31GL);
|
sl@0
|
2176 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2177 |
|
sl@0
|
2178 |
exitDetails = LaunchTestThreadL(_L("TestFunction31H"), &TestFunction31HL);
|
sl@0
|
2179 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2180 |
|
sl@0
|
2181 |
exitDetails = LaunchTestThreadL(_L("TestFunction31I"), &TestFunction31IL);
|
sl@0
|
2182 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2183 |
|
sl@0
|
2184 |
}
|
sl@0
|
2185 |
|
sl@0
|
2186 |
|
sl@0
|
2187 |
/**
|
sl@0
|
2188 |
@SYMTestCaseID SYSLIB-BAFL-CT-4048
|
sl@0
|
2189 |
@SYMTestCaseDesc Tests CClientMessage handling of multiple servers
|
sl@0
|
2190 |
@SYMTestPriority High
|
sl@0
|
2191 |
@SYMTestActions Calls test functions which pass the same message to two different
|
sl@0
|
2192 |
servers. The servers have different message schemas and data is
|
sl@0
|
2193 |
passed to the server to check that the correct schema is used
|
sl@0
|
2194 |
for the given server.
|
sl@0
|
2195 |
@SYMTestExpectedResults The ClientMessage framework should validate the message
|
sl@0
|
2196 |
against the correct schema for the given server
|
sl@0
|
2197 |
@SYMDEF INC117370
|
sl@0
|
2198 |
*/
|
sl@0
|
2199 |
void DoMultipleServerTestsL()
|
sl@0
|
2200 |
{
|
sl@0
|
2201 |
|
sl@0
|
2202 |
RClientMessageTestSession session1;
|
sl@0
|
2203 |
RClientMessageTestSession2 session2;
|
sl@0
|
2204 |
|
sl@0
|
2205 |
TInt err = session1.Connect();
|
sl@0
|
2206 |
Test(err == KErrNone);
|
sl@0
|
2207 |
CleanupClosePushL(session1);
|
sl@0
|
2208 |
|
sl@0
|
2209 |
err = session2.Connect();
|
sl@0
|
2210 |
Test(err == KErrNone);
|
sl@0
|
2211 |
CleanupClosePushL(session2);
|
sl@0
|
2212 |
|
sl@0
|
2213 |
err = session1.TestFunction0( 0, 150);
|
sl@0
|
2214 |
Test(err == KErrNone);
|
sl@0
|
2215 |
|
sl@0
|
2216 |
err = session2.TestFunction0( 0, 150);
|
sl@0
|
2217 |
Test(err == KErrBadParameter);
|
sl@0
|
2218 |
|
sl@0
|
2219 |
err = session1.TestFunction0( 0, -50);
|
sl@0
|
2220 |
Test(err == KErrBadParameter);
|
sl@0
|
2221 |
|
sl@0
|
2222 |
err = session2.TestFunction0( 0, -50);
|
sl@0
|
2223 |
Test(err == KErrNone);
|
sl@0
|
2224 |
|
sl@0
|
2225 |
CleanupStack::PopAndDestroy(2,&session1);
|
sl@0
|
2226 |
|
sl@0
|
2227 |
}
|
sl@0
|
2228 |
|
sl@0
|
2229 |
/**
|
sl@0
|
2230 |
@SYMTestCaseID SYSLIB-BAFL-CT-4051
|
sl@0
|
2231 |
@SYMTestCaseDesc Tests CClientMessage allowing disabling of Panic.
|
sl@0
|
2232 |
@SYMTestPriority Medium
|
sl@0
|
2233 |
@SYMTestActions Calls test functions which pass a message to a server for which the
|
sl@0
|
2234 |
ESrvFlagDoNotPanicClientOnBadMessageErrors flag is set.Then invokes the client API with
|
sl@0
|
2235 |
incorrect arguments to create an error scenario of KErrBadDescriptor.
|
sl@0
|
2236 |
@SYMTestExpectedResults The ClientMessage framework should check for the above flag, and in case
|
sl@0
|
2237 |
its not set simply return an error instead of panicing the client.
|
sl@0
|
2238 |
@SYMDEF DEF125501
|
sl@0
|
2239 |
*/
|
sl@0
|
2240 |
void DoDisablePanicTestsL()
|
sl@0
|
2241 |
{
|
sl@0
|
2242 |
|
sl@0
|
2243 |
RClientMessageTestSession2 session;
|
sl@0
|
2244 |
_LIT(KDes16, "Descriptor");
|
sl@0
|
2245 |
|
sl@0
|
2246 |
TInt err = session.Connect();
|
sl@0
|
2247 |
Test(err == KErrNone);
|
sl@0
|
2248 |
|
sl@0
|
2249 |
CleanupClosePushL(session);
|
sl@0
|
2250 |
|
sl@0
|
2251 |
/* According to schema defined, this function accepts TDesC8 only.
|
sl@0
|
2252 |
Validation failure occurs.Server should check if flag ESrvFlagDoNotPanicClientOnBadMessageErrors
|
sl@0
|
2253 |
is set, and either return with KErrBadDescriptor or Panic the client.
|
sl@0
|
2254 |
In this case the above flag is set for CClientMessageTestServer2.
|
sl@0
|
2255 |
*/
|
sl@0
|
2256 |
err = session.TestFunction1(KDes16);
|
sl@0
|
2257 |
|
sl@0
|
2258 |
#ifdef _DEBUG
|
sl@0
|
2259 |
Test(err == KErrBadDescriptor);
|
sl@0
|
2260 |
|
sl@0
|
2261 |
// Server is not terminated, still alive
|
sl@0
|
2262 |
TInt type = serverProcess.ExitType();
|
sl@0
|
2263 |
Test(type == EExitPending);
|
sl@0
|
2264 |
#else
|
sl@0
|
2265 |
Test(err == KErrBadDescriptor);
|
sl@0
|
2266 |
#endif
|
sl@0
|
2267 |
|
sl@0
|
2268 |
CleanupStack::PopAndDestroy(&session);
|
sl@0
|
2269 |
|
sl@0
|
2270 |
}
|
sl@0
|
2271 |
|
sl@0
|
2272 |
|
sl@0
|
2273 |
static void DoTestsL()
|
sl@0
|
2274 |
{
|
sl@0
|
2275 |
|
sl@0
|
2276 |
TExitDetails exitDetails;
|
sl@0
|
2277 |
|
sl@0
|
2278 |
Test.Title ();
|
sl@0
|
2279 |
Test.Start (_L("ClientMessage Tests"));
|
sl@0
|
2280 |
|
sl@0
|
2281 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4040 Testing Message with Int Parameters "));
|
sl@0
|
2282 |
DoIntParameterTestsL();
|
sl@0
|
2283 |
|
sl@0
|
2284 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4041 Testing Message with Read Only Des Parameters "));
|
sl@0
|
2285 |
DoDesReadParameterTestsL();
|
sl@0
|
2286 |
|
sl@0
|
2287 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4042 Testing Message with Read/Write Des Parameters "));
|
sl@0
|
2288 |
DoDesParameterTestsL();
|
sl@0
|
2289 |
|
sl@0
|
2290 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4043 Testing Message with Ptr Parameters "));
|
sl@0
|
2291 |
DoPtrParameterTestsL();
|
sl@0
|
2292 |
|
sl@0
|
2293 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4044 Testing Message with Pckg Parameters "));
|
sl@0
|
2294 |
DoPckgParameterTestsL();
|
sl@0
|
2295 |
|
sl@0
|
2296 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4045 Testing Message with Null Parameters "));
|
sl@0
|
2297 |
DoNullParameterTestsL();
|
sl@0
|
2298 |
|
sl@0
|
2299 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4046 Testing Security Policy Checking "));
|
sl@0
|
2300 |
exitDetails = LaunchTestThreadL(_L("SecurityPolicyTestL"), &DoSecurityPolicyTestsL);
|
sl@0
|
2301 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2302 |
|
sl@0
|
2303 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4047 Testing Invalid Message "));
|
sl@0
|
2304 |
exitDetails = LaunchTestThreadL(_L("InvalidMessageTestL"), &DoInvalidMessageTestsL);
|
sl@0
|
2305 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2306 |
|
sl@0
|
2307 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4050 Testing CMessageParameterBase Default Implementations "));
|
sl@0
|
2308 |
exitDetails = LaunchTestThreadL(_L("CMessageParameterBaseTestL"), &DoCMessageParameterBaseTestL);
|
sl@0
|
2309 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2310 |
|
sl@0
|
2311 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4048 Testing Multiple Servers "));
|
sl@0
|
2312 |
exitDetails = LaunchTestThreadL(_L("MultipleServerTestingL"), &DoMultipleServerTestsL);
|
sl@0
|
2313 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2314 |
|
sl@0
|
2315 |
Test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-4051 Testing Disable Client Panic"));
|
sl@0
|
2316 |
exitDetails = LaunchTestThreadL(_L("DisablePanicTesting"), &DoDisablePanicTestsL);
|
sl@0
|
2317 |
Test(exitDetails.iExitType == EExitKill);
|
sl@0
|
2318 |
|
sl@0
|
2319 |
|
sl@0
|
2320 |
Test.Printf(_L("Tests Completed O.K."));
|
sl@0
|
2321 |
|
sl@0
|
2322 |
Test.End();
|
sl@0
|
2323 |
Test.Close();
|
sl@0
|
2324 |
|
sl@0
|
2325 |
}
|
sl@0
|
2326 |
|
sl@0
|
2327 |
|
sl@0
|
2328 |
TInt E32Main()
|
sl@0
|
2329 |
//
|
sl@0
|
2330 |
// Server process entry-point
|
sl@0
|
2331 |
//
|
sl@0
|
2332 |
{
|
sl@0
|
2333 |
//
|
sl@0
|
2334 |
CTrapCleanup* cleanup=CTrapCleanup::New();
|
sl@0
|
2335 |
TInt r=KErrNoMemory;
|
sl@0
|
2336 |
if (cleanup)
|
sl@0
|
2337 |
{
|
sl@0
|
2338 |
TRAP(r,DoTestsL());
|
sl@0
|
2339 |
delete cleanup;
|
sl@0
|
2340 |
}
|
sl@0
|
2341 |
//
|
sl@0
|
2342 |
return r;
|
sl@0
|
2343 |
}
|