|
1 // Copyright (c) 2003-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 // This contains RootServer Test cases from section 6 |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <es_mbman.h> |
|
21 |
|
22 // Test system includes |
|
23 #include <networking/log.h> |
|
24 #include <networking/teststep.h> |
|
25 #include <networking/testsuite.h> |
|
26 |
|
27 #include "TestStepRootServer.h" |
|
28 #include "TestSuiteRootServer.h" |
|
29 #include "TestAsynchHandler.h" |
|
30 #include "RootServerTestSection6.h" |
|
31 #include <cfshared.h> |
|
32 #include "RootServerTest.h" |
|
33 |
|
34 |
|
35 // Test step 6.1 - Bind without loading |
|
36 CRootServerTest6_1::CRootServerTest6_1() |
|
37 { |
|
38 // store the name of this test case |
|
39 iTestStepName = _L("Test6.1"); |
|
40 } |
|
41 |
|
42 TVerdict CRootServerTest6_1::doTestStepL( void ) |
|
43 { |
|
44 Log(_L("Test Purpose: Bind without loading")); |
|
45 TVerdict verdict = EPass; |
|
46 |
|
47 // Create scheduler/active object framework |
|
48 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
49 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
50 |
|
51 //*****************step 2************************ |
|
52 Log(_L("02 Attempting bind")); |
|
53 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
54 if (ret != KErrRSModuleNotLoaded) |
|
55 { |
|
56 Log(_L("LoadProvider returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
57 verdict = EFail; |
|
58 } |
|
59 |
|
60 // uninstall and destroy active scheduler |
|
61 CleanupStack::PopAndDestroy(asynchHandler); |
|
62 CleanupStack::PopAndDestroy(scheduler); |
|
63 return verdict; |
|
64 |
|
65 } |
|
66 |
|
67 // Test step 6.2 - Bind loaded to unloaded |
|
68 CRootServerTest6_2::CRootServerTest6_2() |
|
69 { |
|
70 // store the name of this test case |
|
71 iTestStepName = _L("Test6.2"); |
|
72 } |
|
73 |
|
74 TVerdict CRootServerTest6_2::doTestStepL( void ) |
|
75 { |
|
76 Log(_L("Test Purpose: Bind loaded to unloaded")); |
|
77 TVerdict verdict = EPass; |
|
78 |
|
79 // Create scheduler/active object framework |
|
80 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
81 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
82 |
|
83 //*****************step 02*************************// |
|
84 Log(_L("02 Load Test Module")); |
|
85 LoadNormalModuleL(asynchHandler, KModule1); |
|
86 |
|
87 //*****************step 3************************ |
|
88 Log(_L("03 Attempting bind")); |
|
89 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule2, KSubModule1); |
|
90 if (ret != KErrRSModuleNotLoaded) |
|
91 { |
|
92 Log(_L("Bind returned error: <%d> "), ret); |
|
93 verdict = EFail; |
|
94 } |
|
95 |
|
96 // uninstall and destroy active scheduler |
|
97 CleanupStack::PopAndDestroy(asynchHandler); |
|
98 CleanupStack::PopAndDestroy(scheduler); |
|
99 return verdict; |
|
100 |
|
101 } |
|
102 |
|
103 |
|
104 TVerdict CRootServerTest6_BindWithinModule::BindWithinModuleL(TThreadPriority aPriority) |
|
105 { |
|
106 TVerdict verdict = EPass; |
|
107 |
|
108 // Create scheduler/active object framework |
|
109 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
110 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
111 |
|
112 //*****************step 01*************************// |
|
113 Log(_L("01 Load Test Module")); |
|
114 LoadNormalModuleL(asynchHandler, KModule1, aPriority); |
|
115 |
|
116 //*****************step 2*********************** |
|
117 Log(_L("02 Attempting Bind")); |
|
118 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
119 if (ret != KErrNone) |
|
120 { |
|
121 Log(_L("Bind returned error: <%d> "), ret); |
|
122 verdict = EFail; |
|
123 } |
|
124 |
|
125 // uninstall and destroy active scheduler |
|
126 CleanupStack::PopAndDestroy(asynchHandler); |
|
127 CleanupStack::PopAndDestroy(scheduler); |
|
128 return verdict; |
|
129 } |
|
130 |
|
131 // Test step 6.3 - Bind within a module (normal priority) |
|
132 CRootServerTest6_3::CRootServerTest6_3() |
|
133 { |
|
134 // store the name of this test case |
|
135 iTestStepName = _L("Test6.3"); |
|
136 } |
|
137 |
|
138 TVerdict CRootServerTest6_3::doTestStepL( void ) |
|
139 { |
|
140 Log(_L("Test Purpose: Bind within module (normal priority)")); |
|
141 return BindWithinModuleL(EPriorityNormal); |
|
142 } |
|
143 |
|
144 // Test step 6.4 - Bind within a module (elevated priority) |
|
145 CRootServerTest6_4::CRootServerTest6_4() |
|
146 { |
|
147 // store the name of this test case |
|
148 iTestStepName = _L("Test6.4"); |
|
149 } |
|
150 |
|
151 TVerdict CRootServerTest6_4::doTestStepL( void ) |
|
152 { |
|
153 Log(_L("Test Purpose: Bind within module (elevated priority)")); |
|
154 return BindWithinModuleL(EPriorityRealTime); |
|
155 } |
|
156 |
|
157 // Test step 6.5 - Bind submodule to itself |
|
158 CRootServerTest6_5::CRootServerTest6_5() |
|
159 { |
|
160 // store the name of this test case |
|
161 iTestStepName = _L("Test6.5"); |
|
162 } |
|
163 |
|
164 TVerdict CRootServerTest6_5::doTestStepL( void ) |
|
165 { |
|
166 Log(_L("Test Purpose: Bind submodule to itself")); |
|
167 TVerdict verdict = EPass; |
|
168 |
|
169 // Create scheduler/active object framework |
|
170 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
171 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
172 |
|
173 //*****************step 01*************************// |
|
174 Log(_L("01 Load Test Module")); |
|
175 LoadNormalModuleL(asynchHandler, KModule1); |
|
176 |
|
177 //*****************step 2*********************** |
|
178 Log(_L("02 Attempting Bind")); |
|
179 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule1); |
|
180 if (ret != KErrNone) |
|
181 { |
|
182 Log(_L("Bind returned error: <%d> "), ret); |
|
183 verdict = EFail; |
|
184 } |
|
185 |
|
186 // uninstall and destroy active scheduler |
|
187 CleanupStack::PopAndDestroy(asynchHandler); |
|
188 CleanupStack::PopAndDestroy(scheduler); |
|
189 return verdict; |
|
190 } |
|
191 |
|
192 // Test step 6.6 - Bind already bound |
|
193 CRootServerTest6_6::CRootServerTest6_6() |
|
194 { |
|
195 // store the name of this test case |
|
196 iTestStepName = _L("Test6.6"); |
|
197 } |
|
198 |
|
199 TVerdict CRootServerTest6_6::doTestStepL( void ) |
|
200 { |
|
201 Log(_L("Test Purpose: Bind again")); |
|
202 TVerdict verdict = EPass; |
|
203 |
|
204 // Create scheduler/active object framework |
|
205 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
206 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
207 |
|
208 //*****************step 01*************************// |
|
209 Log(_L("01 Load Test Module")); |
|
210 LoadNormalModuleL(asynchHandler, KModule1); |
|
211 |
|
212 //*****************step 2************************ |
|
213 Log(_L("02 Bind internally")); |
|
214 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
215 if (ret != KErrNone) |
|
216 { |
|
217 Log(_L("Bind returned error: <%d> "), ret); |
|
218 User::Leave(ret); |
|
219 } |
|
220 |
|
221 //*****************step 3************************ |
|
222 Log(_L("03 Bind Again")); |
|
223 ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
224 if (ret != KErrRSAlreadyBound) |
|
225 { |
|
226 Log(_L("Bind returned error: <%d> "), ret); |
|
227 User::Leave(KErrGeneral); |
|
228 } |
|
229 |
|
230 // uninstall and destroy active scheduler |
|
231 CleanupStack::PopAndDestroy(asynchHandler); |
|
232 CleanupStack::PopAndDestroy(scheduler); |
|
233 return verdict; |
|
234 |
|
235 } |
|
236 |
|
237 // Test step 6.7 - Enumerate BindInfo |
|
238 CRootServerTest6_7::CRootServerTest6_7() |
|
239 { |
|
240 // store the name of this test case |
|
241 iTestStepName = _L("Test6.7"); |
|
242 } |
|
243 |
|
244 TVerdict CRootServerTest6_7::doTestStepL( void ) |
|
245 { |
|
246 TCFSubModuleAddress fullName1; |
|
247 fullName1.SetModule(KModule1()); |
|
248 fullName1.SetSubModule(KSubModule1()); |
|
249 TCFSubModuleAddress fullName2; |
|
250 fullName2.SetModule(KModule1()); |
|
251 fullName2.SetSubModule(KSubModule2()); |
|
252 |
|
253 Log(_L("Test Purpose: Enumerate BindInfo")); |
|
254 TVerdict verdict = EPass; |
|
255 |
|
256 // Create scheduler/active object framework |
|
257 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
258 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
259 //*****************step 01*************************// |
|
260 Log(_L("01 Load Test Module")); |
|
261 LoadNormalModuleL(asynchHandler, KModule1); |
|
262 |
|
263 //*****************step 2************************ |
|
264 Log(_L("02 Bind internally")); |
|
265 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
266 if (ret != KErrNone) |
|
267 { |
|
268 Log(_L("Bind returned error: <%d> "), ret); |
|
269 User::Leave(ret); |
|
270 } |
|
271 |
|
272 TRSBindingInfo bindInfo; |
|
273 TRSIter position; |
|
274 |
|
275 //*****************step 2************************ |
|
276 Log(_L("02 Enumerate bindings")); |
|
277 ret = iRootServerSuite->RootSess().EnumerateBindings(fullName1, position, bindInfo); |
|
278 |
|
279 Log(_L("Enumerate returned %d"), ret); |
|
280 |
|
281 if (KErrNone != ret) |
|
282 { |
|
283 verdict = EFail; |
|
284 } |
|
285 else |
|
286 { |
|
287 if ( (bindInfo.iParams.iAddress1 == fullName1) && (bindInfo.iParams.iAddress2 == fullName2) ) |
|
288 { |
|
289 Log(_L("Binding Found") ); |
|
290 } |
|
291 else if ( (bindInfo.iParams.iAddress1 == fullName2) && (bindInfo.iParams.iAddress2 == fullName1) ) |
|
292 { |
|
293 Log(_L("Binding Found") ); |
|
294 } |
|
295 else |
|
296 { |
|
297 Log(_L("Binding not found")); |
|
298 verdict = EFail; |
|
299 } |
|
300 ret = iRootServerSuite->RootSess().EnumerateBindings(fullName1, position, bindInfo); |
|
301 Log(_L("Follow-up Enumerate returned %d"), ret); |
|
302 if(KErrEof != ret) |
|
303 { |
|
304 Log(_L("(should have returned KErrEof")); |
|
305 verdict = EFail; |
|
306 } |
|
307 ret = iRootServerSuite->RootSess().EnumerateBindings(fullName1, position, bindInfo); |
|
308 Log(_L("Further Enumerate returned %d"), ret); |
|
309 if(KErrEof != ret) |
|
310 { |
|
311 Log(_L("(should have returned KErrEof")); |
|
312 verdict = EFail; |
|
313 } |
|
314 } |
|
315 |
|
316 // uninstall and destroy active scheduler |
|
317 CleanupStack::PopAndDestroy(asynchHandler); |
|
318 CleanupStack::PopAndDestroy(scheduler); |
|
319 |
|
320 return verdict; |
|
321 } |
|
322 |
|
323 |
|
324 TVerdict CRootServerTest6_UnbindWithinModule::UnbindWithinModuleL(TThreadPriority aPriority) |
|
325 { |
|
326 TVerdict verdict = EPass; |
|
327 |
|
328 // Create scheduler/active object framework |
|
329 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
330 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
331 |
|
332 //*****************step 01*************************// |
|
333 Log(_L("01 Load Test Module")); |
|
334 LoadNormalModuleL(asynchHandler, KModule1, aPriority); |
|
335 |
|
336 //*****************step 2************************ |
|
337 Log(_L("02 Bind internally")); |
|
338 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
339 if (ret != KErrNone) |
|
340 { |
|
341 Log(_L("Bind returned error: <%d> "), ret); |
|
342 User::Leave(ret); |
|
343 } |
|
344 //*****************step 3************************ |
|
345 Log(_L("03 Unbind")); |
|
346 TRSUnBindingInfo unbindInfo; |
|
347 unbindInfo.iParams.iAddress1.SetModule(KModule1()); |
|
348 unbindInfo.iParams.iAddress1.SetSubModule(KSubModule1()); |
|
349 unbindInfo.iParams.iAddress2.SetModule(KModule1()); |
|
350 unbindInfo.iParams.iAddress2.SetSubModule(KSubModule2()); |
|
351 |
|
352 asynchHandler->TryUnBind( unbindInfo ); |
|
353 |
|
354 CActiveScheduler::Start(); |
|
355 if (asynchHandler->iStatus != KErrNone) |
|
356 { |
|
357 Log(_L("Unbind returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
358 verdict = EFail; |
|
359 } |
|
360 |
|
361 Log(_L("04 Duplicate Unbind")); |
|
362 asynchHandler->TryUnBind( unbindInfo ); |
|
363 |
|
364 CActiveScheduler::Start(); |
|
365 if (asynchHandler->iStatus != KErrRSBindingUnknown) |
|
366 { |
|
367 Log(_L("Duplicate Unbind returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
368 verdict = EFail; |
|
369 } |
|
370 |
|
371 // uninstall and destroy active scheduler |
|
372 CleanupStack::PopAndDestroy(asynchHandler); |
|
373 CleanupStack::PopAndDestroy(scheduler); |
|
374 return verdict; |
|
375 } |
|
376 |
|
377 // Test step 6.8 - Unbind within Module (normal priority) |
|
378 CRootServerTest6_8::CRootServerTest6_8() |
|
379 { |
|
380 // store the name of this test case |
|
381 iTestStepName = _L("Test6.8"); |
|
382 } |
|
383 |
|
384 TVerdict CRootServerTest6_8::doTestStepL( void ) |
|
385 { |
|
386 Log(_L("Test Purpose: UnBind within Module (elevated priority)")); |
|
387 return UnbindWithinModuleL(EPriorityNormal); |
|
388 } |
|
389 |
|
390 // Test step 6.9 - Unbind within Module (normal priority) |
|
391 CRootServerTest6_9::CRootServerTest6_9() |
|
392 { |
|
393 // store the name of this test case |
|
394 iTestStepName = _L("Test6.9"); |
|
395 } |
|
396 |
|
397 TVerdict CRootServerTest6_9::doTestStepL( void ) |
|
398 { |
|
399 Log(_L("Test Purpose: UnBind within Module (elevated priority)")); |
|
400 return UnbindWithinModuleL(EPriorityRealTime); |
|
401 } |
|
402 |
|
403 |
|
404 |
|
405 // Test step 6.10 - Cancel Bind |
|
406 CRootServerTest6_10::CRootServerTest6_10() |
|
407 { |
|
408 // store the name of this test case |
|
409 iTestStepName = _L("Test6.10"); |
|
410 } |
|
411 |
|
412 TVerdict CRootServerTest6_10::doTestStepL( void ) |
|
413 { |
|
414 Log(_L("Test Purpose: Cancel bind")); |
|
415 TVerdict verdict = EPass; |
|
416 |
|
417 // Create scheduler/active object framework |
|
418 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
419 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
420 |
|
421 //*****************step 01*************************// |
|
422 Log(_L("01 Load Test Module")); |
|
423 LoadNormalModuleL(asynchHandler, KModule1); |
|
424 |
|
425 //*****************step 2************************ |
|
426 Log(_L("02 Attempting bind")); |
|
427 TRSBindingInfo bindInfo; |
|
428 bindInfo.iParams.iType = EHierarchical; |
|
429 bindInfo.iParams.iAddress1.SetModule(KModule1()); |
|
430 bindInfo.iParams.iAddress1.SetSubModule(KSubModule1()); |
|
431 bindInfo.iParams.iAddress2.SetModule(KModule1()); |
|
432 bindInfo.iParams.iAddress2.SetSubModule(KSubModule2()); |
|
433 bindInfo.iParams.iState1 = KErrNone; |
|
434 bindInfo.iParams.iState2 = KErrNone; |
|
435 bindInfo.iParams.iForwardQLength = TRSBindingInfo::EMinQueueLength; |
|
436 bindInfo.iParams.iReverseQLength = TRSBindingInfo::EMinQueueLength; |
|
437 |
|
438 TRSSubModuleAddress name1(bindInfo.iParams.iAddress1); |
|
439 TRSSubModuleAddress name2(bindInfo.iParams.iAddress2); |
|
440 |
|
441 asynchHandler->TryBind( bindInfo ); |
|
442 |
|
443 //*****************step 3************************ |
|
444 Log(_L("04 Wait for bind to be completed")); |
|
445 User::After(1000000); |
|
446 //*****************step 4************************ |
|
447 Log(_L("04 Cancelling Bind")); |
|
448 iRootServerSuite->RootSess().CancelBind(name1, name2); |
|
449 |
|
450 CActiveScheduler::Start(); |
|
451 |
|
452 if (asynchHandler->iStatus != KErrNone) |
|
453 { |
|
454 Log(_L("Bind returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
455 verdict = EFail; |
|
456 } |
|
457 |
|
458 // uninstall and destroy active scheduler |
|
459 CleanupStack::PopAndDestroy(asynchHandler); |
|
460 CleanupStack::PopAndDestroy(scheduler); |
|
461 return verdict; |
|
462 |
|
463 } |
|
464 |
|
465 // Test step 6.11 - Cancel UnBind |
|
466 CRootServerTest6_11::CRootServerTest6_11() |
|
467 { |
|
468 // store the name of this test case |
|
469 iTestStepName = _L("Test6.11"); |
|
470 } |
|
471 |
|
472 TVerdict CRootServerTest6_11::doTestStepL( void ) |
|
473 { |
|
474 Log(_L("Test Purpose: Cancel Unbind")); |
|
475 TVerdict verdict = EPass; |
|
476 |
|
477 // Create scheduler/active object framework |
|
478 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
479 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
480 |
|
481 //*****************step 01*************************// |
|
482 Log(_L("01 Load Test Module")); |
|
483 LoadNormalModuleL(asynchHandler, KModule1); |
|
484 |
|
485 //*****************step 2************************ |
|
486 Log(_L("02 Bind internally")); |
|
487 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
488 if (ret != KErrNone) |
|
489 { |
|
490 Log(_L("Bind returned error: <%d> "), ret); |
|
491 User::Leave(ret); |
|
492 } |
|
493 |
|
494 //*****************step 3************************ |
|
495 Log(_L("03 Unbind")); |
|
496 TRSUnBindingInfo unbindInfo; |
|
497 unbindInfo.iParams.iAddress1.SetModule(KModule1()); |
|
498 unbindInfo.iParams.iAddress1.SetSubModule(KSubModule1()); |
|
499 unbindInfo.iParams.iAddress2.SetModule(KModule1()); |
|
500 unbindInfo.iParams.iAddress2.SetSubModule(KSubModule2()); |
|
501 |
|
502 TRSSubModuleAddress name1(unbindInfo.iParams.iAddress1); |
|
503 TRSSubModuleAddress name2(unbindInfo.iParams.iAddress2); |
|
504 |
|
505 asynchHandler->TryUnBind( unbindInfo ); |
|
506 |
|
507 //*****************step 4************************ |
|
508 Log(_L("04 Wait for unbind to be completed")); |
|
509 User::After(1000000); |
|
510 //*****************step 5************************ |
|
511 Log(_L("05 Cancelling UnBind")); |
|
512 iRootServerSuite->RootSess().CancelUnbind(name1, name2); |
|
513 |
|
514 CActiveScheduler::Start(); |
|
515 |
|
516 if (asynchHandler->iStatus != KErrNone) |
|
517 { |
|
518 Log(_L("Unbind returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
519 verdict = EFail; |
|
520 } |
|
521 |
|
522 // uninstall and destroy active scheduler |
|
523 CleanupStack::PopAndDestroy(asynchHandler); |
|
524 CleanupStack::PopAndDestroy(scheduler); |
|
525 return verdict; |
|
526 |
|
527 } |
|
528 |
|
529 // Test step 6.12 - Bind sluggish cpm |
|
530 CRootServerTest6_12::CRootServerTest6_12() |
|
531 { |
|
532 // store the name of this test case |
|
533 iTestStepName = _L("Test6.12"); |
|
534 } |
|
535 |
|
536 TVerdict CRootServerTest6_12::doTestStepL( void ) |
|
537 { |
|
538 Log(_L("Test Purpose: Bind sluggish cpm")); |
|
539 TVerdict verdict = EPass; |
|
540 |
|
541 // Create scheduler/active object framework |
|
542 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
543 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
544 |
|
545 TRSStartModuleParams startParams; |
|
546 TTestModuleIniData iniData; |
|
547 DefaultStartParams(startParams, iniData); |
|
548 startParams.iParams.iName = KModule1; |
|
549 iniData.iParams.iDiscoveryDelay = 500; |
|
550 iniData.iParams.iBindDelay = 500; |
|
551 iniData.iParams.iUnbindDelay = 500; |
|
552 iniData.iParams.iShutdownDelay = 500; |
|
553 asynchHandler->TryLoad(startParams, iniData); |
|
554 |
|
555 CActiveScheduler::Start(); |
|
556 if (asynchHandler->iStatus != KErrNone) |
|
557 { |
|
558 Log(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
559 User::Leave(asynchHandler->iStatus.Int()); |
|
560 } |
|
561 //*****************step 02*************************// |
|
562 Log(_L("02 Attempting bind")); |
|
563 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
564 if (ret != KErrNone) |
|
565 { |
|
566 Log(_L("Bind returned error: <%d> "), ret); |
|
567 verdict = EFail; |
|
568 } |
|
569 |
|
570 // uninstall and destroy active scheduler |
|
571 CleanupStack::PopAndDestroy(asynchHandler); |
|
572 CleanupStack::PopAndDestroy(scheduler); |
|
573 return verdict; |
|
574 |
|
575 } |
|
576 |
|
577 // Test step 6.13 - Bind dormant cpm |
|
578 CRootServerTest6_13::CRootServerTest6_13() |
|
579 { |
|
580 // store the name of this test case |
|
581 iTestStepName = _L("Test6.13"); |
|
582 } |
|
583 |
|
584 TVerdict CRootServerTest6_13::doTestStepL( void ) |
|
585 { |
|
586 Log(_L("Test Purpose: Bind dormant cpm")); |
|
587 TVerdict verdict = EPass; |
|
588 |
|
589 // Create scheduler/active object framework |
|
590 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
591 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
592 |
|
593 //*****************step 02*************************// |
|
594 Log(_L("02 Load Dormant Test CPM")); |
|
595 TRSStartModuleParams startParams; |
|
596 TTestModuleIniData iniData; |
|
597 DefaultStartParams(startParams, iniData); |
|
598 startParams.iParams.iName = KModule1; |
|
599 iniData.iParams.iDiscoveryDelay = 500; |
|
600 iniData.iParams.iBindDelay = 30000; |
|
601 iniData.iParams.iUnbindDelay = 30000; |
|
602 iniData.iParams.iShutdownDelay = 1000; |
|
603 asynchHandler->TryLoad(startParams, iniData); |
|
604 |
|
605 CActiveScheduler::Start(); |
|
606 if (asynchHandler->iStatus != KErrNone) |
|
607 { |
|
608 Log(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
609 User::Leave(asynchHandler->iStatus.Int()); |
|
610 } |
|
611 //*****************step 02*************************// |
|
612 Log(_L("02 Attempting bind")); |
|
613 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
614 if (ret != KErrRSRequestTimedOut) |
|
615 { |
|
616 Log(_L("Bind returned error: <%d> "), ret); |
|
617 verdict = EFail; |
|
618 } |
|
619 |
|
620 // uninstall and destroy active scheduler |
|
621 CleanupStack::PopAndDestroy(asynchHandler); |
|
622 CleanupStack::PopAndDestroy(scheduler); |
|
623 return verdict; |
|
624 |
|
625 } |
|
626 |
|
627 // Test step 6.14 - UnBind sluggish test cpm |
|
628 CRootServerTest6_14::CRootServerTest6_14() |
|
629 { |
|
630 // store the name of this test case |
|
631 iTestStepName = _L("Test6.14"); |
|
632 } |
|
633 |
|
634 TVerdict CRootServerTest6_14::doTestStepL( void ) |
|
635 { |
|
636 Log(_L("Test Purpose: Unbind sluggish test cpm")); |
|
637 TVerdict verdict = EPass; |
|
638 |
|
639 // Create scheduler/active object framework |
|
640 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
641 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
642 |
|
643 TRSStartModuleParams startParams; |
|
644 TTestModuleIniData iniData; |
|
645 DefaultStartParams(startParams, iniData); |
|
646 startParams.iParams.iName = KModule1; |
|
647 iniData.iParams.iDiscoveryDelay = 500; |
|
648 iniData.iParams.iBindDelay = 500; |
|
649 iniData.iParams.iUnbindDelay = 500; |
|
650 iniData.iParams.iShutdownDelay = 500; |
|
651 asynchHandler->TryLoad(startParams, iniData); |
|
652 |
|
653 CActiveScheduler::Start(); |
|
654 if (asynchHandler->iStatus != KErrNone) |
|
655 { |
|
656 Log(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
657 User::Leave(asynchHandler->iStatus.Int()); |
|
658 } |
|
659 //*****************step 02*************************// |
|
660 Log(_L("02 Attempting bind")); |
|
661 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
662 if (ret != KErrNone) |
|
663 { |
|
664 Log(_L("Bind returned error: <%d> "), ret); |
|
665 User::Leave(asynchHandler->iStatus.Int()); |
|
666 } |
|
667 |
|
668 Log(_L("03 Unbind")); |
|
669 TRSUnBindingInfo unbindInfo; |
|
670 unbindInfo.iParams.iAddress1.SetModule(KModule1()); |
|
671 unbindInfo.iParams.iAddress1.SetSubModule(KSubModule1()); |
|
672 unbindInfo.iParams.iAddress2.SetModule(KModule1()); |
|
673 unbindInfo.iParams.iAddress2.SetSubModule(KSubModule2()); |
|
674 |
|
675 asynchHandler->TryUnBind( unbindInfo ); |
|
676 |
|
677 CActiveScheduler::Start(); |
|
678 if (asynchHandler->iStatus != KErrNone) |
|
679 { |
|
680 Log(_L("Unbind returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
681 verdict = EFail; |
|
682 } |
|
683 |
|
684 // uninstall and destroy active scheduler |
|
685 CleanupStack::PopAndDestroy(asynchHandler); |
|
686 CleanupStack::PopAndDestroy(scheduler); |
|
687 return verdict; |
|
688 |
|
689 } |
|
690 |
|
691 |
|
692 // Test step 6.15 - UnBind dormant test cpm |
|
693 CRootServerTest6_15::CRootServerTest6_15() |
|
694 { |
|
695 // store the name of this test case |
|
696 iTestStepName = _L("Test6.15"); |
|
697 } |
|
698 |
|
699 TVerdict CRootServerTest6_15::doTestStepL( void ) |
|
700 { |
|
701 Log(_L("Test Purpose: Unbind dormant test cpm")); |
|
702 TVerdict verdict = EPass; |
|
703 |
|
704 // Create scheduler/active object framework |
|
705 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
706 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
707 |
|
708 TRSStartModuleParams startParams; |
|
709 TTestModuleIniData iniData; |
|
710 DefaultStartParams(startParams, iniData); |
|
711 startParams.iParams.iName = KModule1; |
|
712 iniData.iParams.iDiscoveryDelay = 500; |
|
713 iniData.iParams.iBindDelay = 500; |
|
714 iniData.iParams.iUnbindDelay = 30000; |
|
715 iniData.iParams.iShutdownDelay = 500; |
|
716 asynchHandler->TryLoad(startParams, iniData); |
|
717 |
|
718 CActiveScheduler::Start(); |
|
719 if (asynchHandler->iStatus != KErrNone) |
|
720 { |
|
721 Log(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
722 User::Leave(asynchHandler->iStatus.Int()); |
|
723 } |
|
724 //*****************step 02*************************// |
|
725 Log(_L("02 Attempting bind")); |
|
726 TInt ret = TryHierachicalBind(asynchHandler, KModule1, KSubModule1, KModule1, KSubModule2); |
|
727 if (ret != KErrNone) |
|
728 { |
|
729 Log(_L("Bind returned error: <%d> "), ret); |
|
730 User::Leave(asynchHandler->iStatus.Int()); |
|
731 } |
|
732 |
|
733 Log(_L("03 Unbind")); |
|
734 TRSUnBindingInfo unbindInfo; |
|
735 unbindInfo.iParams.iAddress1.SetModule(KModule1()); |
|
736 unbindInfo.iParams.iAddress1.SetSubModule(KSubModule1()); |
|
737 unbindInfo.iParams.iAddress2.SetModule(KModule1()); |
|
738 unbindInfo.iParams.iAddress2.SetSubModule(KSubModule2()); |
|
739 |
|
740 asynchHandler->TryUnBind( unbindInfo ); |
|
741 CActiveScheduler::Start(); |
|
742 |
|
743 if (asynchHandler->iStatus != KErrRSRequestTimedOut) |
|
744 { |
|
745 Log(_L("Unbind returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
746 verdict = EFail; |
|
747 } |
|
748 // uninstall and destroy active scheduler |
|
749 CleanupStack::PopAndDestroy(asynchHandler); |
|
750 CleanupStack::PopAndDestroy(scheduler); |
|
751 return verdict; |
|
752 } |
|
753 |
|
754 |
|
755 // Test step 6.16 - Bind between a server and a module |
|
756 CRootServerTest6_16::CRootServerTest6_16() |
|
757 { |
|
758 // store the name of this test case |
|
759 iTestStepName = _L("Test6.16"); |
|
760 } |
|
761 |
|
762 TVerdict CRootServerTest6_16::doTestStepL( void ) |
|
763 { |
|
764 Log(_L("Test Purpose: Bind between a server and a module")); |
|
765 TVerdict verdict = EPass; |
|
766 |
|
767 // Create scheduler/active object framework |
|
768 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
769 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
770 |
|
771 _LIT8(KPlainModule, "PlainCPM"); |
|
772 _LIT8(KServerModule, "ServerCPM"); |
|
773 |
|
774 //*****************step 01*************************// |
|
775 Log(_L("01 Load Plain Module")); |
|
776 LoadNormalModuleL(asynchHandler, KPlainModule); |
|
777 |
|
778 //*****************step 02*************************// |
|
779 Log(_L("02 Load Server Module")); |
|
780 TRSStartModuleParams startParams; |
|
781 TTestModuleIniData iniData; |
|
782 DefaultStartParams(startParams, iniData); |
|
783 startParams.iParams.iName = KServerModule; |
|
784 startParams.iParams.iIsServer = ETrue; |
|
785 asynchHandler->TryLoad(startParams, iniData); |
|
786 |
|
787 CActiveScheduler::Start(); |
|
788 if (asynchHandler->iStatus != KErrNone) |
|
789 { |
|
790 Log(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
791 User::Leave(asynchHandler->iStatus.Int()); |
|
792 } |
|
793 |
|
794 //*****************step 03*************************// |
|
795 Log(_L("03 Attempting bind of plain above server")); |
|
796 TInt ret = TryHierachicalBind(asynchHandler, KPlainModule, KSubModule1, KServerModule, KSubModule1); |
|
797 if (ret != KErrRSInvalidBinding) |
|
798 { |
|
799 Log(_L("Bind returned error: <%d> "), ret); |
|
800 User::Leave(ret); |
|
801 } |
|
802 |
|
803 //*****************step 04*********************** |
|
804 Log(_L("04 Attempting bind of server above plain")); |
|
805 ret = TryHierachicalBind(asynchHandler, KServerModule, KSubModule1, KPlainModule, KSubModule1); |
|
806 if (ret != KErrNone) |
|
807 { |
|
808 Log(_L("Bind returned error: <%d> "), ret); |
|
809 User::Leave(ret); |
|
810 } |
|
811 |
|
812 // uninstall and destroy active scheduler |
|
813 CleanupStack::PopAndDestroy(asynchHandler); |
|
814 CleanupStack::PopAndDestroy(scheduler); |
|
815 return verdict; |
|
816 |
|
817 } |
|
818 |