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