|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started |
|
15 // in the process of the client. The client initialises the server by calling the |
|
16 // one and only ordinal. |
|
17 // |
|
18 // |
|
19 |
|
20 #include <e32base.h> |
|
21 #include <e32cmn.h> |
|
22 |
|
23 #if (!defined TS_TE_Cntsrv_API_Policing_SERVER_H_) |
|
24 #include "CSuite.h" |
|
25 #endif |
|
26 |
|
27 |
|
28 #include "ECntCloseView1_CStep.h" |
|
29 #include "ECntSendPluginUidToServer1_CStep.h" |
|
30 #include "CntCntctMatchingCriteriaExternalizedSize1_CStep.h" |
|
31 #include "ECntViewSortOrderExternalizedSize1_CStep.h" |
|
32 #include "ECntViewAt1_CStep.h" |
|
33 #include "ECntViewCount1_CStep.h" |
|
34 #include "ECntViewFind1_CStep.h" |
|
35 #include "ECntAllFieldsLength1_CStep.h" |
|
36 #include "ECntGetViewSortOrder1_CStep.h" |
|
37 #include "ECntRequestViewEvent1_CStep.h" |
|
38 #include "ECntCancelRequestViewEvent1_CStep.h" |
|
39 #include "ECntGetIncludedTypes1_CStep.h" |
|
40 #include "ECntGetContactIds1_CStep.h" |
|
41 #include "ECntGetSortPluginUidFromServer1_CStep.h" |
|
42 #include "ECntGetCurrentItem1_CStep.h" |
|
43 #include "ECntSetHeapFailure1_CStep.h" |
|
44 #include "ECntResourceCount1_CStep.h" |
|
45 #include "ECntDbContactCount1_CStep.h" |
|
46 #include "ECntSetDbViewContactType1_CStep.h" |
|
47 #include "ECntViewContactAtLength1_CStep.h" |
|
48 #include "ECntRequestEvent1_CStep.h" |
|
49 #include "ECntCancelEventRequest1_CStep.h" |
|
50 #include "ECntConnectionId1_CStep.h" |
|
51 #include "ECntMachineID1_CStep.h" |
|
52 #include "ECntOverrideMachineID1_CStep.h" |
|
53 #include "ECntGetPrefTemplateId1_CStep.h" |
|
54 #include "ECntICCTemplateId1_CStep.h" |
|
55 #include "ECntPhonebookGroupId1_CStep.h" |
|
56 #include "ECntCloseDataBase1_CStep.h" |
|
57 #include "ECntCloseDbTables1_CStep.h" |
|
58 #include "ECntCancelAsyncOpenDatabase1_CStep.h" |
|
59 #include "ECntFileUniqueId1_CStep.h" |
|
60 #include "ECntOpsTimeOut1_CStep.h" |
|
61 #include "ECntFilesSize1_CStep.h" |
|
62 #include "ECntWastedSpaceInBytes1_CStep.h" |
|
63 #include "ECntMatchesHintField1_CStep.h" |
|
64 #include "ECntGetDefaultDatabaseName1_CStep.h" |
|
65 #include "ECntGetCurrentDb1_CStep.h" |
|
66 #include "ECntDatabaseDrive1_CStep.h" |
|
67 #include "ECntDatabaseExists1_CStep.h" |
|
68 #include "ECntCompressRequired1_CStep.h" |
|
69 #include "ECntIsDamaged1_CStep.h" |
|
70 #include "ECntSetSortPrefs1_CStep.h" |
|
71 #include "ECntGetOwnCard1_CStep.h" |
|
72 #include "ECntFetchTemplateIds1_CStep.h" |
|
73 #include "ECntFetchGroupIdLists1_CStep.h" |
|
74 #include "ECntSeekContact1_CStep.h" |
|
75 #include "ECntSeekIdentContact1_CStep.h" |
|
76 #include "ECntChangeViewDef1_CStep.h" |
|
77 #include "ECntGetSortPrefs1_CStep.h" |
|
78 #include "ECntItemClose1_CStep.h" |
|
79 #include "ECntGetDefinitionsForExistingView1_CStep.h" |
|
80 #include "ECntOpenDataBase1_CStep.h" |
|
81 #include "ECntReOpenDbTables1_CStep.h" |
|
82 #include "ECntCreateView1_CStep.h" |
|
83 #include "ECntCreateNamedView1_CStep.h" |
|
84 #include "ECntViewContactAt1_CStep.h" |
|
85 #include "ECntAllFieldsText1_CStep.h" |
|
86 #include "ECntGetContactsMatchingFilter1_CStep.h" |
|
87 #include "ECntGetContactMatchingCriteria1_CStep.h" |
|
88 #include "ECntGetSpeedDialContactIdAndPhoneNumber1_CStep.h" |
|
89 #include "ECntItemRead1_CStep.h" |
|
90 #include "ECntReadContactTextDef1_CStep.h" |
|
91 #include "ECntFilterDatabase1_CStep.h" |
|
92 #include "ECntFind1_CStep.h" |
|
93 #include "ECntFindAsyncInit1_CStep.h" |
|
94 #include "ECntFindAsyncTextDefInit1_CStep.h" |
|
95 #include "ECntFindAsync1_CStep.h" |
|
96 #include "ECntItemAtL1_CStep.h" |
|
97 #include "ECntGetCollection1_CStep.h" |
|
98 #include "ECntTextField1_CStep.h" |
|
99 #include "ECntListDatabases1_CStep.h" |
|
100 #include "ECntCreateDatabase1_CStep.h" |
|
101 #include "ECntSetPrefTemplateId1_CStep.h" |
|
102 #include "ECntSetOwnCard1_CStep.h" |
|
103 #include "ECntReCreateTemplate1_CStep.h" |
|
104 #include "ECntSetCurrentItem1_CStep.h" |
|
105 #include "ECntRemoveCurrentItem1_CStep.h" |
|
106 #include "ECntSetCurrentDb1_CStep.h" |
|
107 #include "ECntSetSpeedDialIdForPosition1_CStep.h" |
|
108 #include "ECntChangeViewSortOrder1_CStep.h" |
|
109 #include "ECntRecoverDb1_CStep.h" |
|
110 #include "ECntRecoverDbStep1_CStep.h" |
|
111 #include "ECntCancelRecoverStep1_CStep.h" |
|
112 #include "ECntItemOpen1_CStep.h" |
|
113 #include "ECntSetDatabaseDrive1_CStep.h" |
|
114 #include "ECntReplaceDatabase1_CStep.h" |
|
115 #include "ECntDeleteDatabase1_CStep.h" |
|
116 #include "ECntItemUpdate1_CStep.h" |
|
117 #include "ECntItemCommit1_CStep.h" |
|
118 #include "ECntItemDelete1_CStep.h" |
|
119 #include "ECntCompress1_CStep.h" |
|
120 #include "ECntCompressStep1_CStep.h" |
|
121 #include "ECntCancelCompressStep1_CStep.h" |
|
122 #include "ECntDamageDb1_CStep.h" |
|
123 #include "ECntItemCreate1_CStep.h" |
|
124 #include "EBeginDbTransaction1_CStep.h" |
|
125 #include "EEndDbTransaction1_CStep.h" |
|
126 #include "ERollbackDbTransaction1_CStep.h" |
|
127 #include "ELockSrvNotSupported1_CStep.h" |
|
128 |
|
129 // __EDIT_ME__ - Substitute the name of your test server |
|
130 _LIT(KServerName,"Cap_TE_Cntsrv_API_Policing_sc"); |
|
131 // __EDIT_ME__ - Use your own server class name |
|
132 |
|
133 CTestTE_Cntsrv_API_PolicingServer* CTestTE_Cntsrv_API_PolicingServer::NewL() |
|
134 /** |
|
135 * @return - Instance of the test server |
|
136 * Same code for Secure and non-secure variants |
|
137 * Called inside the MainL() function to create and start the |
|
138 * CTestServer derived server. |
|
139 */ |
|
140 { |
|
141 // __EDIT_ME__ - Use your own server class name |
|
142 CTestTE_Cntsrv_API_PolicingServer * server = new (ELeave) CTestTE_Cntsrv_API_PolicingServer(); |
|
143 CleanupStack::PushL(server); |
|
144 // CServer base class call |
|
145 server->StartL(KServerName); |
|
146 CleanupStack::Pop(server); |
|
147 return server; |
|
148 } |
|
149 |
|
150 CTestStep* CTestTE_Cntsrv_API_PolicingServer::CreateTestStep(const TDesC& aStepName) |
|
151 /** |
|
152 * @return - A CTestStep derived instance |
|
153 * Secure and non-secure variants |
|
154 * Implementation of CTestServer pure virtual |
|
155 */ |
|
156 { |
|
157 CTestStep* testStep = NULL; |
|
158 TBool testStepFound(EFalse); |
|
159 // add test steps |
|
160 if (aStepName == _L("CECntCloseView1Step")) |
|
161 { |
|
162 testStep = new CECntCloseView1Step ; |
|
163 testStepFound = ETrue; |
|
164 } |
|
165 |
|
166 else if (aStepName == _L("CECntSendPluginUidToServer1Step")) |
|
167 { |
|
168 testStep = new CECntSendPluginUidToServer1Step ; |
|
169 testStepFound = ETrue; |
|
170 } |
|
171 |
|
172 else if (aStepName == _L("CCntCntctMatchingCriteriaExternalizedSize1Step")) |
|
173 { |
|
174 testStep = new CCntCntctMatchingCriteriaExternalizedSize1Step ; |
|
175 testStepFound = ETrue; |
|
176 } |
|
177 |
|
178 else if (aStepName == _L("CECntViewSortOrderExternalizedSize1Step")) |
|
179 { |
|
180 testStep = new CECntViewSortOrderExternalizedSize1Step ; |
|
181 testStepFound = ETrue; |
|
182 } |
|
183 |
|
184 else if (aStepName == _L("CECntViewAt1Step")) |
|
185 { |
|
186 testStep = new CECntViewAt1Step ; |
|
187 testStepFound = ETrue; |
|
188 } |
|
189 |
|
190 else if (aStepName == _L("CECntViewCount1Step")) |
|
191 { |
|
192 testStep = new CECntViewCount1Step ; |
|
193 testStepFound = ETrue; |
|
194 } |
|
195 |
|
196 else if (aStepName == _L("CECntViewFind1Step")) |
|
197 { |
|
198 testStep = new CECntViewFind1Step ; |
|
199 testStepFound = ETrue; |
|
200 } |
|
201 |
|
202 else if (aStepName == _L("CECntAllFieldsLength1Step")) |
|
203 { |
|
204 testStep = new CECntAllFieldsLength1Step ; |
|
205 testStepFound = ETrue; |
|
206 } |
|
207 |
|
208 else if (aStepName == _L("CECntGetViewSortOrder1Step")) |
|
209 { |
|
210 testStep = new CECntGetViewSortOrder1Step ; |
|
211 testStepFound = ETrue; |
|
212 } |
|
213 |
|
214 else if (aStepName == _L("CECntRequestViewEvent1Step")) |
|
215 { |
|
216 testStep = new CECntRequestViewEvent1Step ; |
|
217 testStepFound = ETrue; |
|
218 } |
|
219 |
|
220 else if (aStepName == _L("CECntCancelRequestViewEvent1Step")) |
|
221 { |
|
222 testStep = new CECntCancelRequestViewEvent1Step ; |
|
223 testStepFound = ETrue; |
|
224 } |
|
225 |
|
226 else if (aStepName == _L("CECntGetIncludedTypes1Step")) |
|
227 { |
|
228 testStep = new CECntGetIncludedTypes1Step ; |
|
229 testStepFound = ETrue; |
|
230 } |
|
231 |
|
232 else if (aStepName == _L("CECntGetContactIds1Step")) |
|
233 { |
|
234 testStep = new CECntGetContactIds1Step ; |
|
235 testStepFound = ETrue; |
|
236 } |
|
237 |
|
238 else if (aStepName == _L("CECntGetSortPluginUidFromServer1Step")) |
|
239 { |
|
240 testStep = new CECntGetSortPluginUidFromServer1Step ; |
|
241 testStepFound = ETrue; |
|
242 } |
|
243 |
|
244 else if (aStepName == _L("CECntGetCurrentItem1Step")) |
|
245 { |
|
246 testStep = new CECntGetCurrentItem1Step ; |
|
247 testStepFound = ETrue; |
|
248 } |
|
249 |
|
250 else if (aStepName == _L("CECntSetHeapFailure1Step")) |
|
251 { |
|
252 testStep = new CECntSetHeapFailure1Step ; |
|
253 testStepFound = ETrue; |
|
254 } |
|
255 |
|
256 else if (aStepName == _L("CECntResourceCount1Step")) |
|
257 { |
|
258 testStep = new CECntResourceCount1Step ; |
|
259 testStepFound = ETrue; |
|
260 } |
|
261 |
|
262 else if (aStepName == _L("CECntDbContactCount1Step")) |
|
263 { |
|
264 testStep = new CECntDbContactCount1Step ; |
|
265 testStepFound = ETrue; |
|
266 } |
|
267 |
|
268 else if (aStepName == _L("CECntSetDbViewContactType1Step")) |
|
269 { |
|
270 testStep = new CECntSetDbViewContactType1Step ; |
|
271 testStepFound = ETrue; |
|
272 } |
|
273 |
|
274 else if (aStepName == _L("CECntViewContactAtLength1Step")) |
|
275 { |
|
276 testStep = new CECntViewContactAtLength1Step ; |
|
277 testStepFound = ETrue; |
|
278 } |
|
279 |
|
280 else if (aStepName == _L("CECntRequestEvent1Step")) |
|
281 { |
|
282 testStep = new CECntRequestEvent1Step ; |
|
283 testStepFound = ETrue; |
|
284 } |
|
285 |
|
286 else if (aStepName == _L("CECntCancelEventRequest1Step")) |
|
287 { |
|
288 testStep = new CECntCancelEventRequest1Step ; |
|
289 testStepFound = ETrue; |
|
290 } |
|
291 |
|
292 else if (aStepName == _L("CECntConnectionId1Step")) |
|
293 { |
|
294 testStep = new CECntConnectionId1Step ; |
|
295 testStepFound = ETrue; |
|
296 } |
|
297 |
|
298 else if (aStepName == _L("CECntMachineID1Step")) |
|
299 { |
|
300 testStep = new CECntMachineID1Step ; |
|
301 testStepFound = ETrue; |
|
302 } |
|
303 |
|
304 else if (aStepName == _L("CECntOverrideMachineID1Step")) |
|
305 { |
|
306 testStep = new CECntOverrideMachineID1Step ; |
|
307 testStepFound = ETrue; |
|
308 } |
|
309 |
|
310 else if (aStepName == _L("CECntGetPrefTemplateId1Step")) |
|
311 { |
|
312 testStep = new CECntGetPrefTemplateId1Step ; |
|
313 testStepFound = ETrue; |
|
314 } |
|
315 |
|
316 else if (aStepName == _L("CECntICCTemplateId1Step")) |
|
317 { |
|
318 testStep = new CECntICCTemplateId1Step ; |
|
319 testStepFound = ETrue; |
|
320 } |
|
321 |
|
322 else if (aStepName == _L("CECntPhonebookGroupId1Step")) |
|
323 { |
|
324 testStep = new CECntPhonebookGroupId1Step ; |
|
325 testStepFound = ETrue; |
|
326 } |
|
327 |
|
328 else if (aStepName == _L("CECntCloseDataBase1Step")) |
|
329 { |
|
330 testStep = new CECntCloseDataBase1Step ; |
|
331 testStepFound = ETrue; |
|
332 } |
|
333 |
|
334 else if (aStepName == _L("CECntCloseDbTables1Step")) |
|
335 { |
|
336 testStep = new CECntCloseDbTables1Step ; |
|
337 testStepFound = ETrue; |
|
338 } |
|
339 |
|
340 else if (aStepName == _L("CECntCancelAsyncOpenDatabase1Step")) |
|
341 { |
|
342 testStep = new CECntCancelAsyncOpenDatabase1Step ; |
|
343 testStepFound = ETrue; |
|
344 } |
|
345 |
|
346 else if (aStepName == _L("CECntFileUniqueId1Step")) |
|
347 { |
|
348 testStep = new CECntFileUniqueId1Step ; |
|
349 testStepFound = ETrue; |
|
350 } |
|
351 |
|
352 else if (aStepName == _L("CECntOpsTimeOut1Step")) |
|
353 { |
|
354 testStep = new CECntOpsTimeOut1Step ; |
|
355 testStepFound = ETrue; |
|
356 } |
|
357 |
|
358 else if (aStepName == _L("CECntFilesSize1Step")) |
|
359 { |
|
360 testStep = new CECntFilesSize1Step ; |
|
361 testStepFound = ETrue; |
|
362 } |
|
363 |
|
364 else if (aStepName == _L("CECntWastedSpaceInBytes1Step")) |
|
365 { |
|
366 testStep = new CECntWastedSpaceInBytes1Step ; |
|
367 testStepFound = ETrue; |
|
368 } |
|
369 |
|
370 else if (aStepName == _L("CECntMatchesHintField1Step")) |
|
371 { |
|
372 testStep = new CECntMatchesHintField1Step ; |
|
373 testStepFound = ETrue; |
|
374 } |
|
375 |
|
376 else if (aStepName == _L("CECntGetDefaultDatabaseName1Step")) |
|
377 { |
|
378 testStep = new CECntGetDefaultDatabaseName1Step ; |
|
379 testStepFound = ETrue; |
|
380 } |
|
381 |
|
382 else if (aStepName == _L("CECntGetCurrentDb1Step")) |
|
383 { |
|
384 testStep = new CECntGetCurrentDb1Step ; |
|
385 testStepFound = ETrue; |
|
386 } |
|
387 |
|
388 else if (aStepName == _L("CECntDatabaseDrive1Step")) |
|
389 { |
|
390 testStep = new CECntDatabaseDrive1Step ; |
|
391 testStepFound = ETrue; |
|
392 } |
|
393 |
|
394 else if (aStepName == _L("CECntDatabaseExists1Step")) |
|
395 { |
|
396 testStep = new CECntDatabaseExists1Step ; |
|
397 testStepFound = ETrue; |
|
398 } |
|
399 |
|
400 else if (aStepName == _L("CECntCompressRequired1Step")) |
|
401 { |
|
402 testStep = new CECntCompressRequired1Step ; |
|
403 testStepFound = ETrue; |
|
404 } |
|
405 |
|
406 else if (aStepName == _L("CECntIsDamaged1Step")) |
|
407 { |
|
408 testStep = new CECntIsDamaged1Step ; |
|
409 testStepFound = ETrue; |
|
410 } |
|
411 |
|
412 else if (aStepName == _L("CECntSetSortPrefs1Step")) |
|
413 { |
|
414 testStep = new CECntSetSortPrefs1Step ; |
|
415 testStepFound = ETrue; |
|
416 } |
|
417 |
|
418 else if (aStepName == _L("CECntGetOwnCard1Step")) |
|
419 { |
|
420 testStep = new CECntGetOwnCard1Step ; |
|
421 testStepFound = ETrue; |
|
422 } |
|
423 |
|
424 else if (aStepName == _L("CECntFetchTemplateIds1Step")) |
|
425 { |
|
426 testStep = new CECntFetchTemplateIds1Step ; |
|
427 testStepFound = ETrue; |
|
428 } |
|
429 |
|
430 else if (aStepName == _L("CECntFetchGroupIdLists1Step")) |
|
431 { |
|
432 testStep = new CECntFetchGroupIdLists1Step ; |
|
433 testStepFound = ETrue; |
|
434 } |
|
435 |
|
436 else if (aStepName == _L("CECntSeekContact1Step")) |
|
437 { |
|
438 testStep = new CECntSeekContact1Step ; |
|
439 testStepFound = ETrue; |
|
440 } |
|
441 |
|
442 else if (aStepName == _L("CECntSeekIdentContact1Step")) |
|
443 { |
|
444 testStep = new CECntSeekIdentContact1Step ; |
|
445 testStepFound = ETrue; |
|
446 } |
|
447 |
|
448 else if (aStepName == _L("CECntChangeViewDef1Step")) |
|
449 { |
|
450 testStep = new CECntChangeViewDef1Step ; |
|
451 testStepFound = ETrue; |
|
452 } |
|
453 |
|
454 else if (aStepName == _L("CECntGetSortPrefs1Step")) |
|
455 { |
|
456 testStep = new CECntGetSortPrefs1Step ; |
|
457 testStepFound = ETrue; |
|
458 } |
|
459 |
|
460 else if (aStepName == _L("CECntItemClose1Step")) |
|
461 { |
|
462 testStep = new CECntItemClose1Step ; |
|
463 testStepFound = ETrue; |
|
464 } |
|
465 |
|
466 else if (aStepName == _L("CECntGetDefinitionsForExistingView1Step")) |
|
467 { |
|
468 testStep = new CECntGetDefinitionsForExistingView1Step ; |
|
469 testStepFound = ETrue; |
|
470 } |
|
471 |
|
472 else if (aStepName == _L("CECntOpenDataBase1Step")) |
|
473 { |
|
474 testStep = new CECntOpenDataBase1Step ; |
|
475 testStepFound = ETrue; |
|
476 } |
|
477 |
|
478 else if (aStepName == _L("CECntReOpenDbTables1Step")) |
|
479 { |
|
480 testStep = new CECntReOpenDbTables1Step ; |
|
481 testStepFound = ETrue; |
|
482 } |
|
483 |
|
484 else if (aStepName == _L("CECntCreateView1Step")) |
|
485 { |
|
486 testStep = new CECntCreateView1Step ; |
|
487 testStepFound = ETrue; |
|
488 } |
|
489 |
|
490 else if (aStepName == _L("CECntCreateNamedView1Step")) |
|
491 { |
|
492 testStep = new CECntCreateNamedView1Step ; |
|
493 testStepFound = ETrue; |
|
494 } |
|
495 |
|
496 else if (aStepName == _L("CECntViewContactAt1Step")) |
|
497 { |
|
498 testStep = new CECntViewContactAt1Step ; |
|
499 testStepFound = ETrue; |
|
500 } |
|
501 |
|
502 else if (aStepName == _L("CECntAllFieldsText1Step")) |
|
503 { |
|
504 testStep = new CECntAllFieldsText1Step ; |
|
505 testStepFound = ETrue; |
|
506 } |
|
507 |
|
508 else if (aStepName == _L("CECntGetContactsMatchingFilter1Step")) |
|
509 { |
|
510 testStep = new CECntGetContactsMatchingFilter1Step ; |
|
511 testStepFound = ETrue; |
|
512 } |
|
513 |
|
514 else if (aStepName == _L("CECntGetContactMatchingCriteria1Step")) |
|
515 { |
|
516 testStep = new CECntGetContactMatchingCriteria1Step ; |
|
517 testStepFound = ETrue; |
|
518 } |
|
519 |
|
520 else if (aStepName == _L("CECntGetSpeedDialContactIdAndPhoneNumber1Step")) |
|
521 { |
|
522 testStep = new CECntGetSpeedDialContactIdAndPhoneNumber1Step ; |
|
523 testStepFound = ETrue; |
|
524 } |
|
525 |
|
526 else if (aStepName == _L("CECntItemRead1Step")) |
|
527 { |
|
528 testStep = new CECntItemRead1Step ; |
|
529 testStepFound = ETrue; |
|
530 } |
|
531 |
|
532 else if (aStepName == _L("CECntReadContactTextDef1Step")) |
|
533 { |
|
534 testStep = new CECntReadContactTextDef1Step ; |
|
535 testStepFound = ETrue; |
|
536 } |
|
537 |
|
538 else if (aStepName == _L("CECntFilterDatabase1Step")) |
|
539 { |
|
540 testStep = new CECntFilterDatabase1Step ; |
|
541 testStepFound = ETrue; |
|
542 } |
|
543 |
|
544 else if (aStepName == _L("CECntFind1Step")) |
|
545 { |
|
546 testStep = new CECntFind1Step ; |
|
547 testStepFound = ETrue; |
|
548 } |
|
549 |
|
550 else if (aStepName == _L("CECntFindAsyncInit1Step")) |
|
551 { |
|
552 testStep = new CECntFindAsyncInit1Step ; |
|
553 testStepFound = ETrue; |
|
554 } |
|
555 |
|
556 else if (aStepName == _L("CECntFindAsyncTextDefInit1Step")) |
|
557 { |
|
558 testStep = new CECntFindAsyncTextDefInit1Step ; |
|
559 testStepFound = ETrue; |
|
560 } |
|
561 |
|
562 else if (aStepName == _L("CECntFindAsync1Step")) |
|
563 { |
|
564 testStep = new CECntFindAsync1Step ; |
|
565 testStepFound = ETrue; |
|
566 } |
|
567 |
|
568 else if (aStepName == _L("CECntItemAtL1Step")) |
|
569 { |
|
570 testStep = new CECntItemAtL1Step ; |
|
571 testStepFound = ETrue; |
|
572 } |
|
573 |
|
574 else if (aStepName == _L("CECntGetCollection1Step")) |
|
575 { |
|
576 testStep = new CECntGetCollection1Step ; |
|
577 testStepFound = ETrue; |
|
578 } |
|
579 |
|
580 else if (aStepName == _L("CECntTextField1Step")) |
|
581 { |
|
582 testStep = new CECntTextField1Step ; |
|
583 testStepFound = ETrue; |
|
584 } |
|
585 |
|
586 else if (aStepName == _L("CECntListDatabases1Step")) |
|
587 { |
|
588 testStep = new CECntListDatabases1Step ; |
|
589 testStepFound = ETrue; |
|
590 } |
|
591 |
|
592 else if (aStepName == _L("CECntCreateDatabase1Step")) |
|
593 { |
|
594 testStep = new CECntCreateDatabase1Step ; |
|
595 testStepFound = ETrue; |
|
596 } |
|
597 |
|
598 else if (aStepName == _L("CECntSetPrefTemplateId1Step")) |
|
599 { |
|
600 testStep = new CECntSetPrefTemplateId1Step ; |
|
601 testStepFound = ETrue; |
|
602 } |
|
603 |
|
604 else if (aStepName == _L("CECntSetOwnCard1Step")) |
|
605 { |
|
606 testStep = new CECntSetOwnCard1Step ; |
|
607 testStepFound = ETrue; |
|
608 } |
|
609 |
|
610 else if (aStepName == _L("CECntReCreateTemplate1Step")) |
|
611 { |
|
612 testStep = new CECntReCreateTemplate1Step ; |
|
613 testStepFound = ETrue; |
|
614 } |
|
615 |
|
616 else if (aStepName == _L("CECntSetCurrentItem1Step")) |
|
617 { |
|
618 testStep = new CECntSetCurrentItem1Step ; |
|
619 testStepFound = ETrue; |
|
620 } |
|
621 |
|
622 else if (aStepName == _L("CECntRemoveCurrentItem1Step")) |
|
623 { |
|
624 testStep = new CECntRemoveCurrentItem1Step ; |
|
625 testStepFound = ETrue; |
|
626 } |
|
627 |
|
628 else if (aStepName == _L("CECntSetCurrentDb1Step")) |
|
629 { |
|
630 testStep = new CECntSetCurrentDb1Step ; |
|
631 testStepFound = ETrue; |
|
632 } |
|
633 |
|
634 else if (aStepName == _L("CECntSetSpeedDialIdForPosition1Step")) |
|
635 { |
|
636 testStep = new CECntSetSpeedDialIdForPosition1Step ; |
|
637 testStepFound = ETrue; |
|
638 } |
|
639 |
|
640 else if (aStepName == _L("CECntChangeViewSortOrder1Step")) |
|
641 { |
|
642 testStep = new CECntChangeViewSortOrder1Step ; |
|
643 testStepFound = ETrue; |
|
644 } |
|
645 |
|
646 else if (aStepName == _L("CECntRecoverDb1Step")) |
|
647 { |
|
648 testStep = new CECntRecoverDb1Step ; |
|
649 testStepFound = ETrue; |
|
650 } |
|
651 |
|
652 else if (aStepName == _L("CECntRecoverDbStep1Step")) |
|
653 { |
|
654 testStep = new CECntRecoverDbStep1Step ; |
|
655 testStepFound = ETrue; |
|
656 } |
|
657 |
|
658 else if (aStepName == _L("CECntCancelRecoverStep1Step")) |
|
659 { |
|
660 testStep = new CECntCancelRecoverStep1Step ; |
|
661 testStepFound = ETrue; |
|
662 } |
|
663 |
|
664 else if (aStepName == _L("CECntItemOpen1Step")) |
|
665 { |
|
666 testStep = new CECntItemOpen1Step ; |
|
667 testStepFound = ETrue; |
|
668 } |
|
669 |
|
670 else if (aStepName == _L("CECntSetDatabaseDrive1Step")) |
|
671 { |
|
672 testStep = new CECntSetDatabaseDrive1Step ; |
|
673 testStepFound = ETrue; |
|
674 } |
|
675 |
|
676 else if (aStepName == _L("CECntReplaceDatabase1Step")) |
|
677 { |
|
678 testStep = new CECntReplaceDatabase1Step ; |
|
679 testStepFound = ETrue; |
|
680 } |
|
681 |
|
682 else if (aStepName == _L("CECntDeleteDatabase1Step")) |
|
683 { |
|
684 testStep = new CECntDeleteDatabase1Step ; |
|
685 testStepFound = ETrue; |
|
686 } |
|
687 |
|
688 else if (aStepName == _L("CECntItemUpdate1Step")) |
|
689 { |
|
690 testStep = new CECntItemUpdate1Step ; |
|
691 testStepFound = ETrue; |
|
692 } |
|
693 |
|
694 else if (aStepName == _L("CECntItemCommit1Step")) |
|
695 { |
|
696 testStep = new CECntItemCommit1Step ; |
|
697 testStepFound = ETrue; |
|
698 } |
|
699 |
|
700 else if (aStepName == _L("CECntItemDelete1Step")) |
|
701 { |
|
702 testStep = new CECntItemDelete1Step ; |
|
703 testStepFound = ETrue; |
|
704 } |
|
705 |
|
706 else if (aStepName == _L("CECntCompress1Step")) |
|
707 { |
|
708 testStep = new CECntCompress1Step ; |
|
709 testStepFound = ETrue; |
|
710 } |
|
711 |
|
712 else if (aStepName == _L("CECntCompressStep1Step")) |
|
713 { |
|
714 testStep = new CECntCompressStep1Step ; |
|
715 testStepFound = ETrue; |
|
716 } |
|
717 |
|
718 else if (aStepName == _L("CECntCancelCompressStep1Step")) |
|
719 { |
|
720 testStep = new CECntCancelCompressStep1Step ; |
|
721 testStepFound = ETrue; |
|
722 } |
|
723 |
|
724 else if (aStepName == _L("CECntDamageDb1Step")) |
|
725 { |
|
726 testStep = new CECntDamageDb1Step ; |
|
727 testStepFound = ETrue; |
|
728 } |
|
729 |
|
730 else if (aStepName == _L("CECntItemCreate1Step")) |
|
731 { |
|
732 testStep = new CECntItemCreate1Step ; |
|
733 testStepFound = ETrue; |
|
734 } |
|
735 |
|
736 else if (aStepName == _L("CEBeginDbTransaction1Step")) |
|
737 { |
|
738 testStep = new CEBeginDbTransaction1Step ; |
|
739 testStepFound = ETrue; |
|
740 } |
|
741 |
|
742 else if (aStepName == _L("CEEndDbTransaction1Step")) |
|
743 { |
|
744 testStep = new CEEndDbTransaction1Step ; |
|
745 testStepFound = ETrue; |
|
746 } |
|
747 |
|
748 else if (aStepName == _L("CERollbackDbTransaction1Step")) |
|
749 { |
|
750 testStep = new CERollbackDbTransaction1Step ; |
|
751 testStepFound = ETrue; |
|
752 } |
|
753 |
|
754 else if (aStepName == _L("CELockSrvNotSupported1Step")) |
|
755 { |
|
756 testStep = new CELockSrvNotSupported1Step ; |
|
757 testStepFound = ETrue; |
|
758 } |
|
759 |
|
760 if (testStepFound && !testStep) |
|
761 { |
|
762 _LIT(KAllocationFailed, |
|
763 "Could not allocate teststep in CTestTE_Cntsrv_API_PolicingServer::CreateTestStep()\n"); |
|
764 ERR_PRINTF1(KAllocationFailed); |
|
765 User::Invariant(); |
|
766 } |
|
767 |
|
768 return testStep; |
|
769 } |
|
770 |
|
771 |
|
772 |
|
773 // Secure variants much simpler |
|
774 // Just an E32Main and a MainL() |
|
775 LOCAL_C void MainL() |
|
776 /** |
|
777 * Secure variant |
|
778 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
779 */ |
|
780 { |
|
781 #if (defined __DATA_CAGING__) |
|
782 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
783 RProcess().DataCaging(RProcess::ESecureApiOn); |
|
784 #endif |
|
785 CActiveScheduler* sched=NULL; |
|
786 sched=new(ELeave) CActiveScheduler; |
|
787 CActiveScheduler::Install(sched); |
|
788 // __EDIT_ME__ - Use your own server class name |
|
789 CTestTE_Cntsrv_API_PolicingServer* server = NULL; |
|
790 // Create the CTestServer derived server |
|
791 TRAPD(err,server = CTestTE_Cntsrv_API_PolicingServer::NewL()); |
|
792 if(!err) |
|
793 { |
|
794 // Sync with the client and enter the active scheduler |
|
795 RProcess::Rendezvous(KErrNone); |
|
796 sched->Start(); |
|
797 } |
|
798 delete server; |
|
799 delete sched; |
|
800 } |
|
801 |
|
802 |
|
803 GLDEF_C TInt E32Main() |
|
804 /** |
|
805 * @return - Standard Epoc error code on process exit |
|
806 * Secure variant only |
|
807 * Process entry point. Called by client using RProcess API |
|
808 */ |
|
809 { |
|
810 __UHEAP_MARK; |
|
811 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
812 if(cleanup == NULL) |
|
813 { |
|
814 return KErrNoMemory; |
|
815 } |
|
816 TRAPD(err,MainL()); |
|
817 delete cleanup; |
|
818 __UHEAP_MARKEND; |
|
819 return err; |
|
820 } |
|
821 |
|
822 |
|
823 TVerdict CCapabilityTestStep::doTestStepPreambleL( void ) |
|
824 { |
|
825 //If Preamble is not required just pass a success value |
|
826 TVerdict testResult = CTestStep::doTestStepPreambleL(); |
|
827 |
|
828 |
|
829 return TestStepResult(); |
|
830 |
|
831 } |
|
832 TVerdict CCapabilityTestStep::doTestStepPostambleL( void ) |
|
833 { |
|
834 //If Postamble is not required just pass a success value |
|
835 TVerdict testResult = CTestStep::doTestStepPostambleL(); |
|
836 |
|
837 return TestStepResult(); |
|
838 |
|
839 } |
|
840 |
|
841 |
|
842 // Moved from CStep.cpp |
|
843 |
|
844 enum TVerdict CCapabilityTestStep::doTestStepL() |
|
845 { |
|
846 //DEF! INFO_PRINTF2(_L("%S - Starting ..."), &iTestStepName); |
|
847 |
|
848 //The MainThread()creates a separate thread that executes SendReceive |
|
849 TVerdict vResult = MainThread(); |
|
850 |
|
851 SetTestStepResult(vResult); |
|
852 return TestStepResult(); |
|
853 } |
|
854 |
|
855 /* |
|
856 ThreadStartFn: |
|
857 Called by: The Child thread |
|
858 Function: Calls the Exec_SendReceive |
|
859 */ |
|
860 static TInt ThreadStartFn( TAny * ptr ) |
|
861 { |
|
862 return(((CCapabilityTestStep *)ptr)->Exec_SendReceive()); |
|
863 } |
|
864 |
|
865 /* |
|
866 TVerdict GetVerdict(TInt aAPIretValue) |
|
867 |
|
868 Called by: "MainThread" for returning verdict |
|
869 |
|
870 Parameters(TInt aRetValue) : 0 if API call gets thru without any rejection |
|
871 1 if API call is rejected for capability error |
|
872 */ |
|
873 enum TVerdict CCapabilityTestStep::GetVerdict(TInt aAPIretValue) |
|
874 { |
|
875 TVerdict vVerdict[] = {EPass, EFail}; |
|
876 |
|
877 //please leave the following if/else block as the information printed by INFO_PRINTF1 is used bu CapTestSumm |
|
878 if(iExpect_Rejection)//[Inverse Test] EPass for 1 while EFail for 0 |
|
879 { |
|
880 INFO_PRINTF1(_L("Test Expected to Fail due to lack of capabilities")); |
|
881 return vVerdict[(aAPIretValue)?0:1]; |
|
882 |
|
883 } |
|
884 else //[Direct Test] EPass for 0 while EFail for 1 |
|
885 { |
|
886 INFO_PRINTF1(_L("Test Expected to Pass with correct capabilities")); |
|
887 return vVerdict[(aAPIretValue)?1:0]; |
|
888 } |
|
889 } |
|
890 |
|
891 |
|
892 /* |
|
893 TVerdict MainThread() |
|
894 |
|
895 Called by: "doTestStepL" |
|
896 |
|
897 Purpose: Creates the child thread(which calls the respective function with regard |
|
898 to the server and also implements the Message Call). Then this fn.waits for the |
|
899 completion of the childthread( doesnt matter how the thread did die!) |
|
900 |
|
901 Return Value(Verdict of the TestStep): |
|
902 |
|
903 A.Reporting PASS/FAIL |
|
904 Direct Test: |
|
905 When a message call gets thru. Please note that in such cases |
|
906 actually the implementation of the message has started. As we |
|
907 are passing "0" Parameters, server may panic, though our botheration |
|
908 stops once the call gets thru. |
|
909 NOTE: The style is the same when CONNECTION capabilities |
|
910 are tested, the only diff is you dont have to expect a |
|
911 panic from server |
|
912 Inverse Test: |
|
913 The call should be either failed or panicked with |
|
914 "KErrPermissionDenied" flag. |
|
915 |
|
916 General Case: |
|
917 If a thread creation failed or if the server couldnt be connected |
|
918 apart from the above two cases, then a FAIL is reported |
|
919 |
|
920 B.Reporting INCONCLUSIVE |
|
921 Any panic say from unexpected source (eg:KERN-EXEC) will be |
|
922 reported INCONCLUSIVE |
|
923 */ |
|
924 TVerdict CCapabilityTestStep::MainThread() |
|
925 { |
|
926 |
|
927 TBuf<100> tExitCategory; |
|
928 TInt tExitReason = 0; |
|
929 TBuf<100> TestStyle; |
|
930 |
|
931 iExpect_Rejection?TestStyle = _L("Inverse"):TestStyle = _L("Direct"); |
|
932 TCapabilitySet theCaps = TSecurityInfo(RProcess()).iCaps ; |
|
933 const TInt KMaxTestThreadHeapSize = 0x10000; |
|
934 |
|
935 //Initialize return values |
|
936 iResult_SR = iResult_Server = KErrNone; |
|
937 |
|
938 |
|
939 // Create a child thread, with a new heap |
|
940 TInt nRes_Thread = tChildThread.Create( |
|
941 ChildThread_SR, |
|
942 ThreadStartFn, |
|
943 KDefaultStackSize, |
|
944 KMinHeapSize, |
|
945 KMaxTestThreadHeapSize, |
|
946 this, |
|
947 EOwnerProcess); |
|
948 |
|
949 |
|
950 if(nRes_Thread == KErrNone)//Thread Created |
|
951 { |
|
952 |
|
953 //Let me know when the thread is dead |
|
954 TRequestStatus ThreadStatus; |
|
955 tChildThread.Logon(ThreadStatus); |
|
956 tChildThread.Resume(); |
|
957 //Is the thread dead? |
|
958 User::WaitForRequest( ThreadStatus ); |
|
959 |
|
960 //yes, he is dead. RIP! Now the Killer's profile |
|
961 tExitCategory = tChildThread.ExitCategory(); |
|
962 tExitReason = tChildThread.ExitReason(); |
|
963 |
|
964 |
|
965 //Somebody Please say what are we testing!! |
|
966 if(iSessionCreated && (SR_MESSAGE_ID >=0))//Flag set by Child thread when connected to Server |
|
967 { |
|
968 //DEF INFO_PRINTF5(_L("Connected to Server(%S) for %S Test [MessageID: %d,Req.Cap: 0x%x,Present.Cap: 0x%x]"),&SR_ServerName,&TestStyle,SR_MESSAGE_ID,iStepCap,TSecurityInfo(RProcess())); |
|
969 } |
|
970 else if(SR_MESSAGE_ID < 0) |
|
971 { |
|
972 //DEF INFO_PRINTF5(_L("Testing Connection capabilities[%S Test] for Server(%S) [Req.Cap: 0x%x,Present.Cap: 0x%x]"),&TestStyle, |
|
973 //&SR_ServerName,TSecurityInfo(RProcess())); |
|
974 } |
|
975 else if(!iSessionCreated)// NO Connection |
|
976 { |
|
977 INFO_PRINTF4(_L("Couldnt connect to the Server(%S) ErrorCode - ServerRet: %d C32ret: %d"),&SR_ServerName,iResult_Server,iResult_C32); |
|
978 //INFO_PRINTF3(_L("Child Thread: ExitCategory : %S ExitReason : %d"),&tExitCategory,tExitReason); |
|
979 return EFail; |
|
980 } |
|
981 |
|
982 |
|
983 |
|
984 switch(tChildThread.ExitType()) |
|
985 { |
|
986 case EExitPanic: |
|
987 //1.A Panic from the connected Server |
|
988 //2.A CServer Panic normally for capability rejection |
|
989 //3.A kernel Panic (consider yourself doomed!) |
|
990 if((tExitReason == KErrPermissionDenied) || |
|
991 //DEF ? it's old version (tExitReason == CServer::EClientDoesntHaveRequiredCaps))//Rejected for Insufficient Cap. |
|
992 // is it correct ? |
|
993 (tExitReason == CServer2::EClientDoesntHaveRequiredCaps))//Rejected for Insufficient Cap. |
|
994 { |
|
995 INFO_PRINTF2(_L("Rejected for insufficient capabilities [Return Value : %d] "),tExitReason); |
|
996 return(GetVerdict(API_RetValue_PermissionDenied)); |
|
997 } |
|
998 else if(tExitCategory == iServer_Panic) //Panic from Server |
|
999 { |
|
1000 INFO_PRINTF2(_L("Server(%S) Panic to child thread"),&tExitCategory); |
|
1001 INFO_PRINTF3(_L("Child Thread: ExitCategory : %S ExitReason : %d"),&tExitCategory,tExitReason); |
|
1002 return(GetVerdict(API_RetValue_ServerPanic)); |
|
1003 } |
|
1004 else//A kernel Panic possibly |
|
1005 { |
|
1006 INFO_PRINTF3(_L("Child Thread: Panic from unexpected source (ExitCategory: %S ExitReason : %d)!"),&tExitCategory,tExitReason); |
|
1007 return EInconclusive; |
|
1008 } |
|
1009 case EExitKill: |
|
1010 if(iResult_SR != KErrPermissionDenied) |
|
1011 { |
|
1012 INFO_PRINTF2(_L("A Successfull call (Return Value : %d)"),((SR_MESSAGE_ID >=0)?iResult_SR:iResult_Server)); |
|
1013 return(GetVerdict(API_RetValue_NoCapError)); |
|
1014 } |
|
1015 else |
|
1016 { |
|
1017 INFO_PRINTF2(_L("Rejected for insufficient capabilities [Return Value : %d] "),((SR_MESSAGE_ID >=0)?iResult_SR:iResult_Server)); |
|
1018 return(GetVerdict(API_RetValue_PermissionDenied)); |
|
1019 } |
|
1020 default: |
|
1021 break; |
|
1022 } |
|
1023 } |
|
1024 else //Our thread couldnt start :o( |
|
1025 { |
|
1026 INFO_PRINTF2(_L("ERROR: Failed to create Child thread, ErrorCode:(%d)"),nRes_Thread); |
|
1027 return EFail; |
|
1028 } |
|
1029 |
|
1030 return EInconclusive; |
|
1031 } |
|
1032 |
|
1033 TInt CCapabilityTestStep::StartServer() |
|
1034 { |
|
1035 |
|
1036 TInt err = KErrNone ; |
|
1037 |
|
1038 // EKA2 is simple No path required |
|
1039 TBuf<32> serverFile; |
|
1040 serverFile.Copy(_L("CNTSRV")); |
|
1041 _LIT(KExe,".exe"); |
|
1042 serverFile.Append(KExe); |
|
1043 RProcess server; |
|
1044 err = server.Create(serverFile,_L("")); |
|
1045 |
|
1046 if(err != KErrNone) |
|
1047 { |
|
1048 return err; |
|
1049 } |
|
1050 |
|
1051 // Synchronise with the server |
|
1052 TRequestStatus reqStatus; |
|
1053 server.Rendezvous(reqStatus); |
|
1054 server.Resume(); |
|
1055 |
|
1056 // Server will call the reciprocal static synchronise call |
|
1057 User::WaitForRequest(reqStatus); |
|
1058 |
|
1059 if(reqStatus.Int() != KErrNone) |
|
1060 { |
|
1061 return reqStatus.Int(); |
|
1062 } |
|
1063 return err; |
|
1064 } |
|
1065 |
|
1066 TInt CCapabilityTestStep::TestDebugHeap(TInt* iDbgIPCNo) |
|
1067 { |
|
1068 |
|
1069 //TDbgFns {MarkHeapStart, MarkHeapEnd, CheckHeap, FailNext, ResetFailNext}; |
|
1070 TInt aFnToTest= iDbgIPCNo[5]; |
|
1071 |
|
1072 |
|
1073 TInt iResult_SR [6] ={0}; |
|
1074 TInt i = 1; |
|
1075 TInt testedFn = 0; |
|
1076 |
|
1077 TInt dbgTestSequence[5][6] = { {MarkHeapStart ,2,0,1,-1,-1}, |
|
1078 {MarkHeapEnd ,2,0,1,-1,-1}, |
|
1079 {CheckHeap ,3,0,2, 1,-1}, |
|
1080 {FailNext ,4,0,3, 4, 1}, |
|
1081 {ResetFailNext ,4,0,3, 4, 1} |
|
1082 |
|
1083 }; |
|
1084 |
|
1085 |
|
1086 TInt aCount = dbgTestSequence[aFnToTest][i]; |
|
1087 |
|
1088 while(aCount-- ) |
|
1089 { |
|
1090 testedFn = dbgTestSequence[aFnToTest][(++i)]; |
|
1091 |
|
1092 iResult_SR[testedFn ]= SendReceive( iDbgIPCNo[testedFn],TIpcArgs(((iDbgIPCNo[testedFn]==3 )?4:0),0,0,0)); |
|
1093 |
|
1094 |
|
1095 if( ((testedFn !=aFnToTest)?iResult_SR[testedFn]:KErrNone) == KErrPermissionDenied) |
|
1096 |
|
1097 User::Panic(_L("Failed at Initialization"),iResult_SR[testedFn]); |
|
1098 |
|
1099 } |
|
1100 |
|
1101 return iResult_SR[aFnToTest]; |
|
1102 } |
|
1103 |
|
1104 |