|
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 #include "Te_SimTestStepBase.h" |
|
17 #include <testconfigfileparser.h> |
|
18 #include <etelmm.h> |
|
19 #include "SimConstants.h" |
|
20 |
|
21 const TInt KUsimGranularity=2; // < Granularity for sat list array |
|
22 |
|
23 TVerdict CSimTestsTestStepBase::doTestStepPreambleL() |
|
24 { |
|
25 __UHEAP_MARK; |
|
26 |
|
27 iActiveScheduler=new(ELeave) CActiveScheduler(); |
|
28 CActiveScheduler::Install(iActiveScheduler); |
|
29 |
|
30 TInt ret = iTelServer.Connect(); |
|
31 if (ret!=KErrNone) |
|
32 { |
|
33 INFO_PRINTF1(_L("Failed to connect to telephony server")); |
|
34 delete iActiveScheduler; |
|
35 User::Leave(ret); |
|
36 } |
|
37 ret=iTelServer.LoadPhoneModule(KSimtsyName); |
|
38 if (ret!=KErrNone) |
|
39 { |
|
40 INFO_PRINTF1(_L("Failed to load phone module")); |
|
41 iTelServer.Close(); |
|
42 delete iActiveScheduler; |
|
43 User::Leave(ret); |
|
44 } |
|
45 |
|
46 return TestStepResult(); |
|
47 } |
|
48 |
|
49 TVerdict CSimTestsTestStepBase::doTestStepPostambleL() |
|
50 { |
|
51 iTelServer.UnloadPhoneModule(KSimtsyName); |
|
52 iTelServer.Close(); |
|
53 delete iActiveScheduler; |
|
54 |
|
55 __UHEAP_MARKEND; |
|
56 return TestStepResult(); |
|
57 } |
|
58 |
|
59 void CSimTestsTestStepBase::SetTestNumberL(TInt aTestNumber) |
|
60 { |
|
61 INFO_PRINTF2(_L("Changing the Test Number to %d"),aTestNumber); |
|
62 TInt ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, aTestNumber); |
|
63 TESTL(ret == KErrNone); |
|
64 ASSERT(RThread().RequestCount()==0); |
|
65 } |
|
66 |
|
67 void CSimTestsTestStepBase::CreateConfigFileL(const TDesC& aConfigFileName) |
|
68 { |
|
69 RFs fs; |
|
70 TInt ret=fs.Connect(); |
|
71 if(ret!=KErrNone) |
|
72 { |
|
73 INFO_PRINTF1(_L("Failed connect to file system")); |
|
74 SetTestStepResult(EFail); |
|
75 User::LeaveIfError(ret); |
|
76 } |
|
77 CFileMan* fileMan=CFileMan::NewL(fs); |
|
78 ret = fileMan->Copy(aConfigFileName, KConfigFilename); |
|
79 delete fileMan; |
|
80 fs.Close(); |
|
81 if(ret!=KErrNone) |
|
82 { |
|
83 INFO_PRINTF1(_L("Failed connect to copy config file")); |
|
84 SetTestStepResult(EFail); |
|
85 User::Leave(ret); |
|
86 } |
|
87 } |
|
88 |
|
89 void CSimTestsTestStepBase::DeleteConfigFileL() |
|
90 { |
|
91 RFs fs; |
|
92 TInt ret=fs.Connect(); |
|
93 if(ret!=KErrNone) |
|
94 { |
|
95 INFO_PRINTF1(_L("Failed connect to file system")); |
|
96 SetTestStepResult(EFail); |
|
97 User::Leave(ret); |
|
98 } |
|
99 fs.Delete(KConfigFilename); |
|
100 fs.Close(); |
|
101 } |
|
102 |
|
103 TVerdict CPhBkAndPacketTestsTestStepBase::doTestStepPreambleL() |
|
104 { |
|
105 __UHEAP_MARK; |
|
106 |
|
107 TInt ret = iTelServer.Connect(); |
|
108 if (ret!=KErrNone) |
|
109 { |
|
110 INFO_PRINTF1(_L("Failed to connect to telephony server")); |
|
111 User::Leave(ret); |
|
112 } |
|
113 ret=iTelServer.LoadPhoneModule(KSimtsyName); |
|
114 if (ret!=KErrNone) |
|
115 { |
|
116 INFO_PRINTF1(_L("Failed to load phone module")); |
|
117 iTelServer.Close(); |
|
118 User::Leave(ret); |
|
119 } |
|
120 |
|
121 return TestStepResult(); |
|
122 } |
|
123 |
|
124 TVerdict CPhBkAndPacketTestsTestStepBase::doTestStepPostambleL() |
|
125 { |
|
126 iTelServer.UnloadPhoneModule(KSimtsyName); |
|
127 iTelServer.Close(); |
|
128 |
|
129 __UHEAP_MARKEND; |
|
130 return TestStepResult(); |
|
131 } |
|
132 |
|
133 void CPhBkAndPacketTestsTestStepBase::SetTestNumberL(TInt aTestNumber) |
|
134 { |
|
135 INFO_PRINTF2(_L("Changing the Test Number to %d"),aTestNumber); |
|
136 TInt ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, aTestNumber); |
|
137 TESTL(ret == KErrNone); |
|
138 ASSERT(RThread().RequestCount()==0); |
|
139 } |
|
140 |
|
141 void CPhBkAndPacketTestsTestStepBase::CreateConfigFileL(const TDesC& aConfigFileName) |
|
142 { |
|
143 RFs fs; |
|
144 TInt ret=fs.Connect(); |
|
145 if(ret!=KErrNone) |
|
146 { |
|
147 INFO_PRINTF1(_L("Failed connect to file system")); |
|
148 SetTestStepResult(EFail); |
|
149 User::LeaveIfError(ret); |
|
150 } |
|
151 CFileMan* fileMan=CFileMan::NewL(fs); |
|
152 ret = fileMan->Copy(aConfigFileName, KConfigFilename); |
|
153 delete fileMan; |
|
154 fs.Close(); |
|
155 if(ret!=KErrNone) |
|
156 { |
|
157 INFO_PRINTF1(_L("Failed connect to copy config file")); |
|
158 SetTestStepResult(EFail); |
|
159 User::Leave(ret); |
|
160 } |
|
161 } |
|
162 |
|
163 void CPhBkAndPacketTestsTestStepBase::WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds) |
|
164 /** |
|
165 * Timeout function |
|
166 */ |
|
167 { |
|
168 TRequestStatus timerStatus; |
|
169 RTimer timer ; |
|
170 timer.CreateLocal() ; |
|
171 timer.After(timerStatus,aNumberOfMicroSeconds); |
|
172 |
|
173 User::WaitForRequest(aStatus, timerStatus); |
|
174 if (timerStatus == KRequestPending) |
|
175 { |
|
176 timer.Cancel(); |
|
177 User::WaitForRequest(timerStatus); |
|
178 } |
|
179 else |
|
180 { |
|
181 INFO_PRINTF1(_L("Time is over!!!")) ; |
|
182 } |
|
183 timer.Close() ; |
|
184 } |
|
185 |
|
186 void CPhBkAndPacketTestsTestStepBase::SignalSimTsyToReduceTimerL(TInt aTimerEventId) |
|
187 { |
|
188 RProperty reduceTimersProperty; |
|
189 User::LeaveIfError(reduceTimersProperty.Attach(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime)); |
|
190 CleanupClosePushL(reduceTimersProperty); |
|
191 |
|
192 User::LeaveIfError(reduceTimersProperty.Set(KUidPSSimTsyCategory, KPSSimTsyTimersReduceTime, |
|
193 aTimerEventId)); |
|
194 |
|
195 CleanupStack::PopAndDestroy(&reduceTimersProperty); |
|
196 } |
|
197 |
|
198 LOCAL_C TInt NTRasThreadFunction(TAny* /*aThreadData*/) |
|
199 { |
|
200 _LIT(KCsyName,"LOOPBACK.CSY"); |
|
201 _LIT(KPortName,"LOOPBACK::1"); |
|
202 |
|
203 _LIT8(KServerText,"SERVER"); |
|
204 |
|
205 CTrapCleanup* cleanup; |
|
206 if ((cleanup=CTrapCleanup::New())==NULL) |
|
207 return KErrGeneral; |
|
208 |
|
209 RCommServ commServ; |
|
210 TInt r=commServ.Connect(); |
|
211 r=commServ.LoadCommModule(KCsyName); |
|
212 RComm comm; |
|
213 r=comm.Open(commServ,KPortName,ECommShared); |
|
214 |
|
215 TBuf8<6> readBuf; |
|
216 TRequestStatus stat0; |
|
217 comm.Read(stat0,readBuf); |
|
218 User::WaitForRequest(stat0) ; |
|
219 |
|
220 comm.Write(stat0,KServerText); |
|
221 User::WaitForRequest(stat0) ; |
|
222 |
|
223 |
|
224 delete cleanup; |
|
225 ASSERT(RThread().RequestCount()==0); |
|
226 return r; |
|
227 } |
|
228 |
|
229 TInt StartNTRasSimulation() |
|
230 { |
|
231 const TInt KStackSize=0x8000; |
|
232 const TInt KHeapSize=0x8000; |
|
233 const TInt KMaxHeapSize=0x80000; |
|
234 |
|
235 _LIT(KNtRasName,"NTRasEmulation"); |
|
236 |
|
237 RThread t; |
|
238 TInt res=t.Create(KNtRasName,NTRasThreadFunction, |
|
239 KStackSize,KHeapSize,KMaxHeapSize,NULL); |
|
240 t.Resume(); |
|
241 t.Close(); |
|
242 ASSERT(RThread().RequestCount()==0); |
|
243 return res; |
|
244 } |
|
245 |
|
246 TVerdict CSimUSimRel6TestsTestStepBase::doTestStepPreambleL() |
|
247 { |
|
248 __UHEAP_MARK; |
|
249 |
|
250 iActiveScheduler=new(ELeave) CActiveScheduler(); |
|
251 CActiveScheduler::Install(iActiveScheduler); |
|
252 |
|
253 TInt ret = iTelServer.Connect(); |
|
254 if (ret!=KErrNone) |
|
255 { |
|
256 INFO_PRINTF1(_L("Failed to connect to telephony server")); |
|
257 delete iActiveScheduler; |
|
258 User::Leave(ret); |
|
259 } |
|
260 ret=iTelServer.LoadPhoneModule(KSimtsyName); |
|
261 if (ret!=KErrNone) |
|
262 { |
|
263 INFO_PRINTF1(_L("Failed to load phone module")); |
|
264 iTelServer.Close(); |
|
265 delete iActiveScheduler; |
|
266 User::Leave(ret); |
|
267 } |
|
268 |
|
269 CreateConfigFileL(_L("c:\\config3.txt")); |
|
270 SetTestNumberL(46); |
|
271 (void)User::LeaveIfError(iFs.Connect()); |
|
272 iConfigFile=CTestConfig::NewLC(iFs,KConfigFileDir,KConfigFilename); |
|
273 |
|
274 TInt testNumber; |
|
275 testNumber=46; |
|
276 iSectionName.Format(KSectionNameFormat,testNumber); |
|
277 if(iConfigFile->Section(iSectionName)==NULL) |
|
278 { |
|
279 CleanupStack::Pop(); |
|
280 User::Leave(KErrNotFound); |
|
281 } |
|
282 CleanupStack::Pop(); // iConfigFile pointer is safely stored as a member variable |
|
283 |
|
284 iVoiceMailIds=new(ELeave) CArrayFixFlat<RMobilePhone::TMobilePhoneVoicemailIdsV8>(KUsimGranularity); |
|
285 iMessageWaiting=new(ELeave) CArrayFixFlat<RMobilePhone::TMobilePhoneMessageWaitingV8>(KUsimGranularity); |
|
286 iWlanData=new(ELeave) CArrayFixFlat<RMobilePhone::TUsimWlanDataV8>(KUsimGranularity); |
|
287 iWlanSid=new(ELeave) CArrayFixFlat<RMobilePhone::TWlanSIDV8>(KUsimGranularity); |
|
288 iPreferredNetworks=new(ELeave) CArrayFixFlat<RMobilePhone::TMobilePreferredNetworkEntryV3>(KUsimGranularity); |
|
289 TInt count; |
|
290 count=CfgFile()->ItemCount(KUsimMailBoxIdInfo); |
|
291 const CTestConfigItem* item=NULL; |
|
292 TInt i; |
|
293 for(i=0;i<count;i++) |
|
294 { |
|
295 item=CfgFile()->Item(KUsimMailBoxIdInfo,i); |
|
296 if(!item) |
|
297 break; |
|
298 |
|
299 TInt voice,data,fax,other,video; |
|
300 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,voice); |
|
301 if(ret!=KErrNone) |
|
302 { |
|
303 INFO_PRINTF1(_L("Failed to get the value for voice identifier")); |
|
304 continue; |
|
305 } |
|
306 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,data); |
|
307 if(ret!=KErrNone) |
|
308 { |
|
309 INFO_PRINTF1(_L("Failed to get the value for data identifier")); |
|
310 continue; |
|
311 } |
|
312 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,fax); |
|
313 if(ret!=KErrNone) |
|
314 { |
|
315 INFO_PRINTF1(_L("Failed to get the value for fax identifier")); |
|
316 continue; |
|
317 } |
|
318 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,other); |
|
319 if(ret!=KErrNone) |
|
320 { |
|
321 INFO_PRINTF1(_L("Failed to get the value for other identifier")); |
|
322 continue; |
|
323 } |
|
324 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,video); |
|
325 if(ret!=KErrNone) |
|
326 { |
|
327 INFO_PRINTF1(_L("Failed to get the value for video identifier")); |
|
328 continue; |
|
329 } |
|
330 RMobilePhone::TMobilePhoneVoicemailIdsV8 mailboxIdInfo; |
|
331 |
|
332 mailboxIdInfo.iVoice=voice; |
|
333 mailboxIdInfo.iData=data; |
|
334 mailboxIdInfo.iFax=fax; |
|
335 mailboxIdInfo.iOther=other; |
|
336 mailboxIdInfo.iVideo=video; |
|
337 iVoiceMailIds->AppendL(mailboxIdInfo); |
|
338 } |
|
339 |
|
340 count=CfgFile()->ItemCount(KUsimMessageWaitingIdInfo); |
|
341 item=NULL; |
|
342 for(i=0;i<count;i++) |
|
343 { |
|
344 item=CfgFile()->Item(KUsimMessageWaitingIdInfo,i); |
|
345 if(!item) |
|
346 break; |
|
347 |
|
348 TInt displayStatus,voiceMsgs,auxVoiceMsgs,dataMsgs,faxMsgs,emailMsgs,otherMsgs,videoMsgs; |
|
349 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,displayStatus); |
|
350 if(ret!=KErrNone) |
|
351 { |
|
352 INFO_PRINTF1(_L("Failed to get the value for Display Status identifier")); |
|
353 continue; |
|
354 } |
|
355 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,voiceMsgs); |
|
356 if(ret!=KErrNone) |
|
357 { |
|
358 INFO_PRINTF1(_L("Failed to get the value for Voice Messages identifier")); |
|
359 continue; |
|
360 } |
|
361 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,auxVoiceMsgs); |
|
362 if(ret!=KErrNone) |
|
363 { |
|
364 INFO_PRINTF1(_L("Failed to get the value for Auxillary Voice Messages identifier")); |
|
365 continue; |
|
366 } |
|
367 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,dataMsgs); |
|
368 if(ret!=KErrNone) |
|
369 { |
|
370 INFO_PRINTF1(_L("Failed to get the value for Data Messages identifier")); |
|
371 continue; |
|
372 } |
|
373 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,faxMsgs); |
|
374 if(ret!=KErrNone) |
|
375 { |
|
376 INFO_PRINTF1(_L("Failed to get the value for Fax Messages identifier")); |
|
377 continue; |
|
378 } |
|
379 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,5,emailMsgs); |
|
380 if(ret!=KErrNone) |
|
381 { |
|
382 INFO_PRINTF1(_L("Failed to get the value for Email Messages identifier")); |
|
383 continue; |
|
384 } |
|
385 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,6,otherMsgs); |
|
386 if(ret!=KErrNone) |
|
387 { |
|
388 INFO_PRINTF1(_L("Failed to get the value for Other Messages identifier")); |
|
389 continue; |
|
390 } |
|
391 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,7,videoMsgs); |
|
392 if(ret!=KErrNone) |
|
393 { |
|
394 INFO_PRINTF1(_L("Failed to get the value for Video Messages identifier")); |
|
395 continue; |
|
396 } |
|
397 RMobilePhone::TMobilePhoneMessageWaitingV8 messageWaiting; |
|
398 |
|
399 messageWaiting.iDisplayStatus = RMobilePhone::TMobilePhoneIndicatorDisplay(displayStatus); |
|
400 messageWaiting.iVoiceMsgs = voiceMsgs; |
|
401 messageWaiting.iAuxVoiceMsgs = auxVoiceMsgs; |
|
402 messageWaiting.iDataMsgs = dataMsgs; |
|
403 messageWaiting.iFaxMsgs = faxMsgs; |
|
404 messageWaiting.iEmailMsgs = emailMsgs; |
|
405 messageWaiting.iOtherMsgs = otherMsgs; |
|
406 messageWaiting.iVideoMsgs = videoMsgs; |
|
407 iMessageWaiting->AppendL(messageWaiting); |
|
408 } |
|
409 |
|
410 count=CfgFile()->ItemCount(KUsimWlanDataInfo); |
|
411 item=NULL; |
|
412 RMobilePhone::TUsimWlanDataV8 wlanData; |
|
413 for(i=0;i<count;i++) |
|
414 { |
|
415 item=CfgFile()->Item(KUsimWlanDataInfo,i); |
|
416 if(!item) |
|
417 break; |
|
418 |
|
419 TPtrC8 FieldsUsed,Pseudonym,ReauthenticationId,MasterKey,Counter; |
|
420 if(i==0) |
|
421 { |
|
422 wlanData.iFieldsUsed=SIMTSY_PHONE_WLAN_LIST_DATA_FLAGS; |
|
423 } |
|
424 else |
|
425 { |
|
426 wlanData.iFieldsUsed=SIMTSY_PHONE_WLAN_LIST_DATA_FLAGS1; |
|
427 } |
|
428 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,Pseudonym); |
|
429 if(ret!=KErrNone) |
|
430 { |
|
431 INFO_PRINTF1(_L("Failed to get the value for Pseudonym identifier")); |
|
432 continue; |
|
433 } |
|
434 else |
|
435 { |
|
436 wlanData.iPseudonym.Copy(Pseudonym); |
|
437 } |
|
438 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,ReauthenticationId); |
|
439 if(ret!=KErrNone) |
|
440 { |
|
441 INFO_PRINTF1(_L("Failed to get the value for Reauthentication identifier")); |
|
442 continue; |
|
443 } |
|
444 else |
|
445 { |
|
446 wlanData.iReauthenticationId.Copy(ReauthenticationId); |
|
447 } |
|
448 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,MasterKey); |
|
449 if(ret!=KErrNone) |
|
450 { |
|
451 INFO_PRINTF1(_L("Failed to get the value for Master Key identifier")); |
|
452 continue; |
|
453 } |
|
454 else |
|
455 { |
|
456 wlanData.iMasterKey.Copy(MasterKey); |
|
457 } |
|
458 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,Counter); |
|
459 if(ret!=KErrNone) |
|
460 { |
|
461 INFO_PRINTF1(_L("Failed to get the value for Counter identifier")); |
|
462 continue; |
|
463 } |
|
464 else |
|
465 { |
|
466 wlanData.iCounter.Copy(Counter); |
|
467 } |
|
468 iWlanData->AppendL(wlanData); |
|
469 } |
|
470 |
|
471 count=CfgFile()->ItemCount(KUsimWlanSidInfo); |
|
472 item=NULL; |
|
473 RMobilePhone::TWlanSIDV8 wlanSid; |
|
474 for(i=0;i<count;i++) |
|
475 { |
|
476 item=CfgFile()->Item(KUsimWlanSidInfo,i); |
|
477 if(!item) |
|
478 break; |
|
479 |
|
480 TPtrC8 wlanSidBuf; |
|
481 TInt userDef; |
|
482 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,wlanSidBuf); |
|
483 if(ret!=KErrNone) |
|
484 { |
|
485 INFO_PRINTF1(_L("Failed to get the value for Wlan SID identifier")); |
|
486 continue; |
|
487 } |
|
488 else |
|
489 { |
|
490 wlanSid.iWSID.Copy(wlanSidBuf); |
|
491 } |
|
492 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,userDef); |
|
493 if(ret!=KErrNone) |
|
494 { |
|
495 INFO_PRINTF1(_L("Failed to get the value for User Defined identifier")); |
|
496 continue; |
|
497 } |
|
498 else |
|
499 { |
|
500 wlanSid.iUserDefined=userDef; |
|
501 } |
|
502 iWlanSid->AppendL(wlanSid); |
|
503 } |
|
504 |
|
505 count=CfgFile()->ItemCount(KUsimPreferredNetworksInfo); |
|
506 item=NULL; |
|
507 RMobilePhone::TMobilePreferredNetworkEntryV3 networkEntry; |
|
508 for(i=0;i<count;i++) |
|
509 { |
|
510 item=CfgFile()->Item(KUsimPreferredNetworksInfo,i); |
|
511 if(!item) |
|
512 break; |
|
513 |
|
514 TPtrC8 accessId,countryCode,networkId; |
|
515 TInt userDef; |
|
516 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,userDef); |
|
517 if(ret!=KErrNone) |
|
518 { |
|
519 INFO_PRINTF1(_L("Failed to get the value for User Defined identifier")); |
|
520 continue; |
|
521 } |
|
522 else |
|
523 { |
|
524 networkEntry.iUserDefined=userDef; |
|
525 } |
|
526 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,countryCode); |
|
527 if(ret!=KErrNone) |
|
528 { |
|
529 INFO_PRINTF1(_L("Failed to get the value for Country code identifier")); |
|
530 continue; |
|
531 } |
|
532 else |
|
533 { |
|
534 networkEntry.iCountryCode.Copy(countryCode); |
|
535 } |
|
536 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,networkId); |
|
537 if(ret!=KErrNone) |
|
538 { |
|
539 INFO_PRINTF1(_L("Failed to get the value for Network Id identifier")); |
|
540 continue; |
|
541 } |
|
542 else |
|
543 { |
|
544 networkEntry.iNetworkId.Copy(networkId); |
|
545 } |
|
546 iPreferredNetworks->AppendL(networkEntry); |
|
547 } |
|
548 |
|
549 //Open the session |
|
550 ret = iPhone.Open(iTelServer,KPhoneName); |
|
551 INFO_PRINTF2(_L("Result: %d"),ret); |
|
552 TESTL(ret == KErrNone); |
|
553 INFO_PRINTF1(_L("Opened phone object")); |
|
554 return TestStepResult(); |
|
555 } |
|
556 |
|
557 TVerdict CSimUSimRel6TestsTestStepBase::doTestStepPostambleL() |
|
558 { |
|
559 iPhone.Close(); |
|
560 delete iConfigFile; |
|
561 delete iVoiceMailIds; |
|
562 delete iMessageWaiting; |
|
563 iFs.Close(); |
|
564 iTelServer.UnloadPhoneModule(KSimtsyName); |
|
565 iTelServer.Close(); |
|
566 delete iWlanData; |
|
567 delete iWlanSid; |
|
568 delete iPreferredNetworks; |
|
569 delete iActiveScheduler; |
|
570 delete iWlanList; |
|
571 delete iNetworkList; |
|
572 __UHEAP_MARKEND; |
|
573 return TestStepResult(); |
|
574 } |
|
575 |
|
576 void CSimUSimRel6TestsTestStepBase::SetTestNumberL(TInt aTestNumber) |
|
577 { |
|
578 INFO_PRINTF2(_L("Changing the Test Number to %d"),aTestNumber); |
|
579 TInt ret = RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, aTestNumber); |
|
580 TESTL(ret == KErrNone); |
|
581 ASSERT(RThread().RequestCount()==0); |
|
582 } |
|
583 |
|
584 void CSimUSimRel6TestsTestStepBase::CreateConfigFileL(const TDesC& aConfigFileName) |
|
585 { |
|
586 RFs fs; |
|
587 TInt ret=fs.Connect(); |
|
588 if(ret!=KErrNone) |
|
589 { |
|
590 INFO_PRINTF1(_L("Failed connect to file system")); |
|
591 SetTestStepResult(EFail); |
|
592 User::LeaveIfError(ret); |
|
593 } |
|
594 CFileMan* fileMan=CFileMan::NewL(fs); |
|
595 ret = fileMan->Copy(aConfigFileName, KConfigFilename); |
|
596 delete fileMan; |
|
597 fs.Close(); |
|
598 if(ret!=KErrNone) |
|
599 { |
|
600 INFO_PRINTF1(_L("Failed connect to copy config file")); |
|
601 SetTestStepResult(EFail); |
|
602 User::Leave(ret); |
|
603 } |
|
604 } |
|
605 |
|
606 void CSimUSimRel6TestsTestStepBase::DeleteConfigFileL() |
|
607 { |
|
608 RFs fs; |
|
609 TInt ret=fs.Connect(); |
|
610 if(ret!=KErrNone) |
|
611 { |
|
612 INFO_PRINTF1(_L("Failed connect to file system")); |
|
613 SetTestStepResult(EFail); |
|
614 User::Leave(ret); |
|
615 } |
|
616 fs.Delete(KConfigFilename); |
|
617 fs.Close(); |
|
618 } |
|
619 |
|
620 const CTestConfigSection* CSimUSimRel6TestsTestStepBase::CfgFile() |
|
621 /** |
|
622 * Return a pointer to the Configuration File Section |
|
623 * |
|
624 * @return CTestConfigSection pointer to the configuration file section |
|
625 */ |
|
626 { |
|
627 return iConfigFile->Section(iSectionName); |
|
628 } |
|
629 |
|
630 const CTestConfigSection* CSimUSimRel6TestsTestStepBase::DefaultCfgFile() |
|
631 /** |
|
632 * Return a pointer to the Default Configuration File Section |
|
633 * |
|
634 * @return CTestConfigSection pointer to the default configuration file section |
|
635 */ |
|
636 { |
|
637 return iConfigFile->Section(KScriptDefaults); |
|
638 } |
|
639 |
|
640 void CSimUSimRel6TestsTestStepBase::TestSmartCardAuthenticate() |
|
641 { |
|
642 TRequestStatus reqStatus; |
|
643 RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData; |
|
644 RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckg(authenticateData); |
|
645 authenticateData.iAUTN = KConfigScWlanAuthAUTN(); |
|
646 authenticateData.iRAND = KConfigScWlanAuthRAND(); |
|
647 authenticateData.iCK = KConfigScWlan(); |
|
648 |
|
649 RMobilePhone::TAID appAID = KWlanAid(); |
|
650 iPhone.SmartCardAuthenticate(reqStatus,appAID,authenticateDataPckg); |
|
651 User::WaitForRequest(reqStatus); |
|
652 TESTL(reqStatus==KErrNone); |
|
653 TESTL(authenticateData.iRES==KConfigScWlanAuthRES()); |
|
654 TESTL(authenticateData.iCK==KConfigScWlanAuthCK()); |
|
655 TESTL(authenticateData.iIK==KConfigScWlanAuthIK()); |
|
656 } |
|
657 |