telephonyserverplugins/simtsy/test/Te_Sim/Te_SimUSimRel6Test.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-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 // Te_SimNetworkStatusTest.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "Te_SimUSimRel6Test.h"
       
    19 #include <testconfigfileparser.h>
       
    20 #include <etelmm.h>
       
    21 #include "SimConstants.h"
       
    22 
       
    23 /****************************************************************************\
       
    24  * 																			*
       
    25  * 			Videomail  Testcases							 				*	
       
    26  * 																			*	
       
    27  ****************************************************************************/
       
    28 
       
    29 CSimVideomailTest1::CSimVideomailTest1() 
       
    30 	{ 
       
    31 	SetTestStepName(_L("VideomailTest1"));
       
    32 	}
       
    33 		
       
    34 TVerdict CSimVideomailTest1::doTestStepL()
       
    35 /**
       
    36 TEL-SIMTSY-MM-8653.
       
    37 Client retrieves mailbox dialling numbers successfully; writes a new phonebook entry successfully.
       
    38 */
       
    39 	{  	
       
    40 	INFO_PRINTF1(_L("Testing Videomail features"));
       
    41 	TRequestStatus stat0,stat1;
       
    42 	RMobilePhone::TMobilePhoneVoicemailIdsV8 voicemailId;
       
    43 	RMobilePhone::TMobilePhoneVoicemailIdsV8Pckg voicemailIdPckg(voicemailId);
       
    44 	iPhone.NotifyMailboxNumbersChange(stat0,voicemailIdPckg);
       
    45 	User::WaitForRequest(stat0);
       
    46 	TESTL(stat0==KErrNone);
       
    47 	TESTL(voicemailId.iData==iVoiceMailIds->At(0).iData);
       
    48 	TESTL(voicemailId.iFax==iVoiceMailIds->At(0).iFax);
       
    49 	TESTL(voicemailId.iOther==iVoiceMailIds->At(0).iOther);
       
    50 	TESTL(voicemailId.iVoice==iVoiceMailIds->At(0).iVoice);
       
    51 	TESTL(voicemailId.iVideo==iVoiceMailIds->At(0).iVideo);
       
    52 	
       
    53 	iPhone.GetMailboxNumbers(stat1,voicemailIdPckg);
       
    54 	User::WaitForRequest(stat1);
       
    55 	TESTL(stat1==KErrNone);	 
       
    56 	TESTL(voicemailId.iData==iVoiceMailIds->At(0).iData);
       
    57 	TESTL(voicemailId.iFax==iVoiceMailIds->At(0).iFax);
       
    58 	TESTL(voicemailId.iOther==iVoiceMailIds->At(0).iOther);
       
    59 	TESTL(voicemailId.iVoice==iVoiceMailIds->At(0).iVoice);
       
    60 	TESTL(voicemailId.iVideo==iVoiceMailIds->At(0).iVideo);
       
    61 			
       
    62   	INFO_PRINTF1(_L("Testing Get Phonebook store info from Phone level."));
       
    63  	TESTL(iPhonebook.Open(iPhone,KETelIccMbdnPhoneBook,KEtelUSimPhoneBookType)==KErrNone);
       
    64   	INFO_PRINTF1(_L("Opened Phonebook object"));
       
    65     INFO_PRINTF1(_L("Testing Phonebook Write"));
       
    66 	
       
    67 	TUint32 notifyEvent;
       
    68 	TInt notifyIndex;
       
    69 	iPhonebook.NotifyStoreEvent(stat1,notifyEvent,notifyIndex);
       
    70 	TInt index=7;
       
    71 	TBuf8<100> phBkBuf;
       
    72 	phBkBuf.Copy(KTestPhonebookB,sizeof(KTestPhonebookB));
       
    73 	iPhonebook.Write(stat0,phBkBuf,index);
       
    74 	User::WaitForRequest(stat0);
       
    75 	User::WaitForRequest(stat1);
       
    76 	TESTL(notifyEvent==(RMobilePhoneStore::KStoreHasSpace |
       
    77 						RMobilePhoneStore::KStoreEntryAdded));
       
    78 	TESTL(notifyIndex==7);
       
    79 	TInt numEntries=1;
       
    80  	iPhonebook.Read(stat0,notifyIndex,numEntries,phBkBuf);
       
    81   	User::WaitForRequest(stat0);
       
    82   	TESTL(stat0==KErrNone);
       
    83 	iPhonebook.Close(); 	
       
    84 	return TestStepResult();
       
    85 	}
       
    86 
       
    87 CSimVideomailTest2::CSimVideomailTest2() 
       
    88 	{ 
       
    89 	SetTestStepName(_L("VideomailTest2"));
       
    90 	}
       
    91 
       
    92 		
       
    93 TVerdict CSimVideomailTest2::doTestStepL()
       
    94 /**
       
    95 TEL-SIMTSY-MM-8654.
       
    96 Client is notified of the change in videomail mailbox number successfully.
       
    97 */
       
    98 	{ 
       
    99   	TRequestStatus stat0;
       
   100   	RMobilePhone::TMobilePhoneVoicemailIdsV8 voicemailId;
       
   101 	RMobilePhone::TMobilePhoneVoicemailIdsV8Pckg voicemailIdPckg(voicemailId);
       
   102   	iPhone.NotifyMailboxNumbersChange(stat0,voicemailIdPckg);
       
   103 	User::WaitForRequest(stat0);
       
   104 	TESTL(stat0==KErrNone);
       
   105 	TESTL(voicemailId.iData==iVoiceMailIds->At(0).iData);
       
   106 	TESTL(voicemailId.iFax==iVoiceMailIds->At(0).iFax);
       
   107 	TESTL(voicemailId.iOther==iVoiceMailIds->At(0).iOther);
       
   108 	TESTL(voicemailId.iVoice==iVoiceMailIds->At(0).iVoice);
       
   109 	TESTL(voicemailId.iVideo==iVoiceMailIds->At(0).iVideo);
       
   110 	return TestStepResult();
       
   111 	}
       
   112 
       
   113 CSimVideomailTest3::CSimVideomailTest3() 
       
   114 	{ 
       
   115 	SetTestStepName(_L("VideomailTest3"));
       
   116 	}
       
   117 		
       
   118 TVerdict CSimVideomailTest3::doTestStepL()
       
   119 /**
       
   120 TEL-SIMTSY-MM-8655.
       
   121 Client retrieves message waiting indicators and sets one indicator to off successfully.
       
   122 */
       
   123 	{
       
   124 	TRequestStatus stat0,stat1;
       
   125 	RMobilePhone::TMobilePhoneMessageWaitingV8 messageWaiting;
       
   126 	RMobilePhone::TMobilePhoneMessageWaitingV8Pckg messageWaitingPckg(messageWaiting);
       
   127 	
       
   128 	TInt messageWaitCount;
       
   129 	iPhone.NotifyMessageWaiting(stat0,messageWaitCount);
       
   130 	User::WaitForRequest(stat0);
       
   131 	TESTL(stat0==KErrNone);
       
   132 	TESTL(messageWaitCount==6);	
       
   133 	
       
   134 	iPhone.NotifyIccMessageWaitingIndicatorsChange(stat1,messageWaitingPckg);		
       
   135 	
       
   136 	messageWaiting.iDisplayStatus=iMessageWaiting->At(0).iDisplayStatus;
       
   137 	messageWaiting.iVoiceMsgs=iMessageWaiting->At(0).iVoiceMsgs;
       
   138 	messageWaiting.iAuxVoiceMsgs=iMessageWaiting->At(0).iAuxVoiceMsgs;
       
   139 	messageWaiting.iDataMsgs=iMessageWaiting->At(0).iDataMsgs;
       
   140 	messageWaiting.iFaxMsgs=iMessageWaiting->At(0).iFaxMsgs;
       
   141 	messageWaiting.iEmailMsgs=iMessageWaiting->At(0).iEmailMsgs;
       
   142 	messageWaiting.iOtherMsgs=iMessageWaiting->At(0).iOtherMsgs;
       
   143 	messageWaiting.iVideoMsgs=iMessageWaiting->At(0).iVideoMsgs;
       
   144 	
       
   145 	iPhone.SetIccMessageWaitingIndicators(stat0,messageWaitingPckg);
       
   146 	User::WaitForRequest(stat0);
       
   147 	TESTL(stat0==KErrNone);	
       
   148 	User::WaitForRequest(stat1);
       
   149 	TESTL(stat1==KErrNone);
       
   150 	TESTL(messageWaiting.iDisplayStatus==iMessageWaiting->At(0).iDisplayStatus);
       
   151 	TESTL(messageWaiting.iVoiceMsgs==iMessageWaiting->At(0).iVoiceMsgs);
       
   152 	TESTL(messageWaiting.iAuxVoiceMsgs==iMessageWaiting->At(0).iAuxVoiceMsgs);
       
   153 	TESTL(messageWaiting.iDataMsgs==iMessageWaiting->At(0).iDataMsgs);
       
   154 	TESTL(messageWaiting.iFaxMsgs==iMessageWaiting->At(0).iFaxMsgs);
       
   155 	TESTL(messageWaiting.iEmailMsgs==iMessageWaiting->At(0).iEmailMsgs);
       
   156 	TESTL(messageWaiting.iOtherMsgs==iMessageWaiting->At(0).iOtherMsgs);
       
   157 	TESTL(messageWaiting.iVideoMsgs==iMessageWaiting->At(0).iVideoMsgs);
       
   158 	
       
   159 	iPhone.GetIccMessageWaitingIndicators(stat1,messageWaitingPckg);
       
   160 	User::WaitForRequest(stat1);
       
   161 	TESTL(stat1==KErrNone); 
       
   162 	TESTL(messageWaiting.iDisplayStatus==iMessageWaiting->At(0).iDisplayStatus);
       
   163 	TESTL(messageWaiting.iVoiceMsgs==iMessageWaiting->At(0).iVoiceMsgs);
       
   164 	TESTL(messageWaiting.iAuxVoiceMsgs==iMessageWaiting->At(0).iAuxVoiceMsgs);
       
   165 	TESTL(messageWaiting.iDataMsgs==iMessageWaiting->At(0).iDataMsgs);
       
   166 	TESTL(messageWaiting.iFaxMsgs==iMessageWaiting->At(0).iFaxMsgs);
       
   167 	TESTL(messageWaiting.iEmailMsgs==iMessageWaiting->At(0).iEmailMsgs);
       
   168 	TESTL(messageWaiting.iOtherMsgs==iMessageWaiting->At(0).iOtherMsgs);
       
   169 	TESTL(messageWaiting.iVideoMsgs==iMessageWaiting->At(0).iVideoMsgs);
       
   170 		
       
   171 	return TestStepResult();
       
   172 	}
       
   173 
       
   174 CSimVideomailTest4::CSimVideomailTest4() 
       
   175 	{ 
       
   176 	SetTestStepName(_L("VideomailTest4"));
       
   177 	}
       
   178 		
       
   179 TVerdict CSimVideomailTest4::doTestStepL()
       
   180 /**
       
   181 TEL-SIMTSY-MM-8656.
       
   182 Client is unable to set message waiting indicators due to absence of indicators on the UICC.
       
   183 */
       
   184 	{ 
       
   185 	TRequestStatus stat0,stat1;
       
   186 	RMobilePhone::TMobilePhoneMessageWaitingV8 messageWaiting;
       
   187 	RMobilePhone::TMobilePhoneMessageWaitingV8Pckg messageWaitingPckg(messageWaiting);
       
   188 	RMobilePhone::TMobilePhoneMessageWaitingV8 messageWaitingV8;
       
   189 	RMobilePhone::TMobilePhoneMessageWaitingV8Pckg messageWaitingPckgV8(messageWaitingV8);
       
   190 	
       
   191 	TInt messageWaitCount;
       
   192 	iPhone.NotifyMessageWaiting(stat0,messageWaitCount);
       
   193 	User::WaitForRequest(stat0);
       
   194 	TESTL(stat0==KErrNone);
       
   195 	TESTL(messageWaitCount==6);
       
   196 	
       
   197 	iPhone.NotifyIccMessageWaitingIndicatorsChange(stat1,messageWaitingPckgV8);
       
   198 		
       
   199 	iPhone.GetIccMessageWaitingIndicators(stat0,messageWaitingPckgV8);
       
   200 	User::WaitForRequest(stat0);
       
   201 	TESTL(stat0==KErrNone); 
       
   202 	TESTL(messageWaitingV8.iDisplayStatus==iMessageWaiting->At(0).iDisplayStatus);
       
   203 	TESTL(messageWaitingV8.iVoiceMsgs==iMessageWaiting->At(0).iVoiceMsgs);
       
   204 	TESTL(messageWaitingV8.iAuxVoiceMsgs==iMessageWaiting->At(0).iAuxVoiceMsgs);
       
   205 	TESTL(messageWaitingV8.iDataMsgs==iMessageWaiting->At(0).iDataMsgs);
       
   206 	TESTL(messageWaitingV8.iFaxMsgs==iMessageWaiting->At(0).iFaxMsgs);
       
   207 	TESTL(messageWaitingV8.iEmailMsgs==iMessageWaiting->At(0).iEmailMsgs);
       
   208 	TESTL(messageWaitingV8.iOtherMsgs==iMessageWaiting->At(0).iOtherMsgs);
       
   209 	TESTL(messageWaitingV8.iVideoMsgs==iMessageWaiting->At(0).iVideoMsgs);
       
   210 		
       
   211 	messageWaiting.iDisplayStatus=iMessageWaiting->At(0).iDisplayStatus;
       
   212 	messageWaiting.iVoiceMsgs=iMessageWaiting->At(0).iVoiceMsgs;
       
   213 	messageWaiting.iAuxVoiceMsgs=iMessageWaiting->At(0).iAuxVoiceMsgs;
       
   214 	messageWaiting.iDataMsgs=iMessageWaiting->At(0).iDataMsgs;
       
   215 	messageWaiting.iFaxMsgs=iMessageWaiting->At(0).iFaxMsgs;
       
   216 	messageWaiting.iEmailMsgs=iMessageWaiting->At(0).iEmailMsgs;
       
   217 	messageWaiting.iOtherMsgs=iMessageWaiting->At(0).iOtherMsgs;
       
   218 	iPhone.SetIccMessageWaitingIndicators(stat0,messageWaitingPckg);
       
   219 	User::WaitForRequest(stat0);
       
   220 	TESTL(stat0==KErrCorrupt);
       
   221 	User::WaitForRequest(stat1);
       
   222 	TESTL(stat1==KErrNone);
       
   223 	TESTL(messageWaitingV8.iDisplayStatus==iMessageWaiting->At(0).iDisplayStatus);
       
   224 	TESTL(messageWaitingV8.iVoiceMsgs==iMessageWaiting->At(0).iVoiceMsgs);
       
   225 	TESTL(messageWaitingV8.iAuxVoiceMsgs==iMessageWaiting->At(0).iAuxVoiceMsgs);
       
   226 	TESTL(messageWaitingV8.iDataMsgs==iMessageWaiting->At(0).iDataMsgs);
       
   227 	TESTL(messageWaitingV8.iFaxMsgs==iMessageWaiting->At(0).iFaxMsgs);
       
   228 	TESTL(messageWaitingV8.iEmailMsgs==iMessageWaiting->At(0).iEmailMsgs);
       
   229 	TESTL(messageWaitingV8.iOtherMsgs==iMessageWaiting->At(0).iOtherMsgs);
       
   230 	TESTL(messageWaitingV8.iVideoMsgs==iMessageWaiting->At(0).iVideoMsgs);
       
   231 		
       
   232 	return TestStepResult();
       
   233 	}
       
   234 
       
   235 
       
   236 
       
   237 CSimVideomailTest5::CSimVideomailTest5() 
       
   238 	{ 
       
   239 	SetTestStepName(_L("VideomailTest5"));
       
   240 	}
       
   241 		
       
   242 TVerdict CSimVideomailTest5::doTestStepL()
       
   243 /**
       
   244 TEL-SIMTSY-MM-8657.
       
   245 Cancel Message waiting and MBDN requests. (All APIs)
       
   246 */
       
   247 	{ 
       
   248 	TRequestStatus stat0,stat1;
       
   249 	RMobilePhone::TMobilePhoneMessageWaitingV8 messageWaiting;
       
   250 	RMobilePhone::TMobilePhoneMessageWaitingV8Pckg messageWaitingPckg(messageWaiting);
       
   251 	
       
   252 	TInt messageWaitCount;
       
   253 	iPhone.NotifyMessageWaiting(stat0,messageWaitCount);
       
   254 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyMessageWaiting);
       
   255 	User::WaitForRequest(stat0);
       
   256 	TESTL(stat0==KErrCancel);
       
   257 		
       
   258 	iPhone.NotifyIccMessageWaitingIndicatorsChange(stat1,messageWaitingPckg);
       
   259 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyIccMessageWaitingIndicatorsChange);
       
   260 	User::WaitForRequest(stat1);
       
   261 	TESTL(stat1==KErrCancel);
       
   262 	
       
   263   	RMobilePhone::TMobilePhoneVoicemailIdsV8 voicemailId;
       
   264 	RMobilePhone::TMobilePhoneVoicemailIdsV8Pckg voicemailIdPckg(voicemailId);
       
   265   	iPhone.NotifyMailboxNumbersChange(stat0,voicemailIdPckg);
       
   266 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyMailboxNumbersChange);	
       
   267 	User::WaitForRequest(stat0);
       
   268 	TESTL(stat0==KErrCancel);
       
   269 	
       
   270 	return TestStepResult();
       
   271 	}
       
   272 
       
   273 /****************************************************************************\
       
   274  * 																			*
       
   275  * 			Wireless Local Area Network  Testcases	 						*	
       
   276  * 																			*	
       
   277  ****************************************************************************/
       
   278 
       
   279 CSimWlanTest1::CSimWlanTest1() 
       
   280 	{ 
       
   281 	SetTestStepName(_L("Wlan Test1"));
       
   282 	}
       
   283 		
       
   284 TVerdict CSimWlanTest1::doTestStepL()
       
   285 /**
       
   286 TEL-SIMTSY-MM-8663.
       
   287 Client stores the Wlan parameters on USIM successfully.
       
   288 */
       
   289 	{ 
       
   290 	// local variables used throughout the tests
       
   291 	TRequestStatus reqStatus,aReqStatus,stat0,reqStatus1;
       
   292 	RMobilePhone::TMobilePhoneSecurityCode whichCode = RMobilePhone::ESecurityUSIMAppPin;
       
   293 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   294   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
   295 	
       
   296 	RMobilePhone::TMobilePassword code = _L("1111");
       
   297 	RMobilePhone::TMobilePassword unblockCode = _L("1111");
       
   298 	RMobilePhone::TMobilePhoneSecurityEvent securityEvent;
       
   299 	iPhone.NotifySecurityEvent(aReqStatus,securityEvent);
       
   300 	usimWlanDataV8.iFieldsUsed = iWlanData->At(0).iFieldsUsed;
       
   301 	iPhone.NotifyWlanDataChange(reqStatus1,usimWlanDataV8Pckgd);
       
   302 	
       
   303 	TestSmartCardAuthenticate();
       
   304 
       
   305   	usimWlanDataV8.iPseudonym = iWlanData->At(0).iPseudonym ;
       
   306   	usimWlanDataV8.iReauthenticationId = iWlanData->At(0).iReauthenticationId;	 
       
   307   	iPhone.SetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   308   	User::WaitForRequest(aReqStatus);
       
   309 	TEST(aReqStatus.Int() == KErrNone);
       
   310 	TEST(securityEvent == RMobilePhone::EUSIMAppPinRequired);
       
   311 	
       
   312 	iPhone.NotifySecurityEvent(stat0,securityEvent);
       
   313 	iPhone.VerifySecurityCode(aReqStatus,whichCode,code,unblockCode);
       
   314 	User::WaitForRequest(aReqStatus);
       
   315 	User::WaitForRequest(stat0);
       
   316 	TEST(aReqStatus.Int() == KErrNone);
       
   317 	TEST(securityEvent == RMobilePhone::EUSIMAppPinVerified);
       
   318   	User::WaitForRequest(reqStatus);
       
   319   	User::WaitForRequest(reqStatus1);
       
   320   	TEST(reqStatus.Int() == KErrNone);
       
   321   	TEST(reqStatus1.Int() == KErrNone);
       
   322   	TEST(usimWlanDataV8.iFieldsUsed == iWlanData->At(0).iFieldsUsed);
       
   323   	TEST(usimWlanDataV8.iPseudonym == iWlanData->At(0).iPseudonym);
       
   324   	TEST(usimWlanDataV8.iReauthenticationId == iWlanData->At(0).iReauthenticationId);
       
   325 	return TestStepResult();
       
   326 	}
       
   327 
       
   328 CSimWlanTest2::CSimWlanTest2() 
       
   329 	{ 
       
   330 	SetTestStepName(_L("Wlan Test2"));
       
   331 	}
       
   332 		
       
   333 TVerdict CSimWlanTest2::doTestStepL()
       
   334 /**
       
   335 TEL-SIMTSY-MM-8664.
       
   336 Client is unable to store the Wlan parameters on USIM due to PIN verification failure.
       
   337 */
       
   338 	{
       
   339 	TRequestStatus reqStatus,aReqStatus,stat0;
       
   340 	RMobilePhone::TMobilePhoneSecurityCode whichCode = RMobilePhone::ESecurityUSIMAppPin;
       
   341 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   342   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8); 
       
   343 	
       
   344 	RMobilePhone::TMobilePassword code = _L("2222");
       
   345 	RMobilePhone::TMobilePassword unblockCode = _L("1111");
       
   346 	RMobilePhone::TMobilePhoneSecurityEvent securityEvent;
       
   347 	iPhone.NotifySecurityEvent(stat0,securityEvent);
       
   348 	
       
   349 	TestSmartCardAuthenticate();
       
   350 	
       
   351   	usimWlanDataV8.iFieldsUsed = iWlanData->At(1).iFieldsUsed;
       
   352   	usimWlanDataV8.iPseudonym = SIMTSY_PHONE_WLAN_ACESS_DENIED;
       
   353   	usimWlanDataV8.iReauthenticationId = iWlanData->At(1).iReauthenticationId;
       
   354  	iPhone.SetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   355   	User::WaitForRequest(stat0);
       
   356 	TEST(stat0.Int() == KErrNone);
       
   357 	TEST(securityEvent == RMobilePhone::EUSIMAppPinRequired);
       
   358 	iPhone.VerifySecurityCode(aReqStatus,whichCode,code,unblockCode);
       
   359 	User::WaitForRequest(aReqStatus);
       
   360 	TEST(aReqStatus.Int() == KErrAccessDenied);	
       
   361   	User::WaitForRequest(reqStatus);
       
   362   	TEST(reqStatus.Int() == KErrAccessDenied); 
       
   363 	return TestStepResult();
       
   364 	}
       
   365 
       
   366 CSimWlanTest3::CSimWlanTest3() 
       
   367 	{ 
       
   368 	SetTestStepName(_L("Wlan Test3"));
       
   369 	}
       
   370 		
       
   371 TVerdict CSimWlanTest3::doTestStepL()
       
   372 /**
       
   373 TEL-SIMTSY-MM-8665.
       
   374 Client, at its own will, retrieves WLAN parameters from USIM successfully.
       
   375 */
       
   376 	{
       
   377  	TRequestStatus reqStatus,aReqStatus,stat0;
       
   378 	RMobilePhone::TMobilePhoneSecurityCode whichCode = RMobilePhone::ESecurityUSIMAppPin;
       
   379 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   380   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
   381  
       
   382 	RMobilePhone::TMobilePassword code = _L("1111");
       
   383 	RMobilePhone::TMobilePassword unblockCode = _L("1111");
       
   384 	RMobilePhone::TMobilePhoneSecurityEvent securityEvent;
       
   385 	iPhone.NotifySecurityEvent(stat0,securityEvent);
       
   386   	
       
   387   	usimWlanDataV8.iFieldsUsed = iWlanData->At(1).iFieldsUsed;
       
   388   	iPhone.GetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   389   	User::WaitForRequest(stat0);
       
   390 	TEST(stat0.Int() == KErrNone);
       
   391 	TEST(securityEvent == RMobilePhone::EUSIMAppPinRequired);
       
   392 	
       
   393 	iPhone.NotifySecurityEvent(stat0,securityEvent);
       
   394 	iPhone.VerifySecurityCode(aReqStatus,whichCode,code,unblockCode);
       
   395 	User::WaitForRequest(aReqStatus);
       
   396 	User::WaitForRequest(stat0);
       
   397 	User::WaitForRequest(reqStatus);
       
   398 	TEST(stat0.Int() == KErrNone);
       
   399 	TEST(aReqStatus.Int() == KErrNone);
       
   400 	TEST(reqStatus.Int() == KErrNone);
       
   401 	TEST(securityEvent == RMobilePhone::EUSIMAppPinVerified);
       
   402 	TEST(usimWlanDataV8.iFieldsUsed == iWlanData->At(1).iFieldsUsed);
       
   403   	TEST(usimWlanDataV8.iPseudonym == iWlanData->At(1).iPseudonym);
       
   404   	TEST(usimWlanDataV8.iReauthenticationId == iWlanData->At(1).iReauthenticationId);
       
   405   	TEST(usimWlanDataV8.iMasterKey == iWlanData->At(1).iMasterKey);
       
   406   	TEST(usimWlanDataV8.iCounter == iWlanData->At(1).iCounter);
       
   407 	return TestStepResult();
       
   408 	}
       
   409 
       
   410 CSimWlanTest4::CSimWlanTest4() 
       
   411 	{ 
       
   412 	SetTestStepName(_L("Wlan Test4"));
       
   413 	}
       
   414 		
       
   415 TVerdict CSimWlanTest4::doTestStepL()
       
   416 /**
       
   417 TEL-SIMTSY-MM-8667.
       
   418 Client is unable to retrieve WLAN parameters from USIM due to lack of support in USIM service table
       
   419 */
       
   420 	{ 
       
   421 	TRequestStatus reqStatus;
       
   422 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   423   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
   424  
       
   425  	usimWlanDataV8.iCounter = iWlanData->At(2).iCounter;
       
   426  	iPhone.GetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   427 	User::WaitForRequest(reqStatus);
       
   428 	TEST(reqStatus.Int() == KErrNotSupported);		
       
   429 	return TestStepResult();
       
   430 	}
       
   431 	
       
   432 CSimWlanTest5::CSimWlanTest5() 
       
   433 	{ 
       
   434 	SetTestStepName(_L("Wlan Test5"));
       
   435 	}
       
   436 		
       
   437 TVerdict CSimWlanTest5::doTestStepL()
       
   438 /**
       
   439 TEL-SIMTSY-MM-8670.
       
   440 Client is unable to retrieve WLAN parameters from USIM due to PIN verification failure.
       
   441 */
       
   442 	{ 
       
   443 	TRequestStatus reqStatus,aReqStatus,stat0,reqStatus1;
       
   444 	RMobilePhone::TMobilePhoneSecurityCode whichCode = RMobilePhone::ESecurityUSIMAppPin;
       
   445 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   446   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
   447 	
       
   448 	RMobilePhone::TMobilePassword code = _L("1111");
       
   449 	RMobilePhone::TMobilePassword unblockCode = _L("1111");
       
   450 	RMobilePhone::TMobilePhoneSecurityEvent securityEvent;
       
   451 	iPhone.NotifySecurityEvent(aReqStatus,securityEvent);
       
   452 	usimWlanDataV8.iFieldsUsed = iWlanData->At(0).iFieldsUsed;
       
   453 	iPhone.NotifyWlanDataChange(reqStatus1,usimWlanDataV8Pckgd);
       
   454 	
       
   455 	TestSmartCardAuthenticate();
       
   456 
       
   457   	usimWlanDataV8.iPseudonym = iWlanData->At(0).iPseudonym ;
       
   458   	usimWlanDataV8.iReauthenticationId = iWlanData->At(0).iReauthenticationId;	 
       
   459   	iPhone.SetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   460   	User::WaitForRequest(aReqStatus);
       
   461 	TEST(aReqStatus.Int() == KErrNone);
       
   462 	TEST(securityEvent == RMobilePhone::EUSIMAppPinRequired);
       
   463 	
       
   464 	iPhone.NotifySecurityEvent(stat0,securityEvent);
       
   465 	iPhone.VerifySecurityCode(aReqStatus,whichCode,code,unblockCode);
       
   466 	User::WaitForRequest(aReqStatus);
       
   467 	User::WaitForRequest(stat0);
       
   468 	TEST(aReqStatus.Int() == KErrNone);
       
   469 	TEST(securityEvent == RMobilePhone::EUSIMAppPinVerified);
       
   470   	User::WaitForRequest(reqStatus);
       
   471   	User::WaitForRequest(reqStatus1);
       
   472   	TEST(reqStatus.Int() == KErrNone);
       
   473   	TEST(reqStatus1.Int() == KErrNone);
       
   474   	TEST(usimWlanDataV8.iFieldsUsed == iWlanData->At(0).iFieldsUsed);
       
   475   	TEST(usimWlanDataV8.iPseudonym == iWlanData->At(0).iPseudonym);
       
   476   	TEST(usimWlanDataV8.iReauthenticationId == iWlanData->At(0).iReauthenticationId);
       
   477 	
       
   478 	code = _L("2222");
       
   479 	iPhone.NotifySecurityEvent(stat0,securityEvent);
       
   480 	usimWlanDataV8.iPseudonym = SIMTSY_PHONE_WLAN_ACESS_DENIED;
       
   481  	iPhone.GetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   482  	User::WaitForRequest(stat0);
       
   483 	TEST(securityEvent == RMobilePhone::EUSIMAppPinRequired);
       
   484 	
       
   485 	iPhone.VerifySecurityCode(aReqStatus,whichCode,code,unblockCode);
       
   486 	User::WaitForRequest(aReqStatus);
       
   487 	TEST(aReqStatus.Int() == KErrAccessDenied);	
       
   488   	User::WaitForRequest(reqStatus);
       
   489   	TEST(reqStatus.Int() == KErrAccessDenied); 
       
   490 	return TestStepResult();
       
   491 	}
       
   492 	
       
   493 CSimWlanTest6::CSimWlanTest6() 
       
   494 	{ 
       
   495 	SetTestStepName(_L("Wlan Test6"));
       
   496 	}
       
   497 		
       
   498 TVerdict CSimWlanTest6::doTestStepL()
       
   499 /**
       
   500 TEL-SIMTSY-MM-8669.
       
   501 Client is unable to retrieve WLAN parameters from USIM due to due to inactive USIM application.
       
   502 */
       
   503 	{
       
   504 	TRequestStatus reqStatus,aReqStatus;
       
   505 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   506   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
   507   	RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData;
       
   508 	RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckg(authenticateData);
       
   509 	authenticateData.iAUTN = KConfigScWlanAuthAUTN();
       
   510 	authenticateData.iRAND = KConfigScWlanAuthRAND();
       
   511 	authenticateData.iCK = KConfigScWlan();
       
   512 	
       
   513 	RMobilePhone::TAID appAID;
       
   514 	iPhone.SmartCardAuthenticate(aReqStatus,appAID,authenticateDataPckg);
       
   515 	usimWlanDataV8.iPseudonym = SIMTSY_PHONE_WLAN_ACESS_DENIED;
       
   516  	iPhone.GetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   517  	User::WaitForRequest(aReqStatus);
       
   518 	TESTL(aReqStatus==KErrMMEtelScApplicationNotActive);
       
   519   	User::WaitForRequest(reqStatus);
       
   520   	TEST(reqStatus.Int() == KErrAccessDenied); 
       
   521 	return TestStepResult();
       
   522 	}
       
   523 	
       
   524 CSimWlanTest7::CSimWlanTest7() 
       
   525 	{ 
       
   526 	SetTestStepName(_L("Wlan Test7"));
       
   527 	}
       
   528 		
       
   529 TVerdict CSimWlanTest7::doTestStepL()
       
   530 /**
       
   531 TEL-SIMTSY-MM-8671.
       
   532 Client retrieves the preferred networks list present on the UICC successfully.
       
   533 */
       
   534 	{ 
       
   535 	CTestGetPreferredNetworks* preferredNetworks=CTestGetPreferredNetworks::NewLC(iPhone);
       
   536     preferredNetworks->Start();
       
   537     CActiveScheduler::Start();
       
   538     delete preferredNetworks->iTestPhone->iNetworkList;
       
   539 	delete preferredNetworks->iTestPhone->iWlanList;
       
   540     delete preferredNetworks;
       
   541 	return TestStepResult();
       
   542 	}
       
   543 
       
   544 CSimWlanTest8::CSimWlanTest8() 
       
   545 	{ 
       
   546 	SetTestStepName(_L("Wlan Test8"));
       
   547 	}
       
   548 		
       
   549 TVerdict CSimWlanTest8::doTestStepL()
       
   550 /**
       
   551 TEL-SIMTSY-MM-8674.
       
   552 Client retrieves the WLAN SID list present on the UICC successfully.
       
   553 */
       
   554 	{ 
       
   555 	CTestRetrieveMobilePhonePreferredWlanSIDs* preferredWlanSidsList=CTestRetrieveMobilePhonePreferredWlanSIDs::NewLC(iPhone);
       
   556 	preferredWlanSidsList->Start();
       
   557 	CActiveScheduler::Start();
       
   558 	delete preferredWlanSidsList->iTestWLAN->iNetworkList;
       
   559 	delete preferredWlanSidsList->iTestWLAN->iWlanList;
       
   560     delete preferredWlanSidsList;
       
   561 	return TestStepResult();
       
   562 	}
       
   563 
       
   564 CSimWlanTest9::CSimWlanTest9() 
       
   565 	{ 
       
   566 	SetTestStepName(_L("Wlan Test9"));
       
   567 	}
       
   568 		
       
   569 TVerdict CSimWlanTest9::doTestStepL()
       
   570 /**
       
   571 TEL-SIMTSY-MM-8675.
       
   572 Client edits the WLAN SID list and stores back on UICC successfully.
       
   573 */
       
   574 	{
       
   575 	TRequestStatus reqStatus,aReqStatus;
       
   576 	iPhone.NotifyPreferredWlanSIDListChange(aReqStatus);
       
   577 	CTestRetrieveMobilePhonePreferredWlanSIDs* preferredWlanSidsList=CTestRetrieveMobilePhonePreferredWlanSIDs::NewLC(iPhone);
       
   578 	preferredWlanSidsList->Start();
       
   579 	CActiveScheduler::Start();	
       
   580     RMobilePhone::TWlanSIDV8 wlanSIDV8_1;
       
   581     wlanSIDV8_1.iWSID = iWlanSid->At(0).iWSID;
       
   582     wlanSIDV8_1.iUserDefined = iWlanSid->At(0).iUserDefined;
       
   583     preferredWlanSidsList->iTestWLAN->iWlanList->ChangeEntryL(0,wlanSIDV8_1);
       
   584     preferredWlanSidsList->iTestWLAN->iWlanList->DeleteEntryL(1);
       
   585     preferredWlanSidsList->iTestWLAN->iWlanList->AddEntryL(wlanSIDV8_1);     
       
   586     iPhone.StorePreferredWlanSIDListL(reqStatus,preferredWlanSidsList->iTestWLAN->iWlanList);
       
   587     User::WaitForRequest(reqStatus);   
       
   588     TEST(reqStatus.Int() == KErrNone);
       
   589     User::WaitForRequest(aReqStatus);
       
   590     TEST(aReqStatus.Int() == KErrNone);
       
   591     delete preferredWlanSidsList->iTestWLAN->iNetworkList; 
       
   592     delete preferredWlanSidsList->iTestWLAN->iWlanList; 
       
   593     delete preferredWlanSidsList;
       
   594 	return TestStepResult();
       
   595 	}
       
   596 	
       
   597 CSimWlanTest10::CSimWlanTest10() 
       
   598 	{ 
       
   599 	SetTestStepName(_L("Wlan Test10"));
       
   600 	}
       
   601 		
       
   602 TVerdict CSimWlanTest10::doTestStepL()
       
   603 /**
       
   604 TEL-SIMTSY-MM-8684
       
   605 Test to cancel all the WLAN APIs successfully.
       
   606 */
       
   607 	{ 
       
   608 	TRequestStatus reqStatus,aReqStatus,stat0;
       
   609 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   610   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
   611 	iPhone.NotifyPreferredWlanSIDListChange(aReqStatus);
       
   612 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyPreferredWlanSIDListChange);
       
   613     User::WaitForRequest(aReqStatus);
       
   614     TEST(aReqStatus.Int() == KErrCancel);
       
   615     
       
   616     iPhone.NotifyPreferredNetworksListChange(reqStatus);
       
   617 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyStorePreferredNetworksListChange);
       
   618 	User::WaitForRequest(reqStatus);
       
   619 	TEST(reqStatus.Int() == KErrCancel);
       
   620 	
       
   621 	usimWlanDataV8.iFieldsUsed = iWlanData->At(1).iFieldsUsed;
       
   622 	iPhone.NotifyWlanDataChange(reqStatus,usimWlanDataV8Pckgd);
       
   623 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyWlanDataChange);
       
   624 	User::WaitForRequest(reqStatus);
       
   625 	TEST(reqStatus.Int() == KErrCancel);
       
   626 	
       
   627 	//preferredWlanSids Cancel
       
   628 	CTestRetrieveMobilePhonePreferredWlanSIDs* preferredWlanSidsList=CTestRetrieveMobilePhonePreferredWlanSIDs::NewLC(iPhone);
       
   629 	preferredWlanSidsList->Start();
       
   630 	preferredWlanSidsList->Cancel();
       
   631 	User::After(1500000L);
       
   632 	
       
   633 	CTestGetPreferredNetworks* preferredNetworks=CTestGetPreferredNetworks::NewLC(iPhone);
       
   634     preferredNetworks->Start();
       
   635     preferredNetworks->Cancel();
       
   636     User::After(1500000L);
       
   637     
       
   638     delete preferredWlanSidsList;
       
   639     delete preferredNetworks;
       
   640 	return TestStepResult();
       
   641 	}
       
   642 	
       
   643 CSimWlanTest11::CSimWlanTest11() 
       
   644 	{ 
       
   645 	SetTestStepName(_L("Wlan Test11"));
       
   646 	}
       
   647 		
       
   648 TVerdict CSimWlanTest11::doTestStepL()
       
   649 /**
       
   650 TEL-SIMTSY-MM-8676.
       
   651 Client is unable to store the WLAN SID list back on the UICC because the submitted list is larger than the expected.
       
   652 */
       
   653 	{ 
       
   654 	TRequestStatus reqStatus,aReqStatus,stat0;
       
   655 	iPhone.NotifyPreferredWlanSIDListChange(aReqStatus);
       
   656 	CTestRetrieveMobilePhonePreferredWlanSIDs* preferredWlanSidsList=CTestRetrieveMobilePhonePreferredWlanSIDs::NewLC(iPhone);
       
   657 	preferredWlanSidsList->Start();
       
   658 	CActiveScheduler::Start();
       
   659     RMobilePhone::TWlanSIDV8 wlanSIDV8_1;
       
   660     wlanSIDV8_1.iWSID = iWlanSid->At(0).iWSID;
       
   661     wlanSIDV8_1.iUserDefined = iWlanSid->At(0).iUserDefined;
       
   662     preferredWlanSidsList->iTestWLAN->iWlanList->AddEntryL(wlanSIDV8_1);
       
   663       
       
   664     iPhone.StorePreferredWlanSIDListL(reqStatus,preferredWlanSidsList->iTestWLAN->iWlanList);
       
   665     User::WaitForRequest(reqStatus);
       
   666     
       
   667     TEST(reqStatus.Int() == KErrNoMemory);
       
   668     User::WaitForRequest(aReqStatus);
       
   669     TEST(aReqStatus.Int() == KErrNone); 
       
   670     delete preferredWlanSidsList->iTestWLAN->iWlanList;
       
   671     delete preferredWlanSidsList->iTestWLAN->iNetworkList;
       
   672     delete preferredWlanSidsList;
       
   673 	return TestStepResult();
       
   674 	}
       
   675 	
       
   676 CSimWlanTest12::CSimWlanTest12() 
       
   677 	{ 
       
   678 	SetTestStepName(_L("Wlan Test12"));
       
   679 	}
       
   680 		
       
   681 TVerdict CSimWlanTest12::doTestStepL()
       
   682 /**
       
   683 TEL-SIMTSY-MM-8677.
       
   684 Test SetWlanData with different capability
       
   685 */
       
   686 	{ 
       
   687 	TRequestStatus reqStatus,aReqStatus,stat0;
       
   688 	TInt ret;
       
   689 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   690   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
   691 	usimWlanDataV8.iFieldsUsed = iWlanData->At(1).iFieldsUsed;
       
   692   	usimWlanDataV8.iPseudonym = iWlanData->At(1).iPseudonym ;
       
   693   	usimWlanDataV8.iReauthenticationId = iWlanData->At(1).iReauthenticationId;
       
   694   	usimWlanDataV8.iMasterKey = iWlanData->At(1).iMasterKey;
       
   695   	usimWlanDataV8.iCounter = iWlanData->At(1).iCounter;
       
   696 	iPhone.SetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   697   	User::WaitForRequest(reqStatus);
       
   698   	ret=reqStatus.Int();
       
   699  	INFO_PRINTF2(_L("ret=%d"),ret);
       
   700 	TEST(reqStatus.Int() == KErrPermissionDenied);
       
   701 	return TestStepResult();
       
   702 	}
       
   703 	
       
   704 CSimWlanTest13::CSimWlanTest13() 
       
   705 	{ 
       
   706 	SetTestStepName(_L("Wlan Test13"));
       
   707 	}
       
   708 		
       
   709 TVerdict CSimWlanTest13::doTestStepL()
       
   710 /**
       
   711 TEL-SIMTSY-MM-8678.
       
   712 Test GetWlanData with different capability
       
   713 */
       
   714 	{
       
   715 	TRequestStatus reqStatus,aReqStatus,stat0;
       
   716 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   717   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8); 
       
   718 	usimWlanDataV8.iFieldsUsed = iWlanData->At(0).iFieldsUsed;
       
   719 	iPhone.GetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
   720   	User::WaitForRequest(reqStatus);
       
   721 	TEST(reqStatus.Int() == KErrPermissionDenied);
       
   722 	return TestStepResult();
       
   723 	}
       
   724 	
       
   725 CSimWlanTest14::CSimWlanTest14() 
       
   726 	{ 
       
   727 	SetTestStepName(_L("Wlan Test14"));
       
   728 	}
       
   729 		
       
   730 TVerdict CSimWlanTest14::doTestStepL()
       
   731 /**
       
   732 TEL-SIMTSY-MM-8679.
       
   733 Test NotifyWlanDataChange with different capability
       
   734 */
       
   735 	{
       
   736 	TRequestStatus reqStatus,aReqStatus,stat0;
       
   737 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
   738   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8); 	
       
   739   
       
   740     usimWlanDataV8.iFieldsUsed = iWlanData->At(1).iFieldsUsed;
       
   741 	iPhone.NotifyWlanDataChange(reqStatus,usimWlanDataV8Pckgd);
       
   742 	User::WaitForRequest(reqStatus);
       
   743     TEST(reqStatus.Int()==KErrPermissionDenied);
       
   744      
       
   745 	return TestStepResult();
       
   746 	}
       
   747 
       
   748 CSimWlanTest15::CSimWlanTest15() 
       
   749 	{ 
       
   750 	SetTestStepName(_L("Wlan Test15"));
       
   751 	}
       
   752 		
       
   753 TVerdict CSimWlanTest15::doTestStepL()
       
   754 /**
       
   755 TEL-SIMTSY-MM-8681.Test 
       
   756 StorePreferredWlanSIDListL with different capability
       
   757 */
       
   758 	{ 
       
   759 	TRequestStatus reqStatus,aReqStatus,stat0;
       
   760 	RMobilePhone::TWlanSIDV8 wlanSIDV8_1;
       
   761   	RMobilePhone::TWlanSIDV8 wlanSIDV8_2;
       
   762   	RMobilePhone::TWlanSIDV8 wlanSIDV8_3;
       
   763   	
       
   764   	CMobilePhoneStoredWlanSIDList* wlanSIDlist;
       
   765   	wlanSIDlist =  CMobilePhoneStoredWlanSIDList::NewL();
       
   766     CleanupStack::PushL(wlanSIDlist);
       
   767       
       
   768     wlanSIDV8_1.iWSID = iWlanSid->At(0).iWSID;
       
   769   	wlanSIDV8_2.iWSID = iWlanSid->At(1).iWSID;
       
   770   	wlanSIDV8_3.iWSID = iWlanSid->At(2).iWSID;
       
   771   	
       
   772   	wlanSIDV8_1.iUserDefined = iWlanSid->At(0).iUserDefined;
       
   773   	wlanSIDV8_2.iUserDefined = iWlanSid->At(1).iUserDefined;
       
   774   	wlanSIDV8_3.iUserDefined = iWlanSid->At(2).iUserDefined;
       
   775   		
       
   776     wlanSIDlist->AddEntryL(wlanSIDV8_1);
       
   777     wlanSIDlist->AddEntryL(wlanSIDV8_2);
       
   778     wlanSIDlist->AddEntryL(wlanSIDV8_3);
       
   779       
       
   780     iPhone.StorePreferredWlanSIDListL(reqStatus,wlanSIDlist);
       
   781     User::WaitForRequest(reqStatus);
       
   782     
       
   783     TEST(reqStatus.Int()==KErrPermissionDenied);
       
   784     CleanupStack::PopAndDestroy();
       
   785 	return TestStepResult();
       
   786 	}
       
   787 
       
   788 CSimWlanTest16::CSimWlanTest16() 
       
   789 	{ 
       
   790 	SetTestStepName(_L("Wlan Test16"));
       
   791 	}
       
   792 		
       
   793 TVerdict CSimWlanTest16::doTestStepL()
       
   794 /**
       
   795 TEL-SIMTSY-MM-8682
       
   796 Test StorePreferredNetworksListL() with different capability
       
   797 */
       
   798 	{
       
   799 	TRequestStatus reqStatus;
       
   800 	RMobilePhone::TMobilePreferredNetworkEntryV3 preferredNetworkEntry1;
       
   801 	RMobilePhone::TMobilePreferredNetworkEntryV3 preferredNetworkEntry2;
       
   802 	RMobilePhone::TMobilePreferredNetworkEntryV3 preferredNetworkEntry3;
       
   803 	RMobilePhone::TMobilePreferredNetworkEntryV3 preferredNetworkEntry4; //- FOR WLAN
       
   804 	RMobilePhone::TMobilePreferredNetworkEntryV3 preferredNetworkEntryFetch;
       
   805 	
       
   806 	preferredNetworkEntry4.iAccess = SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_WLAN;
       
   807 	preferredNetworkEntry4.iUserDefined = iPreferredNetworks->At(0).iUserDefined;
       
   808 	preferredNetworkEntry4.iCountryCode = iPreferredNetworks->At(0).iCountryCode;
       
   809 	preferredNetworkEntry4.iNetworkId = iPreferredNetworks->At(0).iNetworkId;
       
   810 	
       
   811 	preferredNetworkEntry3.iAccess = SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_UTRAN;
       
   812 	preferredNetworkEntry3.iUserDefined = iPreferredNetworks->At(1).iUserDefined;
       
   813 	preferredNetworkEntry3.iCountryCode = iPreferredNetworks->At(1).iCountryCode;
       
   814 	preferredNetworkEntry3.iNetworkId = iPreferredNetworks->At(1).iNetworkId;
       
   815 	
       
   816 	preferredNetworkEntry2.iAccess = SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_GSMC;
       
   817 	preferredNetworkEntry2.iUserDefined = iPreferredNetworks->At(2).iUserDefined;
       
   818 	preferredNetworkEntry2.iCountryCode = iPreferredNetworks->At(2).iCountryCode;
       
   819 	preferredNetworkEntry2.iNetworkId = iPreferredNetworks->At(2).iNetworkId;
       
   820 	
       
   821 	preferredNetworkEntry1.iAccess = SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_GSM;
       
   822 	preferredNetworkEntry1.iUserDefined = iPreferredNetworks->At(3).iUserDefined;
       
   823 	preferredNetworkEntry1.iCountryCode = iPreferredNetworks->At(3).iCountryCode;
       
   824 	preferredNetworkEntry1.iNetworkId = iPreferredNetworks->At(3).iNetworkId;
       
   825 	
       
   826 	CMobilePhoneStoredNetworkList* networklist =  CMobilePhoneStoredNetworkList::NewL();
       
   827 	CleanupStack::PushL(networklist);
       
   828 	
       
   829 	//add at the end
       
   830 
       
   831 	networklist->AddEntryL(preferredNetworkEntry4);	 //- FOR WLAN
       
   832 	networklist->AddEntryL(preferredNetworkEntry3);
       
   833 	networklist->AddEntryL(preferredNetworkEntry2);
       
   834 	networklist->AddEntryL(preferredNetworkEntry1);
       
   835 	
       
   836 	iPhone.StorePreferredNetworksListL(reqStatus, networklist);
       
   837 	User::WaitForRequest(reqStatus); 
       
   838     TEST(reqStatus.Int()==KErrPermissionDenied);
       
   839     CleanupStack::PopAndDestroy();  // networklist	 
       
   840 	return TestStepResult();
       
   841 	}
       
   842 
       
   843 CSimWlanTest17::CSimWlanTest17() 
       
   844 	{ 
       
   845 	SetTestStepName(_L("Wlan Test17"));
       
   846 	}
       
   847 		
       
   848 TVerdict CSimWlanTest17::doTestStepL()
       
   849 /**
       
   850 TEL-SIMTSY-MM-8680.
       
   851 Test CRetrieveMobilePhonePreferredWlanSIDs::Start with different capability
       
   852 */
       
   853 	{
       
   854 	CTestRetrieveMobilePhonePreferredWlanSIDs* preferredWlanSidsList=CTestRetrieveMobilePhonePreferredWlanSIDs::NewLC(iPhone);
       
   855 	preferredWlanSidsList->Start();
       
   856 	CActiveScheduler::Start();
       
   857 	
       
   858     delete preferredWlanSidsList; 
       
   859 	return TestStepResult();
       
   860 	}
       
   861 
       
   862 CSimWlanTest18::CSimWlanTest18() 
       
   863 	{ 
       
   864 	SetTestStepName(_L("Wlan Test18"));
       
   865 	}
       
   866 		
       
   867 TVerdict CSimWlanTest18::doTestStepL()
       
   868 /**
       
   869 TEL-SIMTSY-MM-8683.
       
   870 Test CRetrieveMobilePhonePreferredNetworks::Start with different capability.
       
   871 */
       
   872 	{
       
   873 	CTestGetPreferredNetworks* preferredNetworks=CTestGetPreferredNetworks::NewLC(iPhone);
       
   874     preferredNetworks->Start();
       
   875     CActiveScheduler::Start();
       
   876     delete preferredNetworks->iTestPhone->iNetworkList;
       
   877 	delete preferredNetworks->iTestPhone->iWlanList;
       
   878     delete preferredNetworks;
       
   879 	return TestStepResult();
       
   880 	}
       
   881 CSimWlanTest19::CSimWlanTest19() 
       
   882 	{ 
       
   883 	SetTestStepName(_L("Wlan Test19"));
       
   884 	}
       
   885 		
       
   886 TVerdict CSimWlanTest19::doTestStepL()
       
   887 /**
       
   888 TEL-SIMTSY-MM-8673.
       
   889 Client is unable to store the list back on the UICC because the submitted list is larger than the expected.
       
   890 */
       
   891 	{ 
       
   892 	TRequestStatus reqStatus,aReqStatus;
       
   893 	INFO_PRINTF1(_L("Test - RMobilePhone::NotifyPreferredWlanSIDListChange async"));    
       
   894     iPhone.NotifyPreferredNetworksListChange(aReqStatus);
       
   895     
       
   896 	CTestGetPreferredNetworks* preferredNetworks=CTestGetPreferredNetworks::NewLC(iPhone);
       
   897     preferredNetworks->Start();
       
   898     CActiveScheduler::Start();
       
   899 	RMobilePhone::TMobilePreferredNetworkEntryV3 preferredNetworkEntry1;
       
   900 	
       
   901 	preferredNetworkEntry1.iAccess = SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_GSM;
       
   902 	preferredNetworkEntry1.iUserDefined = iPreferredNetworks->At(3).iUserDefined;
       
   903 	preferredNetworkEntry1.iCountryCode = iPreferredNetworks->At(3).iCountryCode;
       
   904 	preferredNetworkEntry1.iNetworkId = iPreferredNetworks->At(3).iNetworkId;	
       
   905 	
       
   906 	preferredNetworks->iTestPhone->iNetworkList->AddEntryL(preferredNetworkEntry1);
       
   907 
       
   908 	iPhone.StorePreferredNetworksListL(reqStatus,preferredNetworks->iTestPhone->iNetworkList);
       
   909 	User::WaitForRequest(reqStatus); 
       
   910     User::WaitForRequest(aReqStatus);
       
   911     TEST(reqStatus.Int() == KErrNoMemory);
       
   912     TEST(aReqStatus.Int() == KErrNone);    
       
   913 
       
   914 	delete preferredNetworks->iTestPhone->iNetworkList;
       
   915 	delete preferredNetworks->iTestPhone->iWlanList;
       
   916     delete preferredNetworks;
       
   917 	return TestStepResult();
       
   918 	}
       
   919 
       
   920 CSimWlanTest20::CSimWlanTest20() 
       
   921 	{ 
       
   922 	SetTestStepName(_L("Wlan Test20"));
       
   923 	}
       
   924 		
       
   925 TVerdict CSimWlanTest20::doTestStepL()
       
   926 /**
       
   927 TEL-SIMTSY-MM-8668.
       
   928 Client confirms on the support of WLAN functionality by the USIM.
       
   929 */
       
   930 	{ 
       
   931 	//Verify the support of WLAN in USIM Service Table
       
   932 	TRequestStatus reqStatus;
       
   933 	RMobilePhone::TMobilePhoneServiceTableV8 asyncSstV8File;
       
   934 	RMobilePhone::TMobilePhoneServiceTableV8Pckg asyncSstV8FilePckg(asyncSstV8File);
       
   935 	RMobilePhone::TMobilePhoneServiceTable serviceTableType=RMobilePhone::EUSIMServiceTable;
       
   936 	
       
   937 	iPhone.GetServiceTable(reqStatus, serviceTableType, asyncSstV8FilePckg);
       
   938 	
       
   939 	User::WaitForRequest(reqStatus);
       
   940 	TEST(reqStatus.Int()==KErrNone);
       
   941 	if(reqStatus.Int() == KErrNone)
       
   942 		{
       
   943 		INFO_PRINTF1(_L("Test - RMobilePhone::GetServiceTable V8table for Wlan passed"));
       
   944 		}
       
   945 	else
       
   946 		{
       
   947 		INFO_PRINTF1(_L("Test - RMobilePhone::GetServiceTable V8table for Wlan failed"));
       
   948 		}
       
   949 
       
   950 	TEST((asyncSstV8File.iServices65To72) == RMobilePhone::KUstWLANReAuthenId);	
       
   951 	return TestStepResult();
       
   952 	}
       
   953 	
       
   954 CSimWlanTest21::CSimWlanTest21() 
       
   955 	{ 
       
   956 	SetTestStepName(_L("Wlan Test21"));
       
   957 	}
       
   958 		
       
   959 TVerdict CSimWlanTest21::doTestStepL()
       
   960 /**
       
   961 TEL-SIMTSY-MM-8672.
       
   962 Client edits the preferred networks list and stores back on UICC successfully.
       
   963 */
       
   964 	{
       
   965 	TRequestStatus reqStatus,aReqStatus;
       
   966 	INFO_PRINTF1(_L("Test - RMobilePhone::NotifyPreferredWlanSIDListChange async"));    
       
   967     iPhone.NotifyPreferredNetworksListChange(aReqStatus);
       
   968     
       
   969 	CTestGetPreferredNetworks* preferredNetworks=CTestGetPreferredNetworks::NewLC(iPhone);
       
   970     preferredNetworks->Start();
       
   971     CActiveScheduler::Start();
       
   972     
       
   973 	RMobilePhone::TMobilePreferredNetworkEntryV3 preferredNetworkEntry1;
       
   974 	
       
   975 	preferredNetworkEntry1.iAccess = SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_GSM;
       
   976 	preferredNetworkEntry1.iUserDefined = iPreferredNetworks->At(3).iUserDefined;
       
   977 	preferredNetworkEntry1.iCountryCode = iPreferredNetworks->At(3).iCountryCode;
       
   978 	preferredNetworkEntry1.iNetworkId = iPreferredNetworks->At(3).iNetworkId;
       
   979 	preferredNetworks->iTestPhone->iNetworkList->ChangeEntryL(0,preferredNetworkEntry1);
       
   980 	preferredNetworks->iTestPhone->iNetworkList->DeleteEntryL(1);		
       
   981 	preferredNetworks->iTestPhone->iNetworkList->AddEntryL(preferredNetworkEntry1);
       
   982 	iPhone.StorePreferredNetworksListL(reqStatus,preferredNetworks->iTestPhone->iNetworkList);
       
   983 	User::WaitForRequest(reqStatus); 
       
   984     User::WaitForRequest(aReqStatus);
       
   985     TEST(reqStatus.Int() == KErrNone);
       
   986     TEST(aReqStatus.Int() == KErrNone);    
       
   987 
       
   988 	delete preferredNetworks->iTestPhone->iNetworkList;
       
   989 	delete preferredNetworks->iTestPhone->iWlanList;
       
   990     delete preferredNetworks;
       
   991 	return TestStepResult();
       
   992 	}
       
   993 	
       
   994 CSimWlanTest22::CSimWlanTest22() 
       
   995 	{ 
       
   996 	SetTestStepName(_L("Wlan Test22"));
       
   997 	}
       
   998 		
       
   999 TVerdict CSimWlanTest22::doTestStepL()
       
  1000 /**
       
  1001 TEL-SIMTSY-MM-8666.
       
  1002 Client retrieves WLAN parameters from USIM after update done by another client.
       
  1003 */
       
  1004 	{ 
       
  1005 	INFO_PRINTF1(_L("Two Client Scenario..."));
       
  1006 	
       
  1007 	TRequestStatus reqSts1,reqSts2,reqSts3,stat0,reqStatus,aReqStatus;
       
  1008 	
       
  1009 	RMobilePhone::TMobilePhoneSecurityCode whichCode = RMobilePhone::ESecurityUSIMAppPin;
       
  1010 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
  1011   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
  1012 	
       
  1013 	RMobilePhone::TMobilePassword code = _L("1111");
       
  1014 	RMobilePhone::TMobilePassword unblockCode = _L("1111");
       
  1015 	RMobilePhone::TMobilePhoneSecurityEvent securityEvent;
       
  1016 	
       
  1017 	usimWlanDataV8.iFieldsUsed = iWlanData->At(1).iFieldsUsed;
       
  1018 	iPhone.NotifyWlanDataChange(reqSts1,usimWlanDataV8Pckgd);
       
  1019 	iPhone.NotifySecurityEvent(reqSts2,securityEvent);
       
  1020   		
       
  1021 	/* Create another thread and perform the authentication functionality. */
       
  1022 	RThread thread;
       
  1023 	INFO_PRINTF1(_L("A different client performing WLAN authentication"));
       
  1024 	TInt KStackSize=0x8000;
       
  1025 	TInt KHeapSize=0x8000;
       
  1026 	TInt KMaxHeapSize=0x80000;
       
  1027 
       
  1028 	TInt res=thread.Create(_L("DifferentClient"), OtherCltWlan,KStackSize,KHeapSize,KMaxHeapSize,NULL, EOwnerThread);
       
  1029 	
       
  1030 	TEST(res == KErrNone);
       
  1031 	
       
  1032 	thread.Logon(reqSts3);	
       
  1033 	TEST(reqSts3.Int()==KRequestPending);
       
  1034 	
       
  1035 	thread.Resume();
       
  1036 
       
  1037 	User::WaitForRequest(reqSts3);
       
  1038 	TEST(reqSts3.Int()==KErrNone);
       
  1039 	
       
  1040 	
       
  1041 	if (thread.ExitType() != EExitKill && thread.ExitReason() != 0)
       
  1042 		{
       
  1043 		User::Leave(thread.ExitReason());
       
  1044 		}
       
  1045 	thread.Close();
       
  1046 	
       
  1047 	User::WaitForRequest(reqSts1);
       
  1048 	TEST(reqSts1.Int() == KErrNone);
       
  1049   	TEST(usimWlanDataV8.iFieldsUsed == iWlanData->At(1).iFieldsUsed);
       
  1050   	TEST(usimWlanDataV8.iPseudonym == iWlanData->At(1).iPseudonym);
       
  1051   	TEST(usimWlanDataV8.iReauthenticationId == iWlanData->At(1).iReauthenticationId);
       
  1052   	TEST(usimWlanDataV8.iMasterKey == iWlanData->At(1).iMasterKey);
       
  1053   	TEST(usimWlanDataV8.iCounter == iWlanData->At(1).iCounter);
       
  1054   	iPhone.GetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
  1055 	User::WaitForRequest(reqSts2);
       
  1056 	TEST(reqSts2.Int() == KErrNone);
       
  1057 	TEST(securityEvent == RMobilePhone::EUSIMAppPinRequired);
       
  1058 	iPhone.NotifySecurityEvent(stat0,securityEvent);
       
  1059 	iPhone.VerifySecurityCode(aReqStatus,whichCode,code,unblockCode);
       
  1060 	User::WaitForRequest(aReqStatus);
       
  1061 	User::WaitForRequest(stat0);
       
  1062 	TEST(aReqStatus.Int() == KErrNone);
       
  1063 	TEST(stat0.Int() == KErrNone);
       
  1064 	TEST(securityEvent == RMobilePhone::EUSIMAppPinVerified);
       
  1065 	
       
  1066   	User::WaitForRequest(reqStatus);
       
  1067   	TEST(reqStatus.Int() == KErrNone);
       
  1068   	TEST(usimWlanDataV8.iFieldsUsed == iWlanData->At(1).iFieldsUsed);
       
  1069   	TEST(usimWlanDataV8.iPseudonym == iWlanData->At(1).iPseudonym);
       
  1070   	TEST(usimWlanDataV8.iReauthenticationId == iWlanData->At(1).iReauthenticationId);
       
  1071   	TEST(usimWlanDataV8.iMasterKey == iWlanData->At(1).iMasterKey);
       
  1072   	TEST(usimWlanDataV8.iCounter == iWlanData->At(1).iCounter);
       
  1073 	return TestStepResult();	
       
  1074 	}
       
  1075 
       
  1076 TInt OtherCltWlan(void* aThreadData)
       
  1077 	{
       
  1078 	
       
  1079 	(void)aThreadData; // as we are not using this variable.
       
  1080 	
       
  1081 	TInt ret =KErrNone;
       
  1082 	TRAP(ret,CSimUsimR6TestWlanThread* myInstance = CSimUsimR6TestWlanThread::getInstanceL());
       
  1083 	
       
  1084 	return ret;
       
  1085 	
       
  1086 	}
       
  1087 
       
  1088 CSimUsimR6TestWlanThread* CSimUsimR6TestWlanThread::instance=NULL;
       
  1089 
       
  1090 CSimUsimR6TestWlanThread* CSimUsimR6TestWlanThread::getInstanceL()
       
  1091 	{
       
  1092 	if(instance == NULL)
       
  1093 		{
       
  1094 		instance = new(ELeave) CSimUsimR6TestWlanThread();
       
  1095 		}
       
  1096 	return instance;
       
  1097 	}
       
  1098 
       
  1099 CSimUsimR6TestWlanThread::CSimUsimR6TestWlanThread()
       
  1100 	{
       
  1101 	// Do Nothing Constructor
       
  1102 	}
       
  1103 	
       
  1104 CSimUsimR6TestWlanThread::CSimUsimR6TestWlanThread(const CSimUsimR6TestWlanThread&)
       
  1105 	{
       
  1106 	// Do Nothing copy Constructor
       
  1107 	}
       
  1108 
       
  1109 CSimUsimR6TestWlanThread& CSimUsimR6TestWlanThread::operator=(const CSimUsimR6TestWlanThread&)
       
  1110 	{
       
  1111 	// Do Nothing Operator overloaded function
       
  1112 	CSimUsimR6TestWlanThread* test = CSimUsimR6TestWlanThread::getInstanceL();
       
  1113 	return (*test);
       
  1114 	}
       
  1115 
       
  1116 TVerdict CSimUsimR6TestWlanThread::doTestStepL()
       
  1117 /**
       
  1118 TEL-SIMTSY-MM-8663.
       
  1119 Client stores the Wlan parameters on USIM successfully.
       
  1120 */
       
  1121 	{
       
  1122 	// local variables used throughout the tests
       
  1123 	TRequestStatus reqStatus,aReqStatus,stat0,reqStatus1;
       
  1124 	RMobilePhone::TMobilePhoneSecurityCode whichCode = RMobilePhone::ESecurityUSIMAppPin;
       
  1125 	RMobilePhone::TUsimWlanDataV8 usimWlanDataV8;
       
  1126   	RMobilePhone::TUsimWlanDataV8Pckg usimWlanDataV8Pckgd(usimWlanDataV8);
       
  1127 	
       
  1128 	RMobilePhone::TMobilePassword code = _L("1111");
       
  1129 	RMobilePhone::TMobilePassword unblockCode = _L("1111");
       
  1130 	RMobilePhone::TMobilePhoneSecurityEvent securityEvent;
       
  1131 	iPhone.NotifySecurityEvent(aReqStatus,securityEvent);
       
  1132 	usimWlanDataV8.iFieldsUsed = iWlanData->At(0).iFieldsUsed;
       
  1133 	iPhone.NotifyWlanDataChange(reqStatus1,usimWlanDataV8Pckgd);
       
  1134 	
       
  1135 	TestSmartCardAuthenticate();
       
  1136 
       
  1137   	usimWlanDataV8.iPseudonym = iWlanData->At(0).iPseudonym ;
       
  1138   	usimWlanDataV8.iReauthenticationId = iWlanData->At(0).iReauthenticationId;	 
       
  1139   	iPhone.SetWlanData(reqStatus,usimWlanDataV8Pckgd);
       
  1140   	User::WaitForRequest(aReqStatus);
       
  1141 	TEST(aReqStatus.Int() == KErrNone);
       
  1142 	TEST(securityEvent == RMobilePhone::EUSIMAppPinRequired);
       
  1143 	
       
  1144 	iPhone.NotifySecurityEvent(stat0,securityEvent);
       
  1145 	iPhone.VerifySecurityCode(aReqStatus,whichCode,code,unblockCode);
       
  1146 	User::WaitForRequest(aReqStatus);
       
  1147 	User::WaitForRequest(stat0);
       
  1148 	TEST(aReqStatus.Int() == KErrNone);
       
  1149 	TEST(securityEvent == RMobilePhone::EUSIMAppPinVerified);
       
  1150   	User::WaitForRequest(reqStatus);
       
  1151   	User::WaitForRequest(reqStatus1);
       
  1152   	TEST(reqStatus.Int() == KErrNone);
       
  1153   	TEST(reqStatus1.Int() == KErrNone);
       
  1154   	TEST(usimWlanDataV8.iFieldsUsed == iWlanData->At(0).iFieldsUsed);
       
  1155   	TEST(usimWlanDataV8.iPseudonym == iWlanData->At(0).iPseudonym);
       
  1156   	TEST(usimWlanDataV8.iReauthenticationId == iWlanData->At(0).iReauthenticationId);
       
  1157 	return TestStepResult();	
       
  1158 	}
       
  1159 		
       
  1160 CTestRetrieveMobilePhonePreferredWlanSIDs* CTestRetrieveMobilePhonePreferredWlanSIDs::NewLC(RMobilePhone& aPhone)
       
  1161 	{
       
  1162 	CTestRetrieveMobilePhonePreferredWlanSIDs* r=new(ELeave) CTestRetrieveMobilePhonePreferredWlanSIDs(aPhone);
       
  1163 	CleanupStack::PushL(r);
       
  1164 	r->ConstructL();
       
  1165 	CleanupStack::Pop();
       
  1166 	return r;
       
  1167 	}
       
  1168   
       
  1169 CTestRetrieveMobilePhonePreferredWlanSIDs::CTestRetrieveMobilePhonePreferredWlanSIDs(RMobilePhone& aPhone)
       
  1170 : CActive(EPriorityNormal), iPhone(aPhone)
       
  1171 {}
       
  1172  
       
  1173 void CTestRetrieveMobilePhonePreferredWlanSIDs::ConstructL()
       
  1174 	{
       
  1175 	CActiveScheduler::Add(this);
       
  1176 	iRetrieve=CRetrieveMobilePhonePreferredWlanSIDs::NewL(iPhone);
       
  1177 	iTestWLAN = new (ELeave) CSimWlanTest6();
       
  1178 	}
       
  1179      
       
  1180 CTestRetrieveMobilePhonePreferredWlanSIDs::~CTestRetrieveMobilePhonePreferredWlanSIDs()
       
  1181 	{
       
  1182 	delete iRetrieve;
       
  1183 	delete iTestWLAN;
       
  1184 	}
       
  1185 
       
  1186 void CTestRetrieveMobilePhonePreferredWlanSIDs::Start()
       
  1187 	{
       
  1188 	iRetrieve->Start(iStatus); 
       
  1189     SetActive();
       
  1190 	}       
       
  1191 
       
  1192 void CTestRetrieveMobilePhonePreferredWlanSIDs::RunL()
       
  1193 	{
       
  1194 	TInt ret=iStatus.Int();
       
  1195 	if(ret==KErrPermissionDenied)
       
  1196 		{
       
  1197 		iTestWLAN->INFO_PRINTF1(_L("Permission Access Denied"));
       
  1198 		CActiveScheduler::Stop();
       
  1199 		return;
       
  1200 		}
       
  1201 	User::LeaveIfError(ret);
       
  1202 	ret=CheckWLANResults();
       
  1203 	User::LeaveIfError(ret);
       
  1204 	CActiveScheduler::Stop();
       
  1205 	}
       
  1206   
       
  1207 void CTestRetrieveMobilePhonePreferredWlanSIDs::DoCancel()
       
  1208 	{
       
  1209 	iRetrieve->Cancel();
       
  1210 	}       
       
  1211   
       
  1212 TInt CTestRetrieveMobilePhonePreferredWlanSIDs::CheckWLANResults()
       
  1213 	{
       
  1214 	TInt ret=KErrNone;
       
  1215 
       
  1216 	iTestWLAN->iWlanList =NULL;
       
  1217 	TInt leaveCode=KErrNone;
       
  1218 	TRAP(leaveCode, iTestWLAN->iWlanList=iRetrieve->RetrieveListL(););
       
  1219 
       
  1220 	//Check that a list is returned back to the test
       
  1221 	iTestWLAN->TEST(iTestWLAN->iWlanList!=NULL);
       
  1222 
       
  1223 	if (iTestWLAN->iWlanList)
       
  1224 		{
       
  1225 		//Check that the number of entries in the list is as expected
       
  1226 		iTestWLAN->TEST(iTestWLAN->iWlanList->Enumerate()==SIMTSY_PHONE_WLAN_SIDLIST_COUNT);
       
  1227 		// Get each entry
       
  1228 		RMobilePhone::TWlanSIDV8 wlanSIDV8;
       
  1229 		for (TInt i=0; i<SIMTSY_PHONE_WLAN_SIDLIST_COUNT; ++i)
       
  1230 			{
       
  1231 			TRAP(ret,wlanSIDV8=iTestWLAN->iWlanList->GetEntryL(i));
       
  1232 			if (ret != KErrNone)
       
  1233 				{
       
  1234 				break;
       
  1235 				}
       
  1236 			switch(i)
       
  1237 				{
       
  1238 			case 0:
       
  1239 				{
       
  1240 				iTestWLAN->TEST(wlanSIDV8.iWSID == SIMTSY_PHONE_WLAN_WSID_ONE);
       
  1241 				iTestWLAN->TEST(wlanSIDV8.iUserDefined == SIMTSY_PHONE_WLAN_USERDEFD_ONE);
       
  1242 				break;
       
  1243 				}
       
  1244 			case 1:
       
  1245 				{
       
  1246 				iTestWLAN->TEST(wlanSIDV8.iWSID == SIMTSY_PHONE_WLAN_WSID_TWO);
       
  1247 				iTestWLAN->TEST(wlanSIDV8.iUserDefined == SIMTSY_PHONE_WLAN_USERDEFD_TWO);
       
  1248 				break;
       
  1249 				}
       
  1250 			case 2:
       
  1251 				{
       
  1252 				iTestWLAN->TEST(wlanSIDV8.iWSID == SIMTSY_PHONE_WLAN_WSID_THREE);
       
  1253 				iTestWLAN->TEST(wlanSIDV8.iUserDefined == SIMTSY_PHONE_WLAN_USERDEFD_THREE);				break;
       
  1254 				}
       
  1255 			default:
       
  1256 				break;
       
  1257 				}
       
  1258 			}
       
  1259 		}
       
  1260 	return ret;
       
  1261 	}
       
  1262 	
       
  1263 /**************************************************************/
       
  1264 //
       
  1265 // Testing asynchronous retrieve of preferred stored network list
       
  1266 //
       
  1267 /**************************************************************/
       
  1268 
       
  1269 
       
  1270 CTestGetPreferredNetworks* CTestGetPreferredNetworks::NewLC(RMobilePhone& aPhone)
       
  1271 	{
       
  1272     CTestGetPreferredNetworks* r=new(ELeave) CTestGetPreferredNetworks(aPhone);
       
  1273     CleanupStack::PushL(r);
       
  1274     r->ConstructL();
       
  1275     CleanupStack::Pop();
       
  1276     return r;
       
  1277     }
       
  1278       
       
  1279 CTestGetPreferredNetworks::CTestGetPreferredNetworks(RMobilePhone& aPhone)
       
  1280     : CActive(EPriorityNormal), iPhone(aPhone)
       
  1281     {}
       
  1282       
       
  1283 
       
  1284 void CTestGetPreferredNetworks::ConstructL()
       
  1285 	{
       
  1286     CActiveScheduler::Add(this);
       
  1287 	iRetrieve=CRetrieveMobilePhonePreferredNetworks::NewL(iPhone);
       
  1288 	iTestPhone = new (ELeave) CSimWlanTest6();
       
  1289     }
       
  1290          
       
  1291 CTestGetPreferredNetworks::~CTestGetPreferredNetworks()
       
  1292     {
       
  1293     delete iRetrieve;
       
  1294     delete iTestPhone;
       
  1295 	}
       
  1296       
       
  1297 void CTestGetPreferredNetworks::Start()
       
  1298     {
       
  1299     iRetrieve->Start(iStatus);
       
  1300     SetActive();
       
  1301     }       
       
  1302       
       
  1303 void CTestGetPreferredNetworks::RunL()
       
  1304     {
       
  1305 	TInt ret=iStatus.Int();
       
  1306 	if(ret==KErrPermissionDenied)
       
  1307 		{
       
  1308 		iTestPhone->INFO_PRINTF1(_L("Permission Access Denied"));
       
  1309 		CActiveScheduler::Stop();
       
  1310 		return;
       
  1311 		}
       
  1312     User::LeaveIfError(ret);
       
  1313 	ret=CheckResults();
       
  1314 	User::LeaveIfError(ret);
       
  1315 
       
  1316     CActiveScheduler::Stop();
       
  1317 	}
       
  1318       
       
  1319 
       
  1320 void CTestGetPreferredNetworks::DoCancel()
       
  1321     {
       
  1322     iRetrieve->Cancel();
       
  1323     }       
       
  1324       
       
  1325 TInt CTestGetPreferredNetworks::CheckResults()
       
  1326     {
       
  1327 	TInt ret=KErrNone;
       
  1328 
       
  1329 	iTestPhone->iNetworkList=NULL;
       
  1330 	TInt leaveCode=KErrNone;
       
  1331 	TRAP(leaveCode, iTestPhone->iNetworkList=iRetrieve->RetrieveListL(););
       
  1332 
       
  1333 	if (iTestPhone->iNetworkList)
       
  1334 		{
       
  1335 		iTestPhone->TEST(iTestPhone->iNetworkList->Enumerate()==SIMTSY_PHONE_NTWK_LIST_ENTRIES);
       
  1336 
       
  1337 		// Get each stored network entry
       
  1338 		RMobilePhone::TMobilePreferredNetworkEntryV3 entry;
       
  1339 
       
  1340 		for (TInt i=0; i<SIMTSY_PHONE_NTWK_LIST_ENTRIES; ++i)
       
  1341 			{
       
  1342 			TRAP(ret,entry=iTestPhone->iNetworkList->GetEntryL(i));
       
  1343 			if (ret != KErrNone)
       
  1344 				break;
       
  1345 			switch(i)
       
  1346 				{
       
  1347 				case 0:
       
  1348 					{
       
  1349 					iTestPhone->TEST(entry.iAccess == SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_GSM);
       
  1350 					iTestPhone->TEST(entry.iUserDefined == SIMTSY_PHONE_NTWK_LIST_USER_DEFINED_FALSE);
       
  1351 					iTestPhone->TEST(entry.iCountryCode == SIMTSY_PHONE_NTWK_LIST_COUNTRY_ID1);
       
  1352 					iTestPhone->TEST(entry.iNetworkId == SIMTSY_PHONE_NTWK_LIST_NETWORK_ID1);
       
  1353 					}
       
  1354 					break;
       
  1355 				case 1:
       
  1356 					{
       
  1357 					iTestPhone->TEST(entry.iAccess == SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_GSMC);
       
  1358 					iTestPhone->TEST(entry.iUserDefined == SIMTSY_PHONE_NTWK_LIST_USER_DEFINED_FALSE);
       
  1359 					iTestPhone->TEST(entry.iCountryCode == SIMTSY_PHONE_NTWK_LIST_COUNTRY_ID2);
       
  1360 					iTestPhone->TEST(entry.iNetworkId == SIMTSY_PHONE_NTWK_LIST_NETWORK_ID2);
       
  1361 					}
       
  1362 					break;
       
  1363 				case 2:
       
  1364 				default:
       
  1365 					{
       
  1366 					iTestPhone->TEST(entry.iAccess == SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_UTRAN);
       
  1367 					iTestPhone->TEST(entry.iUserDefined == SIMTSY_PHONE_NTWK_LIST_USER_DEFINED_TRUE);
       
  1368 					iTestPhone->TEST(entry.iCountryCode == SIMTSY_PHONE_NTWK_LIST_COUNTRY_ID2);
       
  1369 					iTestPhone->TEST(entry.iNetworkId == SIMTSY_PHONE_NTWK_LIST_NETWORK_ID1);
       
  1370 					}
       
  1371 					break;
       
  1372 				case 3:
       
  1373 					{
       
  1374 					iTestPhone->TEST(entry.iAccess == SIMTSY_PHONE_NTWK_LIST_ACCESS_CAPS_WLAN);// - RAFIK UNCOMMENT THIS
       
  1375 					iTestPhone->TEST(entry.iUserDefined == SIMTSY_PHONE_NTWK_LIST_USER_DEFINED_TRUE);
       
  1376 					iTestPhone->TEST(entry.iCountryCode == SIMTSY_PHONE_NTWK_LIST_COUNTRY_ID2);
       
  1377 					iTestPhone->TEST(entry.iNetworkId == SIMTSY_PHONE_NTWK_LIST_NETWORK_ID1);
       
  1378 					break;
       
  1379 					}
       
  1380 				}
       
  1381 			}
       
  1382 		}
       
  1383    return ret;
       
  1384     }
       
  1385   
       
  1386 
       
  1387 CSim3GSecurityContextTest1::CSim3GSecurityContextTest1() 
       
  1388 	{ 
       
  1389 	SetTestStepName(_L("3GSecurityContextTest1"));
       
  1390 	}
       
  1391 		
       
  1392 TVerdict CSim3GSecurityContextTest1::doTestStepL()
       
  1393 /**
       
  1394 TEL-SIMTSY-MM-8658.
       
  1395 Client performs EAP-AKA USIM authentication successfully.
       
  1396 */
       
  1397 	{ 
       
  1398 	TestSmartCardAuthenticate();
       
  1399 	return TestStepResult();
       
  1400 	}
       
  1401 	
       
  1402 CSim3GSecurityContextTest2::CSim3GSecurityContextTest2() 
       
  1403 	{ 
       
  1404 	SetTestStepName(_L("CSim3GSecurityContextTest2"));
       
  1405 	}
       
  1406 		
       
  1407 TVerdict CSim3GSecurityContextTest2::doTestStepL()
       
  1408 /**
       
  1409 TEL-SIMTSY-MM-8659.
       
  1410 Client is unable to perform EAP-AKA USIM authentication due to lack of support in USIM service table.
       
  1411 */
       
  1412 	{ 
       
  1413 	TRequestStatus reqStatus;
       
  1414    	RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData;
       
  1415 	RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckg(authenticateData);
       
  1416 	authenticateData.iAUTN = KConfigScWlanAuthAUTN();
       
  1417 	authenticateData.iRAND = KConfigScWlanAuthRAND();
       
  1418 	authenticateData.iCK = KConfigScWlanNotSupported();
       
  1419 	
       
  1420 	RMobilePhone::TAID appAID = KWlanAid();
       
  1421 	iPhone.SmartCardAuthenticate(reqStatus,appAID,authenticateDataPckg);
       
  1422 	User::WaitForRequest(reqStatus);
       
  1423 	TESTL(reqStatus==KErrNotSupported);
       
  1424 	return TestStepResult();
       
  1425 	}
       
  1426 	
       
  1427 CSim3GSecurityContextTest3::CSim3GSecurityContextTest3() 
       
  1428 	{ 
       
  1429 	SetTestStepName(_L("CSim3GSecurityContextTest3"));
       
  1430 	}
       
  1431 		
       
  1432 TVerdict CSim3GSecurityContextTest3::doTestStepL()
       
  1433 /**
       
  1434 TEL-SIMTSY-MM-8660.
       
  1435 Client is unable to perform EAP-AKA USIM authentication due to inactive USIM application.
       
  1436 */
       
  1437 	{ 
       
  1438 	TRequestStatus reqStatus;
       
  1439    	RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData;
       
  1440 	RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckg(authenticateData);
       
  1441 	authenticateData.iAUTN = KConfigScWlanAuthAUTN();
       
  1442 	authenticateData.iRAND = KConfigScWlanAuthRAND();
       
  1443 	authenticateData.iCK = KConfigScWlan();
       
  1444 	
       
  1445 	RMobilePhone::TAID appAID;
       
  1446 	iPhone.SmartCardAuthenticate(reqStatus,appAID,authenticateDataPckg);
       
  1447 	User::WaitForRequest(reqStatus);
       
  1448 	TESTL(reqStatus==KErrMMEtelScApplicationNotActive);
       
  1449 	return TestStepResult();
       
  1450 	}
       
  1451 
       
  1452 CSim3GSecurityContextTest4::CSim3GSecurityContextTest4() 
       
  1453 	{ 
       
  1454 	SetTestStepName(_L("CSim3GSecurityContextTest4"));
       
  1455 	}
       
  1456 		
       
  1457 TVerdict CSim3GSecurityContextTest4::doTestStepL()
       
  1458 /**
       
  1459 TEL-SIMTSY-MM-8661.
       
  1460 Client is unable to perform EAP-AKA USIM authentication due to MAC verification failure.
       
  1461 */
       
  1462 	{ 
       
  1463 	TRequestStatus reqStatus;
       
  1464    	RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData;
       
  1465 	RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckg(authenticateData);
       
  1466 	authenticateData.iCK = KConfigScWlan();
       
  1467 	
       
  1468 	RMobilePhone::TAID appAID = KWlanAid();
       
  1469 	iPhone.SmartCardAuthenticate(reqStatus,appAID,authenticateDataPckg);
       
  1470 	User::WaitForRequest(reqStatus);
       
  1471 	TESTL(reqStatus==KErrMMEtelMacVerificationFailed);
       
  1472 	return TestStepResult();
       
  1473 	}
       
  1474 
       
  1475 CSim3GSecurityContextTest5::CSim3GSecurityContextTest5() 
       
  1476 	{ 
       
  1477 	SetTestStepName(_L("CSim3GSecurityContextTest5"));
       
  1478 	}
       
  1479 		
       
  1480 TVerdict CSim3GSecurityContextTest5::doTestStepL()
       
  1481 /**
       
  1482 TEL-SIMTSY-MM-8662.
       
  1483 Client is unable to perform EAP-AKA USIM authentication due to synchronisation failure. 
       
  1484 */
       
  1485 	{ 
       
  1486 	TRequestStatus reqStatus;
       
  1487    	RMobilePhone::TSmartCardAuthenticateDataV6 authenticateData;
       
  1488 	RMobilePhone::TSmartCardAuthenticateDataV6Pckg authenticateDataPckg(authenticateData);
       
  1489 	authenticateData.iAUTN = KConfigScWlanAuthAUTN();
       
  1490 	authenticateData.iCK = KConfigScWlan();
       
  1491 	
       
  1492 	RMobilePhone::TAID appAID = KWlanAid();
       
  1493 	iPhone.SmartCardAuthenticate(reqStatus,appAID,authenticateDataPckg);
       
  1494 	User::WaitForRequest(reqStatus);
       
  1495 	TESTL(reqStatus==KErrMMEtelSqnVerificationFailed);
       
  1496 	return TestStepResult();
       
  1497 	}
       
  1498 		
       
  1499 /****************************************************************************\
       
  1500  * 																			*
       
  1501  * 			Generic Bootstrapping Architecture  Testcases	 				*	
       
  1502  * 																			*	
       
  1503  ****************************************************************************/
       
  1504 
       
  1505 CSimUsimR6GBATest1::CSimUsimR6GBATest1() 
       
  1506 	{ 
       
  1507 	SetTestStepName(_L("UsimR6GBATest1"));
       
  1508 	}
       
  1509 
       
  1510 TVerdict CSimUsimR6GBATest1::doTestStepL()
       
  1511 /**
       
  1512 TEL-SIMTSY-MM-8601.
       
  1513 Client confirms on the support of GBA functionality by the USIM.
       
  1514 */
       
  1515 	{
       
  1516 	INFO_PRINTF1(_L("BeginUsimR6GBATest"));
       
  1517 
       
  1518 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  1519 	SetTestNumberL(38);
       
  1520 
       
  1521 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  1522 	TESTL(ret == KErrNone); 
       
  1523 	INFO_PRINTF1(_L(""));
       
  1524 	TRequestStatus reqStatus=KErrNone;
       
  1525 
       
  1526 	//Verify the support of GBA in USIM Service Table
       
  1527 
       
  1528 	RMobilePhone::TMobilePhoneServiceTableV8 asyncSstV8File;
       
  1529 	RMobilePhone::TMobilePhoneServiceTableV8Pckg asyncSstV8FilePckg(asyncSstV8File);
       
  1530 	RMobilePhone::TMobilePhoneServiceTable serviceTableType=RMobilePhone::EUSIMServiceTable;
       
  1531 	
       
  1532 	iPhone.GetServiceTable(reqStatus, serviceTableType, asyncSstV8FilePckg);
       
  1533 	User::WaitForRequest(reqStatus);
       
  1534 	TEST(reqStatus.Int()==KErrNone);
       
  1535 	if(reqStatus.Int() == KErrNone)
       
  1536 		{
       
  1537 		INFO_PRINTF1(_L("Test - RMobilePhone::GetServiceTable V8table for GBA passed"));
       
  1538 		}
       
  1539 	else
       
  1540 		{
       
  1541 		INFO_PRINTF1(_L("Test - RMobilePhone::GetServiceTable V8table for GBA failed"));
       
  1542 		}
       
  1543 	TEST((asyncSstV8File.iServices65To72) == RMobilePhone::KUstGBA);
       
  1544 	iPhone.Close();
       
  1545 	return TestStepResult();
       
  1546  	}
       
  1547 
       
  1548 CSimUsimR6GBATest2::CSimUsimR6GBATest2() 
       
  1549 	{	 
       
  1550 	SetTestStepName(_L("UsimR6GBATest2"));
       
  1551 	}
       
  1552 
       
  1553 TVerdict CSimUsimR6GBATest2::doTestStepL()
       
  1554 /**
       
  1555 TEL-SIMTSY-MM-8602.
       
  1556 Client performs successfully GBA authentication in Bootstrap mode
       
  1557 */
       
  1558 	{
       
  1559 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  1560 	SetTestNumberL(38);
       
  1561 
       
  1562 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  1563 	TESTL(ret == KErrNone); 
       
  1564 	INFO_PRINTF1(_L(""));
       
  1565 
       
  1566 	TRequestStatus reqSts1,reqSts2,reqSts3,reqStatus;
       
  1567 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  1568 	iPhone.NotifySecurityEvent(reqSts1,secEvent);
       
  1569 
       
  1570 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  1571 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  1572 	
       
  1573 	_LIT8(Krand,"RAND_IN"); 
       
  1574 	_LIT8(Kautn,"AUTN_IN"); 
       
  1575 	_LIT8(Kaid,"AE879");
       
  1576 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  1577 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  1578 
       
  1579 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  1580 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  1581 	iPhone.NotifyAuthenticateDataChange(reqStatus,tAuthInfoV8Pckg);
       
  1582 
       
  1583 	RMobilePhone::TAID appAID = Kaid();
       
  1584 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  1585 	iPhone.SmartCardAuthenticate(reqSts2, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  1586 	User::WaitForRequest(reqSts2);
       
  1587 	TEST(reqSts2.Int() == KErrNone);
       
  1588 	
       
  1589 	User::WaitForRequest(reqStatus);
       
  1590 	TEST(reqStatus.Int() == KErrNone);
       
  1591 	INFO_PRINTF1(_L("RMobilePhone::NotifyAuthenticateDataChange Completed."));
       
  1592 	
       
  1593 	tAuthInfoV8 = tAuthInfoV8Pckg();
       
  1594 	
       
  1595 	TEST(tAuthInfoV8.iAID == Kaid());
       
  1596 	TEST(tAuthInfoV8.iData == RMobilePhone::EGbaBootstrapParams );
       
  1597 	/* 	Client sends the RES to the network in the HTTP Digest AKA response. 
       
  1598 	 * 	The network (i.e. the BSF) authenticates the phone by verifying the 
       
  1599 	 * 	Digest AKA response. The network generates the Ks key, the 
       
  1600 	 *  transaction identifier (B-TID) and the Ks key Lifetime. 
       
  1601 	 *  The network (the BSF) then sends the B-TID value and the key 
       
  1602 	 * lifetime to the phone. 
       
  1603 	 */
       
  1604 	RMobilePhone::TBsfDataV8 tBsfDataV8;
       
  1605 	RMobilePhone::TBsfDataV8Pckg tBsfDataV8Pckg(tBsfDataV8);
       
  1606 
       
  1607 	_LIT8(KBtid,"B2345");
       
  1608 	_LIT8(KKeyLifeTime,"D3789");
       
  1609 	tBsfDataV8.iBtid = KBtid;
       
  1610 	tBsfDataV8.iKeyLifetime = KKeyLifeTime;
       
  1611 
       
  1612 	iPhone.SetGbaBootstrapParams(reqSts3,appAID,tBsfDataV8Pckg);
       
  1613 
       
  1614 	User::WaitForRequest(reqSts1);
       
  1615 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  1616 
       
  1617 	INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinRequired"));
       
  1618 
       
  1619 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  1620 	RMobilePhone::TMobilePassword pass;
       
  1621 	_LIT8(Kpswrd, "1234");
       
  1622 	pass.Copy(Kpswrd);
       
  1623    
       
  1624 	INFO_PRINTF1(_L("Verifying the PIN1"));
       
  1625 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  1626 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  1627 	User::WaitForRequest(reqSts2);
       
  1628 	User::WaitForRequest(reqSts1);
       
  1629 	TEST(reqSts2==KErrNone); 
       
  1630 	TEST(secEvent==RMobilePhone::EUSIMAppPinVerified);
       
  1631 	
       
  1632 	INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinVerified"));
       
  1633 
       
  1634 	User::WaitForRequest(reqSts3);
       
  1635 	TEST(reqSts3.Int() == KErrNone);	
       
  1636 	
       
  1637 	if(reqSts3.Int() == KErrNone)
       
  1638 		{
       
  1639 		INFO_PRINTF1(_L("SetGBABootParams Completed Successfully"));
       
  1640 		}
       
  1641 	else
       
  1642 		{
       
  1643 		INFO_PRINTF1(_L("SetGBABootParams Not Completed Successfully"));
       
  1644 		}
       
  1645 	iPhone.Close();
       
  1646 	return TestStepResult();
       
  1647 	}
       
  1648 
       
  1649 CSimUsimR6GBATest3::CSimUsimR6GBATest3() 
       
  1650 	{ 
       
  1651 	SetTestStepName(_L("UsimR6GBATest3"));
       
  1652 	}
       
  1653 
       
  1654 TVerdict CSimUsimR6GBATest3::doTestStepL()
       
  1655 /**
       
  1656 TEL-SIMTSY-MM-8603.
       
  1657 Client is unable to perform GBA authentication in Bootstrap mode as USIM application is not active
       
  1658 */
       
  1659 	{
       
  1660 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  1661 	SetTestNumberL(39);
       
  1662 
       
  1663 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  1664 	TESTL(ret == KErrNone); 
       
  1665 	INFO_PRINTF1(_L(""));
       
  1666 
       
  1667 	TRequestStatus reqSts;
       
  1668 
       
  1669 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  1670 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  1671 	
       
  1672 	_LIT8(Krand,"RAND_IN"); 
       
  1673 	_LIT8(Kautn,"AUTN_IN"); 
       
  1674 	_LIT8(Kaid,"AE879");
       
  1675 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  1676 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  1677 	
       
  1678 	RMobilePhone::TAID appAID = Kaid();
       
  1679 
       
  1680 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  1681 
       
  1682 	iPhone.SmartCardAuthenticate(reqSts, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  1683 	User::WaitForRequest(reqSts);
       
  1684 	TEST(reqSts.Int() == KErrMMEtelScApplicationNotActive );
       
  1685 	
       
  1686 	if(reqSts.Int() == KErrMMEtelScApplicationNotActive)
       
  1687 		{
       
  1688 		INFO_PRINTF1(_L("SmartCardAuthenticate completed with Application Not Active"));		
       
  1689 		}
       
  1690 	iPhone.Close();
       
  1691 	return TestStepResult();
       
  1692 	}
       
  1693 
       
  1694 CSimUsimR6GBATest4::CSimUsimR6GBATest4() 
       
  1695 	{ 
       
  1696 	SetTestStepName(_L("UsimR6GBATest4"));
       
  1697 	}
       
  1698 
       
  1699 TVerdict CSimUsimR6GBATest4::doTestStepL()
       
  1700 /**
       
  1701 TEL-SIMTSY-MM-8604.
       
  1702 Client is unable to perform GBA authentication in Bootstrap mode as 
       
  1703 USIM application is busy with another client’s request for GBA.
       
  1704 */
       
  1705 	{
       
  1706 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  1707 	SetTestNumberL(40);
       
  1708 
       
  1709 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  1710 	TESTL(ret == KErrNone); 
       
  1711 	INFO_PRINTF1(_L(""));
       
  1712 
       
  1713 	TRequestStatus reqSts;
       
  1714 
       
  1715 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  1716 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  1717 	
       
  1718 	_LIT8(Krand,"RAND_IN"); 
       
  1719 	_LIT8(Kautn,"AUTN_IN"); 
       
  1720 	_LIT8(Kaid,"AE879");
       
  1721 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  1722 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  1723 	
       
  1724 	RMobilePhone::TAID appAID = Kaid();
       
  1725 
       
  1726 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  1727 
       
  1728 	iPhone.SmartCardAuthenticate(reqSts, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  1729 	User::WaitForRequest(reqSts);
       
  1730 	TEST(reqSts.Int() == KErrInUse );
       
  1731 	
       
  1732 	INFO_PRINTF1(_L("SmartCardAuthenticate completed with Application busy."));
       
  1733 	iPhone.Close();
       
  1734 	return TestStepResult();
       
  1735 	}
       
  1736 
       
  1737 CSimUsimR6GBATest5::CSimUsimR6GBATest5() 
       
  1738 	{ 
       
  1739 	SetTestStepName(_L("UsimR6GBATest5"));
       
  1740 	}
       
  1741 
       
  1742 TVerdict CSimUsimR6GBATest5::doTestStepL()
       
  1743 /**
       
  1744 TEL-SIMTSY-MM-8605.
       
  1745 Client is unable to update EFGBABP due to PIN verification failure.
       
  1746 */
       
  1747 	{
       
  1748 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  1749 	SetTestNumberL(38);
       
  1750 
       
  1751 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  1752 	TESTL(ret == KErrNone); 
       
  1753 	INFO_PRINTF1(_L(""));
       
  1754 
       
  1755 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  1756 
       
  1757 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  1758 	iPhone.NotifySecurityEvent(reqSts1,secEvent);
       
  1759 
       
  1760 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  1761 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  1762 	
       
  1763 	_LIT8(Krand,"RAND_IN"); 
       
  1764 	_LIT8(Kautn,"AUTN_IN"); 
       
  1765 	_LIT8(Kaid,"AE879");
       
  1766 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  1767 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  1768 
       
  1769 	RMobilePhone::TAID appAID = Kaid();
       
  1770 
       
  1771 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  1772 
       
  1773 	iPhone.SmartCardAuthenticate(reqSts2, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  1774 	User::WaitForRequest(reqSts2);
       
  1775 	TEST(reqSts2.Int() == KErrNone);
       
  1776  
       
  1777 	if(reqSts2.Int() == KErrNone)
       
  1778 		{
       
  1779 		INFO_PRINTF1(_L("SmartCardAuthenticate completed successfully."));
       
  1780 		}
       
  1781 	else
       
  1782 		{
       
  1783 		INFO_PRINTF1(_L("SmartCardAuthenticate not completed successfully."));
       
  1784 		}
       
  1785 	
       
  1786 	/* 	Client sends the RES to the network in the HTTP Digest AKA response. 
       
  1787 	 * 	The network (i.e. the BSF) authenticates the phone by verifying the 
       
  1788 	 * 	Digest AKA response. The network generates the Ks key, the 
       
  1789 	 *  transaction identifier (B-TID) and the Ks key Lifetime. 
       
  1790 	 *  The network (the BSF) then sends the B-TID value and the key 
       
  1791 	 * lifetime to the phone. 
       
  1792 	 */
       
  1793 	RMobilePhone::TBsfDataV8 tBsfDataV8;
       
  1794 	RMobilePhone::TBsfDataV8Pckg tBsfDataV8Pckg(tBsfDataV8);
       
  1795 
       
  1796 	_LIT8(KBtid,"B4567"); // not the value in the config file to return KErrAccessDenied
       
  1797 	_LIT8(KKeyLifeTime,"D3789");
       
  1798 	tBsfDataV8.iBtid = KBtid;
       
  1799 	tBsfDataV8.iKeyLifetime = KKeyLifeTime;
       
  1800 
       
  1801 	iPhone.SetGbaBootstrapParams(reqSts3,appAID,tBsfDataV8Pckg);
       
  1802 
       
  1803 	User::WaitForRequest(reqSts1);
       
  1804 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  1805 
       
  1806 	INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinRequired"));
       
  1807 
       
  1808 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  1809 	RMobilePhone::TMobilePassword pass;
       
  1810 	_LIT8(Kpswrd, "4567");   // Invalid password
       
  1811 	pass.Copy(Kpswrd);
       
  1812    
       
  1813 	INFO_PRINTF1(_L("Verifying the PIN1"));
       
  1814 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  1815 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  1816 	User::WaitForRequest(reqSts2);
       
  1817 	User::WaitForRequest(reqSts1);
       
  1818 	TEST(reqSts2==KErrAccessDenied); 
       
  1819 	TEST(secEvent==RMobilePhone::EUSIMAppPinRequired);
       
  1820 	
       
  1821 	INFO_PRINTF1(_L("NotifySecurityEvent completed with USIM PIN Verification failed"));
       
  1822 
       
  1823 	User::WaitForRequest(reqSts3);
       
  1824 	TEST(reqSts3.Int() == KErrAccessDenied);	
       
  1825 	if(reqSts3.Int() == KErrAccessDenied)
       
  1826 		{
       
  1827 		INFO_PRINTF1(_L("SetGbaBootstrapParams completed with KErrAccessDenied"));
       
  1828 		}
       
  1829 	iPhone.Close();
       
  1830 	return TestStepResult();
       
  1831 	}
       
  1832 
       
  1833 CSimUsimR6GBATest6::CSimUsimR6GBATest6() 
       
  1834 	{ 
       
  1835 	SetTestStepName(_L("UsimR6GBATest6"));
       
  1836 	}
       
  1837 
       
  1838 TVerdict CSimUsimR6GBATest6::doTestStepL()
       
  1839 /**
       
  1840 TEL-SIMTSY-MM-8606.
       
  1841 Client performs successfully GBA authentication 
       
  1842 in NAF derivation mode after deriving Bootstrap key (Ks).
       
  1843 */
       
  1844 	{
       
  1845 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  1846 	SetTestNumberL(49);
       
  1847 
       
  1848 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  1849 	TESTL(ret == KErrNone); 
       
  1850 	INFO_PRINTF1(_L(""));
       
  1851 
       
  1852 	TRequestStatus reqSts1,reqSts2;
       
  1853 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  1854 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  1855 	
       
  1856 	_LIT8(Kaid,"AE879");
       
  1857 	RMobilePhone::TAID appAID = Kaid();
       
  1858 
       
  1859  	/*Precondition:
       
  1860  	 *  Client performed the GBA authentication in bootstrap mode successsfully 
       
  1861  	 */
       
  1862  	
       
  1863 	// Generation of Ks_ext_NAF using NAF derivation method
       
  1864 	
       
  1865 	_LIT8(KNafid,"C6453");
       
  1866 	_LIT8(KImpi,"E7654");
       
  1867 	
       
  1868 	iPhone.NotifyAuthenticateDataChange(reqSts1,tAuthInfoV8Pckg);
       
  1869 	
       
  1870 	RMobilePhone::TGbaNafAuthDataV8 tGbaNafAuthDataV8;
       
  1871 	RMobilePhone::TGbaNafAuthDataV8Pckg tGbaNafAuthDataV8Pckg(tGbaNafAuthDataV8);
       
  1872 	
       
  1873 	tGbaNafAuthDataV8.iNafId = KNafid;
       
  1874 	tGbaNafAuthDataV8.iImpi = KImpi;
       
  1875 		
       
  1876 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  1877 
       
  1878 	iPhone.SmartCardAuthenticate(reqSts2, appAID,tGbaNafAuthDataV8Pckg);
       
  1879 	User::WaitForRequest(reqSts2);
       
  1880 	TEST(reqSts2.Int() == KErrNone);
       
  1881 
       
  1882 	if(reqSts2.Int() == KErrNone)
       
  1883 		{
       
  1884 		INFO_PRINTF1(_L("SmartCardAuthenticate completed successfully."));
       
  1885 		}
       
  1886 	else
       
  1887 		{
       
  1888 		INFO_PRINTF1(_L("SmartCardAuthenticate not completed successfully."));
       
  1889 		}
       
  1890 	
       
  1891 	tGbaNafAuthDataV8 = tGbaNafAuthDataV8Pckg();
       
  1892 	_LIT8(KksExtNaf,"A6543");
       
  1893 	TEST(tGbaNafAuthDataV8.iKsExtNaf.Compare(KksExtNaf) == 0);
       
  1894  
       
  1895 	User::WaitForRequest(reqSts1);
       
  1896 	TEST(reqSts1.Int() == KErrNone);
       
  1897 	INFO_PRINTF1(_L("RMobilePhone::NotifyAuthenticateDataChange Completed."));
       
  1898 	
       
  1899 	tAuthInfoV8 = tAuthInfoV8Pckg();
       
  1900 	TEST(tAuthInfoV8.iAID == Kaid());
       
  1901 	TEST(tAuthInfoV8.iData == RMobilePhone::EGbaNafIdList );
       
  1902 
       
  1903 	iPhone.Close();	
       
  1904 	return TestStepResult();
       
  1905 	}
       
  1906 
       
  1907 CSimUsimR6GBATest7::CSimUsimR6GBATest7() 
       
  1908 	{ 
       
  1909 	SetTestStepName(_L("UsimR6GBATest7"));
       
  1910 	}
       
  1911 
       
  1912 TVerdict CSimUsimR6GBATest7::doTestStepL()
       
  1913 /**
       
  1914 TEL-SIMTSY-MM-8607.
       
  1915 Client performs successfully GBA authentication in 
       
  1916 NAF derivation mode using the existing Bootstrap key (Ks).
       
  1917 */
       
  1918 	{
       
  1919 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  1920 	SetTestNumberL(38);
       
  1921 
       
  1922 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  1923 	TESTL(ret == KErrNone); 
       
  1924 	INFO_PRINTF1(_L(""));
       
  1925 
       
  1926 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  1927 	
       
  1928 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  1929 	iPhone.NotifySecurityEvent(reqSts1,secEvent);
       
  1930 	
       
  1931 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  1932 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  1933 
       
  1934 	RMobilePhone::TGbaBootstrapParamsV8 tGbaBootstrapParamsV8;
       
  1935 	RMobilePhone::TGbaBootstrapParamsV8Pckg tGbaBootstrapParamsV8Pckg(tGbaBootstrapParamsV8);
       
  1936 	
       
  1937 	_LIT8(Kaid,"AE879");
       
  1938 	
       
  1939 	tAuthInfoV8.iData = RMobilePhone::EGbaBootstrapParams;
       
  1940 	tAuthInfoV8.iAID = Kaid();
       
  1941 	
       
  1942 	iPhone.GetAuthenticationParams(reqSts3,tAuthInfoV8Pckg,tGbaBootstrapParamsV8Pckg);
       
  1943 	
       
  1944 	User::WaitForRequest(reqSts1);
       
  1945 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  1946 	
       
  1947 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  1948 	RMobilePhone::TMobilePassword pass;
       
  1949 	_LIT8(Kpswrd, "1234");
       
  1950 	pass.Copy(Kpswrd);
       
  1951 	   
       
  1952 	INFO_PRINTF1(_L("Verifying the SIM APP PIN..."));
       
  1953 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  1954 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  1955 	User::WaitForRequest(reqSts2);
       
  1956 	User::WaitForRequest(reqSts1);
       
  1957 	TEST(reqSts2==KErrNone); 
       
  1958 //	INFO_PRINTF2(_L("Value of secEvent = %d"),secEvent);
       
  1959 	TEST(secEvent==RMobilePhone::EUSIMAppPinVerified);
       
  1960 	
       
  1961 	INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinVerified"));
       
  1962 	
       
  1963 	User::WaitForRequest(reqSts3);
       
  1964 	TEST(reqSts3.Int() == KErrNone);
       
  1965 	if(reqSts3.Int() == KErrNone)
       
  1966 		{
       
  1967 		INFO_PRINTF1(_L("GetAuthenticationParams completed successfully."));
       
  1968 		}
       
  1969 	else
       
  1970 		{
       
  1971 		INFO_PRINTF1(_L("GetAuthenticationParams not completed successfully."));
       
  1972 		}
       
  1973 	
       
  1974 	tGbaBootstrapParamsV8 = tGbaBootstrapParamsV8Pckg();
       
  1975 	TEST(tGbaBootstrapParamsV8.iRand == _L8("RAND_IN"));
       
  1976 	TEST(tGbaBootstrapParamsV8.iBtid == _L8("B2345"));
       
  1977 	TEST(tGbaBootstrapParamsV8.iKeyLifetime == _L8("D3789"));
       
  1978 		
       
  1979 	RMobilePhone::TGbaNafAuthDataV8 tGbaNafAuthDataV8;
       
  1980 	RMobilePhone::TGbaNafAuthDataV8Pckg tGbaNafAuthDataV8Pckg(tGbaNafAuthDataV8);
       
  1981 	
       
  1982 	_LIT8(KNafId,"C6453");
       
  1983 	_LIT8(KImpi,"E7654");
       
  1984 	
       
  1985 	tGbaNafAuthDataV8.iNafId = KNafId;
       
  1986 	tGbaNafAuthDataV8.iImpi = KImpi;
       
  1987 	
       
  1988 	RMobilePhone::TAID appAID = Kaid();
       
  1989 	
       
  1990 	iPhone.SmartCardAuthenticate(reqSts3,appAID,tGbaNafAuthDataV8Pckg);
       
  1991 	User::WaitForRequest(reqSts3);
       
  1992 	TEST(reqSts3.Int() == KErrNone);
       
  1993 	
       
  1994 	tGbaNafAuthDataV8 = tGbaNafAuthDataV8Pckg();
       
  1995 	_LIT8(KksExtNaf,"A6543");
       
  1996 	TEST(tGbaNafAuthDataV8.iKsExtNaf.Compare(KksExtNaf) == 0);
       
  1997 	
       
  1998 	iPhone.Close();
       
  1999 	return TestStepResult();
       
  2000 	}
       
  2001 
       
  2002 CSimUsimR6GBATest8::CSimUsimR6GBATest8() 
       
  2003 	{ 
       
  2004 	SetTestStepName(_L("UsimR6GBATest8"));
       
  2005 	}
       
  2006 
       
  2007 TVerdict CSimUsimR6GBATest8::doTestStepL()
       
  2008 /**
       
  2009 TEL-SIMTSY-MM-8608.
       
  2010 Client is unable to perform GBA authentication in NAF derivation mode as Ks is not available.
       
  2011 */
       
  2012 	{
       
  2013 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  2014 	SetTestNumberL(41);
       
  2015 
       
  2016 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2017 	TESTL(ret == KErrNone); 
       
  2018 	INFO_PRINTF1(_L(""));
       
  2019 
       
  2020 	TRequestStatus reqSts3;
       
  2021 	
       
  2022 	RMobilePhone::TGbaNafAuthDataV8 tGbaNafAuthDataV8;
       
  2023 	RMobilePhone::TGbaNafAuthDataV8Pckg tGbaNafAuthDataV8Pckg(tGbaNafAuthDataV8);
       
  2024 	
       
  2025 	_LIT8(KNafId,"C6453");
       
  2026 	_LIT8(KImpi,"E7654");
       
  2027 	_LIT8(Kaid,"AE879");
       
  2028 	
       
  2029 	tGbaNafAuthDataV8.iNafId = KNafId;
       
  2030 	tGbaNafAuthDataV8.iImpi = KImpi;
       
  2031 	
       
  2032 	RMobilePhone::TAID appAID = Kaid();
       
  2033 	
       
  2034 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  2035 	
       
  2036 	iPhone.SmartCardAuthenticate(reqSts3,appAID,tGbaNafAuthDataV8Pckg);
       
  2037 	User::WaitForRequest(reqSts3);
       
  2038 	TEST(reqSts3.Int() == KErrMMEtelAuthKeyNotFound);
       
  2039 	
       
  2040 	if(reqSts3.Int() == KErrMMEtelAuthKeyNotFound)
       
  2041 		{
       
  2042 		INFO_PRINTF1(_L("SmartCardAuthenticate completed with Ks Not Found."));
       
  2043 		}
       
  2044 	iPhone.Close();
       
  2045 	return TestStepResult();
       
  2046 	}
       
  2047 
       
  2048 CSimUsimR6GBATest9::CSimUsimR6GBATest9() 
       
  2049 	{	 
       
  2050 	SetTestStepName(_L("UsimR6GBATest9"));
       
  2051 	}
       
  2052 
       
  2053 TVerdict CSimUsimR6GBATest9::doTestStepL()
       
  2054 /**
       
  2055 TEL-SIMTSY-MM-8609.
       
  2056 Client is unable to perform GBA authentication in 
       
  2057 NAF derivation mode as USIM application is not active
       
  2058 */
       
  2059 	{
       
  2060 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  2061 	SetTestNumberL(39);
       
  2062 
       
  2063 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2064 	TESTL(ret == KErrNone); 
       
  2065 	INFO_PRINTF1(_L(""));
       
  2066 
       
  2067 	TRequestStatus reqSts;
       
  2068 	
       
  2069 	RMobilePhone::TGbaNafAuthDataV8 tGbaNafAuthDataV8;
       
  2070 	RMobilePhone::TGbaNafAuthDataV8Pckg tGbaNafAuthDataV8Pckg(tGbaNafAuthDataV8);
       
  2071 	
       
  2072 	_LIT8(KNafId,"C6453");
       
  2073 	_LIT8(KImpi,"E7654");
       
  2074 	_LIT8(Kaid,"AE879");
       
  2075 	
       
  2076 	tGbaNafAuthDataV8.iNafId = KNafId;
       
  2077 	tGbaNafAuthDataV8.iImpi = KImpi;
       
  2078 	
       
  2079 	RMobilePhone::TAID appAID = Kaid();
       
  2080 	
       
  2081 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  2082 	
       
  2083 	iPhone.SmartCardAuthenticate(reqSts,appAID,tGbaNafAuthDataV8Pckg);
       
  2084 	User::WaitForRequest(reqSts);
       
  2085 	TEST(reqSts.Int() == KErrMMEtelScApplicationNotActive);
       
  2086 		
       
  2087 	if(reqSts.Int() == KErrMMEtelScApplicationNotActive)
       
  2088 		{
       
  2089 		INFO_PRINTF1(_L("Test - RMobilePhone::SmartCardAuthenticate Completed with Application Not Active."));
       
  2090 		}
       
  2091 	iPhone.Close();
       
  2092 	return TestStepResult();
       
  2093 	}
       
  2094 
       
  2095 CSimUsimR6GBATest10::CSimUsimR6GBATest10() 
       
  2096 	{ 
       
  2097 	SetTestStepName(_L("UsimR6GBATest10"));
       
  2098 	}
       
  2099 
       
  2100 TVerdict CSimUsimR6GBATest10::doTestStepL()
       
  2101 /**
       
  2102 TEL-SIMTSY-MM-8610.
       
  2103 Client is unable to perform GBA authentication in 
       
  2104 NAF derivation mode as USIM application is busy with another client’s request for GBA.
       
  2105 */
       
  2106 	{
       
  2107 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  2108 	SetTestNumberL(40);
       
  2109 
       
  2110 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2111 	TESTL(ret == KErrNone); 
       
  2112 	INFO_PRINTF1(_L(""));
       
  2113 
       
  2114 	TRequestStatus reqSts;
       
  2115 	
       
  2116 	RMobilePhone::TGbaNafAuthDataV8 tGbaNafAuthDataV8;
       
  2117 	RMobilePhone::TGbaNafAuthDataV8Pckg tGbaNafAuthDataV8Pckg(tGbaNafAuthDataV8);
       
  2118 	
       
  2119 	_LIT8(KNafId,"C6453");
       
  2120 	_LIT8(KImpi,"E7654");
       
  2121 	_LIT8(Kaid,"AE879");
       
  2122 	
       
  2123 	tGbaNafAuthDataV8.iNafId = KNafId;
       
  2124 	tGbaNafAuthDataV8.iImpi = KImpi;
       
  2125 	
       
  2126 	RMobilePhone::TAID appAID = Kaid();
       
  2127 	
       
  2128 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  2129 	
       
  2130 	iPhone.SmartCardAuthenticate(reqSts,appAID,tGbaNafAuthDataV8Pckg);
       
  2131 	User::WaitForRequest(reqSts);
       
  2132 	TEST(reqSts.Int() == KErrInUse);
       
  2133 	
       
  2134 	INFO_PRINTF1(_L("SmartCardAuthenticate Completed with KErrInUse."));
       
  2135 	iPhone.Close();
       
  2136 	return TestStepResult();
       
  2137 	}
       
  2138 
       
  2139 CSimUsimR6GBATest11::CSimUsimR6GBATest11() 
       
  2140 	{ 
       
  2141 	SetTestStepName(_L("UsimR6GBATest11"));
       
  2142 	}
       
  2143 
       
  2144 TVerdict CSimUsimR6GBATest11::doTestStepL()
       
  2145 /**
       
  2146 TEL-SIMTSY-MM-8611.
       
  2147 Client, at its discretion, retrieves GBA Bootstrapping parameters from UICC successfully.
       
  2148 */
       
  2149 	{
       
  2150 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  2151 	SetTestNumberL(38);
       
  2152 
       
  2153 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2154 	TESTL(ret == KErrNone); 
       
  2155 
       
  2156 	INFO_PRINTF1(_L("Two Client Scenario..."));
       
  2157 	
       
  2158 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  2159 	
       
  2160 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  2161 	iPhone.NotifySecurityEvent(reqSts1,secEvent);	
       
  2162 	
       
  2163 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  2164 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  2165 	_LIT8(Kaid,"AE879");
       
  2166 	
       
  2167 	RMobilePhone::TGbaBootstrapParamsV8 tGbaBootstrapParamsV8;
       
  2168 	RMobilePhone::TGbaBootstrapParamsV8Pckg tGbaBootstrapParamsV8Pckg(tGbaBootstrapParamsV8);
       
  2169 	
       
  2170 	tAuthInfoV8.iData = RMobilePhone::EGbaBootstrapParams;
       
  2171 	tAuthInfoV8.iAID = Kaid();
       
  2172 	
       
  2173 	iPhone.GetAuthenticationParams(reqSts3,tAuthInfoV8Pckg,tGbaBootstrapParamsV8Pckg);
       
  2174 	
       
  2175 	User::WaitForRequest(reqSts1);
       
  2176 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  2177 	
       
  2178 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  2179 	RMobilePhone::TMobilePassword pass;
       
  2180 	_LIT8(Kpswrd, "1234");
       
  2181 	pass.Copy(Kpswrd);
       
  2182 	   
       
  2183 	INFO_PRINTF1(_L("Verifying the SIM APP PIN..."));
       
  2184 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  2185 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  2186 	User::WaitForRequest(reqSts2);
       
  2187 	User::WaitForRequest(reqSts1);
       
  2188 	TEST(reqSts2==KErrNone); 
       
  2189 //	INFO_PRINTF2(_L("Value of secEvent = %d"),secEvent);
       
  2190 	TEST(secEvent==RMobilePhone::EUSIMAppPinVerified);
       
  2191 	
       
  2192 	INFO_PRINTF1(_L("NotifySecurityEvent completed Successfully with EUSIMAppPinVerified."));
       
  2193 	
       
  2194 	User::WaitForRequest(reqSts3);
       
  2195 	TEST(reqSts3.Int() == KErrNone);
       
  2196 	if(reqSts3.Int() == KErrNone)
       
  2197 		{
       
  2198 		INFO_PRINTF1(_L("GetAuthenticationParams completed Successfully."));		
       
  2199 		}
       
  2200 	
       
  2201 	tGbaBootstrapParamsV8 = tGbaBootstrapParamsV8Pckg();
       
  2202 	
       
  2203 	_LIT8(KRand,"RAND_IN");
       
  2204 	_LIT8(KBtid,"B2345");
       
  2205 	_LIT8(KKeyLifeTime,"D3789");
       
  2206 	
       
  2207 	TEST(tGbaBootstrapParamsV8.iRand.Compare(KRand)==0);
       
  2208 	TEST(tGbaBootstrapParamsV8.iBtid.Compare(KBtid)==0);
       
  2209 	TEST(tGbaBootstrapParamsV8.iKeyLifetime.Compare(KKeyLifeTime)==0);
       
  2210 	
       
  2211 	iPhone.Close();	
       
  2212 	return TestStepResult();
       
  2213 	}
       
  2214 
       
  2215 CSimUsimR6GBATest12::CSimUsimR6GBATest12() 
       
  2216 	{ 
       
  2217 	SetTestStepName(_L("UsimR6GBATest12"));
       
  2218 	}
       
  2219 
       
  2220 TVerdict CSimUsimR6GBATest12::doTestStepL()
       
  2221 /**
       
  2222 TEL-SIMTSY-MM-8612.
       
  2223 Clients retrieve GBA Bootstrapping parameters successfully upon notification from UICC.
       
  2224 */
       
  2225 	{
       
  2226 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  2227 	SetTestNumberL(38);
       
  2228 
       
  2229 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2230 	TESTL(ret == KErrNone); 
       
  2231 
       
  2232 	INFO_PRINTF1(_L("Two Client Scenario..."));
       
  2233 	
       
  2234 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  2235 	
       
  2236 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  2237 	iPhone.NotifySecurityEvent(reqSts1,secEvent);	
       
  2238 	
       
  2239 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  2240 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  2241 	_LIT8(Kaid,"AE879");
       
  2242 	
       
  2243 	iPhone.NotifyAuthenticateDataChange(reqSts2,tAuthInfoV8Pckg);
       
  2244 	
       
  2245 	/* Create another thread and perform the authentication functionality. */
       
  2246 	RThread thread;
       
  2247 	INFO_PRINTF1(_L("A different client performing GBA authentication"));
       
  2248 	TInt KStackSize=0x8000;
       
  2249 	TInt KHeapSize=0x8000;
       
  2250 	TInt KMaxHeapSize=0x80000;
       
  2251 
       
  2252 	TInt res=thread.Create(_L("DifferentClient"), OtherCltGBA,KStackSize,KHeapSize,KMaxHeapSize,NULL, EOwnerThread);
       
  2253 	
       
  2254 	TEST(res == KErrNone);
       
  2255 	
       
  2256 	thread.Logon(reqSts3);	
       
  2257 	TEST(reqSts3.Int()==KRequestPending);
       
  2258 	
       
  2259 	thread.Resume();
       
  2260 
       
  2261 	User::WaitForRequest(reqSts3);
       
  2262 	TEST(reqSts3.Int()==KErrNone);
       
  2263 	
       
  2264 	/* Client has updated the EFGBA with the new authentication parameters */
       
  2265 	
       
  2266 	User::WaitForRequest(reqSts2);  // NotifyAuthenticateData completes as the 
       
  2267 									// authentication is performed by another client
       
  2268 	TEST(reqSts2.Int()==KErrNone);
       
  2269 	if(reqSts2.Int() == KErrNone)
       
  2270 		{
       
  2271 		INFO_PRINTF1(_L("NotifyAuthenticateDataChange completed Successfully in Client 1."));
       
  2272 		}
       
  2273 	else
       
  2274 		{
       
  2275 		INFO_PRINTF1(_L("NotifyAuthenticateDataChange Not completed Successfully in Client 1."));
       
  2276 		}
       
  2277 	
       
  2278 	tAuthInfoV8 = tAuthInfoV8Pckg();
       
  2279 
       
  2280 	TEST(tAuthInfoV8.iAID == Kaid());
       
  2281 	TEST(tAuthInfoV8.iData == RMobilePhone::EGbaBootstrapParams);
       
  2282 	
       
  2283 	if (thread.ExitType() != EExitKill && thread.ExitReason() != 0)
       
  2284 		{
       
  2285 		User::Leave(thread.ExitReason());
       
  2286 		}
       
  2287 	thread.Close();
       
  2288 	
       
  2289 	RMobilePhone::TGbaBootstrapParamsV8 tGbaBootstrapParamsV8;
       
  2290 	RMobilePhone::TGbaBootstrapParamsV8Pckg tGbaBootstrapParamsV8Pckg(tGbaBootstrapParamsV8);
       
  2291 	
       
  2292 	tAuthInfoV8.iData = RMobilePhone::EGbaBootstrapParams;
       
  2293 	tAuthInfoV8.iAID = Kaid();
       
  2294 	
       
  2295 	iPhone.GetAuthenticationParams(reqSts3,tAuthInfoV8Pckg,tGbaBootstrapParamsV8Pckg);
       
  2296 	
       
  2297 	User::WaitForRequest(reqSts1);
       
  2298 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  2299 	
       
  2300 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  2301 	RMobilePhone::TMobilePassword pass;
       
  2302 	_LIT8(Kpswrd, "1234");
       
  2303 	pass.Copy(Kpswrd);
       
  2304 	   
       
  2305 	INFO_PRINTF1(_L("Verifying the SIM APP PIN..."));
       
  2306 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  2307 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  2308 	User::WaitForRequest(reqSts2);
       
  2309 	User::WaitForRequest(reqSts1);
       
  2310 	TEST(reqSts2==KErrNone); 
       
  2311 //	INFO_PRINTF2(_L("Value of secEvent = %d"),secEvent);
       
  2312 	TEST(secEvent==RMobilePhone::EUSIMAppPinVerified);
       
  2313 	
       
  2314 	INFO_PRINTF1(_L("GetAuthenticationParams completed Successfully in Client 1."));
       
  2315 	
       
  2316 	User::WaitForRequest(reqSts3);
       
  2317 	TEST(reqSts3.Int() == KErrNone);
       
  2318 	if(reqSts3.Int() == KErrNone)
       
  2319 		{
       
  2320 		INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinVerified"));		
       
  2321 		}
       
  2322 	
       
  2323 	tGbaBootstrapParamsV8 = tGbaBootstrapParamsV8Pckg();
       
  2324 	
       
  2325 	_LIT8(KRand,"RAND_IN");
       
  2326 	_LIT8(KBtid,"B2345");
       
  2327 	_LIT8(KKeyLifeTime,"D3789");
       
  2328 	
       
  2329 	TEST(tGbaBootstrapParamsV8.iRand.Compare(KRand)==0);
       
  2330 	TEST(tGbaBootstrapParamsV8.iBtid.Compare(KBtid)==0);
       
  2331 	TEST(tGbaBootstrapParamsV8.iKeyLifetime.Compare(KKeyLifeTime)==0);
       
  2332 	
       
  2333 	iPhone.Close();	
       
  2334 	return TestStepResult();
       
  2335 	}
       
  2336 
       
  2337 CSimUsimR6GBATestThread* CSimUsimR6GBATestThread::instance=NULL;
       
  2338 
       
  2339 CSimUsimR6GBATestThread* CSimUsimR6GBATestThread::getInstanceL()
       
  2340 	{
       
  2341 	if(instance == NULL)
       
  2342 		{
       
  2343 		instance = new(ELeave) CSimUsimR6GBATestThread();
       
  2344 		}
       
  2345 	return instance;
       
  2346 	}
       
  2347 
       
  2348 CSimUsimR6GBATestThread::CSimUsimR6GBATestThread()
       
  2349 	{
       
  2350 	// Do Nothing Constructor
       
  2351 	}
       
  2352 
       
  2353 CSimUsimR6GBATestThread::CSimUsimR6GBATestThread(const CSimUsimR6GBATestThread&)
       
  2354 	{
       
  2355 	// Do Nothing copy Constructor
       
  2356 	}
       
  2357 
       
  2358 CSimUsimR6GBATestThread& CSimUsimR6GBATestThread::operator=(const CSimUsimR6GBATestThread&)
       
  2359 	{
       
  2360 	// Do Nothing Operator overloaded function
       
  2361 	CSimUsimR6GBATestThread* test = CSimUsimR6GBATestThread::getInstanceL();
       
  2362 	return (*test);
       
  2363 	}
       
  2364 
       
  2365 TVerdict CSimUsimR6GBATestThread::doTestStepL()
       
  2366 /**
       
  2367 TEL-SIMTSY-MM-
       
  2368 */
       
  2369 	{
       
  2370 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  2371 	SetTestNumberL(38);
       
  2372 
       
  2373 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2374 	TESTL(ret == KErrNone); 
       
  2375 	
       
  2376 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  2377 
       
  2378 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  2379 	iPhone.NotifySecurityEvent(reqSts1,secEvent);
       
  2380 	
       
  2381 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  2382 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  2383 	
       
  2384 	iPhone.NotifyAuthenticateDataChange(reqSts2,tAuthInfoV8Pckg);
       
  2385 	
       
  2386 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  2387 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  2388 		
       
  2389 	_LIT8(Krand,"ABCD"); 
       
  2390 	_LIT8(Kautn,"ADFC"); 
       
  2391 	_LIT8(Kaid,"AE879");
       
  2392 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  2393 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  2394 	
       
  2395 	RMobilePhone::TAID appAID = Kaid();
       
  2396 	
       
  2397 	iPhone.SmartCardAuthenticate(reqSts3, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  2398 	User::WaitForRequest(reqSts3);
       
  2399 	TEST(reqSts3.Int() == KErrNone);
       
  2400 	 	
       
  2401 	User::WaitForRequest(reqSts2); // NotifyAuthenticateData completes successfully.
       
  2402 	TEST(reqSts2.Int() == KErrNone);
       
  2403 	if(reqSts2.Int() == KErrNone)
       
  2404 		{
       
  2405 		INFO_PRINTF1(_L("NotifyAuthenticateDataChange completed Successfully in Client 1."));
       
  2406 		}
       
  2407 	else
       
  2408 		{
       
  2409 		INFO_PRINTF1(_L("NotifyAuthenticateDataChange Not completed Successfully in Client 1."));
       
  2410 		}
       
  2411 	
       
  2412 	tAuthInfoV8 = tAuthInfoV8Pckg();
       
  2413 	
       
  2414 	TEST(tAuthInfoV8.iAID == Kaid());
       
  2415 	TEST(tAuthInfoV8.iData == RMobilePhone::EGbaBootstrapParams );
       
  2416 	
       
  2417 	RMobilePhone::TBsfDataV8 tBsfDataV8;
       
  2418 	RMobilePhone::TBsfDataV8Pckg tBsfDataV8Pckg(tBsfDataV8);
       
  2419 
       
  2420 	_LIT8(KBtid,"B2345");
       
  2421 	_LIT8(KKeyLifeTime,"D3789");
       
  2422 	tBsfDataV8.iBtid = KBtid;
       
  2423 	tBsfDataV8.iKeyLifetime = KKeyLifeTime;
       
  2424 	
       
  2425 	iPhone.SetGbaBootstrapParams(reqSts3,appAID,tBsfDataV8Pckg);
       
  2426 
       
  2427 	User::WaitForRequest(reqSts1);
       
  2428 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  2429 	
       
  2430 	INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinRequired"));
       
  2431 	
       
  2432 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  2433 	RMobilePhone::TMobilePassword pass;
       
  2434 	_LIT8(Kpswrd, "1234");
       
  2435 	pass.Copy(Kpswrd);
       
  2436 	   
       
  2437 	INFO_PRINTF1(_L("Verifying the PIN1"));
       
  2438 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  2439 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  2440 	User::WaitForRequest(reqSts2);
       
  2441 	User::WaitForRequest(reqSts1);
       
  2442 	TEST(reqSts2==KErrNone); 
       
  2443 //	INFO_PRINTF2(_L("Value of secEvent = %d"),secEvent);
       
  2444 	TEST(secEvent==RMobilePhone::EUSIMAppPinVerified);
       
  2445 	
       
  2446 	INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinVerified"));
       
  2447 	
       
  2448 	User::WaitForRequest(reqSts3);
       
  2449 	TEST(reqSts3.Int() == KErrNone);
       
  2450 	
       
  2451 	iPhone.Close();	
       
  2452 	return TestStepResult();
       
  2453 	}
       
  2454 
       
  2455 TInt OtherCltGBA(void* /*aThreadData*/)
       
  2456 	{
       
  2457 	TInt ret =KErrNone;
       
  2458 	TRAP(ret,CSimUsimR6GBATestThread* myInstance = CSimUsimR6GBATestThread::getInstanceL());
       
  2459 	return ret;
       
  2460 	}
       
  2461 
       
  2462 CSimUsimR6GBATest13::CSimUsimR6GBATest13() 
       
  2463 	{ 
       
  2464 	SetTestStepName(_L("UsimR6GBATest13"));
       
  2465 	}
       
  2466 
       
  2467 TVerdict CSimUsimR6GBATest13::doTestStepL()
       
  2468 /**
       
  2469 TEL-SIMTSY-MM-8613.
       
  2470 Client is unable to retrieve GBA Bootstrapping parameters as the USIM application is not active.
       
  2471 */
       
  2472 	{
       
  2473 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  2474 	SetTestNumberL(39);
       
  2475 
       
  2476 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2477 	TESTL(ret == KErrNone); 
       
  2478 	INFO_PRINTF1(_L(""));
       
  2479 	
       
  2480 	TRequestStatus reqSts;
       
  2481 	
       
  2482 	RMobilePhone::TGbaBootstrapParamsV8 tGbaBootstrapParamsV8;
       
  2483 	RMobilePhone::TGbaBootstrapParamsV8Pckg tGbaBootstrapParamsV8Pckg(tGbaBootstrapParamsV8);
       
  2484 	
       
  2485 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  2486 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  2487 	
       
  2488 	_LIT8(Kaid,"AE879");
       
  2489 	
       
  2490 	tAuthInfoV8.iData = RMobilePhone::EGbaBootstrapParams;
       
  2491 	tAuthInfoV8.iAID = Kaid();
       
  2492 	
       
  2493 	iPhone.GetAuthenticationParams(reqSts,tAuthInfoV8Pckg,tGbaBootstrapParamsV8Pckg);
       
  2494 	
       
  2495 	User::WaitForRequest(reqSts);
       
  2496 	TEST(reqSts.Int() == KErrMMEtelScApplicationNotActive);
       
  2497 	
       
  2498 	if(reqSts.Int() == KErrMMEtelScApplicationNotActive)
       
  2499 		{
       
  2500 		INFO_PRINTF1(_L("GetAuthenticationParams completed with Application Not Active"));		
       
  2501 		}
       
  2502 	iPhone.Close();
       
  2503 	return TestStepResult();	
       
  2504 	}
       
  2505 
       
  2506 CSimUsimR6GBATest14::CSimUsimR6GBATest14() 
       
  2507 	{ 
       
  2508 	SetTestStepName(_L("UsimR6GBATest14"));
       
  2509 	}
       
  2510 
       
  2511 TVerdict CSimUsimR6GBATest14::doTestStepL()
       
  2512 /**
       
  2513 TEL-SIMTSY-MM-8614.
       
  2514 Client is unable to retrieve GBA Bootstrapping parameters due to PIN verification failure.
       
  2515 */
       
  2516 	{
       
  2517 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2518 	SetTestNumberL(42);
       
  2519 
       
  2520 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2521 	TESTL(ret == KErrNone); 
       
  2522 	INFO_PRINTF1(_L(""));
       
  2523 
       
  2524 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  2525 	
       
  2526 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  2527 	iPhone.NotifySecurityEvent(reqSts1,secEvent);	
       
  2528 	
       
  2529 	RMobilePhone::TGbaBootstrapParamsV8 tGbaBootstrapParamsV8;
       
  2530 	RMobilePhone::TGbaBootstrapParamsV8Pckg tGbaBootstrapParamsV8Pckg(tGbaBootstrapParamsV8);
       
  2531 	
       
  2532 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  2533 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  2534 	
       
  2535 	_LIT8(Kaid,"AE879");
       
  2536 	
       
  2537 	tAuthInfoV8.iData = RMobilePhone::EGbaBootstrapParams;
       
  2538 	tAuthInfoV8.iAID = Kaid();
       
  2539 	
       
  2540 	iPhone.GetAuthenticationParams(reqSts3,tAuthInfoV8Pckg,tGbaBootstrapParamsV8Pckg);
       
  2541 	
       
  2542 	User::WaitForRequest(reqSts1);
       
  2543 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  2544 	
       
  2545 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  2546 	RMobilePhone::TMobilePassword pass;
       
  2547 	_LIT8(Kpswrd, "3334"); // Invalid pin for the USIM Appln.
       
  2548 	pass.Copy(Kpswrd);
       
  2549 	   
       
  2550 	INFO_PRINTF1(_L("Verifying the SIM APP PIN..."));
       
  2551 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  2552 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  2553 	User::WaitForRequest(reqSts2);
       
  2554 	User::WaitForRequest(reqSts1);
       
  2555 	TEST(reqSts2.Int() == KErrAccessDenied);  
       
  2556 	TEST(secEvent==RMobilePhone::EUSIMAppPinRequired);
       
  2557 	
       
  2558 	INFO_PRINTF1(_L("NotifySecurityEvent completed with USIM PIN Verification failed"));
       
  2559 
       
  2560 	User::WaitForRequest(reqSts3);
       
  2561 	TEST(reqSts3.Int() == KErrAccessDenied);	
       
  2562 	if(reqSts3.Int() == KErrAccessDenied)
       
  2563 		{
       
  2564 		INFO_PRINTF1(_L("GetAuthenticationParams completed with KErrAccessDenied"));
       
  2565 		}	
       
  2566 	iPhone.Close();
       
  2567 	return TestStepResult();	
       
  2568 	}
       
  2569 
       
  2570 CSimUsimR6GBATest15::CSimUsimR6GBATest15() 
       
  2571 	{ 
       
  2572 	SetTestStepName(_L("UsimR6GBATest15"));
       
  2573 	}
       
  2574 
       
  2575 TVerdict CSimUsimR6GBATest15::doTestStepL()
       
  2576 /**
       
  2577 TEL-SIMTSY-MM-8615.
       
  2578 Client retrieves NAF_ID list from UICC successfully.
       
  2579 */
       
  2580 	{
       
  2581 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2582 	SetTestNumberL(38);
       
  2583 
       
  2584 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2585 	TESTL(ret == KErrNone); 
       
  2586 	INFO_PRINTF1(_L(""));
       
  2587 
       
  2588 	CTestRetrieveMobilePhoneAuthenticationIds *pRetrieve = CTestRetrieveMobilePhoneAuthenticationIds::NewLC(iPhone,
       
  2589 				CTestRetrieveMobilePhoneAuthenticationIds::EGba);
       
  2590 	
       
  2591 	pRetrieve->SetAuthType(CTestRetrieveMobilePhoneAuthenticationIds::EGba);
       
  2592 	pRetrieve->TestRetrieve(RMobilePhone::EGbaNafIdList);
       
  2593 
       
  2594 	//Delete test object
       
  2595 	CleanupStack::PopAndDestroy(); //pRetrieve	
       
  2596 	iPhone.Close();
       
  2597 	return TestStepResult();
       
  2598 	}
       
  2599 
       
  2600 CSimUsimR6GBATest16::CSimUsimR6GBATest16() 
       
  2601 	{ 
       
  2602 	SetTestStepName(_L("UsimR6GBATest16"));
       
  2603 	}	
       
  2604 
       
  2605 TVerdict CSimUsimR6GBATest16::doTestStepL()
       
  2606 /**
       
  2607 TEL-SIMTSY-MM-8616.
       
  2608 Client is unable to perform GBA authentication due to MAC verification failure.
       
  2609 */
       
  2610 	{
       
  2611 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2612 	SetTestNumberL(44);
       
  2613 
       
  2614 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2615 	TESTL(ret == KErrNone); 
       
  2616 	INFO_PRINTF1(_L(""));
       
  2617 
       
  2618 	TRequestStatus reqSts;
       
  2619 	
       
  2620 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  2621 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  2622 		
       
  2623 	_LIT8(Krand,"RAND_IN"); 
       
  2624 	_LIT8(Kautn,"AUTN_IN"); 
       
  2625 	_LIT8(Kaid,"AE879");
       
  2626 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  2627 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  2628 	
       
  2629 	RMobilePhone::TAID appAID = Kaid();
       
  2630 	
       
  2631 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  2632 	
       
  2633 	iPhone.SmartCardAuthenticate(reqSts, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  2634 	User::WaitForRequest(reqSts);
       
  2635 	TEST(reqSts.Int() == KErrMMEtelAuthMacInvalid);
       
  2636 	
       
  2637 	if(reqSts.Int() == KErrMMEtelAuthMacInvalid)
       
  2638 		{
       
  2639 		INFO_PRINTF1(_L("SmartCardAuthenticate API completed with KErrMMEtelAuthMacInvalid"));
       
  2640 		}
       
  2641 	else
       
  2642 		{
       
  2643 		INFO_PRINTF1(_L("SmartCardAuthenticate API not completed with KErrMMEtelAuthMacInvalid"));		
       
  2644 		}
       
  2645 	iPhone.Close();
       
  2646 	return TestStepResult();
       
  2647 	}
       
  2648 
       
  2649 CSimUsimR6GBATest17::CSimUsimR6GBATest17() 
       
  2650 	{ 
       
  2651 	SetTestStepName(_L("UsimR6GBATest17"));
       
  2652 	}
       
  2653 
       
  2654 TVerdict CSimUsimR6GBATest17::doTestStepL()
       
  2655 /**
       
  2656 TEL-SIMTSY-MM-8617.
       
  2657 Client is unable to perform GBA authentication due to invalid sequence.
       
  2658 */
       
  2659 	{
       
  2660 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2661 	SetTestNumberL(45);
       
  2662 
       
  2663 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2664 	TESTL(ret == KErrNone); 
       
  2665 	INFO_PRINTF1(_L(""));
       
  2666 
       
  2667 	TRequestStatus reqSts;
       
  2668 	
       
  2669 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  2670 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  2671 		
       
  2672 	_LIT8(Krand,"RAND_IN"); 
       
  2673 	_LIT8(Kautn,"AUTN_IN"); 
       
  2674 	_LIT8(Kaid,"AE879");
       
  2675 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  2676 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  2677 	
       
  2678 	RMobilePhone::TAID appAID = Kaid();
       
  2679 	
       
  2680 	INFO_PRINTF1(_L("Testing SmartCardAuthenticate async with AID..."));
       
  2681 	
       
  2682 	iPhone.SmartCardAuthenticate(reqSts, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  2683 	User::WaitForRequest(reqSts);
       
  2684 	TEST(reqSts.Int() == KErrMMEtelAuthVerificationFailure);
       
  2685 	
       
  2686 	if(reqSts.Int() == KErrMMEtelAuthVerificationFailure)
       
  2687 		{
       
  2688 		INFO_PRINTF1(_L("SmartCardAuthenticate API completed with KErrMMEtelAuthVerificationFailure"));
       
  2689 		}
       
  2690 	else
       
  2691 		{
       
  2692 		INFO_PRINTF1(_L("SmartCardAuthenticate API not completed with KErrMMEtelAuthVerificationFailure"));		
       
  2693 		}
       
  2694 	iPhone.Close();
       
  2695 	return TestStepResult();
       
  2696 	}
       
  2697 
       
  2698 CSimUsimR6GBATest18::CSimUsimR6GBATest18() 
       
  2699 	{ 
       
  2700 	SetTestStepName(_L("UsimR6GBATest18"));
       
  2701 	}
       
  2702 
       
  2703 TVerdict CSimUsimR6GBATest18::doTestStepL()
       
  2704 /**
       
  2705 TEL-SIMTSY-MM-8618.
       
  2706 Cancel GBA authentication requests. (All APIs)
       
  2707 */
       
  2708 	{
       
  2709 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2710 	SetTestNumberL(38);
       
  2711 
       
  2712 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2713 	TESTL(ret == KErrNone); 
       
  2714 	INFO_PRINTF1(_L(""));
       
  2715 
       
  2716 	TRequestStatus reqSts;
       
  2717 	
       
  2718 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  2719 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  2720 	
       
  2721 	iPhone.NotifyAuthenticateDataChange(reqSts,tAuthInfoV8Pckg);
       
  2722 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyAuthenticateDataChange);
       
  2723 	User::WaitForRequest(reqSts);
       
  2724 	TEST((reqSts.Int() == KErrNone) || (reqSts.Int() == KErrCancel));
       
  2725 	
       
  2726 	INFO_PRINTF1(_L("Cancellation of NotifyAuthenticateDataChange API Completed"));
       
  2727 	
       
  2728 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  2729 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  2730 		
       
  2731 	_LIT8(Krand,"RAND_IN"); 
       
  2732 	_LIT8(Kautn,"AUTN_IN"); 
       
  2733 	_LIT8(Kaid,"AE879");
       
  2734 	
       
  2735 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  2736 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  2737 	
       
  2738 	RMobilePhone::TAID appAID = Kaid();
       
  2739 	
       
  2740 	iPhone.SmartCardAuthenticate(reqSts, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  2741 	iPhone.CancelAsyncRequest(EMobilePhoneSmartCardAuthenticate);
       
  2742 	User::WaitForRequest(reqSts);
       
  2743 		
       
  2744 	TEST((reqSts.Int() == KErrNone) || (reqSts.Int() == KErrCancel));
       
  2745 	INFO_PRINTF1(_L("Cancellation of SmartCardAuthenticate API Completed"));
       
  2746 
       
  2747 	RMobilePhone::TGbaBootstrapParamsV8 tGbaBootstrapParamsV8;
       
  2748 	RMobilePhone::TGbaBootstrapParamsV8Pckg tGbaBootstrapParamsV8Pckg(tGbaBootstrapParamsV8);
       
  2749 		
       
  2750 	tAuthInfoV8.iData = RMobilePhone::EGbaBootstrapParams;
       
  2751 	tAuthInfoV8.iAID = Kaid();
       
  2752 	
       
  2753 	iPhone.GetAuthenticationParams(reqSts,tAuthInfoV8Pckg,tGbaBootstrapParamsV8Pckg);
       
  2754 	iPhone.CancelAsyncRequest(EMobilePhoneGetAuthenticationParams);
       
  2755 	User::WaitForRequest(reqSts);
       
  2756 	
       
  2757 	TEST((reqSts.Int() == KErrNone) || (reqSts.Int() == KErrCancel));
       
  2758 	INFO_PRINTF1(_L("Cancellation of GetAuthenticationParams API Completed"));
       
  2759 	
       
  2760 	RMobilePhone::TBsfDataV8 tBsfDataV8;
       
  2761 	RMobilePhone::TBsfDataV8Pckg tBsfDataV8Pckg(tBsfDataV8);
       
  2762 
       
  2763 	_LIT8(KBtid,"B2345");
       
  2764 	_LIT8(KKeyLifeTime,"D3789");
       
  2765 	tBsfDataV8.iBtid = KBtid;
       
  2766 	tBsfDataV8.iKeyLifetime = KKeyLifeTime;
       
  2767 	
       
  2768 	iPhone.SetGbaBootstrapParams(reqSts,appAID,tBsfDataV8Pckg);
       
  2769 	iPhone.CancelAsyncRequest(EMobilePhoneSetGbaBootstrapParams);
       
  2770 	User::WaitForRequest(reqSts);
       
  2771 	
       
  2772 	TEST((reqSts.Int() == KErrNone) || (reqSts.Int() == KErrCancel));
       
  2773 	INFO_PRINTF1(_L("Cancellation of SetGbaBootstrapParams API Completed"));
       
  2774 	
       
  2775 	/* Cancellation of the two phase retrieval */
       
  2776 	CTestRetrieveMobilePhoneAuthenticationIds *pRetrieve = CTestRetrieveMobilePhoneAuthenticationIds::NewLC(iPhone,
       
  2777 			CTestRetrieveMobilePhoneAuthenticationIds::EGba);
       
  2778 
       
  2779 	pRetrieve->SetAuthType(CTestRetrieveMobilePhoneAuthenticationIds::EGba);
       
  2780 	pRetrieve->TestCancel(RMobilePhone::EGbaNafIdList);
       
  2781 
       
  2782 	//Delete test object
       
  2783 	CleanupStack::PopAndDestroy(); //pRetrieve	
       
  2784 	iPhone.Close();
       
  2785 	return TestStepResult();
       
  2786 	}
       
  2787 
       
  2788 CSimUsimR6GBATest19::CSimUsimR6GBATest19() 
       
  2789 	{ 
       
  2790 	SetTestStepName(_L("UsimR6GBATest19"));
       
  2791 	}
       
  2792 
       
  2793 TVerdict CSimUsimR6GBATest19::doTestStepL()
       
  2794 /**
       
  2795 TEL-SIMTSY-MM-8619.
       
  2796 Test SmartCardAuthenticate API with different capability
       
  2797 */
       
  2798 	{
       
  2799 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2800 	SetTestNumberL(38);
       
  2801 
       
  2802 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2803 	TESTL(ret == KErrNone); 
       
  2804 	INFO_PRINTF1(_L("Testing the SmartCardAuthenticate API with different capability"));
       
  2805 	
       
  2806 	/* Expected Capability = ReadDeviceData */
       
  2807 	/* Calling Client's capability = LocalServices */
       
  2808 	TRequestStatus reqSts;
       
  2809 
       
  2810 	RMobilePhone::TGbaBootstrapAuthDataV8 tGbaBootstrapAuthDataV8;
       
  2811 	RMobilePhone::TGbaBootstrapAuthDataV8Pckg tGbaBootstrapAuthDataV8Pckgd(tGbaBootstrapAuthDataV8);
       
  2812 		
       
  2813 	_LIT8(Krand,"RAND_IN"); 
       
  2814 	_LIT8(Kautn,"AUTN_IN"); 
       
  2815 	_LIT8(Kaid,"AE879");
       
  2816 	tGbaBootstrapAuthDataV8.iRAND = Krand;
       
  2817 	tGbaBootstrapAuthDataV8.iAUTN = Kautn;
       
  2818 	
       
  2819 	RMobilePhone::TAID appAID = Kaid();
       
  2820 	
       
  2821 	iPhone.SmartCardAuthenticate(reqSts, appAID, tGbaBootstrapAuthDataV8Pckgd);
       
  2822 	User::WaitForRequest(reqSts);
       
  2823 	TEST(reqSts.Int() == KErrPermissionDenied);
       
  2824 	
       
  2825 	INFO_PRINTF1(_L("Testing of SmartCardAuthenticate API with different capability Completed"));	
       
  2826 	iPhone.Close();
       
  2827 	return TestStepResult();
       
  2828 	}
       
  2829 
       
  2830 CSimUsimR6GBATest20::CSimUsimR6GBATest20() 
       
  2831 	{ 
       
  2832 	SetTestStepName(_L("UsimR6GBATest20"));
       
  2833 	}
       
  2834 
       
  2835 TVerdict CSimUsimR6GBATest20::doTestStepL()
       
  2836 /**
       
  2837 TEL-SIMTSY-MM-8620.
       
  2838 Test SetGbaBootstrapParams API with different capability
       
  2839 */
       
  2840 	{
       
  2841 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2842 	SetTestNumberL(38);
       
  2843 
       
  2844 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2845 	TESTL(ret == KErrNone); 
       
  2846 	INFO_PRINTF1(_L("Testing the SetGbaBootstrapParams API with different capability"));
       
  2847 
       
  2848 	TRequestStatus reqSts;
       
  2849 	/* Expected Capability = WriteDeviceData */
       
  2850 	/* Calling Client's capability = LocalServices */
       
  2851 	
       
  2852 	_LIT8(Kaid,"AE879");
       
  2853 	RMobilePhone::TAID appAID = Kaid();
       
  2854 	
       
  2855 	RMobilePhone::TBsfDataV8 tBsfDataV8;
       
  2856 	RMobilePhone::TBsfDataV8Pckg tBsfDataV8Pckg(tBsfDataV8);
       
  2857 
       
  2858 	_LIT8(KBtid,"B2345");
       
  2859 	_LIT8(KKeyLifeTime,"D3789");
       
  2860 	tBsfDataV8.iBtid = KBtid;
       
  2861 	tBsfDataV8.iKeyLifetime = KKeyLifeTime;
       
  2862 	
       
  2863 	iPhone.SetGbaBootstrapParams(reqSts,appAID,tBsfDataV8Pckg);
       
  2864 	User::WaitForRequest(reqSts);
       
  2865 	
       
  2866 	TEST(reqSts.Int() == KErrPermissionDenied);
       
  2867 	INFO_PRINTF1(_L("Testing of SetGbaBootstrapParams API with different capability Completed"));	
       
  2868 	iPhone.Close();
       
  2869 	return TestStepResult();
       
  2870 	}
       
  2871 
       
  2872 CSimUsimR6GBATest21::CSimUsimR6GBATest21() 
       
  2873 	{ 
       
  2874 	SetTestStepName(_L("UsimR6GBATest21"));
       
  2875 	}
       
  2876 
       
  2877 TVerdict CSimUsimR6GBATest21::doTestStepL()
       
  2878 /**
       
  2879 TEL-SIMTSY-MM-8621.
       
  2880 Test NotifyAuthenticateDataChange API with different capability
       
  2881 */
       
  2882 	{
       
  2883 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2884 	SetTestNumberL(38);
       
  2885 
       
  2886 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2887 	TESTL(ret == KErrNone); 
       
  2888 	INFO_PRINTF1(_L("Testing the NotifyAuthenticateDataChange API with different capability"));
       
  2889 
       
  2890 	TRequestStatus reqSts;
       
  2891 	/* Expected Capability = ReadDeviceData */
       
  2892 	/* Calling Client's capability = LocalServices */
       
  2893 	
       
  2894 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  2895 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  2896 	
       
  2897 	iPhone.NotifyAuthenticateDataChange(reqSts,tAuthInfoV8Pckg);
       
  2898 	User::WaitForRequest(reqSts);
       
  2899 	TEST(reqSts.Int() == KErrPermissionDenied);
       
  2900 	
       
  2901 	INFO_PRINTF1(_L("Testing of NotifyAuthenticateDataChange API with different capability Completed"));	
       
  2902 	iPhone.Close();
       
  2903 	return TestStepResult();	
       
  2904 	}
       
  2905 
       
  2906 CSimUsimR6GBATest22::CSimUsimR6GBATest22() 
       
  2907 	{ 
       
  2908 	SetTestStepName(_L("UsimR6GBATest22"));
       
  2909 	}
       
  2910 
       
  2911 TVerdict CSimUsimR6GBATest22::doTestStepL()
       
  2912 /**
       
  2913 TEL-SIMTSY-MM-8622.
       
  2914 Test GetAuthenticationParams API with different capability
       
  2915 */
       
  2916 	{
       
  2917 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2918 	SetTestNumberL(4);
       
  2919 
       
  2920 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2921 	TESTL(ret == KErrNone); 
       
  2922 	INFO_PRINTF1(_L("Testing the GetAuthenticationParams API with different capability"));
       
  2923 
       
  2924 	TRequestStatus reqSts;
       
  2925 	/* Expected Capability = ReadDeviceData */
       
  2926 	/* Calling Client's capability = LocalServices */
       
  2927 	
       
  2928 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  2929 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  2930 
       
  2931 	RMobilePhone::TGbaBootstrapParamsV8 tGbaBootstrapParamsV8;
       
  2932 	RMobilePhone::TGbaBootstrapParamsV8Pckg tGbaBootstrapParamsV8Pckg(tGbaBootstrapParamsV8);
       
  2933 	
       
  2934 	_LIT8(Kaid,"AE879");
       
  2935 	
       
  2936 	tAuthInfoV8.iData = RMobilePhone::EGbaBootstrapParams;
       
  2937 	tAuthInfoV8.iAID = Kaid();
       
  2938 	
       
  2939 	iPhone.GetAuthenticationParams(reqSts,tAuthInfoV8Pckg,tGbaBootstrapParamsV8Pckg);
       
  2940 	User::WaitForRequest(reqSts);
       
  2941 	TEST(reqSts.Int() == KErrPermissionDenied);	
       
  2942 	
       
  2943 	INFO_PRINTF1(_L("Testing of GetAuthenticationParams API with different capability Completed"));	
       
  2944 	iPhone.Close();
       
  2945 	return TestStepResult();
       
  2946 	}
       
  2947 
       
  2948 CSimUsimR6GBATest23::CSimUsimR6GBATest23() 
       
  2949 	{ 
       
  2950 	SetTestStepName(_L("UsimR6GBATest23"));
       
  2951 	}
       
  2952 
       
  2953 TVerdict CSimUsimR6GBATest23::doTestStepL()
       
  2954 /**
       
  2955 TEL-SIMTSY-MM-8623.
       
  2956 Test CRetrieveMobilePhoneAuthenticationIds::Start API with different capability
       
  2957 */
       
  2958 	{	
       
  2959 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2960 	SetTestNumberL(38);
       
  2961 
       
  2962 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2963 	TESTL(ret == KErrNone); 
       
  2964 	INFO_PRINTF1(_L(""));
       
  2965 
       
  2966 	CTestRetrieveMobilePhoneAuthenticationIds *pRetrieve = CTestRetrieveMobilePhoneAuthenticationIds::NewLC(iPhone,
       
  2967 				CTestRetrieveMobilePhoneAuthenticationIds::EGba);
       
  2968 	
       
  2969 	pRetrieve->SetAuthType(CTestRetrieveMobilePhoneAuthenticationIds::EGba);
       
  2970 	pRetrieve->TestRetrieve(RMobilePhone::EGbaNafIdList);
       
  2971 
       
  2972 	//Delete test object
       
  2973 	CleanupStack::PopAndDestroy(); //pRetrieve	
       
  2974 	iPhone.Close();	
       
  2975 	return TestStepResult();
       
  2976 	}
       
  2977 
       
  2978 /****************************************************************************\
       
  2979  * 																			*
       
  2980  * 			Multicast Broadcast Messaging Service Testcases 				*	
       
  2981  * 																			*	
       
  2982  ****************************************************************************/
       
  2983 
       
  2984 CSimUsimR6MBMSTest1::CSimUsimR6MBMSTest1() 
       
  2985 	{ 
       
  2986 	SetTestStepName(_L("UsimR6MBMSTest1"));
       
  2987 	}
       
  2988 
       
  2989 TVerdict CSimUsimR6MBMSTest1::doTestStepL()
       
  2990 /**
       
  2991 TEL-SIMTSY-MM-8624.
       
  2992 Client performs MBMS authentication in MSK update mode successfully.
       
  2993 */
       
  2994 	{
       
  2995 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  2996 	SetTestNumberL(38);
       
  2997 
       
  2998 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  2999 	TESTL(ret == KErrNone); 
       
  3000 	INFO_PRINTF1(_L("Testing of MBMS Functionality "));
       
  3001 	
       
  3002 	/*Precondition:
       
  3003  	 *  Client performed successfully GBA authentication in 
       
  3004 	 * 	NAF derivation mode after deriving Bootstrap key (Ks).
       
  3005 	 */
       
  3006 	
       
  3007 	TRequestStatus reqStatus= KErrNone;
       
  3008 	
       
  3009 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3010 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3011 	_LIT8(Kaid,"AE879");
       
  3012 
       
  3013 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3014 	
       
  3015 	RMobilePhone::TAID appAID = Kaid();
       
  3016 	
       
  3017 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3018 
       
  3019 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3020 	User::WaitForRequest(reqStatus);
       
  3021 	TEST(reqStatus.Int() == KErrNone);
       
  3022 
       
  3023 	INFO_PRINTF1(_L("SmartCardAuthenticate API test completed "));
       
  3024 	
       
  3025 	TEST(tMbmsMskUpdateDataV8.iOutputMikey == _L8("OUT_MIKEY_V_BIT"));	
       
  3026 	iPhone.Close();
       
  3027 	return TestStepResult();
       
  3028 	}
       
  3029 
       
  3030 
       
  3031 CSimUsimR6MBMSTest2::CSimUsimR6MBMSTest2() 
       
  3032 	{ 
       
  3033 	SetTestStepName(_L("UsimR6MBMSTest2"));
       
  3034 	}
       
  3035 
       
  3036 TVerdict CSimUsimR6MBMSTest2::doTestStepL()
       
  3037 /**
       
  3038 TEL-SIMTSY-MM-8625.
       
  3039 Client is unable to perform MBMS authentication in MSK update mode 
       
  3040 due to lack of MBMS service support in UICC.
       
  3041 */
       
  3042 	{
       
  3043 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3044 	SetTestNumberL(40);
       
  3045 
       
  3046 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3047 	TESTL(ret == KErrNone); 
       
  3048 	INFO_PRINTF1(_L(""));
       
  3049 	
       
  3050 	/* Precondition:
       
  3051 	 * Client performed successfully GBA authentication in 
       
  3052 	 * NAF derivation mode after deriving Bootstrap key (Ks).
       
  3053 	 */
       
  3054 	TRequestStatus reqStatus= KErrNone;
       
  3055 	
       
  3056 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3057 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3058 	_LIT8(Kaid,"AE879");
       
  3059 	
       
  3060 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3061 	
       
  3062 	RMobilePhone::TAID appAID = Kaid();
       
  3063 	
       
  3064 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3065 
       
  3066 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3067 	User::WaitForRequest(reqStatus);
       
  3068 	TEST(reqStatus.Int() == KErrNotSupported);
       
  3069 
       
  3070 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrNotSupported."));
       
  3071 	iPhone.Close();	
       
  3072 	return TestStepResult();
       
  3073 	}
       
  3074 
       
  3075 CSimUsimR6MBMSTest3::CSimUsimR6MBMSTest3() 
       
  3076 	{ 
       
  3077 	SetTestStepName(_L("UsimR6MBMSTest3"));
       
  3078 	}
       
  3079 
       
  3080 TVerdict CSimUsimR6MBMSTest3::doTestStepL()
       
  3081 /**
       
  3082 TEL-SIMTSY-MM-8626.
       
  3083 Client is unable to perform MBMS authentication in 
       
  3084 MSK update mode because USIM application is not active.
       
  3085 */
       
  3086 	{
       
  3087 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3088 	SetTestNumberL(39);
       
  3089 
       
  3090 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3091 	TESTL(ret == KErrNone); 
       
  3092 	
       
  3093 	/* Precondition:
       
  3094 	 * 	Client performed successfully GBA authentication in 
       
  3095 	 * 	NAF derivation mode after deriving Bootstrap key (Ks).
       
  3096 	 */
       
  3097 	TRequestStatus reqStatus= KErrNone;
       
  3098 	
       
  3099 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3100 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3101 	_LIT8(Kaid,"AE879");
       
  3102 	
       
  3103 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3104 	
       
  3105 	RMobilePhone::TAID appAID = Kaid();
       
  3106 	
       
  3107 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3108 
       
  3109 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3110 	User::WaitForRequest(reqStatus);
       
  3111 	TEST(reqStatus.Int() == KErrMMEtelScApplicationNotActive);
       
  3112 
       
  3113 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelScApplicationNotActive."));	
       
  3114 	iPhone.Close();	
       
  3115 	return TestStepResult();
       
  3116 	}
       
  3117 
       
  3118 CSimUsimR6MBMSTest4::CSimUsimR6MBMSTest4() 
       
  3119 	{ 
       
  3120 	SetTestStepName(_L("UsimR6MBMSTest4"));
       
  3121 	}
       
  3122 
       
  3123 TVerdict CSimUsimR6MBMSTest4::doTestStepL()
       
  3124 /**
       
  3125 TEL-SIMTSY-MM-8627.
       
  3126 Client is unable to perform MBMS authentication in 
       
  3127 MSK update mode because Ks_int_NAF is overwritten.
       
  3128 */
       
  3129 	{
       
  3130 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3131 	SetTestNumberL(41);
       
  3132 
       
  3133 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3134 	TESTL(ret == KErrNone); 
       
  3135 	INFO_PRINTF1(_L(""));
       
  3136 	
       
  3137 	/* Precondition:
       
  3138 	 * 	Client performed successfully GBA authentication in 
       
  3139 	 * 	NAF derivation mode after deriving Bootstrap key (Ks).
       
  3140 	 * 	After the successful authentication, the KsIntNaf has been overwritten.
       
  3141 	 */
       
  3142 	TRequestStatus reqStatus= KErrNone;
       
  3143 	
       
  3144 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3145 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3146 	_LIT8(Kaid,"AE879");
       
  3147 	
       
  3148 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3149 	
       
  3150 	RMobilePhone::TAID appAID = Kaid();
       
  3151 	
       
  3152 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3153 
       
  3154 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3155 	User::WaitForRequest(reqStatus);
       
  3156 	TEST(reqStatus.Int() == KErrMMEtelAuthKeyNotFound);
       
  3157 
       
  3158 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelAuthKeyNotFound."));	
       
  3159 	iPhone.Close();	
       
  3160 	return TestStepResult();
       
  3161 	}
       
  3162 
       
  3163 CSimUsimR6MBMSTest5::CSimUsimR6MBMSTest5() 
       
  3164 	{ 
       
  3165 	SetTestStepName(_L("UsimR6MBMSTest5"));
       
  3166 	}
       
  3167 
       
  3168 TVerdict CSimUsimR6MBMSTest5::doTestStepL()
       
  3169 /**
       
  3170 TEL-SIMTSY-MM-8628.
       
  3171 Client is unable to perform MBMS authentication in MSK update mode due to out of memory.
       
  3172 */
       
  3173 	{
       
  3174 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3175 	SetTestNumberL(42);
       
  3176 
       
  3177 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3178 	TESTL(ret == KErrNone); 
       
  3179 	INFO_PRINTF1(_L(""));
       
  3180 	
       
  3181 	/* Precondition:
       
  3182 	 * 	Client performed successfully GBA authentication in 
       
  3183 	 * NAF derivation mode after deriving Bootstrap key (Ks).
       
  3184 	 */
       
  3185 	TRequestStatus reqStatus= KErrNone;
       
  3186 	
       
  3187 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3188 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3189 	_LIT8(Kaid,"AE879");
       
  3190 	
       
  3191 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3192 	
       
  3193 	RMobilePhone::TAID appAID = Kaid();
       
  3194 	
       
  3195 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3196 
       
  3197 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3198 	User::WaitForRequest(reqStatus);
       
  3199 	TEST(reqStatus.Int() == KErrNoMemory);
       
  3200 
       
  3201 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrNoMemory."));	
       
  3202 	iPhone.Close();
       
  3203 	return TestStepResult();
       
  3204 	}
       
  3205 
       
  3206 
       
  3207 CSimUsimR6MBMSTest6::CSimUsimR6MBMSTest6() 
       
  3208 	{ 
       
  3209 	SetTestStepName(_L("UsimR6MBMSTest6"));
       
  3210 	}
       
  3211 
       
  3212 TVerdict CSimUsimR6MBMSTest6::doTestStepL()
       
  3213 /**
       
  3214 TEL-SIMTSY-MM-8629.
       
  3215 Client successfully creates space to store new MSK IDs and 
       
  3216 MUK IDs before initiating a MSK request procedure.
       
  3217 */
       
  3218 	{
       
  3219 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3220 	SetTestNumberL(42);
       
  3221 
       
  3222 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3223 	TESTL(ret == KErrNone); 
       
  3224 	INFO_PRINTF1(_L(""));
       
  3225 	
       
  3226 	/* Precondition:
       
  3227 	 *	Client performed successfully GBA authentication in 
       
  3228 	 * NAF derivation mode after deriving Bootstrap key (Ks).
       
  3229 	 */
       
  3230 	TRequestStatus reqStatus= KErrNone;
       
  3231 	
       
  3232 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3233 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3234 	_LIT8(Kaid,"AE879");
       
  3235 
       
  3236 	RMobilePhone::TAID appAID = Kaid();
       
  3237 	
       
  3238 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3239 
       
  3240 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3241 	User::WaitForRequest(reqStatus);
       
  3242 	TEST(reqStatus.Int() == KErrNoMemory);
       
  3243 	if(reqStatus.Int() == KErrNoMemory)
       
  3244 		{
       
  3245 		INFO_PRINTF1(_L("RMobilePhone::SmartCardAuthenticate MSK Updation failed because of NoMemory."));
       
  3246 		}
       
  3247 
       
  3248 	/*
       
  3249 	 * Client decides to delete the MSKs that are no longer needed to free up storage for new MSKs.   
       
  3250 	 */
       
  3251 	
       
  3252 	RMobilePhone::TMbmsMskDeleteDataV8 tMbmsMskDeleteDataV8;
       
  3253 	RMobilePhone::TMbmsMskDeleteDataV8Pckg tMbmsMskDeleteDataV8Pckgd(tMbmsMskDeleteDataV8);
       
  3254 	
       
  3255 	tMbmsMskDeleteDataV8.iKeyDomainId = _L8("KDN");
       
  3256 	tMbmsMskDeleteDataV8.iMskIdKeyGroup = _L8("GR");
       
  3257 
       
  3258 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMskDeleteDataV8Pckgd);
       
  3259 	User::WaitForRequest(reqStatus);
       
  3260 	TEST(reqStatus.Int() == KErrNone);
       
  3261 	if(reqStatus.Int() == KErrNone)
       
  3262 		{
       
  3263 		INFO_PRINTF1(_L("RMobilePhone::SmartCardAuthenticate MSK Deletion successful."));
       
  3264 		}
       
  3265 	
       
  3266 	RMobilePhone::TMbmsMukDeleteDataV8 tMbmsMukDeleteDataV8;
       
  3267 	RMobilePhone::TMbmsMukDeleteDataV8Pckg tMbmsMukDeleteDataV8Pckgd(tMbmsMukDeleteDataV8);
       
  3268 	
       
  3269 	tMbmsMukDeleteDataV8.iMukIdTlv = _L8("MUK_ID_TLV");
       
  3270 	
       
  3271 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3272 	
       
  3273 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMukDeleteDataV8Pckgd);
       
  3274 	User::WaitForRequest(reqStatus);
       
  3275 	TEST(reqStatus.Int() == KErrNone);
       
  3276 	if(reqStatus.Int() == KErrNone)
       
  3277 		{
       
  3278 		INFO_PRINTF1(_L("RMobilePhone::SmartCardAuthenticate MUK Deletion successful."));
       
  3279 		}
       
  3280 	
       
  3281 	INFO_PRINTF1(_L("SmartCardAuthenticate API completed."));
       
  3282 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3283 	
       
  3284 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3285 
       
  3286 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3287 	User::WaitForRequest(reqStatus);
       
  3288 	TEST(reqStatus.Int() == KErrNone);
       
  3289 	if(reqStatus.Int() == KErrNone)
       
  3290 		{
       
  3291 		INFO_PRINTF1(_L("RMobilePhone::SmartCardAuthenticate MUK Updation successful."));
       
  3292 		}
       
  3293 	iPhone.Close();
       
  3294 	return TestStepResult();
       
  3295 	}
       
  3296 
       
  3297 CSimUsimR6MBMSTest7::CSimUsimR6MBMSTest7() 
       
  3298 	{ 
       
  3299 	SetTestStepName(_L("UsimR6MBMSTest7"));
       
  3300 	}
       
  3301 
       
  3302 TVerdict CSimUsimR6MBMSTest7::doTestStepL()
       
  3303 /**
       
  3304 TEL-SIMTSY-MM-8630.
       
  3305 Client runs GBA authentication in NAF derivation mode before re-running MSK update mode
       
  3306 */
       
  3307 	{	
       
  3308 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3309 	SetTestNumberL(41);
       
  3310 
       
  3311 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3312 	TESTL(ret == KErrNone); 
       
  3313 	INFO_PRINTF1(_L(""));
       
  3314 
       
  3315 	/* Precondition:
       
  3316 	 *	Client performed successfully GBA authentication in 
       
  3317 	 * NAF derivation mode after deriving Bootstrap key (Ks).
       
  3318 	 */
       
  3319 	
       
  3320 	TRequestStatus reqStatus= KErrNone;
       
  3321 	
       
  3322 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3323 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3324 	_LIT8(Kaid,"AE879");
       
  3325 	
       
  3326 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3327 	
       
  3328 	RMobilePhone::TAID appAID = Kaid();
       
  3329 	
       
  3330 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3331 
       
  3332 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3333 	User::WaitForRequest(reqStatus);
       
  3334 	TEST(reqStatus.Int() == KErrMMEtelAuthKeyNotFound);
       
  3335 
       
  3336 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelAuthKeyNotFound."));
       
  3337 	
       
  3338 	/* Precondition:
       
  3339 	 *	Client performed successfully GBA authentication in 
       
  3340 	 * NAF derivation mode after deriving Bootstrap key (Ks).
       
  3341 	 */
       
  3342 	
       
  3343 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3344 
       
  3345 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3346 	User::WaitForRequest(reqStatus);
       
  3347 	TEST(reqStatus.Int() == KErrNone);
       
  3348 
       
  3349 	INFO_PRINTF1(_L("SmartCardAuthenticate API completed."));
       
  3350 	
       
  3351 	tMbmsMskUpdateDataV8 = tTMbmsMskUpdateDataV8Pckg();
       
  3352 	TEST(tMbmsMskUpdateDataV8.iOutputMikey == _L8("OUT_MIKEY_V_BIT"));
       
  3353 	
       
  3354 	iPhone.Close();
       
  3355 	return TestStepResult();
       
  3356 	}
       
  3357 
       
  3358 CSimUsimR6MBMSTest8::CSimUsimR6MBMSTest8() 
       
  3359 	{ 
       
  3360 	SetTestStepName(_L("UsimR6MBMSTest8"));
       
  3361 	}
       
  3362 
       
  3363 TVerdict CSimUsimR6MBMSTest8::doTestStepL()
       
  3364 /**
       
  3365 TEL-SIMTSY-MM-8631.
       
  3366 Client is unable to perform MBMS authentication in 
       
  3367 MSK update mode because of MAC verification failure. 
       
  3368 */
       
  3369 	{
       
  3370 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3371 	SetTestNumberL(44);
       
  3372 
       
  3373 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3374 	TESTL(ret == KErrNone); 
       
  3375 	INFO_PRINTF1(_L(""));
       
  3376 	/* Precondition:
       
  3377 	 * 	Client performed successfully GBA authentication in 
       
  3378 	 * NAF derivation mode after deriving Bootstrap key (Ks).
       
  3379 	 */
       
  3380 	TRequestStatus reqStatus= KErrNone;
       
  3381 	
       
  3382 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3383 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3384 	_LIT8(Kaid,"AE879");
       
  3385 	
       
  3386 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3387 	
       
  3388 	RMobilePhone::TAID appAID = Kaid();
       
  3389 	
       
  3390 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3391 
       
  3392 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3393 	User::WaitForRequest(reqStatus);
       
  3394 	TEST(reqStatus.Int() == KErrMMEtelAuthMacInvalid);
       
  3395 
       
  3396 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelAuthMacInvalid."));
       
  3397 	iPhone.Close();
       
  3398 	return TestStepResult();
       
  3399 	}
       
  3400 
       
  3401 CSimUsimR6MBMSTest9::CSimUsimR6MBMSTest9() 
       
  3402 	{ 
       
  3403 	SetTestStepName(_L("UsimR6MBMSTest9"));
       
  3404 	}
       
  3405 
       
  3406 TVerdict CSimUsimR6MBMSTest9::doTestStepL()
       
  3407 /**
       
  3408 TEL-SIMTSY-MM-8632.
       
  3409 Client is unable to perform MBMS authentication in 
       
  3410 MSK update mode because of incorrect MUK. 
       
  3411 */
       
  3412 	{	
       
  3413 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3414 	SetTestNumberL(41);
       
  3415 
       
  3416 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3417 	TESTL(ret == KErrNone); 
       
  3418 	INFO_PRINTF1(_L(""));
       
  3419 	
       
  3420 	/* Precondition:
       
  3421 	 *	Client performed successfully GBA authentication in 
       
  3422 	 * NAF derivation mode after deriving Bootstrap key (Ks).
       
  3423 	 * After the succesful authentication, the KsIntNaf has been overwritten.
       
  3424 	 */
       
  3425 	TRequestStatus reqStatus= KErrNone;
       
  3426 	
       
  3427 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3428 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3429 	_LIT8(Kaid,"AE879");
       
  3430 	
       
  3431 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3432 	
       
  3433 	RMobilePhone::TAID appAID = Kaid();
       
  3434 	
       
  3435 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3436 
       
  3437 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3438 	User::WaitForRequest(reqStatus);
       
  3439 	TEST(reqStatus.Int() == KErrMMEtelAuthKeyNotFound);
       
  3440 
       
  3441 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelAuthKeyNotFound."));
       
  3442 	iPhone.Close();
       
  3443 	return TestStepResult();
       
  3444 	}
       
  3445 
       
  3446 CSimUsimR6MBMSTest10::CSimUsimR6MBMSTest10() 
       
  3447 	{ 
       
  3448 	SetTestStepName(_L("UsimR6MBMSTest10"));
       
  3449 	}
       
  3450 
       
  3451 TVerdict CSimUsimR6MBMSTest10::doTestStepL()
       
  3452 /**
       
  3453 TEL-SIMTSY-MM-8633.
       
  3454 Client is unable to perform MBMS authentication in 
       
  3455 MSK update mode because of key freshness failure.
       
  3456 */
       
  3457 	{	
       
  3458 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3459 	SetTestNumberL(45);
       
  3460 
       
  3461 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3462 	TESTL(ret == KErrNone); 
       
  3463 	INFO_PRINTF1(_L(""));
       
  3464 	
       
  3465 	/* Precondition:
       
  3466 	 * Client performed successfully GBA authentication in 
       
  3467 	 * NAF derivation mode after deriving Bootstrap key (Ks).
       
  3468 	 * After the succesful authentication, the KsIntNaf has been overwritten.
       
  3469 	 */
       
  3470 	TRequestStatus reqStatus= KErrNone;
       
  3471 	
       
  3472 	RMobilePhone::TMbmsMskUpdateDataV8 tMbmsMskUpdateDataV8;
       
  3473 	RMobilePhone::TMbmsMskUpdateDataV8Pckg tTMbmsMskUpdateDataV8Pckg(tMbmsMskUpdateDataV8);
       
  3474 	_LIT8(Kaid,"AE879");
       
  3475 	
       
  3476 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3477 	
       
  3478 	RMobilePhone::TAID appAID = Kaid();
       
  3479 	
       
  3480 	tMbmsMskUpdateDataV8.iInputMikey = _L8("IN_MIKEY_V_BIT");
       
  3481 
       
  3482 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tTMbmsMskUpdateDataV8Pckg);
       
  3483 	User::WaitForRequest(reqStatus);
       
  3484 	TEST(reqStatus.Int() == KErrMMEtelAuthVerificationFailure);
       
  3485 
       
  3486 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelAuthVerificationFailure."));
       
  3487 	iPhone.Close();
       
  3488 	return TestStepResult();
       
  3489 	}
       
  3490 
       
  3491 CSimUsimR6MBMSTest11::CSimUsimR6MBMSTest11() 
       
  3492 	{ 
       
  3493 	SetTestStepName(_L("UsimR6MBMSTest11"));
       
  3494 	}
       
  3495 
       
  3496 TVerdict CSimUsimR6MBMSTest11::doTestStepL()
       
  3497 /**
       
  3498 TEL-SIMTSY-MM-8634.
       
  3499 Client performs MBMS authentication in MTK generation mode successfully.
       
  3500 */
       
  3501 	{
       
  3502 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3503 	SetTestNumberL(38);
       
  3504 
       
  3505 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3506 	TESTL(ret == KErrNone); 
       
  3507 	INFO_PRINTF1(_L(""));
       
  3508 	
       
  3509 	/* Client performs MBMS authentication in MTK generation mode successfully.*/
       
  3510 	
       
  3511 	TRequestStatus reqStatus = KErrNone;
       
  3512 	_LIT8(Kaid,"AE879");
       
  3513 	
       
  3514 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3515 	
       
  3516 	RMobilePhone::TAID appAID = Kaid();
       
  3517 	
       
  3518 	RMobilePhone::TMbmsMtkGenerateDataV8 tMbmsMtkGenerateDataV8;
       
  3519 	RMobilePhone::TMbmsMtkGenerateDataV8Pckg tMbmsMtkGenerateDataV8Pckgd(tMbmsMtkGenerateDataV8);
       
  3520 
       
  3521 	tMbmsMtkGenerateDataV8.iMikey = _L8("IN_MIKEY_V_BIT");
       
  3522 	
       
  3523 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMtkGenerateDataV8Pckgd);
       
  3524 	User::WaitForRequest(reqStatus);
       
  3525 	TEST(reqStatus.Int() == KErrNone);
       
  3526 
       
  3527 	TEST(tMbmsMtkGenerateDataV8.iMtk == _L8("MBMS_TR_KEY"));
       
  3528 	TEST(tMbmsMtkGenerateDataV8.iSaltKey == _L8("SALT_KEY"));
       
  3529 
       
  3530 	INFO_PRINTF1(_L("SmartCardAuthenticate API completed."));
       
  3531 	iPhone.Close();
       
  3532 	return TestStepResult();
       
  3533 	}
       
  3534 
       
  3535 
       
  3536 CSimUsimR6MBMSTest12::CSimUsimR6MBMSTest12() 
       
  3537 	{ 
       
  3538 	SetTestStepName(_L("UsimR6MBMSTest12"));
       
  3539 	}
       
  3540 
       
  3541 TVerdict CSimUsimR6MBMSTest12::doTestStepL()
       
  3542 /**
       
  3543 TEL-SIMTSY-MM-8635.
       
  3544 Client is unable to perform MBMS authentication in MTK generation mode because 
       
  3545 this feature is not enabled in USIM service table.
       
  3546 */
       
  3547 	{
       
  3548 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3549 	SetTestNumberL(40);
       
  3550 
       
  3551 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3552 	TESTL(ret == KErrNone); 
       
  3553 	INFO_PRINTF1(_L(""));
       
  3554 	
       
  3555 	TRequestStatus reqStatus = KErrNone;
       
  3556 	_LIT8(Kaid,"AE879");
       
  3557 	
       
  3558 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3559 	
       
  3560 	RMobilePhone::TAID appAID = Kaid();
       
  3561 	
       
  3562 	RMobilePhone::TMbmsMtkGenerateDataV8 tMbmsMtkGenerateDataV8;
       
  3563 	RMobilePhone::TMbmsMtkGenerateDataV8Pckg tMbmsMtkGenerateDataV8Pckgd(tMbmsMtkGenerateDataV8);
       
  3564 
       
  3565 	tMbmsMtkGenerateDataV8.iMikey = _L8("IN_MIKEY_V_BIT");
       
  3566 	
       
  3567 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMtkGenerateDataV8Pckgd);
       
  3568 	User::WaitForRequest(reqStatus);
       
  3569 	TEST(reqStatus.Int() == KErrNotSupported);
       
  3570 	
       
  3571 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrNotSupported."));
       
  3572 	iPhone.Close();
       
  3573 	return TestStepResult();
       
  3574 	}
       
  3575 
       
  3576 
       
  3577 CSimUsimR6MBMSTest13::CSimUsimR6MBMSTest13() 
       
  3578 	{ 
       
  3579 	SetTestStepName(_L("UsimR6MBMSTest13"));
       
  3580 	}
       
  3581 
       
  3582 TVerdict CSimUsimR6MBMSTest13::doTestStepL()
       
  3583 /**
       
  3584 TEL-SIMTSY-MM-8636.
       
  3585 Client is unable to perform MBMS authentication in 
       
  3586 MSK update mode because USIM application is not active.
       
  3587 */
       
  3588 	{
       
  3589 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3590 	SetTestNumberL(39);
       
  3591 
       
  3592 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3593 	TESTL(ret == KErrNone); 
       
  3594 	INFO_PRINTF1(_L(""));
       
  3595 	
       
  3596 	TRequestStatus reqStatus = KErrNone;
       
  3597 	_LIT8(Kaid,"AE879");
       
  3598 	
       
  3599 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3600 	
       
  3601 	RMobilePhone::TAID appAID = Kaid();
       
  3602 	
       
  3603 	RMobilePhone::TMbmsMtkGenerateDataV8 tMbmsMtkGenerateDataV8;
       
  3604 	RMobilePhone::TMbmsMtkGenerateDataV8Pckg tMbmsMtkGenerateDataV8Pckgd(tMbmsMtkGenerateDataV8);
       
  3605 
       
  3606 	tMbmsMtkGenerateDataV8.iMikey = _L8("IN_MIKEY_V_BIT");
       
  3607 	
       
  3608 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMtkGenerateDataV8Pckgd);
       
  3609 	User::WaitForRequest(reqStatus);
       
  3610 	TEST(reqStatus.Int() == KErrMMEtelScApplicationNotActive);
       
  3611 	
       
  3612 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelScApplicationNotActive."));
       
  3613 	iPhone.Close();
       
  3614 	return TestStepResult();
       
  3615 	}
       
  3616 
       
  3617 CSimUsimR6MBMSTest14::CSimUsimR6MBMSTest14() 
       
  3618 	{ 
       
  3619 	SetTestStepName(_L("UsimR6MBMSTest14"));
       
  3620 	}
       
  3621 
       
  3622 TVerdict CSimUsimR6MBMSTest14::doTestStepL()
       
  3623 /**
       
  3624 TEL-SIMTSY-MM-8637.
       
  3625 Client is unable to perform MBMS authentication in 
       
  3626 MTK generation mode due to unavailability of MSK.
       
  3627 */
       
  3628 	{
       
  3629 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3630 	SetTestNumberL(41);
       
  3631 
       
  3632 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3633 	TESTL(ret == KErrNone); 
       
  3634 	INFO_PRINTF1(_L(""));
       
  3635 	
       
  3636 	TRequestStatus reqStatus = KErrNone;
       
  3637 	_LIT8(Kaid,"AE879");
       
  3638 	
       
  3639 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3640 	
       
  3641 	RMobilePhone::TAID appAID = Kaid();
       
  3642 	
       
  3643 	RMobilePhone::TMbmsMtkGenerateDataV8 tMbmsMtkGenerateDataV8;
       
  3644 	RMobilePhone::TMbmsMtkGenerateDataV8Pckg tMbmsMtkGenerateDataV8Pckgd(tMbmsMtkGenerateDataV8);
       
  3645 
       
  3646 	tMbmsMtkGenerateDataV8.iMikey = _L8("IN_MIKEY_V_BIT");
       
  3647 	
       
  3648 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMtkGenerateDataV8Pckgd);
       
  3649 	User::WaitForRequest(reqStatus);
       
  3650 	TEST(reqStatus.Int() == KErrMMEtelAuthKeyNotFound);
       
  3651 	
       
  3652 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelAuthKeyNotFound."));
       
  3653 	iPhone.Close();
       
  3654 	return TestStepResult();
       
  3655 	}
       
  3656 
       
  3657 CSimUsimR6MBMSTest15::CSimUsimR6MBMSTest15() 
       
  3658 	{ 
       
  3659 	SetTestStepName(_L("UsimR6MBMSTest15"));
       
  3660 	}
       
  3661 
       
  3662 TVerdict CSimUsimR6MBMSTest15::doTestStepL()
       
  3663 /**
       
  3664 TEL-SIMTSY-MM-8638.
       
  3665 Client is unable to perform MBMS authentication in 
       
  3666 MTK generation mode because of invalidated MSK.
       
  3667 */
       
  3668 	{
       
  3669 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3670 	SetTestNumberL(45);
       
  3671 
       
  3672 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3673 	TESTL(ret == KErrNone); 
       
  3674 	INFO_PRINTF1(_L(""));
       
  3675 	
       
  3676 	TRequestStatus reqStatus = KErrNone;
       
  3677 	_LIT8(Kaid,"AE879");
       
  3678 	
       
  3679 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3680 	
       
  3681 	RMobilePhone::TAID appAID = Kaid();
       
  3682 	
       
  3683 	RMobilePhone::TMbmsMtkGenerateDataV8 tMbmsMtkGenerateDataV8;
       
  3684 	RMobilePhone::TMbmsMtkGenerateDataV8Pckg tMbmsMtkGenerateDataV8Pckgd(tMbmsMtkGenerateDataV8);
       
  3685 
       
  3686 	tMbmsMtkGenerateDataV8.iMikey = _L8("IN_MIKEY_V_BIT");
       
  3687 	
       
  3688 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMtkGenerateDataV8Pckgd);
       
  3689 	User::WaitForRequest(reqStatus);
       
  3690 	TEST(reqStatus.Int() == KErrMMEtelAuthVerificationFailure);
       
  3691 	
       
  3692 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelAuthVerificationFailure."));
       
  3693 	iPhone.Close();
       
  3694 	return TestStepResult();
       
  3695 	}
       
  3696 
       
  3697 CSimUsimR6MBMSTest16::CSimUsimR6MBMSTest16() 
       
  3698 	{ 
       
  3699 	SetTestStepName(_L("UsimR6MBMSTest16"));
       
  3700 	}
       
  3701 
       
  3702 TVerdict CSimUsimR6MBMSTest16::doTestStepL()
       
  3703 /**
       
  3704 TEL-SIMTSY-MM-8639.
       
  3705 Client is unable to perform MBMS authentication in 
       
  3706 MTK generation mode because of invalid MTK. 
       
  3707 */
       
  3708 	{
       
  3709 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3710 	SetTestNumberL(49);
       
  3711 
       
  3712 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3713 	TESTL(ret == KErrNone); 
       
  3714 	INFO_PRINTF1(_L(""));
       
  3715 	
       
  3716 	TRequestStatus reqStatus = KErrNone;
       
  3717 	_LIT8(Kaid,"AE879");
       
  3718 	
       
  3719 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3720 	
       
  3721 	RMobilePhone::TAID appAID = Kaid();
       
  3722 	
       
  3723 	RMobilePhone::TMbmsMtkGenerateDataV8 tMbmsMtkGenerateDataV8;
       
  3724 	RMobilePhone::TMbmsMtkGenerateDataV8Pckg tMbmsMtkGenerateDataV8Pckgd(tMbmsMtkGenerateDataV8);
       
  3725 
       
  3726 	tMbmsMtkGenerateDataV8.iMikey = _L8("IN_MIKEY_V_BIT");
       
  3727 	
       
  3728 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMtkGenerateDataV8Pckgd);
       
  3729 	User::WaitForRequest(reqStatus);
       
  3730 	TEST(reqStatus.Int() == KErrMMEtelAuthKeyInvalid);
       
  3731 	
       
  3732 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelAuthKeyInvalid."));
       
  3733 	iPhone.Close();
       
  3734 	return TestStepResult();
       
  3735 	}
       
  3736 
       
  3737 CSimUsimR6MBMSTest17::CSimUsimR6MBMSTest17() 
       
  3738 	{ 
       
  3739 	SetTestStepName(_L("UsimR6MBMSTest17"));
       
  3740 	}
       
  3741 
       
  3742 TVerdict CSimUsimR6MBMSTest17::doTestStepL()
       
  3743 /**
       
  3744 TEL-SIMTSY-MM-8640.
       
  3745 Client performs MBMS authentication in MSK Deletion Mode successfully.
       
  3746 */
       
  3747 	{
       
  3748 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3749 	SetTestNumberL(38);
       
  3750 
       
  3751 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3752 	TESTL(ret == KErrNone); 
       
  3753 	INFO_PRINTF1(_L(""));
       
  3754 	
       
  3755 	/*Client retrieves MSK ID list from UICC successfully. */
       
  3756 	TRequestStatus reqStatus = KErrNone;
       
  3757 	_LIT8(Kaid,"AE879");
       
  3758 	
       
  3759 	RMobilePhone::TAID appAID = Kaid();
       
  3760 	
       
  3761 	/*Client decides to delete the MSKs that are no longer needed to free up storage for new MSKs.   */
       
  3762 	
       
  3763 	RMobilePhone::TMbmsMskDeleteDataV8 tMbmsMskDeleteDataV8;
       
  3764 	RMobilePhone::TMbmsMskDeleteDataV8Pckg tMbmsMskDeleteDataV8Pckgd(tMbmsMskDeleteDataV8);
       
  3765 	
       
  3766 	tMbmsMskDeleteDataV8.iKeyDomainId = _L8("KDN");
       
  3767 	tMbmsMskDeleteDataV8.iMskIdKeyGroup = _L8("GR");
       
  3768 
       
  3769 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3770 	
       
  3771 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMskDeleteDataV8Pckgd);
       
  3772 	User::WaitForRequest(reqStatus);
       
  3773 	TEST(reqStatus.Int() == KErrNone);
       
  3774 
       
  3775 	INFO_PRINTF1(_L("SmartCardAuthenticate API completed."));
       
  3776 	iPhone.Close();
       
  3777 	return TestStepResult();
       
  3778 	}
       
  3779 
       
  3780 CSimUsimR6MBMSTest18::CSimUsimR6MBMSTest18() 
       
  3781 	{ 
       
  3782 	SetTestStepName(_L("UsimR6MBMSTest18"));
       
  3783 	}
       
  3784 
       
  3785 TVerdict CSimUsimR6MBMSTest18::doTestStepL()
       
  3786 /**
       
  3787 TEL-SIMTSY-MM-8641.
       
  3788 Client performs MBMS authentication in MSK Deletion Mode - record match not found.
       
  3789 */
       
  3790 	{
       
  3791 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3792 	SetTestNumberL(47);
       
  3793 
       
  3794 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3795 	TESTL(ret == KErrNone); 
       
  3796 	INFO_PRINTF1(_L(""));
       
  3797 	
       
  3798 	/*Client retrieves MSK ID list from UICC successfully. */
       
  3799 	TRequestStatus reqStatus = KErrNone;
       
  3800 	_LIT8(Kaid,"AE879");
       
  3801 	
       
  3802 	RMobilePhone::TAID appAID = Kaid();
       
  3803 	
       
  3804 	/*Client decides to delete the MSKs that are no longer needed to free up storage for new MSKs.   */
       
  3805 	
       
  3806 	RMobilePhone::TMbmsMskDeleteDataV8 tMbmsMskDeleteDataV8;
       
  3807 	RMobilePhone::TMbmsMskDeleteDataV8Pckg tMbmsMskDeleteDataV8Pckgd(tMbmsMskDeleteDataV8);
       
  3808 	
       
  3809 	tMbmsMskDeleteDataV8.iKeyDomainId = _L8("KDN");
       
  3810 	tMbmsMskDeleteDataV8.iMskIdKeyGroup = _L8("GR");
       
  3811 
       
  3812 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3813 	
       
  3814 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMskDeleteDataV8Pckgd);
       
  3815 	User::WaitForRequest(reqStatus);
       
  3816 	TEST(reqStatus.Int() == KErrNotFound);
       
  3817 
       
  3818 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrNotFound."));
       
  3819 	iPhone.Close();
       
  3820 	return TestStepResult();
       
  3821 	}
       
  3822 
       
  3823 CSimUsimR6MBMSTest19::CSimUsimR6MBMSTest19() 
       
  3824 	{ 
       
  3825 	SetTestStepName(_L("UsimR6MBMSTest19"));
       
  3826 	}
       
  3827 
       
  3828 TVerdict CSimUsimR6MBMSTest19::doTestStepL()
       
  3829 /**
       
  3830 TEL-SIMTSY-MM-8642.
       
  3831 Client is unable to perform MBMS authentication in 
       
  3832 MSK Deletion Mode because USIM application is not active.
       
  3833 */
       
  3834 	{
       
  3835 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3836 	SetTestNumberL(39);
       
  3837 
       
  3838 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3839 	TESTL(ret == KErrNone); 
       
  3840 	INFO_PRINTF1(_L(""));
       
  3841 	
       
  3842 	/*Client retrieves MSK ID list from UICC successfully. */
       
  3843 	TRequestStatus reqStatus = KErrNone;
       
  3844 	_LIT8(Kaid,"AE879");
       
  3845 	
       
  3846 	RMobilePhone::TAID appAID = Kaid();
       
  3847 	
       
  3848 	/*Client decides to delete the MSKs that are no longer needed to free up storage for new MSKs.   */
       
  3849 	
       
  3850 	RMobilePhone::TMbmsMskDeleteDataV8 tMbmsMskDeleteDataV8;
       
  3851 	RMobilePhone::TMbmsMskDeleteDataV8Pckg tMbmsMskDeleteDataV8Pckgd(tMbmsMskDeleteDataV8);
       
  3852 	
       
  3853 	tMbmsMskDeleteDataV8.iKeyDomainId = _L8("KDN");
       
  3854 	tMbmsMskDeleteDataV8.iMskIdKeyGroup = _L8("GR");
       
  3855 
       
  3856 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3857 	
       
  3858 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMskDeleteDataV8Pckgd);
       
  3859 	User::WaitForRequest(reqStatus);
       
  3860 	TEST(reqStatus.Int() == KErrMMEtelScApplicationNotActive);
       
  3861 
       
  3862 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelScApplicationNotActive."));
       
  3863 	iPhone.Close();
       
  3864 	return TestStepResult();
       
  3865 	}
       
  3866 
       
  3867 CSimUsimR6MBMSTest20::CSimUsimR6MBMSTest20() 
       
  3868 	{ 
       
  3869 	SetTestStepName(_L("UsimR6MBMSTest20"));
       
  3870 	}
       
  3871 
       
  3872 TVerdict CSimUsimR6MBMSTest20::doTestStepL()
       
  3873 /**
       
  3874 TEL-SIMTSY-MM-8643.
       
  3875 Client is unable to perform MBMS authentication in 
       
  3876 MSK Deletion Mode due to lack of MBMS service support in UICC.
       
  3877 */
       
  3878 	{
       
  3879 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3880 	SetTestNumberL(40);
       
  3881 
       
  3882 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3883 	TESTL(ret == KErrNone); 
       
  3884 	INFO_PRINTF1(_L(""));
       
  3885 	
       
  3886 	/*Client retrieves MSK ID list from UICC successfully. */
       
  3887 	TRequestStatus reqStatus = KErrNone;
       
  3888 	_LIT8(Kaid,"AE879");
       
  3889 	
       
  3890 	RMobilePhone::TAID appAID = Kaid();
       
  3891 	
       
  3892 	/*Client decides to delete the MSKs that are no longer needed to free up storage for new MSKs.   */
       
  3893 	
       
  3894 	RMobilePhone::TMbmsMskDeleteDataV8 tMbmsMskDeleteDataV8;
       
  3895 	RMobilePhone::TMbmsMskDeleteDataV8Pckg tMbmsMskDeleteDataV8Pckgd(tMbmsMskDeleteDataV8);
       
  3896 	
       
  3897 	tMbmsMskDeleteDataV8.iKeyDomainId = _L8("KDN");
       
  3898 	tMbmsMskDeleteDataV8.iMskIdKeyGroup = _L8("GR");
       
  3899 
       
  3900 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3901 	
       
  3902 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMskDeleteDataV8Pckgd);
       
  3903 	User::WaitForRequest(reqStatus);
       
  3904 	TEST(reqStatus.Int() == KErrNotSupported);
       
  3905 
       
  3906 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrNotSupported."));
       
  3907 	iPhone.Close();
       
  3908 	return TestStepResult();
       
  3909 	}
       
  3910 
       
  3911 CSimUsimR6MBMSTest21::CSimUsimR6MBMSTest21() 
       
  3912 	{ 
       
  3913 	SetTestStepName(_L("UsimR6MBMSTest21"));
       
  3914 	}
       
  3915 
       
  3916 TVerdict CSimUsimR6MBMSTest21::doTestStepL()
       
  3917 /**
       
  3918 TEL-SIMTSY-MM-8644.
       
  3919 Client performs MBMS authentication in MUK Deletion Mode successfully.
       
  3920 */
       
  3921 	{
       
  3922 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3923 	SetTestNumberL(38);
       
  3924 
       
  3925 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3926 	TESTL(ret == KErrNone); 
       
  3927 	INFO_PRINTF1(_L(""));
       
  3928 	
       
  3929 	/* Client retrieves MUK ID and timestamp counter successfully.*/
       
  3930 	
       
  3931 	TRequestStatus reqStatus=KErrNone;
       
  3932 	_LIT8(Kaid,"AE879");
       
  3933 	
       
  3934 	RMobilePhone::TAID appAID = Kaid();
       
  3935 	
       
  3936 	/*Client decides to delete the MUK to free up storage for new MUK */
       
  3937 	
       
  3938 	RMobilePhone::TMbmsMukDeleteDataV8 tMbmsMukDeleteDataV8;
       
  3939 	RMobilePhone::TMbmsMukDeleteDataV8Pckg tMbmsMukDeleteDataV8Pckgd(tMbmsMukDeleteDataV8);
       
  3940 	
       
  3941 	tMbmsMukDeleteDataV8.iMukIdTlv = _L8("MUK_ID_TLV");
       
  3942 	
       
  3943 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3944 	
       
  3945 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMukDeleteDataV8Pckgd);
       
  3946 	User::WaitForRequest(reqStatus);
       
  3947 	TEST(reqStatus.Int() == KErrNone);
       
  3948 	
       
  3949 	INFO_PRINTF1(_L("SmartCardAuthenticate API completed."));
       
  3950 	iPhone.Close();
       
  3951 	return TestStepResult();
       
  3952 	}
       
  3953 
       
  3954 CSimUsimR6MBMSTest22::CSimUsimR6MBMSTest22() 
       
  3955 	{ 
       
  3956 	SetTestStepName(_L("UsimR6MBMSTest22"));
       
  3957 	}
       
  3958 
       
  3959 TVerdict CSimUsimR6MBMSTest22::doTestStepL()
       
  3960 /**
       
  3961 TEL-SIMTSY-MM-8645.
       
  3962 Client performs MBMS authentication in MUK Deletion Mode - record match not found.
       
  3963 */
       
  3964 	{
       
  3965 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  3966 	SetTestNumberL(47);
       
  3967 
       
  3968 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  3969 	TESTL(ret == KErrNone); 
       
  3970 	INFO_PRINTF1(_L(""));
       
  3971 	
       
  3972 	/* Client retrieves MUK ID and timestamp counter successfully.*/
       
  3973 	
       
  3974 	TRequestStatus reqStatus=KErrNone;
       
  3975 	_LIT8(Kaid,"AE879");
       
  3976 	
       
  3977 	RMobilePhone::TAID appAID = Kaid();
       
  3978 	
       
  3979 	/*Client decides to delete the MUK to free up storage for new MUK */
       
  3980 	
       
  3981 	RMobilePhone::TMbmsMukDeleteDataV8 tMbmsMukDeleteDataV8;
       
  3982 	RMobilePhone::TMbmsMukDeleteDataV8Pckg tMbmsMukDeleteDataV8Pckgd(tMbmsMukDeleteDataV8);
       
  3983 	
       
  3984 	tMbmsMukDeleteDataV8.iMukIdTlv = _L8("MUK_ID_TLV");
       
  3985 	
       
  3986 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  3987 	
       
  3988 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMukDeleteDataV8Pckgd);
       
  3989 	User::WaitForRequest(reqStatus);
       
  3990 	TEST(reqStatus.Int() == KErrNotFound);
       
  3991 	
       
  3992 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrNotFound."));
       
  3993 	iPhone.Close();
       
  3994 	return TestStepResult();
       
  3995 	}
       
  3996 
       
  3997 CSimUsimR6MBMSTest23::CSimUsimR6MBMSTest23() 
       
  3998 	{ 
       
  3999 	SetTestStepName(_L("UsimR6MBMSTest23"));
       
  4000 	}
       
  4001 
       
  4002 TVerdict CSimUsimR6MBMSTest23::doTestStepL()
       
  4003 /**
       
  4004 TEL-SIMTSY-MM-8646.
       
  4005 Client is unable to perform MBMS authentication in 
       
  4006 MSK update mode because UICC application is not active.
       
  4007 */
       
  4008 	{
       
  4009 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  4010 	SetTestNumberL(39);
       
  4011 
       
  4012 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  4013 	TESTL(ret == KErrNone); 
       
  4014 	INFO_PRINTF1(_L(""));
       
  4015 	
       
  4016 	/* Client retrieves MUK ID and timestamp counter successfully.*/
       
  4017 	
       
  4018 	TRequestStatus reqStatus=KErrNone;
       
  4019 	_LIT8(Kaid,"AE879");
       
  4020 	
       
  4021 	RMobilePhone::TAID appAID = Kaid();
       
  4022 	
       
  4023 	/*Client decides to delete the MUK to free up storage for new MUK */
       
  4024 	
       
  4025 	RMobilePhone::TMbmsMukDeleteDataV8 tMbmsMukDeleteDataV8;
       
  4026 	RMobilePhone::TMbmsMukDeleteDataV8Pckg tMbmsMukDeleteDataV8Pckgd(tMbmsMukDeleteDataV8);
       
  4027 	
       
  4028 	tMbmsMukDeleteDataV8.iMukIdTlv = _L8("MUK_ID_TLV");
       
  4029 	
       
  4030 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  4031 	
       
  4032 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMukDeleteDataV8Pckgd);
       
  4033 	User::WaitForRequest(reqStatus);
       
  4034 	TEST(reqStatus.Int() == KErrMMEtelScApplicationNotActive);
       
  4035 	
       
  4036 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrMMEtelScApplicationNotActive."));
       
  4037 	iPhone.Close();
       
  4038 	return TestStepResult();
       
  4039 	}
       
  4040 
       
  4041 CSimUsimR6MBMSTest24::CSimUsimR6MBMSTest24() 
       
  4042 	{ 
       
  4043 	SetTestStepName(_L("UsimR6MBMSTest24"));
       
  4044 	}
       
  4045 
       
  4046 TVerdict CSimUsimR6MBMSTest24::doTestStepL()
       
  4047 /**
       
  4048 TEL-SIMTSY-MM-8647.
       
  4049 Client is unable to perform MBMS authentication in 
       
  4050 MSK update mode because this feature is not enabled in USIM service table
       
  4051 */
       
  4052 	{
       
  4053 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  4054 	SetTestNumberL(40);
       
  4055 
       
  4056 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  4057 	TESTL(ret == KErrNone); 
       
  4058 	INFO_PRINTF1(_L(""));
       
  4059 	
       
  4060 	/* Client retrieves MUK ID and timestamp counter successfully.*/
       
  4061 	
       
  4062 	TRequestStatus reqStatus=KErrNone;
       
  4063 	_LIT8(Kaid,"AE879");
       
  4064 	
       
  4065 	RMobilePhone::TAID appAID = Kaid();
       
  4066 	
       
  4067 	/*Client decides to delete the MUK to free up storage for new MUK */
       
  4068 	
       
  4069 	RMobilePhone::TMbmsMukDeleteDataV8 tMbmsMukDeleteDataV8;
       
  4070 	RMobilePhone::TMbmsMukDeleteDataV8Pckg tMbmsMukDeleteDataV8Pckgd(tMbmsMukDeleteDataV8);
       
  4071 	
       
  4072 	tMbmsMukDeleteDataV8.iMukIdTlv = _L8("MUK_ID_TLV");
       
  4073 	
       
  4074 	INFO_PRINTF1(_L("Testing RMobilePhone::SmartCardAuthenticate async with AID."));
       
  4075 	
       
  4076 	iPhone.SmartCardAuthenticate(reqStatus, appAID, tMbmsMukDeleteDataV8Pckgd);
       
  4077 	User::WaitForRequest(reqStatus);
       
  4078 	TEST(reqStatus.Int() == KErrNotSupported);
       
  4079 	
       
  4080 	INFO_PRINTF1(_L("SmartCardAuthenticate completes with KErrNotSupported."));
       
  4081 	iPhone.Close();
       
  4082 	return TestStepResult();
       
  4083 	}
       
  4084 
       
  4085 CSimUsimR6MBMSTest25::CSimUsimR6MBMSTest25() 
       
  4086 	{ 
       
  4087 	SetTestStepName(_L("UsimR6MBMSTest25"));
       
  4088 	}
       
  4089 
       
  4090 TVerdict CSimUsimR6MBMSTest25::doTestStepL()
       
  4091 /**
       
  4092 TEL-SIMTSY-MM-8648.
       
  4093 Client retrieves MUK ID and timestamp counter successfully.
       
  4094 */
       
  4095 	{
       
  4096 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  4097 	SetTestNumberL(38);
       
  4098 
       
  4099 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  4100 	TESTL(ret == KErrNone); 
       
  4101 	INFO_PRINTF1(_L(""));
       
  4102 
       
  4103 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  4104 	
       
  4105 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  4106 	iPhone.NotifySecurityEvent(reqSts1,secEvent);
       
  4107 	
       
  4108 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  4109 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  4110 
       
  4111 	RMobilePhone::TMbmsUserKeyV8 tMbmsUserKeyV8;
       
  4112 	RMobilePhone::TMbmsUserKeyV8Pckg tMbmsUserKeyV8Pckg(tMbmsUserKeyV8);
       
  4113 	
       
  4114 	_LIT8(Kaid,"AE879");
       
  4115 	
       
  4116 	tAuthInfoV8.iData = RMobilePhone::EMbmsMuk;
       
  4117 	tAuthInfoV8.iAID = Kaid();
       
  4118 	
       
  4119 	iPhone.GetAuthenticationParams(reqSts3,tAuthInfoV8Pckg,tMbmsUserKeyV8Pckg);
       
  4120 	
       
  4121 	User::WaitForRequest(reqSts1);
       
  4122 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  4123 	
       
  4124 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  4125 	RMobilePhone::TMobilePassword pass;
       
  4126 	_LIT8(Kpswrd, "1234");
       
  4127 	pass.Copy(Kpswrd);
       
  4128 	   
       
  4129 	INFO_PRINTF1(_L("Verifying the SIM APP PIN..."));
       
  4130 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  4131 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  4132 	User::WaitForRequest(reqSts2);
       
  4133 	User::WaitForRequest(reqSts1);
       
  4134 	TEST(reqSts2==KErrNone); 
       
  4135 	INFO_PRINTF2(_L("Value of secEvent = %d"),secEvent);
       
  4136 	TEST(secEvent==RMobilePhone::EUSIMAppPinVerified);
       
  4137 	
       
  4138 	INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinVerified"));
       
  4139 	
       
  4140 	User::WaitForRequest(reqSts3);
       
  4141 	TEST(reqSts3.Int() == KErrNone);
       
  4142 	if(reqSts3.Int() == KErrNone)
       
  4143 		{
       
  4144 		INFO_PRINTF1(_L("GetAuthenticationParams completed successfully."));
       
  4145 		}
       
  4146 	else
       
  4147 		{
       
  4148 		INFO_PRINTF1(_L("GetAuthenticationParams not completed successfully."));
       
  4149 		}
       
  4150 	
       
  4151 	tMbmsUserKeyV8 = tMbmsUserKeyV8Pckg();  
       
  4152 	TEST(tMbmsUserKeyV8.iMukIdi == _L8("MUK_IDI"));
       
  4153 	TEST(tMbmsUserKeyV8.iMukIdr == _L8("MUK_IDR"));
       
  4154 	TEST(tMbmsUserKeyV8.iTimeStampCounter == _L8("STM"));
       
  4155 	
       
  4156 	iPhone.Close();
       
  4157 	return TestStepResult();
       
  4158 	}
       
  4159 
       
  4160 CSimUsimR6MBMSTest26::CSimUsimR6MBMSTest26() 
       
  4161 	{ 
       
  4162 	SetTestStepName(_L("UsimR6MBMSTest26"));
       
  4163 	}
       
  4164 
       
  4165 TVerdict CSimUsimR6MBMSTest26::doTestStepL()
       
  4166 /**
       
  4167 TEL-SIMTSY-MM-8689.
       
  4168 Client is unable to retrieve MUK ID and timestamp counter because 
       
  4169 UICC application is not active.
       
  4170 */
       
  4171 	{
       
  4172 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  4173 	SetTestNumberL(39);
       
  4174 
       
  4175 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  4176 	TESTL(ret == KErrNone); 
       
  4177 	INFO_PRINTF1(_L(""));
       
  4178 
       
  4179 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  4180 	
       
  4181 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  4182 	iPhone.NotifySecurityEvent(reqSts1,secEvent);
       
  4183 	
       
  4184 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  4185 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  4186 
       
  4187 	RMobilePhone::TMbmsUserKeyV8 tMbmsUserKeyV8;
       
  4188 	RMobilePhone::TMbmsUserKeyV8Pckg tMbmsUserKeyV8Pckg(tMbmsUserKeyV8);
       
  4189 	
       
  4190 	_LIT8(Kaid,"AE879");
       
  4191 	
       
  4192 	tAuthInfoV8.iData = RMobilePhone::EMbmsMuk;
       
  4193 	tAuthInfoV8.iAID = Kaid();
       
  4194 	
       
  4195 	iPhone.GetAuthenticationParams(reqSts3,tAuthInfoV8Pckg,tMbmsUserKeyV8Pckg);
       
  4196 	
       
  4197 	User::WaitForRequest(reqSts1);
       
  4198 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  4199 	
       
  4200 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  4201 	RMobilePhone::TMobilePassword pass;
       
  4202 	_LIT8(Kpswrd, "1234");
       
  4203 	pass.Copy(Kpswrd);
       
  4204 	   
       
  4205 	INFO_PRINTF1(_L("Verifying the SIM APP PIN..."));
       
  4206 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  4207 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  4208 	User::WaitForRequest(reqSts2);
       
  4209 	User::WaitForRequest(reqSts1);
       
  4210 	TEST(reqSts2==KErrNone); 
       
  4211 	INFO_PRINTF2(_L("Value of secEvent = %d"),secEvent);
       
  4212 	TEST(secEvent==RMobilePhone::EUSIMAppPinVerified);
       
  4213 	
       
  4214 	INFO_PRINTF1(_L("NotifySecurityEvent completed with EUSIMAppPinVerified"));
       
  4215 	
       
  4216 	User::WaitForRequest(reqSts3);
       
  4217 	TEST(reqSts3.Int() == KErrMMEtelScApplicationNotActive);
       
  4218 	if(reqSts3.Int() == KErrMMEtelScApplicationNotActive)
       
  4219 		{
       
  4220 		INFO_PRINTF1(_L("GetAuthenticationParams completed with KErrMMEtelScApplicationNotActive."));
       
  4221 		}
       
  4222 	else
       
  4223 		{
       
  4224 		INFO_PRINTF1(_L("GetAuthenticationParams not completed with KErrMMEtelScApplicationNotActive."));
       
  4225 		}
       
  4226 	iPhone.Close();
       
  4227 	return TestStepResult();
       
  4228 	}
       
  4229 
       
  4230 CSimUsimR6MBMSTest27::CSimUsimR6MBMSTest27() 
       
  4231 	{ 
       
  4232 	SetTestStepName(_L("UsimR6MBMSTest27"));
       
  4233 	}
       
  4234 
       
  4235 TVerdict CSimUsimR6MBMSTest27::doTestStepL()
       
  4236 /**
       
  4237 TEL-SIMTSY-MM-8650.
       
  4238 Client is unable to retrieve MUK ID due to PIN verification failure.
       
  4239 */
       
  4240 	{
       
  4241 	CreateConfigFileL(_L("c:\\config3.txt")); 
       
  4242 	SetTestNumberL(48);
       
  4243 
       
  4244 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  4245 	TESTL(ret == KErrNone); 
       
  4246 	INFO_PRINTF1(_L(""));
       
  4247 
       
  4248 	TRequestStatus reqSts1,reqSts2,reqSts3;
       
  4249 	
       
  4250 	RMobilePhone::TMobilePhoneSecurityEvent secEvent;
       
  4251 	iPhone.NotifySecurityEvent(reqSts1,secEvent);
       
  4252 	
       
  4253 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  4254 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  4255 
       
  4256 	RMobilePhone::TMbmsUserKeyV8 tMbmsUserKeyV8;
       
  4257 	RMobilePhone::TMbmsUserKeyV8Pckg tMbmsUserKeyV8Pckg(tMbmsUserKeyV8);
       
  4258 	
       
  4259 	_LIT8(Kaid,"AE879");
       
  4260 	
       
  4261 	tAuthInfoV8.iData = RMobilePhone::EMbmsMuk;
       
  4262 	tAuthInfoV8.iAID = Kaid();
       
  4263 	
       
  4264 	iPhone.GetAuthenticationParams(reqSts3,tAuthInfoV8Pckg,tMbmsUserKeyV8Pckg);
       
  4265 	
       
  4266 	User::WaitForRequest(reqSts1);
       
  4267 	TEST(secEvent == RMobilePhone::EUSIMAppPinRequired);
       
  4268 	
       
  4269 	RMobilePhone::TMobilePhoneSecurityCode type=RMobilePhone::ESecurityUSIMAppPin;
       
  4270 	RMobilePhone::TMobilePassword pass;
       
  4271 	_LIT8(Kpswrd, "6789");  // Invalid password
       
  4272 	pass.Copy(Kpswrd);
       
  4273 	   
       
  4274 	INFO_PRINTF1(_L("Verifying the SIM APP PIN..."));
       
  4275 	iPhone.NotifySecurityEvent(reqSts1, secEvent);
       
  4276 	iPhone.VerifySecurityCode(reqSts2, type, pass,pass);
       
  4277 	User::WaitForRequest(reqSts2);
       
  4278 	User::WaitForRequest(reqSts1);
       
  4279 	TEST(reqSts2==KErrAccessDenied); 
       
  4280 	TEST(secEvent==RMobilePhone::EUSIMAppPinRequired);
       
  4281 	
       
  4282 	INFO_PRINTF1(_L("NotifySecurityEvent completed with USIM PIN Verification failed"));
       
  4283 
       
  4284 	User::WaitForRequest(reqSts3);
       
  4285 	TEST(reqSts3.Int() == KErrAccessDenied);	
       
  4286 	if(reqSts3.Int() == KErrAccessDenied)
       
  4287 		{
       
  4288 		INFO_PRINTF1(_L("GetAuthenticationParams completed with KErrAccessDenied"));
       
  4289 		}
       
  4290 	iPhone.Close();
       
  4291 	return TestStepResult();
       
  4292 	}
       
  4293 
       
  4294 CSimUsimR6MBMSTest28::CSimUsimR6MBMSTest28() 
       
  4295 	{ 
       
  4296 	SetTestStepName(_L("UsimR6MBMSTest28"));
       
  4297 	}
       
  4298 
       
  4299 TVerdict CSimUsimR6MBMSTest28::doTestStepL()
       
  4300 /**
       
  4301 TEL-SIMTSY-MM-8651.
       
  4302 Client retrieves MSK ID list from UICC successfully.
       
  4303 */
       
  4304 	{
       
  4305 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  4306 	SetTestNumberL(38);
       
  4307 
       
  4308 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  4309 	TESTL(ret == KErrNone); 
       
  4310 	INFO_PRINTF1(_L(""));
       
  4311 	
       
  4312 	CTestRetrieveMobilePhoneAuthenticationIds *pRetrieve = CTestRetrieveMobilePhoneAuthenticationIds::NewLC(iPhone,
       
  4313 			CTestRetrieveMobilePhoneAuthenticationIds::EMbms);
       
  4314 
       
  4315 	pRetrieve->SetAuthType(CTestRetrieveMobilePhoneAuthenticationIds::EMbms);
       
  4316 	pRetrieve->TestRetrieve(RMobilePhone::EMbmsMskIdList);
       
  4317 
       
  4318 	//Delete test object
       
  4319 	CleanupStack::PopAndDestroy(); //pRetrieve	
       
  4320 	iPhone.Close();
       
  4321 	return TestStepResult();
       
  4322 	}
       
  4323 
       
  4324 CSimUsimR6MBMSTest29::CSimUsimR6MBMSTest29() 
       
  4325 	{ 
       
  4326 	SetTestStepName(_L("UsimR6MBMSTest29"));
       
  4327 	}
       
  4328 
       
  4329 TVerdict CSimUsimR6MBMSTest29::doTestStepL()
       
  4330 /**
       
  4331 TEL-SIMTSY-MM-8652.
       
  4332 Client confirms on the support of MBMS functionality by the USIM.
       
  4333 */
       
  4334 	{
       
  4335 	CreateConfigFileL(_L("c:\\config3.txt")); 	
       
  4336 	SetTestNumberL(39);
       
  4337 
       
  4338 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
  4339 	TESTL(ret == KErrNone); 
       
  4340 	INFO_PRINTF1(_L(""));
       
  4341 	TRequestStatus reqStatus=KErrNone;
       
  4342 
       
  4343 	//Verify the support of MBMS in USIM Service Table
       
  4344 
       
  4345 	RMobilePhone::TMobilePhoneServiceTableV8 asyncSstV8File;
       
  4346 	RMobilePhone::TMobilePhoneServiceTableV8Pckg asyncSstV8FilePckg(asyncSstV8File);
       
  4347 	RMobilePhone::TMobilePhoneServiceTable serviceTableType=RMobilePhone::EUSIMServiceTable;
       
  4348 	
       
  4349 	iPhone.GetServiceTable(reqStatus, serviceTableType, asyncSstV8FilePckg);
       
  4350 	
       
  4351 	User::WaitForRequest(reqStatus);
       
  4352 	TEST(reqStatus.Int()==KErrNone);
       
  4353 	if(reqStatus.Int() == KErrNone)
       
  4354 		{
       
  4355 		INFO_PRINTF1(_L("Test - RMobilePhone::GetServiceTable V8table for MBMS passed"));
       
  4356 		}
       
  4357 	else
       
  4358 		{
       
  4359 		INFO_PRINTF1(_L("Test - RMobilePhone::GetServiceTable V8table for MBMS failed"));
       
  4360 		}
       
  4361 
       
  4362 	TEST((asyncSstV8File.iServices65To72) == RMobilePhone::KUstMBMSSecurity);
       
  4363 	iPhone.Close();
       
  4364 	return TestStepResult();
       
  4365 	}
       
  4366 
       
  4367 CTestCanceller::CTestCanceller(CActive* aRetrieve)
       
  4368 : CAsyncOneShot(EPriorityNormal),iRetrieve(aRetrieve)
       
  4369 	{}
       
  4370 
       
  4371 CTestCanceller::~CTestCanceller()
       
  4372 	{}
       
  4373 
       
  4374 void CTestCanceller::RunL()
       
  4375 	{
       
  4376 	iRetrieve->Cancel();
       
  4377 	CActiveScheduler::Stop();
       
  4378 	}
       
  4379 
       
  4380 CTestRetrieveMobilePhoneAuthenticationIds* CTestRetrieveMobilePhoneAuthenticationIds::NewLC(RMobilePhone& aPhone,TTypeOfAuth aType)
       
  4381 	{
       
  4382 	CTestRetrieveMobilePhoneAuthenticationIds* r=new(ELeave) CTestRetrieveMobilePhoneAuthenticationIds(aPhone,aType);
       
  4383 	CleanupStack::PushL(r);
       
  4384 	r->ConstructL();
       
  4385 	return r;
       
  4386 	}
       
  4387   
       
  4388 CTestRetrieveMobilePhoneAuthenticationIds::CTestRetrieveMobilePhoneAuthenticationIds(RMobilePhone& aPhone,TTypeOfAuth aType)
       
  4389 : CActive(EPriorityNormal), iPhone(aPhone), iAuthType(aType)
       
  4390 	{}
       
  4391  
       
  4392 void CTestRetrieveMobilePhoneAuthenticationIds::ConstructL()
       
  4393 	{
       
  4394 	CActiveScheduler::Add(this);
       
  4395 	iRetrieveAuthId=CRetrieveMobilePhoneAuthenticationIds::NewL(iPhone);
       
  4396 	iCanceller=new (ELeave) CTestCanceller(this);
       
  4397 	iGBATest = new (ELeave) CSimUsimR6GBATest14();
       
  4398 	}
       
  4399      
       
  4400 CTestRetrieveMobilePhoneAuthenticationIds::~CTestRetrieveMobilePhoneAuthenticationIds()
       
  4401 	{
       
  4402 	delete iRetrieveAuthId;
       
  4403 	delete iCanceller;
       
  4404 	delete iGBATest;
       
  4405 	}
       
  4406 void CTestRetrieveMobilePhoneAuthenticationIds::SetAuthType(TTypeOfAuth aAuthType)
       
  4407 	{
       
  4408 	iAuthType = aAuthType;
       
  4409 	iGBATest->INFO_PRINTF2(_L("Value of iAuthType = %d"),iAuthType);
       
  4410 	}
       
  4411 
       
  4412 void CTestRetrieveMobilePhoneAuthenticationIds::TestRetrieve(RMobilePhone::TAuthData aAuthData)
       
  4413 	{
       
  4414 	Start(aAuthData);
       
  4415 	CActiveScheduler::Start();
       
  4416 	}
       
  4417 
       
  4418 void CTestRetrieveMobilePhoneAuthenticationIds::Start(RMobilePhone::TAuthData aAuthData)
       
  4419 	{
       
  4420 	//If iTestVersion is set to EGba, test calling the Gba retrieval method
       
  4421 	RMobilePhone::TAuthInfoV8 tAuthInfoV8;
       
  4422 	RMobilePhone::TAuthInfoV8Pckg tAuthInfoV8Pckg(tAuthInfoV8);
       
  4423 	
       
  4424 	if(iAuthType==CTestRetrieveMobilePhoneAuthenticationIds::EGba)
       
  4425 		{
       
  4426 		tAuthInfoV8.iData = aAuthData;
       
  4427 		iRetrieveAuthId->Start(iStatus,tAuthInfoV8Pckg);
       
  4428 		TRequestStatus tmpStatus;
       
  4429 		iRetrieveAuthId->Start(tmpStatus,tAuthInfoV8Pckg);
       
  4430 		User::WaitForRequest(tmpStatus);
       
  4431 		iGBATest->TEST(tmpStatus.Int() == KErrInUse);
       
  4432 		SetActive();
       
  4433 		}
       
  4434 	//If iTestVersion is set to EMbms, test calling the Mbms retrieval method
       
  4435 	else if(iAuthType==CTestRetrieveMobilePhoneAuthenticationIds::EMbms)
       
  4436 		{
       
  4437 		tAuthInfoV8.iData = aAuthData;
       
  4438 		iRetrieveAuthId->Start(iStatus,tAuthInfoV8Pckg);
       
  4439 		TRequestStatus tmpStatus;
       
  4440 		iRetrieveAuthId->Start(tmpStatus,tAuthInfoV8Pckg);
       
  4441 		User::WaitForRequest(tmpStatus);
       
  4442 		iGBATest->TEST(tmpStatus.Int() == KErrInUse);
       
  4443 		SetActive();
       
  4444 		}
       
  4445 	else
       
  4446 		{}
       
  4447 	}       
       
  4448 
       
  4449 void CTestRetrieveMobilePhoneAuthenticationIds::RunL()
       
  4450 	{
       
  4451 	TInt ret=iStatus.Int();
       
  4452 	if(ret == KErrPermissionDenied)
       
  4453 		{
       
  4454 		iGBATest->INFO_PRINTF1(_L("CRetrieveMobilePhoneAuthenticationId -> Start failed with Permission Denied"));
       
  4455 		CActiveScheduler::Stop();
       
  4456 		return;
       
  4457 		}
       
  4458 	else
       
  4459 		{
       
  4460 		User::LeaveIfError(ret);
       
  4461 		}
       
  4462 
       
  4463 	iGBATest->INFO_PRINTF2(_L("In RunL with iAuthType = %d"),iAuthType);	
       
  4464 
       
  4465 	if(iAuthType == EGba)
       
  4466 		{
       
  4467 		iGBATest->INFO_PRINTF1(_L("In RunL with iAuthType =EGba"));
       
  4468 		ret=CheckGBAResults();
       
  4469 		}
       
  4470 	else if(iAuthType == EMbms)
       
  4471 		{
       
  4472 		iGBATest->INFO_PRINTF1(_L("In RunL with iAuthType =EMbms"));
       
  4473 		ret=CheckMBMSResults();
       
  4474 		}
       
  4475 	else
       
  4476 		{
       
  4477 		iGBATest->INFO_PRINTF1(_L("In RunL with iAuthType =Error"));
       
  4478 		ret=KErrNotFound;
       
  4479 		}
       
  4480 
       
  4481 	if((ret != KErrNone) && (ret != KErrNotFound))
       
  4482 		{
       
  4483 		User::LeaveIfError(ret);
       
  4484 		}
       
  4485 
       
  4486 	CActiveScheduler::Stop();
       
  4487 	}
       
  4488 
       
  4489 void CTestRetrieveMobilePhoneAuthenticationIds::TestCancel(RMobilePhone::TAuthData aAuthData)
       
  4490 	{
       
  4491 	Start(aAuthData);
       
  4492 
       
  4493 	CTestCanceller* cancelAuthData = RetrieveCancelPtr();
       
  4494 	cancelAuthData->Call();
       
  4495 
       
  4496 	CActiveScheduler::Start();
       
  4497 	TBool cancelled = (iStatus == KErrCancel || iStatus == KErrNone);
       
  4498 
       
  4499 	// Ensure that AO can be used after its previous transaction was cancelled
       
  4500 	Start(aAuthData);
       
  4501 	CActiveScheduler::Start();
       
  4502 
       
  4503 	if (cancelled)
       
  4504 		{
       
  4505 		iGBATest->INFO_PRINTF2(_L("Cancelled Type of Authentication is %d"),iAuthType);
       
  4506 		iGBATest->INFO_PRINTF1(_L("Test %d - CRetrieveMobilePhoneAuthenticationIds (async & cancel (Cancelled Request)) passed"));
       
  4507 		}
       
  4508 	else
       
  4509 		{
       
  4510 		iGBATest->INFO_PRINTF1(_L("Test %d - CRetrieveMobilePhoneAuthenticationIds (async & cancel (Request Not Cancelled)) passed"));
       
  4511 		}	
       
  4512 	}      
       
  4513 
       
  4514 CTestCanceller* CTestRetrieveMobilePhoneAuthenticationIds::RetrieveCancelPtr()
       
  4515 	{
       
  4516 	return iCanceller;
       
  4517 	}
       
  4518   
       
  4519 void CTestRetrieveMobilePhoneAuthenticationIds::DoCancel()
       
  4520 	{
       
  4521 	iRetrieveAuthId->Cancel();
       
  4522 	}       
       
  4523   
       
  4524 TInt CTestRetrieveMobilePhoneAuthenticationIds::CheckGBAResults()
       
  4525 	{
       
  4526 	TInt ret=KErrNone;
       
  4527 
       
  4528 	CMobilePhoneGbaNafIdList* nafList =NULL;
       
  4529 	TInt leaveCode=KErrNone;
       
  4530 	TRAP(leaveCode, nafList=iRetrieveAuthId->RetrieveGbaListL(););
       
  4531 
       
  4532 	//Check that a list is returned back to the test
       
  4533 	iGBATest->TEST(nafList!=NULL);
       
  4534 
       
  4535 	if (nafList)
       
  4536 		{
       
  4537 
       
  4538 		RMobilePhone::TGbaNafEntryV8 nafEntry;
       
  4539 		
       
  4540 		//Check that the number of entries in the list is as expected
       
  4541 		if(nafList->Enumerate() != SIMTSY_GBA_NAFLIST_COUNT)
       
  4542 			{
       
  4543 			TRAP(ret,nafEntry=nafList->GetEntryL(0));
       
  4544 			if (ret != KErrNone)
       
  4545 				{
       
  4546 				iGBATest-> INFO_PRINTF1(_L("The NAFLIST doesnot contain TGbaNafEntryV8 entries "));
       
  4547 				}
       
  4548 			delete nafList;
       
  4549 			return KErrNotFound;
       
  4550 			}
       
  4551 
       
  4552 		// Get each NafList entry
       
  4553 
       
  4554 		for (TInt i=0; i< SIMTSY_GBA_NAFLIST_COUNT; ++i)
       
  4555 			{
       
  4556 			TRAP(ret,nafEntry=nafList->GetEntryL(i));
       
  4557 			if (ret != KErrNone)
       
  4558 				{
       
  4559 				break;
       
  4560 				}
       
  4561 			switch(i)
       
  4562 				{
       
  4563 				case 0:
       
  4564 					{
       
  4565 					iGBATest->TEST(nafEntry.iBtid == _L8("C6453"));
       
  4566 					iGBATest->TEST(nafEntry.iNafId == _L8("B2345"));
       
  4567 					break;
       
  4568 					}
       
  4569 				case 1:
       
  4570 					{
       
  4571 					iGBATest->TEST(nafEntry.iBtid == _L8("D6453"));
       
  4572 					iGBATest->TEST(nafEntry.iNafId == _L8("C2345"));
       
  4573 					break;
       
  4574 					}
       
  4575 				case 2:
       
  4576 					{
       
  4577 					iGBATest->TEST(nafEntry.iBtid == _L8("E6453"));
       
  4578 					iGBATest->TEST(nafEntry.iNafId == _L8("D2345"));
       
  4579 					break;
       
  4580 					}
       
  4581 				default:
       
  4582 					{
       
  4583 					break;
       
  4584 					}
       
  4585 				}
       
  4586 			}
       
  4587 		delete nafList;
       
  4588 		}
       
  4589 	return ret;
       
  4590 	}
       
  4591 
       
  4592 TInt CTestRetrieveMobilePhoneAuthenticationIds::CheckMBMSResults()
       
  4593 	{
       
  4594 	TInt ret=KErrNone;
       
  4595 
       
  4596 	CMobilePhoneMbmsMskIdList* mbmsList =NULL;
       
  4597 	TInt leaveCode=KErrNone;
       
  4598 	TRAP(leaveCode, mbmsList=iRetrieveAuthId->RetrieveMbmsListL(););
       
  4599 
       
  4600 	//Check that a list is returned back to the test
       
  4601 	iGBATest->TEST(mbmsList!=NULL);
       
  4602 
       
  4603 	if (mbmsList)
       
  4604 		{
       
  4605 		//Check that the number of entries in the list is as expected
       
  4606 		RMobilePhone::TMskEntryV8 tMskEntry;
       
  4607 		
       
  4608 		if(mbmsList->Enumerate() != SIMTSY_MBMS_MSKLIST_COUNT)
       
  4609 			{
       
  4610 			TRAP(ret,tMskEntry=mbmsList->GetEntryL(0));
       
  4611 			if (ret != KErrNone)
       
  4612 				{
       
  4613 				iGBATest-> INFO_PRINTF1(_L("The MBMSLIST doesnot contain TMskEntryV8 entries "));
       
  4614 				}
       
  4615 			delete mbmsList;
       
  4616 			return KErrNotFound;
       
  4617 			}
       
  4618 											  
       
  4619 		// Get each MbmsList entry
       
  4620 
       
  4621 		for (TInt i=0; i<SIMTSY_MBMS_MSKLIST_COUNT; ++i)
       
  4622 			{
       
  4623 			TRAP(ret,tMskEntry=mbmsList->GetEntryL(i));
       
  4624 			if (ret != KErrNone)
       
  4625 				{
       
  4626 				break;
       
  4627 				}
       
  4628 			switch(i)
       
  4629 				{
       
  4630 				case 0:
       
  4631 					{
       
  4632 					iGBATest->TEST(tMskEntry.iMskId == _L8("MSK1"));
       
  4633 					iGBATest->TEST(tMskEntry.iKeyDomainId == _L8("KEYDMN1"));
       
  4634 					iGBATest->TEST(tMskEntry.iTimeStampCounter == _L8("STM1"));
       
  4635 					break;
       
  4636 					}
       
  4637 				case 1:
       
  4638 					{
       
  4639 					iGBATest->TEST(tMskEntry.iMskId == _L8("MSK2"));
       
  4640 					iGBATest->TEST(tMskEntry.iKeyDomainId == _L8("KEYDMN2"));
       
  4641 					iGBATest->TEST(tMskEntry.iTimeStampCounter == _L8("STM2"));
       
  4642 					break;
       
  4643 					}
       
  4644 				case 2:
       
  4645 					{
       
  4646 					iGBATest->TEST(tMskEntry.iMskId == _L8("MSK3"));
       
  4647 					iGBATest->TEST(tMskEntry.iKeyDomainId == _L8("KEYDMN3"));
       
  4648 					iGBATest->TEST(tMskEntry.iTimeStampCounter == _L8("STM3"));
       
  4649 					break;
       
  4650 					}
       
  4651 				default:
       
  4652 					break;
       
  4653 				}
       
  4654 			}
       
  4655 		delete mbmsList;
       
  4656 		}
       
  4657 	return ret;
       
  4658 	}
       
  4659 
       
  4660 
       
  4661