|
1 // Copyright (c) 2005-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 // |
|
15 |
|
16 /** |
|
17 @file loadcpmStep.h |
|
18 */ |
|
19 |
|
20 |
|
21 #include "heapfailureStep.h" |
|
22 |
|
23 using namespace RootServer; |
|
24 |
|
25 |
|
26 //NET-iConfigurator-I-0029-HP |
|
27 //Heap Allocation failure test for load and unload API |
|
28 CHeapAllocationFailure ::~CHeapAllocationFailure () |
|
29 /** |
|
30 * Destructor |
|
31 */ |
|
32 { |
|
33 } |
|
34 |
|
35 CHeapAllocationFailure ::CHeapAllocationFailure () |
|
36 /** |
|
37 * Constructor |
|
38 */ |
|
39 { |
|
40 SetTestStepName(KHeapAllocationFailure ); |
|
41 } |
|
42 |
|
43 |
|
44 /** |
|
45 * @see HeapAllocationFailure test case NET-iConfigurator-I-00029-HP |
|
46 * |
|
47 * doTestStepL virtual function does the below action |
|
48 * it test the heap failure test for the fuction called |
|
49 * in the trap function |
|
50 * Expected:-HeapAllocationFailure return EPass |
|
51 */ |
|
52 TVerdict CHeapAllocationFailure ::doTestStepL() |
|
53 { |
|
54 SetTestStepResult(EFail); |
|
55 TInt error = KErrNone; |
|
56 TInt failRate = 0; |
|
57 |
|
58 do |
|
59 { |
|
60 // The OOM loop |
|
61 ++failRate; |
|
62 //set the heap failure test to fail |
|
63 __UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
64 //Mark the biging of the heap to test for the heap failure test |
|
65 __UHEAP_MARK; |
|
66 // Do the tests |
|
67 TRAP(error, CallOOM()); |
|
68 //Mark the end of the heap to test for the heap failure test |
|
69 __UHEAP_MARKEND; |
|
70 //Reset the heap mark |
|
71 __UHEAP_RESET; |
|
72 if(error != KErrNone && error != KErrNoMemory) |
|
73 { |
|
74 INFO_PRINTF3(_L("Unexpected error occured in %S: %D"), &TestStepName(), error); |
|
75 SetTestStepResult(EFail); |
|
76 break; |
|
77 } |
|
78 else |
|
79 { |
|
80 SetTestStepResult(EPass); |
|
81 } |
|
82 }while(error != KErrNone); |
|
83 |
|
84 return TestStepResult(); |
|
85 } |
|
86 |
|
87 |
|
88 //CallOOM function use the LoadCpm and UnLoadCpm API to test for heap failure test |
|
89 void CHeapAllocationFailure::CallOOM() |
|
90 { |
|
91 |
|
92 INFO_PRINTF1(_L("OOM load started \n")); |
|
93 _LIT8(KNameDummyCpm,"DummyCpm"); |
|
94 |
|
95 //iConfigurator Load the DummyCpm CPM |
|
96 iConfigurator.LoadCpm(KNameDummyCpm(), iStatus); |
|
97 //Waits for a specific asynchronous request to complete. |
|
98 User::WaitForRequest(iStatus); |
|
99 if(iStatus.Int() == KErrNone) |
|
100 { |
|
101 INFO_PRINTF1(_L("Heap failure test DummyCpm Loaded Successfully \n")); |
|
102 } |
|
103 else if(iStatus.Int() == KErrRSModuleUnknown) |
|
104 { |
|
105 INFO_PRINTF2(_L("Heap failure test LoadCpm (DummyCpm) returned KErrRSModuleUnknown(%d) \n"), iStatus.Int()); |
|
106 } |
|
107 else |
|
108 { |
|
109 INFO_PRINTF2(_L("Heap failure test LoadCpm (DummyCpm) returned Error (%d) \n"), iStatus.Int()); |
|
110 } |
|
111 |
|
112 INFO_PRINTF1(_L("OOM load end \n")); |
|
113 //iConfigurator to unload the DummyCpm CPM |
|
114 iConfigurator.UnloadCpm(KNameDummyCpm(), EImmediate, iStatus); |
|
115 User::WaitForRequest(iStatus); |
|
116 |
|
117 if(iStatus.Int() == KErrNone) |
|
118 { |
|
119 INFO_PRINTF1(_L("Heap failure test DummyCpm UnLoaded Successfully \n")); |
|
120 } |
|
121 else if(iStatus.Int() == KErrRSModuleUnknown) |
|
122 { |
|
123 INFO_PRINTF2(_L("Heap failure test UnLoadCpm (DummyCpm) returned KErrRSModuleUnknown(%d) \n"), iStatus.Int()); |
|
124 } |
|
125 else |
|
126 { |
|
127 INFO_PRINTF2(_L("Heap failure test UnLoadCpm (DummyCpm) returned Error (%d) \n"), iStatus.Int()); |
|
128 } |
|
129 } |
|
130 |
|
131 |
|
132 //NET-iConfigurator-I-0030-HP |
|
133 //Heap Allocation failure test for load unload and cancel load API |
|
134 CHeapFailurecancelLoad ::~CHeapFailurecancelLoad () |
|
135 /** |
|
136 * Destructor |
|
137 */ |
|
138 { |
|
139 } |
|
140 CHeapFailurecancelLoad ::CHeapFailurecancelLoad () |
|
141 /** |
|
142 * Constructor |
|
143 */ |
|
144 { |
|
145 SetTestStepName(KHeapFailurecancelLoad ); |
|
146 } |
|
147 |
|
148 /** |
|
149 * @see HeapFailurecancelLoad test case NET-iConfigurator-I-00029-HP |
|
150 * |
|
151 * doTestStepL virtual function does the below action |
|
152 * it test the heap failure test for the fuction called |
|
153 * in the trap function |
|
154 * Expected:-HeapFailurecancelLoad return EPass |
|
155 */ |
|
156 TVerdict CHeapFailurecancelLoad ::doTestStepL() |
|
157 { |
|
158 SetTestStepResult(EFail); |
|
159 TInt error = KErrNone; |
|
160 TInt failRate = 0; |
|
161 |
|
162 do |
|
163 { |
|
164 // The OOM loop |
|
165 ++failRate; |
|
166 //set the heap failure test to fail |
|
167 __UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
168 //Mark the biging of the heap to test for the heap failure test |
|
169 __UHEAP_MARK; |
|
170 // Do the tests |
|
171 TRAP(error, CancelLoad()); |
|
172 //Mark the end of the heap to test for the heap failure test |
|
173 __UHEAP_MARKEND; |
|
174 //Reset the heap mark |
|
175 __UHEAP_RESET; |
|
176 |
|
177 if(error != KErrNone && error != KErrNoMemory) |
|
178 { |
|
179 INFO_PRINTF3(_L("Unexpected error occured in %S: %D"), &TestStepName(), error); |
|
180 SetTestStepResult(EFail); |
|
181 break; |
|
182 } |
|
183 else |
|
184 { |
|
185 SetTestStepResult(EPass); |
|
186 } |
|
187 }while(error != KErrNone); |
|
188 return TestStepResult(); |
|
189 } |
|
190 |
|
191 |
|
192 //CancelLoad function use the LoadCpm,UnLoadCpm,cancelLoadCpm API to test for heap failure test |
|
193 void CHeapFailurecancelLoad::CancelLoad() |
|
194 { |
|
195 _LIT8(KNameDummyCpm,"DummyCpm"); |
|
196 |
|
197 //iConfigurator Load the DummyCpm CPM |
|
198 iConfigurator.LoadCpm(KNameDummyCpm(), iStatus); |
|
199 if(iStatus.Int() == KErrNone) |
|
200 { |
|
201 INFO_PRINTF1(_L("DummyCpm Loaded Successfully")); |
|
202 } |
|
203 else if(iStatus.Int() == KErrRSModuleUnknown) |
|
204 { |
|
205 INFO_PRINTF2(_L("LoadCpm returned KErrRSModuleUnknown(%d) \n"), iStatus.Int()); |
|
206 } |
|
207 else |
|
208 { |
|
209 INFO_PRINTF2(_L("LoadCpm returned Error (%d) \n"), iStatus.Int()); |
|
210 } |
|
211 |
|
212 //iConfigurator to call Cancel Load request preveously called |
|
213 iConfigurator.CancelLoadCpm(KNameDummyCpm()); |
|
214 User::WaitForRequest(iStatus); |
|
215 iConfigurator.LoadCpm(KNameDummyCpm(), iStatus); |
|
216 //iConfigurator Load the DummyCpm CPM |
|
217 User::WaitForRequest(iStatus); |
|
218 if(iStatus.Int() == KErrNone) |
|
219 { |
|
220 INFO_PRINTF1(_L("CancelLoadCpm Loaded Successfully")); |
|
221 } |
|
222 else if(iStatus.Int() == KErrRSModuleAlreadyExist) |
|
223 { |
|
224 INFO_PRINTF1(_L("CancelLoading DummyCpm Failed\n")); |
|
225 } |
|
226 else if(iStatus.Int() == KErrRSModuleUnknown) |
|
227 { |
|
228 INFO_PRINTF2(_L("CancelLoading DummyCpm returned KErrRSModuleUnknown(%d) \n"), iStatus.Int()); |
|
229 } |
|
230 else |
|
231 { |
|
232 INFO_PRINTF2(_L("CancelLoading DummyCpm Unknown status (%d) \n"), iStatus.Int()); |
|
233 } |
|
234 |
|
235 //iConfigurator unLoad the DummyCpm CPM |
|
236 iConfigurator.UnloadCpm(KNameDummyCpm(), EImmediate, iStatus); |
|
237 User::WaitForRequest(iStatus); |
|
238 } |
|
239 |
|
240 //NET-iConfigurator-I-0031-HP |
|
241 //Heap Allocation failure test for load unload and cancel unload API |
|
242 CHeapFailurecancelUnLoad ::~CHeapFailurecancelUnLoad () |
|
243 /** |
|
244 * Destructor |
|
245 */ |
|
246 { |
|
247 } |
|
248 |
|
249 CHeapFailurecancelUnLoad ::CHeapFailurecancelUnLoad () |
|
250 /** |
|
251 * Constructor |
|
252 */ |
|
253 { |
|
254 SetTestStepName(KHeapFailurecancelUnLoad ); |
|
255 } |
|
256 |
|
257 /** |
|
258 * HeapFailurecancelUnLoad test case NET-iConfigurator-I-0031-HP |
|
259 * |
|
260 * doTestStepL virtual function does the below action |
|
261 * it test the heap failure test for the fuction called |
|
262 * in the trap function |
|
263 * Expected:-HeapFailurecancelUnLoad return EPass |
|
264 */ |
|
265 TVerdict CHeapFailurecancelUnLoad ::doTestStepL() |
|
266 { |
|
267 SetTestStepResult(EFail); |
|
268 TInt error = KErrNone; |
|
269 TInt failRate = 0; |
|
270 |
|
271 do |
|
272 { |
|
273 // The OOM loop |
|
274 ++failRate; |
|
275 //set the heap failure test to fail |
|
276 __UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
277 //Mark the biging of the heap to test for the heap failure test |
|
278 __UHEAP_MARK; |
|
279 // Do the tests |
|
280 TRAP(error, CancelUnLoad()); |
|
281 //Mark the end of the heap to test for the heap failure test |
|
282 __UHEAP_MARKEND; |
|
283 //Reset the heap mark |
|
284 __UHEAP_RESET; |
|
285 |
|
286 if(error != KErrNone && error != KErrNoMemory) |
|
287 { |
|
288 INFO_PRINTF3(_L("Unexpected error occured in %S: %D"), &TestStepName(), error); |
|
289 SetTestStepResult(EFail); |
|
290 break; |
|
291 } |
|
292 else |
|
293 { |
|
294 SetTestStepResult(EPass); |
|
295 } |
|
296 }while(error != KErrNone); |
|
297 |
|
298 return TestStepResult(); |
|
299 } |
|
300 |
|
301 //CancelUnLoad function use the LoadCpm,UnLoadCpm,CancelUnLoadCpm API to test for heap failure test |
|
302 void CHeapFailurecancelUnLoad::CancelUnLoad() |
|
303 { |
|
304 _LIT8(KNameDummyCpm,"DummyCpm"); |
|
305 |
|
306 //iConfigurator Load the DummyCpm CPM |
|
307 iConfigurator.LoadCpm(KNameDummyCpm(), iStatus); |
|
308 User::WaitForRequest(iStatus); |
|
309 if(iStatus.Int() == KErrNone) |
|
310 { |
|
311 INFO_PRINTF1(_L("DummyCpm Loaded Successfully")); |
|
312 } |
|
313 else if(iStatus.Int() == KErrRSModuleUnknown) |
|
314 { |
|
315 INFO_PRINTF2(_L("LoadCpm returned KErrRSModuleUnknown(%d) \n"), iStatus.Int()); |
|
316 } |
|
317 else |
|
318 { |
|
319 INFO_PRINTF2(_L("LoadCpm returned Error (%d) \n"), iStatus.Int()); |
|
320 } |
|
321 |
|
322 //iConfigurator to unload the DummyCpm CPM |
|
323 iConfigurator.UnloadCpm(KNameDummyCpm(), EImmediate, iStatus); |
|
324 //iConfigurator to cancel unload the DummyCpm CPM |
|
325 iConfigurator.CancelUnloadCpm(KNameDummyCpm()); |
|
326 User::WaitForRequest(iStatus); |
|
327 //iConfigurator Load the DummyCpm CPM |
|
328 iConfigurator.LoadCpm(KNameDummyCpm(), iStatus); |
|
329 User::WaitForRequest(iStatus); |
|
330 if(iStatus.Int() == KErrNone) |
|
331 { |
|
332 INFO_PRINTF1(_L("CancelLoadCpm Loaded Successfully")); |
|
333 SetTestStepResult(EFail); |
|
334 } |
|
335 else if(iStatus.Int() == KErrRSModuleAlreadyExist) |
|
336 { |
|
337 INFO_PRINTF1(_L("CancelLoading DummyCpm Failed\n")); |
|
338 } |
|
339 else if(iStatus.Int() == KErrRSModuleUnknown) |
|
340 { |
|
341 INFO_PRINTF2(_L("CancelLoading DummyCpm returned KErrRSModuleUnknown(%d) \n"), iStatus.Int()); |
|
342 } |
|
343 else |
|
344 { |
|
345 INFO_PRINTF2(_L("CancelLoading DummyCpm Unknown status (%d) \n"), iStatus.Int()); |
|
346 } |
|
347 |
|
348 //iConfigurator to unload the DummyCpm CPM |
|
349 iConfigurator.UnloadCpm(KNameDummyCpm(), EImmediate, iStatus); |
|
350 //Waits for a specific asynchronous request to complete. |
|
351 User::WaitForRequest(iStatus); |
|
352 } |
|
353 |
|
354 //NET-iConfigurator-I-0032-HP |
|
355 //Heap Allocation failure test for load unload and GetModuleIniData |
|
356 CHeapFailureconfigApi ::~CHeapFailureconfigApi() |
|
357 /** |
|
358 * Destructor |
|
359 */ |
|
360 { |
|
361 } |
|
362 |
|
363 CHeapFailureconfigApi::CHeapFailureconfigApi () |
|
364 /** |
|
365 * Constructor |
|
366 */ |
|
367 { |
|
368 SetTestStepName(KHeapFailureconfigApi ); |
|
369 } |
|
370 |
|
371 TVerdict CHeapFailureconfigApi ::doTestStepL() |
|
372 { |
|
373 SetTestStepResult(EFail); |
|
374 TInt error = KErrNone; |
|
375 TInt failRate = 0; |
|
376 do |
|
377 { |
|
378 // The OOM loop |
|
379 ++failRate; |
|
380 //set the heap failure test to fail |
|
381 //__UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
382 //Mark the biging of the heap to test for the heap failure test |
|
383 __UHEAP_MARK; |
|
384 // Do the tests |
|
385 TRAP(error, ConfiguratorApis()); |
|
386 //Mark the end of the heap to test for the heap failure test |
|
387 __UHEAP_MARKEND; |
|
388 //Reset the heap mark |
|
389 __UHEAP_RESET; |
|
390 |
|
391 if(error != KErrNone && error != KErrNoMemory) |
|
392 { |
|
393 INFO_PRINTF3(_L("Unexpected error occured in %S: %D"), &TestStepName(), error); |
|
394 SetTestStepResult(EFail); |
|
395 break; |
|
396 } |
|
397 else |
|
398 { |
|
399 SetTestStepResult(EPass); |
|
400 } |
|
401 }while(error != KErrNone); |
|
402 |
|
403 return TestStepResult(); |
|
404 |
|
405 } |
|
406 |
|
407 //iConfiguratorApis function use the LoadCpm,UnLoadCpm,GetModuleIniData,EnumerateModules API to test for heap failure test |
|
408 void CHeapFailureconfigApi::ConfiguratorApis() |
|
409 { |
|
410 _LIT8(KNameDummyCpm,"DummyCpm"); |
|
411 |
|
412 //iConfigurator Load the DummyCpm CPM |
|
413 iConfigurator.LoadCpm(KNameDummyCpm(), iStatus); |
|
414 User::WaitForRequest(iStatus); |
|
415 |
|
416 if(iStatus.Int() == KErrNone) |
|
417 { |
|
418 INFO_PRINTF1(_L("DummyCpm Loaded Successfully")); |
|
419 } |
|
420 else if(iStatus.Int() == KErrRSModuleUnknown) |
|
421 { |
|
422 INFO_PRINTF2(_L("LoadCpm returned KErrRSModuleUnknown(%d) \n"), iStatus.Int()); |
|
423 } |
|
424 else |
|
425 { |
|
426 INFO_PRINTF2(_L("LoadCpm returned Error (%d) \n"), iStatus.Int()); |
|
427 } |
|
428 |
|
429 //iConfigurator unLoad the DummyCpm |
|
430 iConfigurator.UnloadCpm(KNameDummyCpm(), EImmediate, iStatus); |
|
431 User::WaitForRequest(iStatus); |
|
432 if(iStatus.Int() == KErrNone) |
|
433 { |
|
434 INFO_PRINTF1(_L("UnLoadCpm Loaded Successfully")); |
|
435 } |
|
436 else if(iStatus.Int() == KErrRSModuleAlreadyExist) |
|
437 { |
|
438 INFO_PRINTF2(_L("UnLoadCpm DummyCpm Unknown status (%d) \n"), iStatus.Int());; |
|
439 } |
|
440 else if(iStatus.Int() == KErrRSModuleUnknown) |
|
441 { |
|
442 INFO_PRINTF2(_L("UnLoadCpm DummyCpm returned KErrRSModuleUnknown(%d) \n"), iStatus.Int()); |
|
443 } |
|
444 else |
|
445 { |
|
446 INFO_PRINTF2(_L("UnLoadCpm DummyCpm Unknown status (%d) \n"), iStatus.Int()); |
|
447 } |
|
448 |
|
449 RBuf8 data; |
|
450 data.Create(100); |
|
451 TInt actualdatasize; |
|
452 //iConfigurator call to get the module inidata section |
|
453 TInt error = iConfigurator.GetModuleIniData(KNameDummyCpm(), data, actualdatasize); |
|
454 if (error == KErrOverflow) |
|
455 { |
|
456 INFO_PRINTF2(_L("GetModuleIniData returned KErrOverflow (%d) \n"), error); |
|
457 data.ReAlloc(actualdatasize); |
|
458 error = iConfigurator.GetModuleIniData(KNameDummyCpm(), data, actualdatasize); |
|
459 SetTestStepResult(EFail); |
|
460 } |
|
461 else if (error == KErrRSModuleUnknown ) |
|
462 { |
|
463 INFO_PRINTF2(_L("GetModuleIniData returned KErrRSModuleUnknown (%d) \n"), error); |
|
464 SetTestStepResult(EFail); |
|
465 } |
|
466 else if (error == KErrNone) |
|
467 { |
|
468 INFO_PRINTF1(_L("GetModuleIniData Sucessful")); |
|
469 } |
|
470 else |
|
471 { |
|
472 INFO_PRINTF2(_L("GetModuleIniData (DummyCpm) returned Error (%d) \n"), error); |
|
473 } |
|
474 |
|
475 data.Close(); |
|
476 TRSIter position; |
|
477 TCFModuleName moduleName; |
|
478 _LIT8(KGroupName, "Group1"); |
|
479 TCFGroupName groupName(KGroupName); |
|
480 //Enables the client to assemble a list of modules for matching one group by retrieving the |
|
481 // name of one module at a time from all modules |
|
482 while(KErrNone == iConfigurator.EnumerateModules(groupName, position , moduleName)) |
|
483 { |
|
484 INFO_PRINTF1(_L("EnumerateModules Sucessful\n")); |
|
485 } |
|
486 } |
|
487 |
|
488 //NET-iConfigurator-I-0033-HP |
|
489 //Heap Allocation failure test for GetIni API |
|
490 CHeapFailurecancelGetIni ::CHeapFailurecancelGetIni () |
|
491 /** |
|
492 * Destructor |
|
493 */ |
|
494 { |
|
495 } |
|
496 |
|
497 CHeapFailurecancelGetIni ::~CHeapFailurecancelGetIni () |
|
498 /** |
|
499 * Constructor |
|
500 */ |
|
501 { |
|
502 SetTestStepName(KHeapFailurecancelGetIni ); |
|
503 } |
|
504 |
|
505 TVerdict CHeapFailurecancelGetIni ::doTestStepL() |
|
506 { |
|
507 |
|
508 SetTestStepResult(EFail); |
|
509 TInt error = KErrNone; |
|
510 TInt failRate = 0; |
|
511 |
|
512 do |
|
513 { |
|
514 // The OOM loop |
|
515 ++failRate; |
|
516 //set the heap failure test to fail |
|
517 //__UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
518 //Mark the biging of the heap to test for the heap failure test |
|
519 __UHEAP_MARK; |
|
520 // Do the tests |
|
521 TRAP(error, CancelGetIni()); |
|
522 //Mark the end of the heap to test for the heap failure test |
|
523 __UHEAP_MARKEND; |
|
524 //Reset the heap mark |
|
525 __UHEAP_RESET; |
|
526 if(error != KErrNone && error != KErrNoMemory) |
|
527 { |
|
528 INFO_PRINTF3(_L("Unexpected error occured in %S: %D"), &TestStepName(), error); |
|
529 SetTestStepResult(EFail); |
|
530 break; |
|
531 } |
|
532 else |
|
533 { |
|
534 SetTestStepResult(EPass); |
|
535 } |
|
536 }while(error != KErrNone); |
|
537 |
|
538 return TestStepResult(); |
|
539 } |
|
540 |
|
541 //CancelGetIni function use the LoadCpm,UnLoadCpm,GetModuleIniData,EnumerateModules API to test for heap failure test |
|
542 void CHeapFailurecancelGetIni::CancelGetIni() |
|
543 { |
|
544 |
|
545 TCFModuleName DummyCpm; |
|
546 _LIT8(KNameDummyCpm,"DummyCpm"); |
|
547 DummyCpm.Copy(KNameDummyCpm); |
|
548 RBuf8 data; |
|
549 data.Create(100); |
|
550 TInt actualdatasize; |
|
551 |
|
552 TInt error = iConfigurator.GetModuleIniData(DummyCpm, data, actualdatasize); |
|
553 if (error == KErrOverflow) |
|
554 { |
|
555 INFO_PRINTF2(_L("GetModuleIniData returned KErrOverflow (%d) \n"), error); |
|
556 data.ReAlloc(actualdatasize); |
|
557 error = iConfigurator.GetModuleIniData(DummyCpm, data, actualdatasize); |
|
558 } |
|
559 else |
|
560 if (error == KErrRSModuleUnknown ) |
|
561 { |
|
562 INFO_PRINTF2(_L("GetModuleIniData returned KErrRSModuleUnknown (%d) \n"), error); |
|
563 } |
|
564 else |
|
565 if (error == KErrNone) |
|
566 { |
|
567 INFO_PRINTF1(_L("GetModuleIniData Sucessful")); |
|
568 } |
|
569 else |
|
570 { |
|
571 INFO_PRINTF2(_L("GetModuleIniData (DummyCpm) returned Error (%d) \n"), error); |
|
572 } |
|
573 data.Close(); |
|
574 } |
|
575 |
|
576 //NET-iConfigurator-I-0034-HP |
|
577 //Heap Allocation failure test for GetIni API |
|
578 CHeapFailureEnumerateGrp ::CHeapFailureEnumerateGrp () |
|
579 /** |
|
580 * Destructor |
|
581 */ |
|
582 { |
|
583 } |
|
584 |
|
585 CHeapFailureEnumerateGrp ::~CHeapFailureEnumerateGrp () |
|
586 /** |
|
587 * Constructor |
|
588 */ |
|
589 { |
|
590 SetTestStepName(KHeapFailureEnumerateGrp ); |
|
591 } |
|
592 |
|
593 TVerdict CHeapFailureEnumerateGrp ::doTestStepL() |
|
594 { |
|
595 |
|
596 SetTestStepResult(EFail); |
|
597 TInt error = KErrNone; |
|
598 TInt failRate = 0; |
|
599 |
|
600 do |
|
601 { |
|
602 // The OOM loop |
|
603 ++failRate; |
|
604 //set the heap failure test to fail |
|
605 //__UHEAP_SETFAIL(RHeap::EDeterministic, failRate); |
|
606 //Mark the biging of the heap to test for the heap failure test |
|
607 __UHEAP_MARK; |
|
608 // Do the tests |
|
609 TRAP(error, EnumerateGrp()); |
|
610 //Mark the end of the heap to test for the heap failure test |
|
611 __UHEAP_MARKEND; |
|
612 //Reset the heap mark |
|
613 __UHEAP_RESET; |
|
614 |
|
615 if(error != KErrNone && error != KErrNoMemory) |
|
616 { |
|
617 INFO_PRINTF3(_L("Unexpected error occured in %S: %D"), &TestStepName(), error); |
|
618 SetTestStepResult(EFail); |
|
619 break; |
|
620 } |
|
621 else |
|
622 { |
|
623 SetTestStepResult(EPass); |
|
624 } |
|
625 }while(error != KErrNone); |
|
626 |
|
627 return TestStepResult(); |
|
628 } |
|
629 |
|
630 |
|
631 void CHeapFailureEnumerateGrp::EnumerateGrp() |
|
632 { |
|
633 TRSIter position; |
|
634 TCFModuleName moduleName; |
|
635 _LIT8(KGroupName, "Group1"); |
|
636 |
|
637 TCFGroupName groupName(KGroupName); |
|
638 //Enables the client to assemble a list of modules for matching group. |
|
639 while(KErrNone == iConfigurator.EnumerateModules(groupName, position , moduleName)) |
|
640 { |
|
641 INFO_PRINTF1(_L("EnumerateModules Sucessful\n")); |
|
642 } |
|
643 |
|
644 } |
|
645 |
|
646 |
|
647 |