telephonyserverplugins/common_tsy/test/integration/src/cctsyintegrationtestphonesecurity.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 // Test step definitions for the PhoneSecurity functional unit.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @internalTechnology
       
    20 */
       
    21 #include "cctsyintegrationtestphonesecurity.h"
       
    22 #include "cctsyinidata.h"
       
    23 #include <mpbutil.h>
       
    24 	
       
    25 CCTSYIntegrationTestPhoneSecurityBase::CCTSYIntegrationTestPhoneSecurityBase(CEtelSessionMgr& aEtelSessionMgr)
       
    26 	: CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr), iSimTsyTestHelper(*this), iNetworkTsyTestHelper(*this), iPhoneTsyTestHelper(*this)
       
    27 /**
       
    28  * Constructor
       
    29  */
       
    30 	{
       
    31 	}
       
    32 
       
    33 CCTSYIntegrationTestPhoneSecurityBase::~CCTSYIntegrationTestPhoneSecurityBase()
       
    34 /*
       
    35  * Destructor
       
    36  */
       
    37 	{
       
    38 	}
       
    39 
       
    40 void CCTSYIntegrationTestPhoneSecurityBase::ManglePassword(const TDesC& aOldPassword, TDes& aNewPassword)
       
    41 /**
       
    42  * member function for mangling the password returning void
       
    43  * 
       
    44  * @param aOldPassword a reference of type TDesC, holding password to be mangled
       
    45  * @param aNewPassword a reference to type TDes, holds the mangled password
       
    46 
       
    47  * @return void
       
    48  */
       
    49 	{
       
    50 	aNewPassword.Zero();
       
    51 	char ch;
       
    52     for(TInt i=aOldPassword.Length()-1; i>=0; i--)
       
    53 	    {
       
    54 	    ch = aOldPassword[i] + 1;
       
    55 	    aNewPassword.Append(ch);
       
    56 	    }
       
    57 	}
       
    58 
       
    59 
       
    60 void CCTSYIntegrationTestPhoneSecurityBase::UnblockPinL(RMobilePhone& aMobilePhone,
       
    61 		RMobilePhone::TMobilePhoneSecurityCode aPhoneSecurityCode, TDesC& aPin, TDesC& aPuk)
       
    62 /**
       
    63  * member function for unblocking pin1/pin2 returing void
       
    64  * 
       
    65  * @param aMobilePhone a reference to RMobilePhone object
       
    66  * @param aPhoneSecurityCode holds the pin type to be unbolcked
       
    67  * @param aPin holds the pin password
       
    68  * @param aPuk holds the puk password
       
    69  *
       
    70  * @return void
       
    71  */
       
    72 
       
    73 	{
       
    74 	
       
    75 	// post notification
       
    76 	TExtEtelRequestStatus notifySecurityEventStatus(aMobilePhone, EMobilePhoneNotifySecurityEvent);
       
    77 	CleanupStack::PushL( notifySecurityEventStatus );
       
    78 	RMobilePhone::TMobilePhoneSecurityEvent securityEvent;
       
    79 	aMobilePhone.NotifySecurityEvent(notifySecurityEventStatus, securityEvent);
       
    80 	
       
    81 	RMobilePhone::TMobilePhoneSecurityCode  secCode;
       
    82 	RMobilePhone::TMobilePhoneSecurityEvent pukRequired;
       
    83 	RMobilePhone::TMobilePhoneSecurityEvent pukVerified;
       
    84 	if(aPhoneSecurityCode == RMobilePhone::ESecurityCodePuk1)
       
    85 		{
       
    86 		secCode = RMobilePhone::ESecurityCodePin1;
       
    87 		pukRequired = RMobilePhone::EPuk1Required;
       
    88 		pukVerified = RMobilePhone::EPuk1Verified;
       
    89 		
       
    90 		TExtEtelRequestStatus getSecurityCodeInfoStatus(aMobilePhone, EMobilePhoneGetSecurityCodeInfo);
       
    91 		CleanupStack::PushL( getSecurityCodeInfoStatus );	
       
    92 		RMobilePhone::TMobilePhoneSecurityCodeInfoV5 getSecurityCodeInfo;
       
    93 		RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg getSecurityCodeInfoPckg( getSecurityCodeInfo );
       
    94 		aMobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,secCode, getSecurityCodeInfoPckg);
       
    95 
       
    96 		ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::NotifySecurityEvent returns KErrOverflow from LTSY.<font color=Black>"));
       
    97 		iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityEvent(aMobilePhone,notifySecurityEventStatus,
       
    98 				securityEvent,
       
    99 				pukRequired,
       
   100 				KErrOverflow);
       
   101 
       
   102 		if( pukRequired == securityEvent )
       
   103 			{
       
   104 		aMobilePhone.NotifySecurityEvent(notifySecurityEventStatus, securityEvent);
       
   105 		TExtEtelRequestStatus verifySecurityCodeStatus(aMobilePhone, EMobilePhoneVerifySecurityCode);
       
   106 		CleanupStack::PushL( verifySecurityCodeStatus );
       
   107 		aMobilePhone.VerifySecurityCode( verifySecurityCodeStatus, aPhoneSecurityCode, 
       
   108 										aPin, aPuk );
       
   109 		ASSERT_EQUALS(WaitForRequestWithTimeOut(verifySecurityCodeStatus, ETimeLong), 
       
   110 				KErrNone, _L("RMobilePhone::VerifySecurityCode timed-out"));
       
   111 		ASSERT_EQUALS( verifySecurityCodeStatus.Int(), KErrNone, _L("RMobilePhone::VerifySecurityCode returned with an error"));
       
   112 			
       
   113 		iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityEvent(aMobilePhone,notifySecurityEventStatus,
       
   114 				securityEvent,
       
   115 				pukVerified,
       
   116 				KErrNone);
       
   117 		
       
   118 		ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
   119 		ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
   120 		CleanupStack::PopAndDestroy(&verifySecurityCodeStatus);
       
   121 			}
       
   122 		else
       
   123 			{
       
   124 			ASSERT_TRUE(EFalse, _L("RMobilePhone::EPuk1Required state not reached, unblock pin failed"));
       
   125 	
       
   126 			}
       
   127 		CleanupStack::PopAndDestroy(&getSecurityCodeInfoStatus);
       
   128 
       
   129 		}
       
   130 	else if(aPhoneSecurityCode == RMobilePhone::ESecurityCodePuk2)
       
   131 		{
       
   132 		secCode = RMobilePhone::ESecurityCodePin2;
       
   133 		pukRequired = RMobilePhone::EPuk2Required;
       
   134 		pukVerified = RMobilePhone::EPuk2Verified;
       
   135 		
       
   136 		TExtEtelRequestStatus verifySecurityCodeStatus(aMobilePhone, EMobilePhoneVerifySecurityCode);
       
   137 		CleanupStack::PushL( verifySecurityCodeStatus );
       
   138 		aMobilePhone.VerifySecurityCode( verifySecurityCodeStatus, aPhoneSecurityCode, 
       
   139 										aPin, aPuk );
       
   140 		ASSERT_EQUALS(WaitForRequestWithTimeOut(verifySecurityCodeStatus, ETimeLong), 
       
   141 				KErrNone, _L("RMobilePhone::VerifySecurityCode timed-out"));
       
   142 		ASSERT_EQUALS( verifySecurityCodeStatus.Int(), KErrNone, _L("RMobilePhone::VerifySecurityCode returned with an error"));
       
   143 			
       
   144 		iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityEvent(aMobilePhone,notifySecurityEventStatus,
       
   145 				securityEvent,
       
   146 				pukVerified,
       
   147 				KErrNone);		
       
   148 		CleanupStack::PopAndDestroy(&verifySecurityCodeStatus);
       
   149 		}
       
   150 	
       
   151 	CleanupStack::PopAndDestroy(&notifySecurityEventStatus);
       
   152 	
       
   153 	}
       
   154 
       
   155 CCTSYIntegrationTestPhoneSecurity0001::CCTSYIntegrationTestPhoneSecurity0001(CEtelSessionMgr& aEtelSessionMgr)
       
   156 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
   157 /**
       
   158  * Constructor.
       
   159  */
       
   160 	{
       
   161 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0001::GetTestStepName());
       
   162 	}
       
   163 
       
   164 CCTSYIntegrationTestPhoneSecurity0001::~CCTSYIntegrationTestPhoneSecurity0001()
       
   165 /**
       
   166  * Destructor.
       
   167  */
       
   168 	{
       
   169 	}
       
   170 
       
   171 TVerdict CCTSYIntegrationTestPhoneSecurity0001::doTestStepL()
       
   172 /**
       
   173  * @SYMTestCaseID BA-CTSY-INT-PSEC-0001
       
   174  * @SYMFssID BA/CTSY/PSEC-0001
       
   175  * @SYMTestCaseDesc Change PIN1.
       
   176  * @SYMTestPriority High
       
   177  * @SYMTestActions RMobilePhone::NotifySecurityCodeInfoChange, RMobilePhone::GetSecurityCodeInfo
       
   178  * @SYMTestExpectedResults Pass - PIN1 is changed
       
   179  * @SYMTestType CIT
       
   180  * @SYMTestCaseDependencies live/automatic
       
   181  *
       
   182  * Reason for test: Verify PIN1 can be changed and security notification completes.
       
   183  *
       
   184  * @return - TVerdict code
       
   185  */
       
   186 	{
       
   187 
       
   188 	//
       
   189 	// SET UP
       
   190 	//
       
   191 
       
   192 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   193 
       
   194 	//register with home network
       
   195 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
   196 	CHECK_EQUALS_L(ret, KErrNone, 
       
   197 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
   198 
       
   199 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
   200     TUint32 secCaps = 0;
       
   201     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC;
       
   202 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
   203 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
   204 
       
   205 	// get network operator information
       
   206 	const TDesC* networkSection = NULL;
       
   207 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
   208 	// Get the password from the ini file
       
   209 	TPtrC pin1; 
       
   210 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin1, pin1) != EFalse, 
       
   211 			_L("GetStringFromConfig returned with an error"));
       
   212 	
       
   213 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
   214 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC,RMobilePhone::ELockSetEnabled, pin1);
       
   215 
       
   216 	//
       
   217 	// SET UP END
       
   218 	//
       
   219 	
       
   220 	StartTest();
       
   221 	
       
   222 	//
       
   223 	// TEST START
       
   224 	//
       
   225 	
       
   226 	// post notification for NotifySecurityCodeInfoChange
       
   227 	TExtEtelRequestStatus notifySecurityCodeInfoChangeStatus(mobilePhone, EMobilePhoneNotifySecurityCodeInfoChange);
       
   228 	CleanupStack::PushL( notifySecurityCodeInfoChangeStatus );
       
   229 	RMobilePhone::TMobilePhoneSecurityCode securityCode;
       
   230 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityCodeInfo;
       
   231 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg securityCodeInfoPckg( securityCodeInfo );
       
   232 	mobilePhone.NotifySecurityCodeInfoChange(notifySecurityCodeInfoChangeStatus, securityCode,securityCodeInfoPckg);
       
   233 	
       
   234 	// Change the security code with RMobilePhone::ChangeSecurityCode with aType=ESecurityCodePin1 , aChange.iOldPassword=old PIN1 and aChange.iNewPassword=new valid PIN1 
       
   235 	TExtEtelRequestStatus changeSecurityCodeStatus(mobilePhone, EMobilePhoneChangeSecurityCode);
       
   236 	CleanupStack::PushL( changeSecurityCodeStatus );
       
   237 	RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange;
       
   238 	passwordChange.iOldPassword = pin1;
       
   239 	ManglePassword(pin1,passwordChange.iNewPassword);
       
   240 	mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin1,passwordChange);
       
   241 	
       
   242 	// Check RMobilePhone::NotifySecurityCodeInfoChange with aSecurityCode=ESecurityCodePin1 completes with aSecurityCodeInfo.iRemainingEntryAttempts=3
       
   243 	RMobilePhone::TMobilePhoneSecurityCode expectedSecurityCode = RMobilePhone::ESecurityCodePin1;
       
   244 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 expectedSecurityCodeInfo;
       
   245 	expectedSecurityCodeInfo.iRemainingEntryAttempts = 3;
       
   246 	TCmpBase<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> mobilePhoneSecurityCodeInfoCmpBase(expectedSecurityCodeInfo,securityCodeInfo,*this);
       
   247 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityCodeInfoChange(mobilePhone,notifySecurityCodeInfoChangeStatus,
       
   248 			expectedSecurityCode,mobilePhoneSecurityCodeInfoCmpBase, KErrNone);
       
   249 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
   250 	ASSERT_EQUALS(changeSecurityCodeStatus.Int(), KErrNone, _L("RMobilePhone::ChangeSecurityCode returned an error"));
       
   251 
       
   252 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin1 returns aSecurityCodeInfo.iRemainingEntryAttempts=3
       
   253 	TExtEtelRequestStatus getSecurityCodeInfoStatus(mobilePhone, EMobilePhoneGetSecurityCodeInfo);
       
   254 	CleanupStack::PushL( getSecurityCodeInfoStatus );
       
   255 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 getSecurityCodeInfo;
       
   256 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg getSecurityCodeInfoPckg( getSecurityCodeInfo );
       
   257 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin1, getSecurityCodeInfoPckg);
       
   258 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
   259 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
   260 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 3, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect remaining entry attempts"));
       
   261 	
       
   262 	//
       
   263 	// TEST END
       
   264 	//
       
   265 
       
   266     StartCleanup();
       
   267     
       
   268 	passwordChange.iOldPassword = passwordChange.iNewPassword;
       
   269 	passwordChange.iNewPassword = pin1;
       
   270     mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin1,passwordChange);
       
   271 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
   272 	ASSERT_EQUALS(changeSecurityCodeStatus.Int(), KErrNone, _L("RMobilePhone::ChangeSecurityCode returned an error"));
       
   273 
       
   274     iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled, pin1);
       
   275 
       
   276 	// 1 notifySecurityCodeInfoChangeStatus
       
   277     // 2 changeSecurityCodeStatus
       
   278     // 3 getSecurityCodeInfoStatus
       
   279     
       
   280 	CleanupStack::PopAndDestroy(3, &notifySecurityCodeInfoChangeStatus);
       
   281 	
       
   282 	return TestStepResult();
       
   283 	}
       
   284 
       
   285 TPtrC CCTSYIntegrationTestPhoneSecurity0001::GetTestStepName()
       
   286 /**
       
   287  * @return The test step name.
       
   288  */
       
   289 	{
       
   290 	return _L("CCTSYIntegrationTestPhoneSecurity0001");
       
   291 	}
       
   292 
       
   293 
       
   294 
       
   295 CCTSYIntegrationTestPhoneSecurity0002::CCTSYIntegrationTestPhoneSecurity0002(CEtelSessionMgr& aEtelSessionMgr)
       
   296 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
   297 /**
       
   298  * Constructor.
       
   299  */
       
   300 	{
       
   301 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0002::GetTestStepName());
       
   302 	}
       
   303 
       
   304 CCTSYIntegrationTestPhoneSecurity0002::~CCTSYIntegrationTestPhoneSecurity0002()
       
   305 /**
       
   306  * Destructor.
       
   307  */
       
   308 	{
       
   309 	}
       
   310 
       
   311 TVerdict CCTSYIntegrationTestPhoneSecurity0002::doTestStepL()
       
   312 /**
       
   313  * @SYMTestCaseID BA-CTSY-INT-PSEC-0002
       
   314  * @SYMFssID BA/CTSY/PSEC-0002
       
   315  * @SYMTestCaseDesc Change PIN1 with incorrect old PIN1.
       
   316  * @SYMTestPriority High
       
   317  * @SYMTestActions RMobilePhone::NotifySecurityCodeInfoChange, RMobilePhone::GetSecurityCodeInfo
       
   318  * @SYMTestExpectedResults Pass - KErrAccessDenied returned on attempt to change PIN with incorrect old PIN.
       
   319  * @SYMTestType CIT
       
   320  * @SYMTestCaseDependencies live/automatic
       
   321  *
       
   322  * Reason for test: Verify KErrAccessDenied returned.
       
   323  *
       
   324  * @return - TVerdict code
       
   325  */
       
   326 	{
       
   327 
       
   328 	//
       
   329 	// SET UP
       
   330 	//
       
   331 
       
   332 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   333 	
       
   334 	//register with home network
       
   335 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
   336 	CHECK_EQUALS_L(ret, KErrNone, 
       
   337 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
   338 
       
   339 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
   340     TUint32 secCaps = 0;
       
   341     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC;
       
   342 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
   343 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
   344 
       
   345 	// get network operator information
       
   346 	const TDesC* networkSection = NULL;
       
   347 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
   348 	// Get the password from the ini file
       
   349 	TPtrC pin1; 
       
   350 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin1, pin1) != EFalse, 
       
   351 			_L("GetStringFromConfig returned with an error"));
       
   352 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
   353 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC,RMobilePhone::ELockSetEnabled, pin1);
       
   354 	
       
   355 	//
       
   356 	// SET UP END
       
   357 	//
       
   358 	
       
   359 	StartTest();
       
   360 	
       
   361 	//
       
   362 	// TEST START
       
   363 	//
       
   364 
       
   365 	// post notification for NotifySecurityCodeInfoChange
       
   366 	TExtEtelRequestStatus notifySecurityCodeInfoChangeStatus(mobilePhone, EMobilePhoneNotifySecurityCodeInfoChange);
       
   367 	CleanupStack::PushL( notifySecurityCodeInfoChangeStatus );
       
   368 	RMobilePhone::TMobilePhoneSecurityCode securityCode;
       
   369 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityCodeInfo;
       
   370 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg securityCodeInfoPckg( securityCodeInfo );
       
   371 	mobilePhone.NotifySecurityCodeInfoChange(notifySecurityCodeInfoChangeStatus, securityCode,securityCodeInfoPckg);
       
   372 	
       
   373 	// Attempt to change PIN1 with incorrect old PIN1 with RMobilePhone::ChangeSecurityCode with aType=ESecurityCodePin1 , aChange.iOldPassword=incorrect old PIN1 and aChange.iNewPassword=new valid PIN1 	
       
   374 	TExtEtelRequestStatus changeSecurityCodeStatus(mobilePhone, EMobilePhoneChangeSecurityCode);
       
   375 	CleanupStack::PushL( changeSecurityCodeStatus );
       
   376 	RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange;
       
   377 	passwordChange.iOldPassword = _L("abcd"); // incorrect pin
       
   378 	passwordChange.iNewPassword = pin1;
       
   379 	mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin1,passwordChange);
       
   380 
       
   381 	// Check KErrGsm0707IncorrectPassword / KErrAccessDenied  is returned.
       
   382 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
   383 	ASSERT_TRUE( ( changeSecurityCodeStatus.Int() == KErrAccessDenied
       
   384 					|| changeSecurityCodeStatus.Int() == KErrGsm0707IncorrectPassword ), _L("RMobilePhone::ChangeSecurityCode did not return an error"));
       
   385 
       
   386 	// Check RMobilePhone::NotifySecurityCodeInfoChange with aSecurityCode=ESecurityCodePin1 completes with aSecurityCodeInfo.iRemainingEntryAttempts=2
       
   387 	RMobilePhone::TMobilePhoneSecurityCode expectedSecurityCode = RMobilePhone::ESecurityCodePin1;
       
   388 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 expectedSecurityCodeInfo;
       
   389 	expectedSecurityCodeInfo.iRemainingEntryAttempts = 2;
       
   390 	TCmpBase<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> mobilePhoneSecurityCodeInfoCmpBase(expectedSecurityCodeInfo,securityCodeInfo,*this);
       
   391 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityCodeInfoChange(mobilePhone,notifySecurityCodeInfoChangeStatus,
       
   392 			expectedSecurityCode,mobilePhoneSecurityCodeInfoCmpBase, KErrNone);
       
   393 
       
   394 
       
   395 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin1 returns aSecurityCodeInfo.iRemainingEntryAttempts=2
       
   396 	TExtEtelRequestStatus getSecurityCodeInfoStatus(mobilePhone, EMobilePhoneGetSecurityCodeInfo);
       
   397 	CleanupStack::PushL( getSecurityCodeInfoStatus );
       
   398 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 getSecurityCodeInfo;
       
   399 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg getSecurityCodeInfoPckg( getSecurityCodeInfo );
       
   400 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin1, getSecurityCodeInfoPckg);
       
   401 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
   402 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
   403 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 2, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect remaining entry attempts"));
       
   404 	
       
   405 	//
       
   406 	// TEST END
       
   407 	//
       
   408 
       
   409     StartCleanup();
       
   410 	
       
   411     iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled, pin1);
       
   412 
       
   413 	// 1 notifySecurityCodeInfoChangeStatus
       
   414     // 2 changeSecurityCodeStatus
       
   415     // 3 getSecurityCodeInfoStatus
       
   416     
       
   417 	CleanupStack::PopAndDestroy(3, &notifySecurityCodeInfoChangeStatus);
       
   418 
       
   419 	return TestStepResult();
       
   420 	}
       
   421 
       
   422 TPtrC CCTSYIntegrationTestPhoneSecurity0002::GetTestStepName()
       
   423 /**
       
   424  * @return The test step name.
       
   425  */
       
   426 	{
       
   427 	return _L("CCTSYIntegrationTestPhoneSecurity0002");
       
   428 	}
       
   429 
       
   430 
       
   431 
       
   432 CCTSYIntegrationTestPhoneSecurity0003::CCTSYIntegrationTestPhoneSecurity0003(CEtelSessionMgr& aEtelSessionMgr)
       
   433 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
   434 /**
       
   435  * Constructor.
       
   436  */
       
   437 	{
       
   438 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0003::GetTestStepName());
       
   439 	}
       
   440 
       
   441 CCTSYIntegrationTestPhoneSecurity0003::~CCTSYIntegrationTestPhoneSecurity0003()
       
   442 /**
       
   443  * Destructor.
       
   444  */
       
   445 	{
       
   446 	}
       
   447 
       
   448 TVerdict CCTSYIntegrationTestPhoneSecurity0003::doTestStepL()
       
   449 /**
       
   450  * @SYMTestCaseID BA-CTSY-INT-PSEC-0003
       
   451  * @SYMFssID BA/CTSY/PSEC-0003
       
   452  * @SYMTestCaseDesc Change PIN1 when new PIN1 is only 3 digits long.
       
   453  * @SYMTestPriority High
       
   454  * @SYMTestActions RMobilePhone::NotifySecurityCodeInfoChange, RMobilePhone::GetSecurityCodeInfo
       
   455  * @SYMTestExpectedResults Pass - PIN1 is not changed
       
   456  * @SYMTestType CIT
       
   457  * @SYMTestCaseDependencies live/automatic
       
   458  *
       
   459  * Reason for test: Verify error is returned.
       
   460  *
       
   461  * @return - TVerdict code
       
   462  */
       
   463 	{
       
   464 
       
   465 	//
       
   466 	// SET UP
       
   467 	//
       
   468 
       
   469 	
       
   470 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
   471 
       
   472 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
   473 
       
   474 
       
   475 	//
       
   476 	// SET UP END
       
   477 	//
       
   478 	
       
   479 	StartTest();
       
   480 	
       
   481 	//
       
   482 	// TEST START
       
   483 	//
       
   484 	
       
   485 	
       
   486 	// Attempt to change PIN1 to a new 3 digit PIN1 with RMobilePhone::ChangeSecurityCode with aType=ESecurityCodePin1, aChange.iOldPassword=old PIN1 and aChange.iNewPassword=3 digit number 
       
   487 
       
   488 	// Check error is returned.
       
   489 
       
   490 	// Check RMobilePhone::NotifySecurityCodeInfoChange with aSecurityCode=ESecurityCodePin1 completes with aSecurityCodeInfo.iRemainingEntryAttempts=2
       
   491 
       
   492 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin1 returns aSecurityCodeInfo.iRemainingEntryAttempts=2
       
   493 
       
   494 	
       
   495 	//
       
   496 	// TEST END
       
   497 	//
       
   498 
       
   499     StartCleanup();
       
   500 	
       
   501 	// Put any required test clean up here, then remove this comment
       
   502 	
       
   503 	return TestStepResult();
       
   504 	}
       
   505 
       
   506 TPtrC CCTSYIntegrationTestPhoneSecurity0003::GetTestStepName()
       
   507 /**
       
   508  * @return The test step name.
       
   509  */
       
   510 	{
       
   511 	return _L("CCTSYIntegrationTestPhoneSecurity0003");
       
   512 	}
       
   513 
       
   514 
       
   515 
       
   516 CCTSYIntegrationTestPhoneSecurity0004::CCTSYIntegrationTestPhoneSecurity0004(CEtelSessionMgr& aEtelSessionMgr)
       
   517 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
   518 /**
       
   519  * Constructor.
       
   520  */
       
   521 	{
       
   522 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0004::GetTestStepName());
       
   523 	}
       
   524 
       
   525 CCTSYIntegrationTestPhoneSecurity0004::~CCTSYIntegrationTestPhoneSecurity0004()
       
   526 /**
       
   527  * Destructor.
       
   528  */
       
   529 	{
       
   530 	}
       
   531 
       
   532 TVerdict CCTSYIntegrationTestPhoneSecurity0004::doTestStepL()
       
   533 /**
       
   534  * @SYMTestCaseID BA-CTSY-INT-PSEC-0004
       
   535  * @SYMFssID BA/CTSY/PSEC-0004
       
   536  * @SYMTestCaseDesc Disable PIN1.
       
   537  * @SYMTestPriority High
       
   538  * @SYMTestActions RMobilePhone::GetLockInfo, RMobilePhone::NotifyLockInfoChange, RMobilePhone::GetSubscriberId
       
   539  * @SYMTestExpectedResults Pass - PIN1 is disabled
       
   540  * @SYMTestType CIT
       
   541  * @SYMTestCaseDependencies live/automatic
       
   542  *
       
   543  * Reason for test: Verify lock info change notification completes and lock info correct.
       
   544  *
       
   545  * @return - TVerdict code
       
   546  */
       
   547 	{
       
   548 
       
   549 	//
       
   550 	// SET UP
       
   551 	//
       
   552 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   553 	
       
   554 	//register with home network
       
   555 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
   556 	CHECK_EQUALS_L(ret, KErrNone, 
       
   557 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
   558 
       
   559 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
   560     TUint32 secCaps = 0;
       
   561     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC;
       
   562 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
   563 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
   564 
       
   565 	// get network operator information
       
   566 	const TDesC* networkSection = NULL;
       
   567 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
   568 	// Get the password from the ini file
       
   569 	TPtrC pin1; 
       
   570 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin1, pin1) != EFalse, 
       
   571 			_L("GetStringFromConfig returned with an error"));
       
   572 	
       
   573 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
   574 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC,RMobilePhone::ELockSetEnabled, pin1);
       
   575 
       
   576 	//
       
   577 	// SET UP END
       
   578 	//
       
   579 	
       
   580 	StartTest();
       
   581 	
       
   582 	//
       
   583 	// TEST START
       
   584 	//
       
   585 	
       
   586 	// post notification
       
   587 	RMobilePhone::TMobilePhoneLock mobilePhoneLock;
       
   588     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
   589     RMobilePhone::TMobilePhoneLockInfoV1 expectedLockInfo;
       
   590     expectedLockInfo.iSetting = RMobilePhone::ELockSetDisabled;
       
   591 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoPckg(lockInfo);
       
   592 	TExtEtelRequestStatus notifyLockInfoChangeStatus(mobilePhone, EMobilePhoneNotifyLockInfoChange);
       
   593 	CleanupStack::PushL(notifyLockInfoChangeStatus);
       
   594 	mobilePhone.NotifyLockInfoChange(notifyLockInfoChangeStatus, mobilePhoneLock, infoPckg);
       
   595 	
       
   596 	// Disable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC and aSetting=ELockSetDisabled 
       
   597 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled, pin1);
       
   598 	  
       
   599 	// Check RMobilePhone::NotifyLockInfoChange with aLock=ELockICC completes with aLockInfo.iStatus=EStatusUnlocked and aLockInfo.iSetting=ELockSetDisabled
       
   600 	TCmpTMobilePhoneLockInfoV1NoStatus lockInfoCmp(expectedLockInfo,lockInfo,*this);
       
   601 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifyLockInfoChange(mobilePhone,notifyLockInfoChangeStatus,
       
   602 			mobilePhoneLock,RMobilePhone::ELockICC,lockInfoCmp,KErrNone);
       
   603 	ASSERT_EQUALS(lockInfo.iSetting, RMobilePhone::ELockSetDisabled, _L("RMobilePhone::NotifyLockInfoChange TMobilePhoneLockInfoV1.iSetting is not ELockSetDisabled as expected"));
       
   604 
       
   605 	// Check RMobilePhone::GetLockInfo with aLock=ELockICC  returs aLockInfo.iStatus=EStatusUnlocked and aLockInfo.iSetting=ELockSetDisabled
       
   606 	TExtEtelRequestStatus getLockInfoStatus(mobilePhone, EMobilePhoneGetLockInfo);
       
   607 	CleanupStack::PushL(getLockInfoStatus);
       
   608 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockICC, infoPckg);
       
   609 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
   610 	ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
   611 	ASSERT_EQUALS(lockInfo.iStatus, RMobilePhone::EStatusUnlocked, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusUnlocked as expected"));
       
   612 	ASSERT_EQUALS(lockInfo.iSetting, RMobilePhone::ELockSetDisabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetDisabled as expected"));
       
   613 
       
   614 	// ===  Ensure success of disabling PIN1 by carrying out an operation which would normally require PIN1 ===
       
   615 
       
   616 	// Check RMobilePhone::GetSubscriberId returns an IMSI with length > 0
       
   617 	TExtEtelRequestStatus getSubscriberIdStatus(mobilePhone, EMobilePhoneGetSubscriberId);
       
   618 	CleanupStack::PushL(getSubscriberIdStatus);
       
   619 	RMobilePhone::TMobilePhoneSubscriberId mobilePhoneSubscriberId;
       
   620 	mobilePhone.GetSubscriberId(getSubscriberIdStatus, mobilePhoneSubscriberId);
       
   621 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSubscriberIdStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetSubscriberId timed out"));
       
   622 	ASSERT_EQUALS(getSubscriberIdStatus.Int(), KErrNone, _L("RMobilePhone::GetSubscriberId returned with an error"));
       
   623 	ASSERT_TRUE(mobilePhoneSubscriberId.Length() > 0 , _L("RMobilePhone::GetSubscriberId returns an IMSI with length not greater than 0"));
       
   624 
       
   625 	//
       
   626 	// TEST END
       
   627 	//
       
   628 
       
   629     StartCleanup();
       
   630 	
       
   631 	// 1 notifyLockInfoChangeStatus
       
   632     // 2 getLockInfoStatus
       
   633     // 3 getSubscriberIdStatus
       
   634     
       
   635 	CleanupStack::PopAndDestroy(3, &notifyLockInfoChangeStatus);
       
   636 	
       
   637 	return TestStepResult();
       
   638 	}
       
   639 
       
   640 TPtrC CCTSYIntegrationTestPhoneSecurity0004::GetTestStepName()
       
   641 /**
       
   642  * @return The test step name.
       
   643  */
       
   644 	{
       
   645 	return _L("CCTSYIntegrationTestPhoneSecurity0004");
       
   646 	}
       
   647 
       
   648 
       
   649 
       
   650 CCTSYIntegrationTestPhoneSecurity0005::CCTSYIntegrationTestPhoneSecurity0005(CEtelSessionMgr& aEtelSessionMgr)
       
   651 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
   652 /**
       
   653  * Constructor.
       
   654  */
       
   655 	{
       
   656 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0005::GetTestStepName());
       
   657 	}
       
   658 
       
   659 CCTSYIntegrationTestPhoneSecurity0005::~CCTSYIntegrationTestPhoneSecurity0005()
       
   660 /**
       
   661  * Destructor.
       
   662  */
       
   663 	{
       
   664 	}
       
   665 
       
   666 TVerdict CCTSYIntegrationTestPhoneSecurity0005::doTestStepL()
       
   667 /**
       
   668  * @SYMTestCaseID BA-CTSY-INT-PSEC-0005
       
   669  * @SYMFssID BA/CTSY/PSEC-0005
       
   670  * @SYMTestCaseDesc Change PIN1 when it is deactivated.
       
   671  * @SYMTestPriority High
       
   672  * @SYMTestActions RMobilePhone::NotifySecurityCodeInfoChange, RMobilePhone::GetSecurityCodeInfo
       
   673  * @SYMTestExpectedResults Pass - PIN 1 changed successfully.
       
   674  * @SYMTestType CIT
       
   675  * @SYMTestCaseDependencies live/automatic
       
   676  *
       
   677  * Reason for test: Verify PIN1 can be changed and security notification completes.
       
   678  *
       
   679  * @return - TVerdict code
       
   680  */
       
   681 	{
       
   682 
       
   683 	//
       
   684 	// SET UP
       
   685 	//
       
   686 
       
   687 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   688 	
       
   689 	//register with home network
       
   690 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
   691 	CHECK_EQUALS_L(ret, KErrNone, 
       
   692 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
   693 
       
   694 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
   695     TUint32 secCaps = 0;
       
   696     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC;
       
   697 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
   698 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
   699 
       
   700 	// get network operator information
       
   701 	const TDesC* networkSection = NULL;
       
   702 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
   703 	// Get the password from the ini file
       
   704 	TPtrC pin1; 
       
   705 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin1, pin1) != EFalse, 
       
   706 			_L("GetStringFromConfig returned with an error"));
       
   707 	
       
   708 	// Disable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetDisabled 
       
   709 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC,RMobilePhone::ELockSetDisabled, pin1);
       
   710 
       
   711 	// Ensure RMobilePhone::GetLockInfo with aLock=ELockICC returns iSetting=ELockSetDisabled 
       
   712 	TExtEtelRequestStatus getLockInfoStatus(mobilePhone, EMobilePhoneGetLockInfo);
       
   713 	CleanupStack::PushL(getLockInfoStatus);
       
   714     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
   715 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoPckg(lockInfo);
       
   716 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockICC, infoPckg);
       
   717 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
   718 	CHECK_EQUALS_L(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
   719 	CHECK_EQUALS_L(lockInfo.iSetting, RMobilePhone::ELockSetDisabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetDisabled as expected"));
       
   720 
       
   721 
       
   722 	//
       
   723 	// SET UP END
       
   724 	//
       
   725 	
       
   726 	StartTest();
       
   727 	
       
   728 	//
       
   729 	// TEST START
       
   730 	//
       
   731 	
       
   732 	// post notification for NotifySecurityCodeInfoChange
       
   733 	TExtEtelRequestStatus notifySecurityCodeInfoChangeStatus(mobilePhone, EMobilePhoneNotifySecurityCodeInfoChange);
       
   734 	CleanupStack::PushL( notifySecurityCodeInfoChangeStatus );
       
   735 	RMobilePhone::TMobilePhoneSecurityCode securityCode;
       
   736 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityCodeInfo;
       
   737 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg securityCodeInfoPckg( securityCodeInfo );
       
   738 	mobilePhone.NotifySecurityCodeInfoChange(notifySecurityCodeInfoChangeStatus, securityCode,securityCodeInfoPckg);
       
   739 	
       
   740 	// Change the security code with RMobilePhone::ChangeSecurityCode with aType=ESecurityCodePin1 , aChange.iOldPassword=old PIN1 and aChange.iNewPassword=new valid PIN1 
       
   741 	TExtEtelRequestStatus changeSecurityCodeStatus(mobilePhone, EMobilePhoneChangeSecurityCode);
       
   742 	CleanupStack::PushL( changeSecurityCodeStatus );
       
   743 	RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange;
       
   744 	passwordChange.iOldPassword = pin1;
       
   745 	ManglePassword(pin1,passwordChange.iNewPassword);
       
   746 	mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin1,passwordChange);
       
   747 	
       
   748 	// Check RMobilePhone::NotifySecurityCodeInfoChange with aSecurityCode=ESecurityCodePin1 completes with aSecurityCodeInfo.iRemainingEntryAttempts=3
       
   749 	RMobilePhone::TMobilePhoneSecurityCode expectedSecurityCode = RMobilePhone::ESecurityCodePin1;
       
   750 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 expectedSecurityCodeInfo;
       
   751 	expectedSecurityCodeInfo.iRemainingEntryAttempts = 3;
       
   752 	TCmpBase<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> mobilePhoneSecurityCodeInfoCmpBase(expectedSecurityCodeInfo,securityCodeInfo,*this);
       
   753 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityCodeInfoChange(mobilePhone,notifySecurityCodeInfoChangeStatus,
       
   754 			expectedSecurityCode,mobilePhoneSecurityCodeInfoCmpBase, KErrNone);
       
   755 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
   756 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::ChangeSecurityCode returns KErrGeneral from LTSY.<font color=Black>"));
       
   757 	ASSERT_EQUALS(changeSecurityCodeStatus.Int(), KErrGeneral, _L("RMobilePhone::ChangeSecurityCode returned an error"));
       
   758 
       
   759 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin1 returns aSecurityCodeInfo.iRemainingEntryAttempts=3
       
   760 	TExtEtelRequestStatus getSecurityCodeInfoStatus(mobilePhone, EMobilePhoneGetSecurityCodeInfo);
       
   761 	CleanupStack::PushL( getSecurityCodeInfoStatus );
       
   762 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 getSecurityCodeInfo;
       
   763 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg getSecurityCodeInfoPckg( getSecurityCodeInfo );
       
   764 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin1, getSecurityCodeInfoPckg);
       
   765 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
   766 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
   767 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 3, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect remaining entry attempts"));
       
   768 
       
   769 	//
       
   770 	// TEST END
       
   771 	//
       
   772 
       
   773     StartCleanup();
       
   774 	
       
   775 	passwordChange.iOldPassword = passwordChange.iNewPassword;
       
   776 	passwordChange.iNewPassword = pin1;
       
   777     mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin1,passwordChange);
       
   778 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
   779 	ASSERT_EQUALS(changeSecurityCodeStatus.Int(), KErrNone, _L("RMobilePhone::ChangeSecurityCode returned an error"));
       
   780 
       
   781     // 1 getLockInfoStatus
       
   782     // 2 notifySecurityCodeInfoChangeStatus
       
   783     // 3 changeSecurityCodeStatus
       
   784     // 4 getSecurityCodeInfoStatus
       
   785     
       
   786 	CleanupStack::PopAndDestroy(4, &getLockInfoStatus);
       
   787     
       
   788 	return TestStepResult();
       
   789 	}
       
   790 
       
   791 TPtrC CCTSYIntegrationTestPhoneSecurity0005::GetTestStepName()
       
   792 /**
       
   793  * @return The test step name.
       
   794  */
       
   795 	{
       
   796 	return _L("CCTSYIntegrationTestPhoneSecurity0005");
       
   797 	}
       
   798 
       
   799 
       
   800 
       
   801 CCTSYIntegrationTestPhoneSecurity0006::CCTSYIntegrationTestPhoneSecurity0006(CEtelSessionMgr& aEtelSessionMgr)
       
   802 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
   803 /**
       
   804  * Constructor.
       
   805  */
       
   806 	{
       
   807 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0006::GetTestStepName());
       
   808 	}
       
   809 
       
   810 CCTSYIntegrationTestPhoneSecurity0006::~CCTSYIntegrationTestPhoneSecurity0006()
       
   811 /**
       
   812  * Destructor.
       
   813  */
       
   814 	{
       
   815 	}
       
   816 
       
   817 TVerdict CCTSYIntegrationTestPhoneSecurity0006::doTestStepL()
       
   818 /**
       
   819  * @SYMTestCaseID BA-CTSY-INT-PSEC-0006
       
   820  * @SYMFssID BA/CTSY/PSEC-0006
       
   821  * @SYMTestCaseDesc Enable PIN1.
       
   822  * @SYMTestPriority High
       
   823  * @SYMTestActions RMobilePhone::GetLockInfo, RMobilePhone::NotifyLockInfoChange, RMobilePhone::VerifySecurityCode, RMobilePhone::NotifySecurityEvent
       
   824  * @SYMTestExpectedResults Pass - PIN1 is activated
       
   825  * @SYMTestType CIT
       
   826  * @SYMTestCaseDependencies live/automatic
       
   827  *
       
   828  * Reason for test: Verify lock info change notification completes and lock info correct.
       
   829  *
       
   830  * @return - TVerdict code
       
   831  */
       
   832 	{
       
   833 	ERR_PRINTF1(_L("<font color=Orange>$CTSYKnownFailure: defect id = 10001</font>"));
       
   834 
       
   835 	//
       
   836 	// SET UP
       
   837 	//
       
   838 	
       
   839 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
   840     RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   841     TUint32 secCaps;
       
   842     TUint32 expectedCaps = (RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC);
       
   843 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
   844 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
   845     
       
   846 	//
       
   847 	// SET UP END
       
   848 	//
       
   849 		
       
   850 	StartTest();
       
   851 	
       
   852 	//
       
   853 	// TEST START
       
   854 	//
       
   855 	
       
   856 	// ===  Enable PIN1 ===
       
   857 	
       
   858 	// get network operator information
       
   859 	const TDesC* networkSection = NULL;
       
   860 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
   861 	// Get the password from the ini file
       
   862 	TPtrC pin1; 
       
   863 	ASSERT_TRUE(GetStringFromConfig(*networkSection, KIniPin1, pin1) != EFalse, 
       
   864 			_L("GetStringFromConfig returned with an error"));
       
   865 
       
   866 	// post notification
       
   867 	RMobilePhone::TMobilePhoneLock mobilePhoneLock1;
       
   868     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo1;
       
   869     RMobilePhone::TMobilePhoneLockInfoV1 expectedLockInfo;
       
   870     expectedLockInfo.iSetting = RMobilePhone::ELockSetEnabled;
       
   871 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoPckg1(lockInfo1);
       
   872 	TExtEtelRequestStatus notifyLockInfoChangeStatus1(mobilePhone, EMobilePhoneNotifyLockInfoChange);
       
   873 	CleanupStack::PushL(notifyLockInfoChangeStatus1);
       
   874 	mobilePhone.NotifyLockInfoChange(notifyLockInfoChangeStatus1, mobilePhoneLock1, infoPckg1);
       
   875 
       
   876 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
   877 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC,RMobilePhone::ELockSetEnabled, pin1);
       
   878 
       
   879 	// Check RMobilePhone::NotifyLockInfoChange with aLock=ELockICC completes with aLockInfo.iSetting=ELockSetEnabled
       
   880 	TCmpTMobilePhoneLockInfoV1NoStatus lockInfoCmp1(expectedLockInfo,lockInfo1,*this);
       
   881 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifyLockInfoChange(mobilePhone,notifyLockInfoChangeStatus1,
       
   882 					mobilePhoneLock1,RMobilePhone::ELockICC,lockInfoCmp1,KErrNone);
       
   883 	ASSERT_EQUALS(lockInfo1.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::NotifyLockInfoChange TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
   884 
       
   885 	// Check RMobilePhone::GetLockInfo with aLock=ELockICC  returns aLockInfo.iSetting=ELockSetEnabled
       
   886 	TExtEtelRequestStatus getLockInfoStatus(mobilePhone, EMobilePhoneGetLockInfo);
       
   887 	CleanupStack::PushL(getLockInfoStatus);
       
   888 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockICC, infoPckg1);
       
   889 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
   890 	ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
   891 	ASSERT_EQUALS(lockInfo1.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
   892 
       
   893 	// ===  Disable PIN1 ===
       
   894 	// post notification
       
   895 	RMobilePhone::TMobilePhoneLock mobilePhoneLock2;
       
   896     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo2;
       
   897     expectedLockInfo.iSetting = RMobilePhone::ELockSetDisabled;
       
   898 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoPckg2(lockInfo2);
       
   899 	TExtEtelRequestStatus notifyLockInfoChangeStatus2(mobilePhone, EMobilePhoneNotifyLockInfoChange);
       
   900 	CleanupStack::PushL(notifyLockInfoChangeStatus2);
       
   901 	mobilePhone.NotifyLockInfoChange(notifyLockInfoChangeStatus2, mobilePhoneLock2, infoPckg2);
       
   902 
       
   903 	// Disable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetDisabled 
       
   904 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled,pin1);
       
   905 
       
   906 	// Check RMobilePhone::NotifyLockInfoChange with aLock=ELockICC completes with aLockInfo.iStatus=EStatusUnlocked and aLockInfo.iSetting=ELockSetDisabled
       
   907 	TCmpTMobilePhoneLockInfoV1NoStatus lockInfoCmp2(expectedLockInfo,lockInfo2,*this);
       
   908 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifyLockInfoChange(mobilePhone,notifyLockInfoChangeStatus2,
       
   909 			mobilePhoneLock2,RMobilePhone::ELockICC,lockInfoCmp2,KErrNone);
       
   910 	ASSERT_EQUALS(lockInfo2.iSetting, RMobilePhone::ELockSetDisabled, _L("RMobilePhone::NotifyLockInfoChange TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
   911 	
       
   912 	// Check RMobilePhone::GetLockInfo with aLock=ELockICC  returns  aLockInfo.iSetting=ELockSetDisabled
       
   913     mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockICC, infoPckg2);
       
   914     ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
   915     ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
   916 	ASSERT_EQUALS(lockInfo2.iSetting, RMobilePhone::ELockSetDisabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
   917 
       
   918 	//
       
   919 	// TEST END
       
   920 	//
       
   921 
       
   922     StartCleanup();
       
   923 	
       
   924 	// Pop
       
   925 	// notifyLockInfoChangeStatus1
       
   926 	// getLockInfoStatus
       
   927 	// notifyLockInfoChangeStatus2
       
   928 	CleanupStack::Pop(3, &notifyLockInfoChangeStatus1);
       
   929 	
       
   930 	return TestStepResult();
       
   931 	}
       
   932 
       
   933 TPtrC CCTSYIntegrationTestPhoneSecurity0006::GetTestStepName()
       
   934 /**
       
   935  * @return The test step name.
       
   936  */
       
   937 	{
       
   938 	return _L("CCTSYIntegrationTestPhoneSecurity0006");
       
   939 	}
       
   940 
       
   941 
       
   942 
       
   943 CCTSYIntegrationTestPhoneSecurity0007::CCTSYIntegrationTestPhoneSecurity0007(CEtelSessionMgr& aEtelSessionMgr)
       
   944 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
   945 /**
       
   946  * Constructor.
       
   947  */
       
   948 	{
       
   949 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0007::GetTestStepName());
       
   950 	}
       
   951 
       
   952 CCTSYIntegrationTestPhoneSecurity0007::~CCTSYIntegrationTestPhoneSecurity0007()
       
   953 /**
       
   954  * Destructor.
       
   955  */
       
   956 	{
       
   957 	}
       
   958 
       
   959 TVerdict CCTSYIntegrationTestPhoneSecurity0007::doTestStepL()
       
   960 /**
       
   961  * @SYMTestCaseID BA-CTSY-INT-PSEC-0007
       
   962  * @SYMFssID BA/CTSY/PSEC-0007
       
   963  * @SYMTestCaseDesc Check failure of PIN1 change procedure when PIN1 is blocked
       
   964  * @SYMTestPriority High
       
   965  * @SYMTestActions 
       
   966  * @SYMTestExpectedResults Pass - Cannot unlock a blocked PIN.
       
   967  * @SYMTestType CIT
       
   968  * @SYMTestCaseDependencies live/manual
       
   969  *
       
   970  * Reason for test: Verify changing PIN1 fails.
       
   971  *
       
   972  * @return - TVerdict code
       
   973  */
       
   974 	{
       
   975 
       
   976 	//
       
   977 	// SET UP
       
   978 	//
       
   979 
       
   980 	
       
   981 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC. 
       
   982 
       
   983 	// ===  Block PIN1 ===
       
   984 
       
   985 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
   986 
       
   987 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
   988 
       
   989 	// Block PIN1 by calling RMobilePhone::VerifySecurityCode with aType=ESecurityCodePin1, aCode = wrong PIN1 until RMobilePhone::GetLockInfo with aLock=ELockICC returns TMobilePhoneSecurityCodeInfoV5::iRemainingEntryAttempts=0 then calling RMobilePhone::VerifySecurityCode one more time with aCode=wrong PIN1. 
       
   990 
       
   991 	// Check RMobilePhone::GetLockInfo with aLock=ELockICC returns iSetting=ELockSetEnabled and iStatus=EStatusBlocked
       
   992 
       
   993 
       
   994 	//
       
   995 	// SET UP END
       
   996 	//
       
   997 	
       
   998 	StartTest();
       
   999 	
       
  1000 	//
       
  1001 	// TEST START
       
  1002 	//
       
  1003 	
       
  1004 	
       
  1005 	// Change the security code with RMobilePhone::ChangeSecurityCode with aType=ESecurityCodePin1 , aChange.iOldPassword=old PIN1 and aChange.iNewPassword=new valid PIN1 
       
  1006 
       
  1007 	// Check error is returned.
       
  1008 
       
  1009 	
       
  1010 	//
       
  1011 	// TEST END
       
  1012 	//
       
  1013 
       
  1014     StartCleanup();
       
  1015 	
       
  1016 	// Put any required test clean up here, then remove this comment
       
  1017 	
       
  1018 	return TestStepResult();
       
  1019 	}
       
  1020 
       
  1021 TPtrC CCTSYIntegrationTestPhoneSecurity0007::GetTestStepName()
       
  1022 /**
       
  1023  * @return The test step name.
       
  1024  */
       
  1025 	{
       
  1026 	return _L("CCTSYIntegrationTestPhoneSecurity0007");
       
  1027 	}
       
  1028 
       
  1029 
       
  1030 
       
  1031 CCTSYIntegrationTestPhoneSecurity0008::CCTSYIntegrationTestPhoneSecurity0008(CEtelSessionMgr& aEtelSessionMgr)
       
  1032 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  1033 /**
       
  1034  * Constructor.
       
  1035  */
       
  1036 	{
       
  1037 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0008::GetTestStepName());
       
  1038 	}
       
  1039 
       
  1040 CCTSYIntegrationTestPhoneSecurity0008::~CCTSYIntegrationTestPhoneSecurity0008()
       
  1041 /**
       
  1042  * Destructor.
       
  1043  */
       
  1044 	{
       
  1045 	}
       
  1046 
       
  1047 TVerdict CCTSYIntegrationTestPhoneSecurity0008::doTestStepL()
       
  1048 /**
       
  1049  * @SYMTestCaseID BA-CTSY-INT-PSEC-0008
       
  1050  * @SYMFssID BA/CTSY/PSEC-0008
       
  1051  * @SYMTestCaseDesc Unblock PIN1.
       
  1052  * @SYMTestPriority High
       
  1053  * @SYMTestActions RMobilePhone::GetSecurityCodeInfo, RMobilePhone::NotifySecurityEvent, RMobilePhone::GetLockInfo, RMobilePhone::NotifyLockInfoChange, RMobilePhone::NotifySecurityCapsChange
       
  1054  * @SYMTestExpectedResults Pass - PIN1 is unblocked
       
  1055  * @SYMTestType CIT
       
  1056  * @SYMTestCaseDependencies live/manual
       
  1057  *
       
  1058  * Reason for test: Verify PIN1 can be unblocked and number of retry attempts is correct.
       
  1059  *
       
  1060  * @return - TVerdict code
       
  1061  */
       
  1062 	{
       
  1063 
       
  1064 	//
       
  1065 	// SET UP
       
  1066 	//
       
  1067 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1068 	
       
  1069 	//reigster with home network
       
  1070 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
  1071 	CHECK_EQUALS_L(ret, KErrNone, 
       
  1072 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
  1073 
       
  1074 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 
       
  1075 	TUint32 secCaps = 0;
       
  1076     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin1;
       
  1077 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
  1078 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
  1079 
       
  1080 	// ===  Block PIN1 ===
       
  1081 
       
  1082 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
  1083 	expectedCaps = RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC;
       
  1084 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
  1085 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
  1086 
       
  1087 	
       
  1088 	// get network operator information
       
  1089 	const TDesC* networkSection = NULL;
       
  1090 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
  1091 	// Get the password from the ini file
       
  1092 	TPtrC pin1; 
       
  1093 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin1, pin1) != EFalse, 
       
  1094 			_L("GetStringFromConfig returned with an error"));
       
  1095 	
       
  1096 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
  1097 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC,RMobilePhone::ELockSetEnabled, pin1);
       
  1098 
       
  1099 	// Block PIN1 by calling RMobilePhone::VerifySecurityCode with aType=ESecurityCodePin1, aCode = wrong PIN1 until RMobilePhone::GetLockInfo with aLock=ELockICC returns TMobilePhoneSecurityCodeInfoV5::iRemainingEntryAttempts=0 then calling RMobilePhone::VerifySecurityCode one more time with aCode=wrong PIN1. 
       
  1100 	iPhoneTsyTestHelper.BlockPinL(mobilePhone,RMobilePhone::ESecurityCodePin1);
       
  1101 	
       
  1102 	// Check RMobilePhone::GetLockInfo with aLock=ELockICC returns iSetting=ELockSetEnabled and iStatus=EStatusBlocked
       
  1103 	TExtEtelRequestStatus getLockInfoStatus(mobilePhone, EMobilePhoneGetLockInfo);
       
  1104 	CleanupStack::PushL(getLockInfoStatus);
       
  1105     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
  1106 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoPckg(lockInfo);
       
  1107 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockICC, infoPckg);
       
  1108 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
  1109 	CHECK_TRUE_L(getLockInfoStatus.Int() != KErrNone, _L("RMobilePhone::GetLockInfo did not returned with an error"));
       
  1110 	CHECK_EQUALS_L(lockInfo.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
  1111 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusBlocked as expected.<font color=Black>"));
       
  1112 	// CHECK_EQUALS_L(lockInfo.iStatus, RMobilePhone::EStatusBlocked, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusBlocked as expected"));
       
  1113 
       
  1114 	//
       
  1115 	// SET UP END
       
  1116 	//
       
  1117 	
       
  1118 	StartTest();
       
  1119 	
       
  1120 	//
       
  1121 	// TEST START
       
  1122 	//
       
  1123 	
       
  1124 	
       
  1125 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin1 returns aSecurityCodeInfo.iRemainingEntryAttempts=0
       
  1126 	TExtEtelRequestStatus getSecurityCodeInfoStatus(mobilePhone, EMobilePhoneGetSecurityCodeInfo);
       
  1127 	CleanupStack::PushL( getSecurityCodeInfoStatus );
       
  1128 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 getSecurityCodeInfo;
       
  1129 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg getSecurityCodeInfoPckg( getSecurityCodeInfo );
       
  1130 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin1, getSecurityCodeInfoPckg);
       
  1131 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
  1132 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
  1133 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 0, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect aSecurityCodeInfo.iRemainingEntryAttempts"));
       
  1134 	
       
  1135 	//post notification for security caps change
       
  1136 	TExtEtelRequestStatus notifySecurityCapsChangeStatus(mobilePhone, EMobilePhoneNotifySecurityCapsChange);
       
  1137 	CleanupStack::PushL( notifySecurityCapsChangeStatus );		
       
  1138 	secCaps = 0;
       
  1139 	mobilePhone.NotifySecurityCapsChange(notifySecurityCapsChangeStatus,secCaps);
       
  1140 
       
  1141 	// post notification for lock info change
       
  1142 	RMobilePhone::TMobilePhoneLock lock;
       
  1143 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfoChange;
       
  1144 	RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoChangePckg(lockInfoChange);
       
  1145 	TExtEtelRequestStatus notifyNotifyLockInfoChangeStatus(mobilePhone, EMobilePhoneNotifyLockInfoChange);
       
  1146 	CleanupStack::PushL(notifyNotifyLockInfoChangeStatus);
       
  1147 	mobilePhone.NotifyLockInfoChange(notifyNotifyLockInfoChangeStatus, lock, lockInfoChangePckg);
       
  1148 	
       
  1149 	// Unblock PIN1 with RMobilePhone::VerifySecurityCode with aType=ESecurityCodePuk1, aCode=new PIN1, aUnblockCode=PUK1 
       
  1150 	// Check RMobilePhone::NotifySecurityEvent completes with aEvent=EPuk1Verified	
       
  1151 	TPtrC puk1;
       
  1152 	ASSERT_TRUE(GetStringFromConfig(KIniSectionSIMParams, KIniPuk1, puk1) != EFalse, 
       
  1153 			_L("GetStringFromConfig returned with an error"));
       
  1154 	UnblockPinL(mobilePhone,RMobilePhone::ESecurityCodePuk1, pin1, puk1);
       
  1155 	// Check RMobilePhone::NotifySecurityCapsChange completes with caps in set of KCapsLockICC | KCapsAccessPin1 | KCapsAccessPin2
       
  1156     expectedCaps = RMobilePhone::KCapsLockICC | RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsAccessPin2;
       
  1157     iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityCapsChange(mobilePhone,notifySecurityCapsChangeStatus,
       
  1158     						secCaps,expectedCaps,KNoUnwantedBits, KErrNone);
       
  1159 
       
  1160 	// Check RMobilePhone::NotifyLockInfoChange with aLock=ELockICC completes with aLockInfo.iStatus=EStatusLocked and aLockInfo.iSetting=ELockSetEnabled
       
  1161 	RMobilePhone::TMobilePhoneLockInfoV1 expectedLockInfo;
       
  1162 	expectedLockInfo.iSetting = RMobilePhone::ELockSetEnabled;
       
  1163 	TCmpTMobilePhoneLockInfoV1NoStatus mobilePhoneLockInfoV1CmpBase(lockInfoChange,expectedLockInfo,*this);
       
  1164 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::NotifyLockInfoChange returns incorrect lock information from LTSY.<font color=Black>"));
       
  1165 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifyLockInfoChange(mobilePhone,notifyNotifyLockInfoChangeStatus,
       
  1166 			lock,RMobilePhone::ELockICC,mobilePhoneLockInfoV1CmpBase,KErrNone);
       
  1167 
       
  1168 	// Check RMobilePhone::GetLockInfo with aLock=ELockICC  returs aLockInfo.iStatus=EStatusLocked and aLockInfo.iSetting=ELockSetEnabled
       
  1169 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockICC, infoPckg);
       
  1170 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
  1171 	ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
  1172 	ASSERT_EQUALS(lockInfo.iStatus, RMobilePhone::EStatusLocked, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusLocked as expected"));
       
  1173 	ASSERT_EQUALS(lockInfo.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
  1174 
       
  1175 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin1 returns aSecurityCodeInfo.iRemainingEntryAttempts=3
       
  1176 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin1, getSecurityCodeInfoPckg);
       
  1177 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
  1178 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
  1179 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 3, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect aSecurityCodeInfo.iRemainingEntryAttempts"));
       
  1180 
       
  1181 	//
       
  1182 	// TEST END
       
  1183 	//
       
  1184 
       
  1185     StartCleanup();
       
  1186 	
       
  1187     iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled, pin1);
       
  1188 
       
  1189 	// 1 getLockInfoStatus
       
  1190     // 2 getSecurityCodeInfoStatus
       
  1191     // 3 notifySecurityCapsChangeStatus
       
  1192     // 4 notifyNotifyLockInfoChangeStatus
       
  1193     
       
  1194 	CleanupStack::PopAndDestroy(4, &getLockInfoStatus);
       
  1195 	
       
  1196 	return TestStepResult();
       
  1197 	}
       
  1198 
       
  1199 TPtrC CCTSYIntegrationTestPhoneSecurity0008::GetTestStepName()
       
  1200 /**
       
  1201  * @return The test step name.
       
  1202  */
       
  1203 	{
       
  1204 	return _L("CCTSYIntegrationTestPhoneSecurity0008");
       
  1205 	}
       
  1206 
       
  1207 
       
  1208 
       
  1209 CCTSYIntegrationTestPhoneSecurity0009::CCTSYIntegrationTestPhoneSecurity0009(CEtelSessionMgr& aEtelSessionMgr)
       
  1210 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  1211 /**
       
  1212  * Constructor.
       
  1213  */
       
  1214 	{
       
  1215 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0009::GetTestStepName());
       
  1216 	}
       
  1217 
       
  1218 CCTSYIntegrationTestPhoneSecurity0009::~CCTSYIntegrationTestPhoneSecurity0009()
       
  1219 /**
       
  1220  * Destructor.
       
  1221  */
       
  1222 	{
       
  1223 	}
       
  1224 
       
  1225 TVerdict CCTSYIntegrationTestPhoneSecurity0009::doTestStepL()
       
  1226 /**
       
  1227  * @SYMTestCaseID BA-CTSY-INT-PSEC-0009
       
  1228  * @SYMFssID BA/CTSY/PSEC-0009
       
  1229  * @SYMTestCaseDesc Change PIN2.
       
  1230  * @SYMTestPriority High
       
  1231  * @SYMTestActions RMobilePhone::NotifySecurityCodeInfoChange, RMobilePhone::GetSecurityCodeInfo
       
  1232  * @SYMTestExpectedResults Pass - PIN2 is changed
       
  1233  * @SYMTestType CIT
       
  1234  * @SYMTestCaseDependencies live/automatic
       
  1235  *
       
  1236  * Reason for test: Verify PIN2 is changed and security code info notification completes.
       
  1237  *
       
  1238  * @return - TVerdict code
       
  1239  */
       
  1240 	{
       
  1241 
       
  1242 	//
       
  1243 	// SET UP
       
  1244 	//
       
  1245 
       
  1246 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1247 	
       
  1248 	//register with home network
       
  1249 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
  1250 	CHECK_EQUALS_L(ret, KErrNone, 
       
  1251 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
  1252 
       
  1253 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin2 
       
  1254     TUint32 secCaps = 0;
       
  1255     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin2;
       
  1256 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
  1257 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
  1258 
       
  1259 	// get network operator information
       
  1260 	const TDesC* networkSection = NULL;
       
  1261 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
  1262 	// Get the password from the ini file
       
  1263 	TPtrC pin2; 
       
  1264 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin2, pin2) != EFalse, 
       
  1265 			_L("GetStringFromConfig returned with an error"));
       
  1266 	
       
  1267 	// Enable PIN2 with RMobilePhone::SetLockSetting with aLock=ELockPin2, aSetting=ELockSetEnabled 
       
  1268 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::SetLockSetting returns KErrNotSupported from LTSY.<font color=Black>"));
       
  1269 	//iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2,RMobilePhone::ELockSetEnabled, pin2);
       
  1270 
       
  1271 	//
       
  1272 	// SET UP END
       
  1273 	//
       
  1274 	
       
  1275 	StartTest();
       
  1276 	
       
  1277 	//
       
  1278 	// TEST START
       
  1279 	//
       
  1280 	
       
  1281 	// post notification for NotifySecurityCodeInfoChange
       
  1282 	TExtEtelRequestStatus notifySecurityCodeInfoChangeStatus(mobilePhone, EMobilePhoneNotifySecurityCodeInfoChange);
       
  1283 	CleanupStack::PushL( notifySecurityCodeInfoChangeStatus );
       
  1284 	RMobilePhone::TMobilePhoneSecurityCode securityCode;
       
  1285 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityCodeInfo;
       
  1286 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg securityCodeInfoPckg( securityCodeInfo );
       
  1287 	mobilePhone.NotifySecurityCodeInfoChange(notifySecurityCodeInfoChangeStatus, securityCode,securityCodeInfoPckg);
       
  1288 	
       
  1289 	// Change the security code with RMobilePhone::ChangeSecurityCode with aType=ESecurityCodePin2 , aChange.iOldPassword=old PIN2 and aChange.iNewPassword=new valid PIN2 
       
  1290 	TExtEtelRequestStatus changeSecurityCodeStatus(mobilePhone, EMobilePhoneChangeSecurityCode);
       
  1291 	CleanupStack::PushL( changeSecurityCodeStatus );
       
  1292 	RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange;
       
  1293 	passwordChange.iOldPassword = pin2; 
       
  1294 	ManglePassword(pin2,passwordChange.iNewPassword );
       
  1295 	mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin2,passwordChange);
       
  1296 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
  1297 	ASSERT_EQUALS( changeSecurityCodeStatus.Int(),KErrNone, _L("RMobilePhone::ChangeSecurityCode returned an error"));
       
  1298 
       
  1299 	// Check RMobilePhone::NotifySecurityCodeInfoChange with aSecurityCode=ESecurityCodePin2 completes with aSecurityCodeInfo.iRemainingEntryAttempts=3
       
  1300 	RMobilePhone::TMobilePhoneSecurityCode expectedSecurityCode = RMobilePhone::ESecurityCodePin2;
       
  1301 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 expectedSecurityCodeInfo;
       
  1302 	expectedSecurityCodeInfo.iRemainingEntryAttempts = 3;
       
  1303 	TCmpBase<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> mobilePhoneSecurityCodeInfoCmpBase(expectedSecurityCodeInfo,securityCodeInfo,*this);
       
  1304 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityCodeInfoChange(mobilePhone,notifySecurityCodeInfoChangeStatus,
       
  1305 			expectedSecurityCode,mobilePhoneSecurityCodeInfoCmpBase, KErrNone);
       
  1306 
       
  1307 
       
  1308 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin2 returns aSecurityCodeInfo.iRemainingEntryAttempts=3
       
  1309 	TExtEtelRequestStatus getSecurityCodeInfoStatus(mobilePhone, EMobilePhoneGetSecurityCodeInfo);
       
  1310 	CleanupStack::PushL( getSecurityCodeInfoStatus );
       
  1311 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 getSecurityCodeInfo;
       
  1312 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg getSecurityCodeInfoPckg( getSecurityCodeInfo );
       
  1313 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin2, getSecurityCodeInfoPckg);
       
  1314 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
  1315 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
  1316 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 3, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect remaining entry attempts"));
       
  1317 	
       
  1318 	//
       
  1319 	// TEST END
       
  1320 	//
       
  1321 
       
  1322     StartCleanup();
       
  1323 	
       
  1324 	passwordChange.iOldPassword = passwordChange.iNewPassword;
       
  1325 	passwordChange.iNewPassword = pin2;
       
  1326     mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin2,passwordChange);
       
  1327 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
  1328 	ASSERT_EQUALS(changeSecurityCodeStatus.Int(), KErrNone, _L("RMobilePhone::ChangeSecurityCode returned an error"));
       
  1329 
       
  1330     //iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2, RMobilePhone::ELockSetDisabled, pin2);
       
  1331 
       
  1332 	// 1 notifySecurityCodeInfoChangeStatus
       
  1333     // 2 changeSecurityCodeStatus
       
  1334     // 3 getSecurityCodeInfoStatus
       
  1335     
       
  1336 	CleanupStack::PopAndDestroy(3, &notifySecurityCodeInfoChangeStatus);
       
  1337 	
       
  1338 	return TestStepResult();
       
  1339 	}
       
  1340 
       
  1341 TPtrC CCTSYIntegrationTestPhoneSecurity0009::GetTestStepName()
       
  1342 /**
       
  1343  * @return The test step name.
       
  1344  */
       
  1345 	{
       
  1346 	return _L("CCTSYIntegrationTestPhoneSecurity0009");
       
  1347 	}
       
  1348 
       
  1349 
       
  1350 
       
  1351 CCTSYIntegrationTestPhoneSecurity0010::CCTSYIntegrationTestPhoneSecurity0010(CEtelSessionMgr& aEtelSessionMgr)
       
  1352 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  1353 /**
       
  1354  * Constructor.
       
  1355  */
       
  1356 	{
       
  1357 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0010::GetTestStepName());
       
  1358 	}
       
  1359 
       
  1360 CCTSYIntegrationTestPhoneSecurity0010::~CCTSYIntegrationTestPhoneSecurity0010()
       
  1361 /**
       
  1362  * Destructor.
       
  1363  */
       
  1364 	{
       
  1365 	}
       
  1366 
       
  1367 TVerdict CCTSYIntegrationTestPhoneSecurity0010::doTestStepL()
       
  1368 /**
       
  1369  * @SYMTestCaseID BA-CTSY-INT-PSEC-0010
       
  1370  * @SYMFssID BA/CTSY/PSEC-0010
       
  1371  * @SYMTestCaseDesc Change PIN2 supplying incorrect old PIN2.
       
  1372  * @SYMTestPriority High
       
  1373  * @SYMTestActions RMobilePhone::NotifySecurityCodeInfoChange, RMobilePhone::GetSecurityCodeInfo
       
  1374  * @SYMTestExpectedResults Pass - PIN2 is not changed
       
  1375  * @SYMTestType CIT
       
  1376  * @SYMTestCaseDependencies live/automatic
       
  1377  *
       
  1378  * Reason for test: Verify KErrAccessDenied returned.
       
  1379  *
       
  1380  * @return - TVerdict code
       
  1381  */
       
  1382 	{
       
  1383 
       
  1384 	//
       
  1385 	// SET UP
       
  1386 	//
       
  1387 
       
  1388 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1389 	
       
  1390 	//register with home network
       
  1391 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
  1392 	CHECK_EQUALS_L(ret, KErrNone, 
       
  1393 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
  1394 
       
  1395 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin2 
       
  1396     TUint32 secCaps = 0;
       
  1397     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin2;
       
  1398 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
  1399 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
  1400 
       
  1401 	// get network operator information
       
  1402 	const TDesC* networkSection = NULL;
       
  1403 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
  1404 	// Get the password from the ini file
       
  1405 	TPtrC pin2; 
       
  1406 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin2, pin2) != EFalse, 
       
  1407 			_L("GetStringFromConfig returned with an error"));
       
  1408 	
       
  1409 	// Enable PIN2 with RMobilePhone::SetLockSetting with aLock=ELockPin2, aSetting=ELockSetEnabled 
       
  1410 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::SetLockSetting returns KErrNotSupported from LTSY.<font color=Black>"));
       
  1411 	//iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2,RMobilePhone::ELockSetEnabled, pin2);
       
  1412 	
       
  1413 
       
  1414 	//
       
  1415 	// SET UP END
       
  1416 	//
       
  1417 	
       
  1418 	StartTest();
       
  1419 	
       
  1420 	//
       
  1421 	// TEST START
       
  1422 	//
       
  1423 	
       
  1424 	
       
  1425 	// post notification for NotifySecurityCodeInfoChange
       
  1426 	TExtEtelRequestStatus notifySecurityCodeInfoChangeStatus(mobilePhone, EMobilePhoneNotifySecurityCodeInfoChange);
       
  1427 	CleanupStack::PushL( notifySecurityCodeInfoChangeStatus );
       
  1428 	RMobilePhone::TMobilePhoneSecurityCode securityCode;
       
  1429 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityCodeInfo;
       
  1430 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg securityCodeInfoPckg( securityCodeInfo );
       
  1431 	mobilePhone.NotifySecurityCodeInfoChange(notifySecurityCodeInfoChangeStatus, securityCode,securityCodeInfoPckg);
       
  1432 	
       
  1433 	// Attempt to change PIN2 with incorrect old PIN2 with RMobilePhone::ChangeSecurityCode with aType=ESecurityCodePin2 , aChange.iOldPassword=incorrect old PIN2 and aChange.iNewPassword=new valid PIN2 
       
  1434 	TExtEtelRequestStatus changeSecurityCodeStatus(mobilePhone, EMobilePhoneChangeSecurityCode);
       
  1435 	CleanupStack::PushL( changeSecurityCodeStatus );
       
  1436 	RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange;
       
  1437 	passwordChange.iOldPassword = _L("abcd"); // incorrect pin
       
  1438 	passwordChange.iNewPassword = pin2;
       
  1439 	mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin2,passwordChange);
       
  1440 	
       
  1441 	// Check KErrGsm0707IncorrectPassword/ KErrAccessDenied  is returned.
       
  1442 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
  1443 	ASSERT_TRUE( ( changeSecurityCodeStatus.Int() == KErrAccessDenied
       
  1444 			|| changeSecurityCodeStatus.Int() == KErrGsm0707IncorrectPassword ), _L("RMobilePhone::ChangeSecurityCode did not return an error"));
       
  1445 
       
  1446 	// Check RMobilePhone::NotifySecurityCodeInfoChange with aSecurityCode=ESecurityCodePin2 completes with aSecurityCodeInfo.iRemainingEntryAttempts=2
       
  1447 	RMobilePhone::TMobilePhoneSecurityCode expectedSecurityCode = RMobilePhone::ESecurityCodePin2;
       
  1448 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 expectedSecurityCodeInfo;
       
  1449 	expectedSecurityCodeInfo.iRemainingEntryAttempts = 2;
       
  1450 	TCmpBase<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> mobilePhoneSecurityCodeInfoCmpBase(expectedSecurityCodeInfo,securityCodeInfo,*this);
       
  1451 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityCodeInfoChange(mobilePhone,notifySecurityCodeInfoChangeStatus,
       
  1452 			expectedSecurityCode,mobilePhoneSecurityCodeInfoCmpBase, KErrNone);
       
  1453 
       
  1454 
       
  1455 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin2 returns aSecurityCodeInfo.iRemainingEntryAttempts=2
       
  1456 	TExtEtelRequestStatus getSecurityCodeInfoStatus(mobilePhone, EMobilePhoneGetSecurityCodeInfo);
       
  1457 	CleanupStack::PushL( getSecurityCodeInfoStatus );
       
  1458 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 getSecurityCodeInfo;
       
  1459 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg getSecurityCodeInfoPckg( getSecurityCodeInfo );
       
  1460 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin2, getSecurityCodeInfoPckg);
       
  1461 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
  1462 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
  1463 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 2, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect remaining entry attempts"));
       
  1464 	
       
  1465 	//
       
  1466 	// TEST END
       
  1467 	//
       
  1468 
       
  1469     StartCleanup();
       
  1470 	
       
  1471     //iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2, RMobilePhone::ELockSetDisabled, pin2);
       
  1472 
       
  1473 	// 1 notifySecurityCodeInfoChangeStatus
       
  1474     // 2 changeSecurityCodeStatus
       
  1475     // 3 getSecurityCodeInfoStatus
       
  1476     
       
  1477 	CleanupStack::PopAndDestroy(3, &notifySecurityCodeInfoChangeStatus);
       
  1478 	
       
  1479 	return TestStepResult();
       
  1480 	}
       
  1481 
       
  1482 TPtrC CCTSYIntegrationTestPhoneSecurity0010::GetTestStepName()
       
  1483 /**
       
  1484  * @return The test step name.
       
  1485  */
       
  1486 	{
       
  1487 	return _L("CCTSYIntegrationTestPhoneSecurity0010");
       
  1488 	}
       
  1489 
       
  1490 
       
  1491 
       
  1492 CCTSYIntegrationTestPhoneSecurity0011::CCTSYIntegrationTestPhoneSecurity0011(CEtelSessionMgr& aEtelSessionMgr)
       
  1493 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  1494 /**
       
  1495  * Constructor.
       
  1496  */
       
  1497 	{
       
  1498 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0011::GetTestStepName());
       
  1499 	}
       
  1500 
       
  1501 CCTSYIntegrationTestPhoneSecurity0011::~CCTSYIntegrationTestPhoneSecurity0011()
       
  1502 /**
       
  1503  * Destructor.
       
  1504  */
       
  1505 	{
       
  1506 	}
       
  1507 
       
  1508 TVerdict CCTSYIntegrationTestPhoneSecurity0011::doTestStepL()
       
  1509 /**
       
  1510  * @SYMTestCaseID BA-CTSY-INT-PSEC-0011
       
  1511  * @SYMFssID BA/CTSY/PSEC-0011
       
  1512  * @SYMTestCaseDesc Check failure of PIN2 change procedure when PIN2 is blocked
       
  1513  * @SYMTestPriority High
       
  1514  * @SYMTestActions 
       
  1515  * @SYMTestExpectedResults Pass - Cannot change a blocked PIN2.
       
  1516  * @SYMTestType CIT
       
  1517  * @SYMTestCaseDependencies live/manual
       
  1518  *
       
  1519  * Reason for test: Verify PIN2 cannot be changed.
       
  1520  *
       
  1521  * @return - TVerdict code
       
  1522  */
       
  1523 	{
       
  1524 
       
  1525 	//
       
  1526 	// SET UP
       
  1527 	//
       
  1528 
       
  1529 	// ===  Block PIN2 ===
       
  1530 	
       
  1531 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1532 	
       
  1533 	//register with home network
       
  1534 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
  1535 	CHECK_EQUALS_L(ret, KErrNone, 
       
  1536 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
  1537 
       
  1538 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin2 
       
  1539 	TUint32 secCaps = 0;
       
  1540     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin2;
       
  1541 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
  1542 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
  1543 
       
  1544 	// get network operator information
       
  1545 	const TDesC* networkSection = NULL;
       
  1546 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
  1547 	// Get the password from the ini file
       
  1548 	TPtrC pin2; 
       
  1549 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin2, pin2) != EFalse, 
       
  1550 			_L("GetStringFromConfig returned with an error"));
       
  1551 
       
  1552 	// Enable PIN2 with RMobilePhone::SetLockSetting with aLock=ELockPin2, aSetting=ELockSetEnabled 
       
  1553 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::SetLockSetting returns KErrNotSupported from LTSY.<font color=Black>"));
       
  1554 	//iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2,RMobilePhone::ELockSetEnabled, pin2);
       
  1555 
       
  1556 	// Block PIN2 by calling RMobilePhone::VerifySecurityCode with aType=ESecurityCodePin2, aCode = wrong PIN2 until RMobilePhone::GetLockInfo with aLock=ELockICC returns TMobilePhoneSecurityCodeInfoV5::iRemainingEntryAttempts=0 then calling RMobilePhone::VerifySecurityCode one more time with aCode=wrong PIN2. 
       
  1557 	iPhoneTsyTestHelper.BlockPinL(mobilePhone,RMobilePhone::ESecurityCodePin2);
       
  1558 	
       
  1559 	// Check RMobilePhone::GetLockInfo with aLock=ELockPin2 returns iSetting=ELockSetEnabled and iStatus=EStatusBlocked
       
  1560 	TExtEtelRequestStatus getLockInfoStatus(mobilePhone, EMobilePhoneGetLockInfo);
       
  1561 	CleanupStack::PushL(getLockInfoStatus);
       
  1562     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
  1563 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoPckg(lockInfo);
       
  1564 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockPin2, infoPckg);
       
  1565 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
  1566 	CHECK_TRUE_L(getLockInfoStatus.Int() != KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
  1567 	CHECK_EQUALS_L(lockInfo.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
  1568 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusBlocked as expected.<font color=Black>"));
       
  1569 	// CHECK_EQUALS_L(lockInfo.iStatus, RMobilePhone::EStatusBlocked, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusBlocked as expected"));
       
  1570 
       
  1571 	//
       
  1572 	// SET UP END
       
  1573 	//
       
  1574 	
       
  1575 	StartTest();
       
  1576 	
       
  1577 	//
       
  1578 	// TEST START
       
  1579 	//
       
  1580 	
       
  1581 	
       
  1582 	// Change the security code with RMobilePhone::ChangeSecurityCode with aType=ESecurityCodePin2 , aChange.iOldPassword=old PIN2 and aChange.iNewPassword=new valid PIN2 
       
  1583 	TExtEtelRequestStatus changeSecurityCodeStatus(mobilePhone, EMobilePhoneChangeSecurityCode);
       
  1584 	CleanupStack::PushL( changeSecurityCodeStatus );
       
  1585 	RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange;
       
  1586 	passwordChange.iOldPassword = pin2; 
       
  1587 	ManglePassword(pin2,passwordChange.iNewPassword);
       
  1588 	mobilePhone.ChangeSecurityCode(changeSecurityCodeStatus,RMobilePhone::ESecurityCodePin2,passwordChange);
       
  1589 	
       
  1590 	// Check error is returned.
       
  1591 	ASSERT_EQUALS(WaitForRequestWithTimeOut(changeSecurityCodeStatus, ETimeMedium), KErrNone, _L("RMobilePhone::ChangeSecurityCode timed out"));
       
  1592 	ASSERT_TRUE( changeSecurityCodeStatus.Int()!= KErrNone, _L("RMobilePhone::ChangeSecurityCode returned KErrNone"));
       
  1593 
       
  1594 	
       
  1595 	//
       
  1596 	// TEST END
       
  1597 	//
       
  1598 
       
  1599     StartCleanup();
       
  1600 	
       
  1601 	TPtrC puk2; 
       
  1602 	ASSERT_TRUE(GetStringFromConfig(KIniSectionSIMParams, KIniPuk2, puk2) != EFalse, 
       
  1603 			_L("GetStringFromConfig returned with an error"));
       
  1604 	UnblockPinL(mobilePhone,RMobilePhone::ESecurityCodePuk2, pin2, puk2);
       
  1605 
       
  1606     //iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2, RMobilePhone::ELockSetDisabled, pin2);
       
  1607 
       
  1608 	// 1 getLockInfoStatus
       
  1609     // 2 changeSecurityCodeStatus
       
  1610     
       
  1611 	CleanupStack::PopAndDestroy(2, &getLockInfoStatus);
       
  1612 
       
  1613 	
       
  1614 	return TestStepResult();
       
  1615 	}
       
  1616 
       
  1617 TPtrC CCTSYIntegrationTestPhoneSecurity0011::GetTestStepName()
       
  1618 /**
       
  1619  * @return The test step name.
       
  1620  */
       
  1621 	{
       
  1622 	return _L("CCTSYIntegrationTestPhoneSecurity0011");
       
  1623 	}
       
  1624 
       
  1625 
       
  1626 
       
  1627 CCTSYIntegrationTestPhoneSecurity0012::CCTSYIntegrationTestPhoneSecurity0012(CEtelSessionMgr& aEtelSessionMgr)
       
  1628 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  1629 /**
       
  1630  * Constructor.
       
  1631  */
       
  1632 	{
       
  1633 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0012::GetTestStepName());
       
  1634 	}
       
  1635 
       
  1636 CCTSYIntegrationTestPhoneSecurity0012::~CCTSYIntegrationTestPhoneSecurity0012()
       
  1637 /**
       
  1638  * Destructor.
       
  1639  */
       
  1640 	{
       
  1641 	}
       
  1642 
       
  1643 TVerdict CCTSYIntegrationTestPhoneSecurity0012::doTestStepL()
       
  1644 /**
       
  1645  * @SYMTestCaseID BA-CTSY-INT-PSEC-0012
       
  1646  * @SYMFssID BA/CTSY/PSEC-0012
       
  1647  * @SYMTestCaseDesc Unblock PIN2.
       
  1648  * @SYMTestPriority High
       
  1649  * @SYMTestActions RMobilePhone::GetSecurityCodeInfo, RMobilePhone::GetLockInfo, RMobilePhone::NotifySecurityEvent, RMobilePhone::NotifySecurityCapsChange
       
  1650  * @SYMTestExpectedResults Pass - PIN2 is unblocked
       
  1651  * @SYMTestType CIT
       
  1652  * @SYMTestCaseDependencies live/manual
       
  1653  *
       
  1654  * Reason for test: Verify PIN2 is unblocked and number of retry attempts is correct.
       
  1655  *
       
  1656  * @return - TVerdict code
       
  1657  */
       
  1658 	{
       
  1659 
       
  1660 	//
       
  1661 	// SET UP
       
  1662 	//
       
  1663 	// ===  Block PIN2 ===
       
  1664 	
       
  1665 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1666 	
       
  1667 	//register with home network
       
  1668 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
  1669 	CHECK_EQUALS_L(ret, KErrNone, 
       
  1670 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
  1671 
       
  1672 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin2 
       
  1673 	TUint32 secCaps = 0;
       
  1674     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin2;
       
  1675 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
  1676 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
  1677 
       
  1678 	// get network operator information
       
  1679 	const TDesC* networkSection = NULL;
       
  1680 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
  1681 	// Get the password from the ini file
       
  1682 	TPtrC pin2; 
       
  1683 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin2, pin2) != EFalse, 
       
  1684 			_L("GetStringFromConfig returned with an error"));
       
  1685 
       
  1686 	// Enable PIN2 with RMobilePhone::SetLockSetting with aLock=ELockPin2, aSetting=ELockSetEnabled 	
       
  1687 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::SetLockSetting returns KErrNotSupported from LTSY.<font color=Black>"));
       
  1688 	//iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2,RMobilePhone::ELockSetEnabled, pin2);
       
  1689 
       
  1690 	// Block PIN2 by calling RMobilePhone::VerifySecurityCode with aType=ESecurityCodePin2, aCode = wrong PIN2 until RMobilePhone::GetLockInfo with aLock=ELockICC returns TMobilePhoneSecurityCodeInfoV5::iRemainingEntryAttempts=0 then calling RMobilePhone::VerifySecurityCode one more time with aCode=wrong PIN2. 
       
  1691 	iPhoneTsyTestHelper.BlockPinL(mobilePhone,RMobilePhone::ESecurityCodePin2);
       
  1692 	
       
  1693 	// Check RMobilePhone::GetLockInfo with aLock=ELockPin2 returns iSetting=ELockSetEnabled and iStatus=EStatusBlocked
       
  1694 	TExtEtelRequestStatus getLockInfoStatus(mobilePhone, EMobilePhoneGetLockInfo);
       
  1695 	CleanupStack::PushL(getLockInfoStatus);
       
  1696     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
  1697 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoPckg(lockInfo);
       
  1698 	DEBUG_PRINTF2(_L("AAA %d"),__LINE__);
       
  1699 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockPin2, infoPckg);
       
  1700 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
  1701 	DEBUG_PRINTF2(_L("AAA %d"),__LINE__);
       
  1702 	CHECK_TRUE_L(getLockInfoStatus.Int() != KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
  1703 	CHECK_EQUALS_L(lockInfo.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
  1704 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusBlocked as expected.<font color=Black>"));
       
  1705 	// CHECK_EQUALS_L(lockInfo.iStatus, RMobilePhone::EStatusBlocked, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusBlocked as expected"));
       
  1706 	
       
  1707 	//
       
  1708 	// SET UP END
       
  1709 	//
       
  1710 	
       
  1711 	StartTest();
       
  1712 	
       
  1713 	//
       
  1714 	// TEST START
       
  1715 	//
       
  1716 	
       
  1717 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin2 returns aSecurityCodeInfo.iRemainingEntryAttempts=0
       
  1718 	TExtEtelRequestStatus getSecurityCodeInfoStatus(mobilePhone, EMobilePhoneGetSecurityCodeInfo);
       
  1719 	CleanupStack::PushL( getSecurityCodeInfoStatus );
       
  1720 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 getSecurityCodeInfo;
       
  1721 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg getSecurityCodeInfoPckg( getSecurityCodeInfo );
       
  1722 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin2, getSecurityCodeInfoPckg);
       
  1723 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
  1724 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
  1725 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 0, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect aSecurityCodeInfo.iRemainingEntryAttempts"));
       
  1726 	
       
  1727 	//post notification for security caps change
       
  1728 	TExtEtelRequestStatus notifySecurityCapsChangeStatus(mobilePhone, EMobilePhoneNotifySecurityCapsChange);
       
  1729 	CleanupStack::PushL( notifySecurityCapsChangeStatus );		
       
  1730 	secCaps = 0;
       
  1731 	mobilePhone.NotifySecurityCapsChange(notifySecurityCapsChangeStatus,secCaps);
       
  1732 
       
  1733 	// post notification for lock info change
       
  1734 	RMobilePhone::TMobilePhoneLock lock;
       
  1735 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfoChange;
       
  1736 	RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoChangePckg(lockInfoChange);
       
  1737 	TExtEtelRequestStatus notifyNotifyLockInfoChangeStatus(mobilePhone, EMobilePhoneNotifyLockInfoChange);
       
  1738 	CleanupStack::PushL(notifyNotifyLockInfoChangeStatus);
       
  1739 	mobilePhone.NotifyLockInfoChange(notifyNotifyLockInfoChangeStatus, lock, lockInfoChangePckg);
       
  1740 	
       
  1741 	// Unblock PIN2 with RMobilePhone::VerifySecurityCode with aType=ESecurityCodePuk2, aCode=new PIN2, aUnblockCode=PUK2 
       
  1742 	// Check RMobilePhone::NotifySecurityEvent completes with aEvent=EPuk2Verified
       
  1743 	TPtrC puk2; 
       
  1744 	ASSERT_TRUE(GetStringFromConfig(KIniSectionSIMParams, KIniPuk2, puk2) != EFalse, 
       
  1745 			_L("GetStringFromConfig returned with an error"));
       
  1746 	UnblockPinL(mobilePhone,RMobilePhone::ESecurityCodePuk2, pin2, puk2);
       
  1747 	
       
  1748 	// Check RMobilePhone::NotifySecurityCapsChange completes with caps in set of KCapsLockICC | KCapsAccessPin1 | KCapsAccessPin2
       
  1749     expectedCaps = RMobilePhone::KCapsLockICC | RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsAccessPin2;
       
  1750     iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityCapsChange(mobilePhone,notifySecurityCapsChangeStatus,
       
  1751     						secCaps,expectedCaps,KNoUnwantedBits, KErrNone);
       
  1752 
       
  1753     // Check RMobilePhone::NotifyLockInfoChange with aLock=ELockPin2 completes with aLockInfo.iStatus=EStatusLocked and aLockInfo.iSetting=ELockSetEnabled
       
  1754 	RMobilePhone::TMobilePhoneLockInfoV1 expectedLockInfo;
       
  1755 	expectedLockInfo.iSetting = RMobilePhone::ELockSetEnabled;
       
  1756 	TCmpTMobilePhoneLockInfoV1NoStatus mobilePhoneLockInfoV1CmpBase(lockInfoChange,expectedLockInfo,*this);
       
  1757 	ERR_PRINTF1(_L("<font color=Cyan>$CTSYProblem: RMobilePhone::NotifyLockInfoChange returns incorrect lock information from LTSY.<font color=Black>"));
       
  1758 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifyLockInfoChange(mobilePhone,notifyNotifyLockInfoChangeStatus,
       
  1759 			lock,RMobilePhone::ELockPin2,mobilePhoneLockInfoV1CmpBase,KErrNone);
       
  1760 
       
  1761 	// Check RMobilePhone::GetLockInfo with aLock=ELockPin2 returns aLockInfo.iStatus=EStatusLocked and aLockInfo.iSetting=ELockSetEnabled
       
  1762 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockPin2, infoPckg);
       
  1763 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
  1764 	ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
  1765 	ASSERT_EQUALS(lockInfo.iStatus, RMobilePhone::EStatusLocked, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iStatus is not EStatusLocked as expected"));
       
  1766 	ASSERT_EQUALS(lockInfo.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
  1767 
       
  1768 	// Check RMobilePhone::GetSecurityCodeInfo with aSecurityCode=ESecurityCodePin2 returns aSecurityCodeInfo.iRemainingEntryAttempts=3
       
  1769 	mobilePhone.GetSecurityCodeInfo(getSecurityCodeInfoStatus,RMobilePhone::ESecurityCodePin1, getSecurityCodeInfoPckg);
       
  1770 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getSecurityCodeInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo timed out"));
       
  1771 	ASSERT_EQUALS(getSecurityCodeInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetSecurityCodeInfo returned an error"));
       
  1772 	ASSERT_EQUALS(getSecurityCodeInfo.iRemainingEntryAttempts, 3, _L("RMobilePhone::GetSecurityCodeInfo returned incorrect aSecurityCodeInfo.iRemainingEntryAttempts"));
       
  1773 
       
  1774 	//
       
  1775 	// TEST END
       
  1776 	//
       
  1777 
       
  1778     StartCleanup();
       
  1779 	
       
  1780     // iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2, RMobilePhone::ELockSetDisabled, pin2);
       
  1781 
       
  1782 	// 1 getLockInfoStatus
       
  1783     // 2 getSecurityCodeInfoStatus
       
  1784     // 3 notifySecurityCapsChangeStatus
       
  1785     // 4 notifyNotifyLockInfoChangeStatus
       
  1786     
       
  1787 	CleanupStack::PopAndDestroy(4, &getLockInfoStatus);
       
  1788 	
       
  1789 	return TestStepResult();
       
  1790 	}
       
  1791 
       
  1792 TPtrC CCTSYIntegrationTestPhoneSecurity0012::GetTestStepName()
       
  1793 /**
       
  1794  * @return The test step name.
       
  1795  */
       
  1796 	{
       
  1797 	return _L("CCTSYIntegrationTestPhoneSecurity0012");
       
  1798 	}
       
  1799 
       
  1800 
       
  1801 
       
  1802 CCTSYIntegrationTestPhoneSecurity0013::CCTSYIntegrationTestPhoneSecurity0013(CEtelSessionMgr& aEtelSessionMgr)
       
  1803 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  1804 /**
       
  1805  * Constructor.
       
  1806  */
       
  1807 	{
       
  1808 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0013::GetTestStepName());
       
  1809 	}
       
  1810 
       
  1811 CCTSYIntegrationTestPhoneSecurity0013::~CCTSYIntegrationTestPhoneSecurity0013()
       
  1812 /**
       
  1813  * Destructor.
       
  1814  */
       
  1815 	{
       
  1816 	}
       
  1817 
       
  1818 TVerdict CCTSYIntegrationTestPhoneSecurity0013::doTestStepL()
       
  1819 /**
       
  1820  * @SYMTestCaseID BA-CTSY-INT-PSEC-0013
       
  1821  * @SYMFssID BA/CTSY/PSEC-0013
       
  1822  * @SYMTestCaseDesc Abort unlock PIN1 procedure
       
  1823  * @SYMTestPriority High
       
  1824  * @SYMTestActions RMobilePhone::AbortSecurityCode, RMobilePhone::NotifySecurityEvent
       
  1825  * @SYMTestExpectedResults Pass - Fails for SetLockSetting .
       
  1826  * @SYMTestType CIT
       
  1827  * @SYMTestCaseDependencies live/automatic
       
  1828  *
       
  1829  * Reason for test: Verify operation that requires PIN1 completes with an error.
       
  1830  *
       
  1831  * @return - TVerdict code
       
  1832  */
       
  1833 	{
       
  1834 
       
  1835 	//
       
  1836 	// SET UP
       
  1837 	//
       
  1838 
       
  1839 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1840 	
       
  1841 	//register with home network
       
  1842 	TInt ret = iNetworkTsyTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
  1843 	CHECK_EQUALS_L(ret, KErrNone, 
       
  1844 			_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
  1845 
       
  1846 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
  1847     TUint32 secCaps = 0;
       
  1848     TUint32 expectedCaps = RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC;
       
  1849 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
  1850 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
  1851 
       
  1852 	// get network operator information
       
  1853 	const TDesC* networkSection = NULL;
       
  1854 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
  1855 	// Get the password from the ini file
       
  1856 	TPtrC pin1; 
       
  1857 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin1, pin1) != EFalse, 
       
  1858 			_L("GetStringFromConfig returned with an error"));
       
  1859 	
       
  1860 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
  1861 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC,RMobilePhone::ELockSetEnabled, pin1);
       
  1862 
       
  1863 	//
       
  1864 	// SET UP END
       
  1865 	//
       
  1866 	
       
  1867 	StartTest();
       
  1868 	
       
  1869 	//
       
  1870 	// TEST START
       
  1871 	//
       
  1872 		
       
  1873 	// ===  Make a request to something that requires PIN1 i.e. SetLockSetting ===
       
  1874 
       
  1875 	// post notification
       
  1876 	RMobilePhone::TMobilePhoneSecurityEvent event;
       
  1877 	TExtEtelRequestStatus notifySecurityEventStatus(mobilePhone, EMobilePhoneNotifySecurityEvent);
       
  1878 	CleanupStack::PushL(notifySecurityEventStatus);
       
  1879 	mobilePhone.NotifySecurityEvent(notifySecurityEventStatus, event);
       
  1880 	
       
  1881 	// Call RMobilePhone::SetLockSetting 
       
  1882     TExtEtelRequestStatus setLockSettingStatus(mobilePhone, EMobilePhoneSetLockSetting);
       
  1883 	CleanupStack::PushL(setLockSettingStatus);
       
  1884 	mobilePhone.SetLockSetting(setLockSettingStatus, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled);
       
  1885 
       
  1886 
       
  1887 	// Check RMobilePhone::NotifySecurityEvent completes with aEvent=EPin1Required
       
  1888 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityEvent(mobilePhone,notifySecurityEventStatus,
       
  1889 			event,
       
  1890 			RMobilePhone::EPin1Required,
       
  1891 			KErrNone);
       
  1892 
       
  1893 	// Abort security code with RMobilePhone::AbortSecurityCode with aType=ESecurityCodePin1 
       
  1894 	ASSERT_EQUALS( mobilePhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1), KErrNone, _L("RMobilePhone::AbortSecurityCode returned KErrNone"));
       
  1895 	
       
  1896 	// Check RMobilePhone::SetLockSetting completes with an error.
       
  1897 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setLockSettingStatus, ETimeMedium), KErrNone, _L("RMobilePhone::SetLockSetting timed out"));
       
  1898 	ASSERT_TRUE(setLockSettingStatus.Int() != KErrNone, _L("RMobilePhone::SetLockSetting returned KErrNone"));
       
  1899 	
       
  1900 	//
       
  1901 	// TEST END
       
  1902 	//
       
  1903 
       
  1904     StartCleanup();
       
  1905 	
       
  1906     iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled, pin1);
       
  1907 
       
  1908 	// 1 notifySecurityEventStatus
       
  1909     // 2 setLockSettingStatus
       
  1910     
       
  1911 	CleanupStack::PopAndDestroy(2, &notifySecurityEventStatus);
       
  1912 	
       
  1913 	return TestStepResult();
       
  1914 	}
       
  1915 
       
  1916 TPtrC CCTSYIntegrationTestPhoneSecurity0013::GetTestStepName()
       
  1917 /**
       
  1918  * @return The test step name.
       
  1919  */
       
  1920 	{
       
  1921 	return _L("CCTSYIntegrationTestPhoneSecurity0013");
       
  1922 	}
       
  1923 
       
  1924 
       
  1925 
       
  1926 CCTSYIntegrationTestPhoneSecurity0014::CCTSYIntegrationTestPhoneSecurity0014(CEtelSessionMgr& aEtelSessionMgr)
       
  1927 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  1928 /**
       
  1929  * Constructor.
       
  1930  */
       
  1931 	{
       
  1932 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0014::GetTestStepName());
       
  1933 	}
       
  1934 
       
  1935 CCTSYIntegrationTestPhoneSecurity0014::~CCTSYIntegrationTestPhoneSecurity0014()
       
  1936 /**
       
  1937  * Destructor.
       
  1938  */
       
  1939 	{
       
  1940 	}
       
  1941 
       
  1942 TVerdict CCTSYIntegrationTestPhoneSecurity0014::doTestStepL()
       
  1943 /**
       
  1944  * @SYMTestCaseID BA-CTSY-INT-PSEC-0014
       
  1945  * @SYMFssID BA/CTSY/PSEC-0014
       
  1946  * @SYMTestCaseDesc Verify a code that doesn't need verifying
       
  1947  * @SYMTestPriority High
       
  1948  * @SYMTestActions RMobilePhone::GetLockInfo, RMobilePhone::SetLockSetting
       
  1949  * @SYMTestExpectedResults Pass - Fails to verify PIN2
       
  1950  * @SYMTestType CIT
       
  1951  * @SYMTestCaseDependencies live/automatic
       
  1952  *
       
  1953  * Reason for test: Verify KErrNotReady is returned.
       
  1954  *
       
  1955  * @return - TVerdict code
       
  1956  */
       
  1957 	{
       
  1958 	ERR_PRINTF1(_L("<font color=Orange>$CTSYKnownFailure: defect id = 10005</font>"));
       
  1959 
       
  1960 	//
       
  1961 	// SET UP
       
  1962 	//
       
  1963 
       
  1964 	
       
  1965 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
  1966     RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1967     TUint32 secCaps;
       
  1968     TUint32 expectedCaps = (RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC);
       
  1969 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(secCaps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned with an error"));
       
  1970 	CHECK_BITS_SET_L(secCaps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned with unexpected caps"));
       
  1971     
       
  1972 	//
       
  1973 	// SET UP END
       
  1974 	//
       
  1975 	
       
  1976 	StartTest();
       
  1977 	
       
  1978 	//
       
  1979 	// TEST START
       
  1980 	//
       
  1981 	
       
  1982 	
       
  1983 	// ===  Verify PIN1 when phone is not asking for it ===
       
  1984 
       
  1985 	// get network operator information
       
  1986 	const TDesC* networkSection = NULL;
       
  1987 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
  1988 	// Get the password from the ini file
       
  1989 	TPtrC pin1; 
       
  1990 	ASSERT_TRUE(GetStringFromConfig(*networkSection, KIniPin1, pin1) != EFalse, 
       
  1991 			_L("GetStringFromConfig returned with an error"));
       
  1992 	
       
  1993 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled
       
  1994 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetEnabled, pin1);
       
  1995 
       
  1996 	// Verify PIN1 with RMobilePhone::VerifySecurityCode with aType=ESecurityCodePin1, aCode=PIN1 code 
       
  1997     TExtEtelRequestStatus verifySecCodeStatus(mobilePhone, EMobilePhoneVerifySecurityCode);
       
  1998 	CleanupStack::PushL(verifySecCodeStatus);
       
  1999 	mobilePhone.VerifySecurityCode(verifySecCodeStatus, RMobilePhone::ESecurityCodePin1, pin1, pin1);
       
  2000 	ASSERT_EQUALS(WaitForRequestWithTimeOut(verifySecCodeStatus, ETimeLong), KErrNone,_L("RMobilePhone::VerifySecurityCode timed out"));
       
  2001 	// Check KErrNotReady is returned	
       
  2002 	ASSERT_EQUALS(verifySecCodeStatus.Int(), KErrNotReady, _L("RMobilePhone::VerifySecurityCode did not return KErrNotReady as expected"));
       
  2003 
       
  2004 	// Check RMobilePhone::GetLockInfo with aLock=ELockICC returns aLockInfo.iSetting=ELockSetEnabled
       
  2005     RMobilePhone::TMobilePhoneLockInfoV1 mobilePhoneLockInfoV1;
       
  2006 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoV1Pckg(mobilePhoneLockInfoV1);
       
  2007 	TExtEtelRequestStatus getLockInfoStatus(mobilePhone, EMobilePhoneVerifySecurityCode);
       
  2008 	CleanupStack::PushL(getLockInfoStatus);
       
  2009     mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockICC, infoV1Pckg);
       
  2010     ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
  2011     ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
  2012 	ASSERT_EQUALS(mobilePhoneLockInfoV1.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
  2013 	
       
  2014 	// ===  Verify PIN2 when phone is not asking for it ===
       
  2015 
       
  2016 	// Enable PIN2 with RMobilePhone::SetLockSetting with aLock=ELockPin2, aSetting=ELockSetEnabled 
       
  2017 	// Get the password from the ini file
       
  2018 	TPtrC pin2; 
       
  2019 	ASSERT_TRUE(GetStringFromConfig(*networkSection, KIniPin2, pin2) != EFalse, 
       
  2020 			_L("GetStringFromConfig returned with an error"));
       
  2021 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2, RMobilePhone::ELockSetEnabled, pin2);
       
  2022 
       
  2023 	// Verify PIN2 with RMobilePhone::VerifySecurityCode with aType=ESecurityCodePin2, aCode=PIN2 code 
       
  2024     mobilePhone.VerifySecurityCode(verifySecCodeStatus, RMobilePhone::ESecurityCodePin2, pin2, pin2);
       
  2025 	ASSERT_EQUALS(WaitForRequestWithTimeOut(verifySecCodeStatus, ETimeLong), KErrNone, _L("RMobilePhone::VerifySecurityCode timed out"));
       
  2026 	
       
  2027 	// Check KErrNotReady is returned
       
  2028     ASSERT_EQUALS(verifySecCodeStatus.Int(), KErrNotReady, _L("RMobilePhone::VerifySecurityCode did not return KErrNotReady as expected"));
       
  2029 	
       
  2030 	// Check RMobilePhone::GetLockInfo with aLock=ELockPin2 returns aLockInfo.iSetting=ELockSetEnabled
       
  2031 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
  2032 	RMobilePhone::TMobilePhoneLockInfoV1Pckg infoPckg(lockInfo);		
       
  2033     mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockPin2, infoPckg);
       
  2034     ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeLong), KErrNone, _L("RMobilePhone::GetLockInfo timed out"));
       
  2035     ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
  2036 	ASSERT_EQUALS(lockInfo.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo TMobilePhoneLockInfoV1.iSetting is not ELockSetEnabled as expected"));
       
  2037 	
       
  2038 	//
       
  2039 	// TEST END
       
  2040 	//
       
  2041 
       
  2042     StartCleanup();
       
  2043     iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled, pin1);
       
  2044 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2, RMobilePhone::ELockSetDisabled, pin2);
       
  2045 
       
  2046 	// Pop
       
  2047 	// getVerifySecCodeStatus
       
  2048 	// getLockInfoStatus
       
  2049 	CleanupStack::Pop(2, &verifySecCodeStatus);
       
  2050 	
       
  2051 	return TestStepResult();
       
  2052 	}
       
  2053 
       
  2054 TPtrC CCTSYIntegrationTestPhoneSecurity0014::GetTestStepName()
       
  2055 /**
       
  2056  * @return The test step name.
       
  2057  */
       
  2058 	{
       
  2059 	return _L("CCTSYIntegrationTestPhoneSecurity0014");
       
  2060 	}
       
  2061 
       
  2062 
       
  2063 
       
  2064 CCTSYIntegrationTestPhoneSecurity0015::CCTSYIntegrationTestPhoneSecurity0015(CEtelSessionMgr& aEtelSessionMgr)
       
  2065 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  2066 /**
       
  2067  * Constructor.
       
  2068  */
       
  2069 	{
       
  2070 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0015::GetTestStepName());
       
  2071 	}
       
  2072 
       
  2073 CCTSYIntegrationTestPhoneSecurity0015::~CCTSYIntegrationTestPhoneSecurity0015()
       
  2074 /**
       
  2075  * Destructor.
       
  2076  */
       
  2077 	{
       
  2078 	}
       
  2079 
       
  2080 TVerdict CCTSYIntegrationTestPhoneSecurity0015::doTestStepL()
       
  2081 /**
       
  2082  * @SYMTestCaseID BA-CTSY-INT-PSEC-0015
       
  2083  * @SYMFssID BA/CTSY/PSEC-0015
       
  2084  * @SYMTestCaseDesc Abort a code that doesn't need aborting
       
  2085  * @SYMTestPriority High
       
  2086  * @SYMTestActions RMobilePhone::SetLockSetting, RMobilePhone::AbortSecurityCode, RMobilePhone::NotifySecurityEvent, RMobilePhone::SetFdnSetting
       
  2087  * @SYMTestExpectedResults Pass - Fails to abort PIN1 security event notification
       
  2088  * @SYMTestType CIT
       
  2089  * @SYMTestCaseDependencies live/automatic
       
  2090  *
       
  2091  * Reason for test: Verify error is returned
       
  2092  *
       
  2093  * @return - TVerdict code
       
  2094  */
       
  2095 	{
       
  2096 	ERR_PRINTF1(_L("<font color=Orange>$CTSYKnownFailure: defect id = 10030</font>"));
       
  2097 	//
       
  2098 	// SET UP
       
  2099 	//
       
  2100 
       
  2101 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2102 	TUint32 caps;
       
  2103 	
       
  2104 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of KCapsAccessPin1 | KCapsLockICC 
       
  2105 	CHECK_EQUALS_L(mobilePhone.GetSecurityCaps(caps), KErrNone, _L("RMobilePhone::GetSecurityCaps returned an error"));
       
  2106 	TInt32 expectedCaps =  RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsLockICC;
       
  2107 	CHECK_BITS_SET_L(caps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned incorrect Security Caps"));
       
  2108 
       
  2109 	//
       
  2110 	// SET UP END
       
  2111 	//
       
  2112 	
       
  2113 	StartTest();
       
  2114 	
       
  2115 	//
       
  2116 	// TEST START
       
  2117 	//
       
  2118 	const TDesC* networkSection = NULL;
       
  2119 	iNetworkTsyTestHelper.GetNetworkPasswordsSectionL(mobilePhone, networkSection);
       
  2120 	// Get the password from the ini file
       
  2121 	TPtrC pin2; 
       
  2122 	CHECK_TRUE_L(GetStringFromConfig(*networkSection, KIniPin2, pin2) != EFalse, 
       
  2123 			_L("GetStringFromConfig returned with an error"));
       
  2124 
       
  2125 
       
  2126 	// part I
       
  2127 	// ===  Make a request to something that requires PIN2 i.e. SetLockSetting but abort PIN1 ===	
       
  2128 	RMobilePhone::TMobilePhoneSecurityEvent event;
       
  2129 	TExtEtelRequestStatus notifySecurityEventStatus(mobilePhone, EMobilePhoneNotifySecurityEvent);
       
  2130 	CleanupStack::PushL(notifySecurityEventStatus);
       
  2131 	mobilePhone.NotifySecurityEvent(notifySecurityEventStatus, event);
       
  2132 		
       
  2133 	// Enable PIN2 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
  2134     TExtEtelRequestStatus setLockSettingStatus(mobilePhone, EMobilePhoneSetLockSetting);
       
  2135 	CleanupStack::PushL(setLockSettingStatus);
       
  2136 	mobilePhone.SetLockSetting(setLockSettingStatus, RMobilePhone::ELockPin2, RMobilePhone::ELockSetEnabled);
       
  2137 
       
  2138 	// Check RMobilePhone::NotifySecurityEvent completes with aEvent=EPin2Required
       
  2139 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityEvent(mobilePhone,notifySecurityEventStatus,
       
  2140 			event,
       
  2141 			RMobilePhone::EPin2Required,
       
  2142 			KErrNone);
       
  2143 
       
  2144 	// Check RMobilePhone::AbortSecurityCode with aType=ESecurityCodePin1 returns an error
       
  2145 	ASSERT_TRUE( mobilePhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1)!= KErrNone, _L("RMobilePhone::AbortSecurityCode returned KErrNone"));
       
  2146 	
       
  2147 	// Check RMobilePhone::SetLockSetting completes with an error
       
  2148 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setLockSettingStatus, ETimeMedium), KErrNone, _L("RMobilePhone::SetLockSetting timed out"));
       
  2149 	ASSERT_TRUE(setLockSettingStatus.Int() != KErrNone, _L("RMobilePhone::SetLockSetting returned KErrNone"));
       
  2150 	
       
  2151 	// part II
       
  2152 	// ===  Make a request to something that requires PIN2 i.e. SetFdnStatus but abort PIN1 ===	
       
  2153 	RMobilePhone::TMobilePhoneFdnSetting fdnSetting = RMobilePhone::EFdnSetOn;
       
  2154     TExtEtelRequestStatus setFdnSettingStatus(mobilePhone, EMobilePhoneSetFdnSetting);
       
  2155 	CleanupStack::PushL(setFdnSettingStatus);
       
  2156 	mobilePhone.NotifySecurityEvent(notifySecurityEventStatus, event);
       
  2157 	mobilePhone.SetFdnSetting(setFdnSettingStatus, fdnSetting);
       
  2158 
       
  2159 	// Check RMobilePhone::NotifySecurityEvent completes with aEvent=EPin2Required
       
  2160 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifySecurityEvent(mobilePhone,notifySecurityEventStatus,
       
  2161 			event,
       
  2162 			RMobilePhone::EPin2Required,
       
  2163 			KErrNone);
       
  2164 
       
  2165 	// Check RMobilePhone::AbortSecurityCode with aType=ESecurityCodePin1 returns an error
       
  2166 	ASSERT_TRUE( mobilePhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1)!= KErrNone, _L("RMobilePhone::AbortSecurityCode returned KErrNone"));
       
  2167 	
       
  2168 	// Check RMobilePhone::SetFdnSetting completes with an error
       
  2169 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setFdnSettingStatus, ETimeMedium), KErrNone, _L("RMobilePhone::SetFdnSetting timed out"));
       
  2170 	ASSERT_TRUE(setFdnSettingStatus.Int() != KErrNone, _L("RMobilePhone::SetFdnSetting returned KErrNone"));
       
  2171 
       
  2172 	//
       
  2173 	// TEST END
       
  2174 	//
       
  2175 
       
  2176     StartCleanup();
       
  2177 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPin2, RMobilePhone::ELockSetDisabled, pin2);
       
  2178 
       
  2179 	// Pop
       
  2180 	// setLockSettingStatus
       
  2181 	// notifySecurityEventStatus
       
  2182 	// setFdnSettingStatus
       
  2183 	CleanupStack::Pop(3, &notifySecurityEventStatus);
       
  2184 	
       
  2185 	return TestStepResult();
       
  2186 	}
       
  2187 
       
  2188 TPtrC CCTSYIntegrationTestPhoneSecurity0015::GetTestStepName()
       
  2189 /**
       
  2190  * @return The test step name.
       
  2191  */
       
  2192 	{
       
  2193 	return _L("CCTSYIntegrationTestPhoneSecurity0015");
       
  2194 	}
       
  2195 
       
  2196 
       
  2197 
       
  2198 CCTSYIntegrationTestPhoneSecurity0016::CCTSYIntegrationTestPhoneSecurity0016(CEtelSessionMgr& aEtelSessionMgr)
       
  2199 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  2200 /**
       
  2201  * Constructor.
       
  2202  */
       
  2203 	{
       
  2204 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0016::GetTestStepName());
       
  2205 	}
       
  2206 
       
  2207 CCTSYIntegrationTestPhoneSecurity0016::~CCTSYIntegrationTestPhoneSecurity0016()
       
  2208 /**
       
  2209  * Destructor.
       
  2210  */
       
  2211 	{
       
  2212 	}
       
  2213 
       
  2214 TVerdict CCTSYIntegrationTestPhoneSecurity0016::doTestStepL()
       
  2215 /**
       
  2216  * @SYMTestCaseID BA-CTSY-INT-PSEC-0016
       
  2217  * @SYMFssID BA/CTSY/PSEC-0016
       
  2218  * @SYMTestCaseDesc Get the security capabilities.
       
  2219  * @SYMTestPriority High
       
  2220  * @SYMTestActions 
       
  2221  * @SYMTestExpectedResults Pass - Correct security caps returned.
       
  2222  * @SYMTestType CIT
       
  2223  * @SYMTestCaseDependencies live/automatic
       
  2224  *
       
  2225  * Reason for test: Verify initial security caps correct.
       
  2226  *
       
  2227  * @return - TVerdict code
       
  2228  */
       
  2229 	{
       
  2230 
       
  2231 	//
       
  2232 	// SET UP
       
  2233 	//
       
  2234 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2235 	
       
  2236 
       
  2237 	//
       
  2238 	// SET UP END
       
  2239 	//
       
  2240 	
       
  2241 	StartTest();
       
  2242 	
       
  2243 	//
       
  2244 	// TEST START
       
  2245 	//
       
  2246 	
       
  2247 	
       
  2248 	// Check RMobilePhone::GetSecurityCaps returns caps in set of RMobilePhone::KCapsLockPhone
       
  2249 
       
  2250 	//         | RMobilePhone::KCapsLockICC 
       
  2251 
       
  2252 	//         | RMobilePhone::KCapsLockPhoneToICC 
       
  2253 
       
  2254 	//         | RMobilePhone::KCapsAccessPin1 
       
  2255 
       
  2256 	//         | RMobilePhone::KCapsAccessPin2 
       
  2257 
       
  2258 	//         | RMobilePhone::KCapsAccessPhonePassword 
       
  2259 	
       
  2260 	TUint32 securityCaps=0;
       
  2261 	ASSERT_EQUALS(phone.GetSecurityCaps(securityCaps), KErrNone, _L("MobilePhone::GetSecurityCaps returned with an error"));
       
  2262 	TUint32 expectedCaps= RMobilePhone::KCapsLockPhone | RMobilePhone::KCapsLockICC 
       
  2263 							| RMobilePhone::KCapsLockPhoneToICC	| RMobilePhone::KCapsAccessPin1
       
  2264 							| RMobilePhone::KCapsAccessPin2  | RMobilePhone::KCapsAccessPhonePassword;
       
  2265 	ASSERT_BITS_SET(securityCaps, expectedCaps,KNoUnwantedBits,_L("RMobilePhone::GetSecurityCaps miniumum security capabilites not found:KCapsLockPhone,KCapsLockICC,KCapsLockPhoneToICC,KCapsAccessPin1,KCapsAccessPin2,KCapsAccessPhonePassword."))
       
  2266 	
       
  2267 	//
       
  2268 	// TEST END
       
  2269 	//
       
  2270 
       
  2271     StartCleanup();
       
  2272 	
       
  2273 	// Put any required test clean up here, then remove this comment
       
  2274 	
       
  2275 	return TestStepResult();
       
  2276 	}
       
  2277 
       
  2278 TPtrC CCTSYIntegrationTestPhoneSecurity0016::GetTestStepName()
       
  2279 /**
       
  2280  * @return The test step name.
       
  2281  */
       
  2282 	{
       
  2283 	return _L("CCTSYIntegrationTestPhoneSecurity0016");
       
  2284 	}
       
  2285 
       
  2286 
       
  2287 
       
  2288 CCTSYIntegrationTestPhoneSecurity0017::CCTSYIntegrationTestPhoneSecurity0017(CEtelSessionMgr& aEtelSessionMgr)
       
  2289 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  2290 /**
       
  2291  * Constructor.
       
  2292  */
       
  2293 	{
       
  2294 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0017::GetTestStepName());
       
  2295 	}
       
  2296 
       
  2297 CCTSYIntegrationTestPhoneSecurity0017::~CCTSYIntegrationTestPhoneSecurity0017()
       
  2298 /**
       
  2299  * Destructor.
       
  2300  */
       
  2301 	{
       
  2302 	}
       
  2303 
       
  2304 TVerdict CCTSYIntegrationTestPhoneSecurity0017::doTestStepL()
       
  2305 /**
       
  2306  * @SYMTestCaseID BA-CTSY-INT-PSEC-0017
       
  2307  * @SYMFssID BA/CTSY/PSEC-0017
       
  2308  * @SYMTestCaseDesc Enable and disable the phone lock and get lock info.
       
  2309  * @SYMTestPriority High
       
  2310  * @SYMTestActions RMobilePhone::NotifyLockInfoChange, RMobilePhone::SetLockSetting, 
       
  2311  * @SYMTestExpectedResults Pass - Phone lock setting and status correct.
       
  2312  * @SYMTestType CIT
       
  2313  * @SYMTestCaseDependencies live/automatic
       
  2314  *
       
  2315  * Reason for test: Verify phone lock information is correct.
       
  2316  *
       
  2317  * @return - TVerdict code
       
  2318  */
       
  2319 	{
       
  2320 	ERR_PRINTF1(_L("<font color=Orange>$CTSYKnownFailure: defect id = 10001</font>"));
       
  2321 	//
       
  2322 	// SET UP
       
  2323 	//
       
  2324 
       
  2325 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2326 	TUint32 caps;
       
  2327 	
       
  2328 	// Ensure RMobilePhone::GetSecurityCaps returns caps in set of RMobilePhone::KCapsLockICC | RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsAccessPin2 
       
  2329 	CHECK_TRUE_L(mobilePhone.GetSecurityCaps(caps) == KErrNone, _L("RMobilePhone::GetSecurityCaps returned an error"))		
       
  2330 	TInt32 expectedCaps =  RMobilePhone::KCapsLockICC | RMobilePhone::KCapsAccessPin1 | RMobilePhone::KCapsAccessPin2 ;
       
  2331 	CHECK_BITS_SET_L(caps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetSecurityCaps returned incorrect Security Caps"));
       
  2332 
       
  2333 	//
       
  2334 	// SET UP END
       
  2335 	//
       
  2336 	
       
  2337 	StartTest();
       
  2338 	
       
  2339 	//
       
  2340 	// TEST START
       
  2341 	//
       
  2342 	
       
  2343 	// Enable phone lock with RMobilePhone::SetLockSetting with aLock=RMobilePhone::ELockPhoneDevice, aSetting=ELockSetEnabled 	
       
  2344 	RMobilePhone::TMobilePhoneLock lock;
       
  2345 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfo1;
       
  2346 	RMobilePhone::TMobilePhoneLockInfoV1 expectedLockInfo;
       
  2347 	expectedLockInfo.iSetting = RMobilePhone::ELockSetEnabled;
       
  2348 	RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg1(lockInfo1);
       
  2349 	TExtEtelRequestStatus notifyNotifyLockInfoChangeStatus(mobilePhone, EMobilePhoneNotifyLockInfoChange);
       
  2350 	CleanupStack::PushL(notifyNotifyLockInfoChangeStatus);
       
  2351 	mobilePhone.NotifyLockInfoChange(notifyNotifyLockInfoChangeStatus, lock, lockInfoPckg1); 	
       
  2352 
       
  2353 	TPtrC phoneLock; 
       
  2354 	CHECK_TRUE_L(GetStringFromConfig(KIniSectionBoardParams, KIniPhoneLock, phoneLock) != EFalse, 
       
  2355 			_L("GetStringFromConfig returned with an error"));
       
  2356 
       
  2357 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPhoneDevice, RMobilePhone::ELockSetEnabled, phoneLock);
       
  2358 
       
  2359 	// Check RMobilePhone::NotifyLockInfoChange with aLock=ELockPhoneDevice completes with aLockInfo.iSetting=ELockSetEnabled
       
  2360 	TCmpTMobilePhoneLockInfoV1NoStatus mobilePhoneLockInfoV1CmpBase(lockInfo1,expectedLockInfo,*this);
       
  2361 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifyLockInfoChange(mobilePhone,notifyNotifyLockInfoChangeStatus,
       
  2362 			lock,RMobilePhone::ELockPhoneDevice,mobilePhoneLockInfoV1CmpBase,KErrNone);
       
  2363 	ASSERT_EQUALS(lock, RMobilePhone::ELockPhoneDevice, _L("RMobilePhone::NotifyLockInfoChange returned wrong aLock"));
       
  2364 	ASSERT_EQUALS(lockInfo1.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::NotifyLockInfoChange returned wrong iSetting"));
       
  2365 	
       
  2366 	// Check RMobilePhone::GetLockInfo with aLock=ELockPhoneDevice returns aLockInfo.iSetting=ELockSetEnabled
       
  2367 	TExtEtelRequestStatus getLockInfoStatus(mobilePhone, EMobilePhoneGetLockInfo);
       
  2368 	CleanupStack::PushL(getLockInfoStatus);
       
  2369 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockPhoneDevice, lockInfoPckg1); 
       
  2370 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetLockInfo timed-out"));
       
  2371 	ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
  2372 	ASSERT_EQUALS(lockInfo1.iSetting, RMobilePhone::ELockSetEnabled, _L("RMobilePhone::GetLockInfo returned wrong iSetting"));
       
  2373 
       
  2374 	// Enable phone lock with RMobilePhone::SetLockSetting with aLock=RMobilePhone::ELockPhoneDevice, aSetting=ELockSetDisabled 
       
  2375 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfo2;
       
  2376 	RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg2(lockInfo2);
       
  2377 	mobilePhone.NotifyLockInfoChange(notifyNotifyLockInfoChangeStatus, lock, lockInfoPckg2); 
       
  2378 	
       
  2379 	iPhoneTsyTestHelper.ChangePhoneLockSettingL(mobilePhone, RMobilePhone::ELockPhoneDevice, RMobilePhone::ELockSetDisabled, phoneLock);
       
  2380 
       
  2381 	// Check RMobilePhone::NotifyLockInfoChange with aLock=ELockPhoneDevice completes with aLockInfo.iSetting=ELockSetDisabled	
       
  2382 	expectedLockInfo.iSetting = RMobilePhone::ELockSetDisabled;
       
  2383 	expectedLockInfo.iStatus = RMobilePhone::EStatusUnlocked;
       
  2384 	TCmpTMobilePhoneLockInfoV1NoStatus mobilePhoneLockInfoV1CmpBase2(lockInfo2,expectedLockInfo,*this);
       
  2385 	iPhoneTsyTestHelper.WaitForMobilePhoneNotifyLockInfoChange(mobilePhone,notifyNotifyLockInfoChangeStatus,
       
  2386 			lock,RMobilePhone::ELockPhoneDevice,mobilePhoneLockInfoV1CmpBase2,KErrNone);
       
  2387 	ASSERT_EQUALS(lock, RMobilePhone::ELockPhoneDevice, _L("RMobilePhone::NotifyLockInfoChange returned wrong aLock"));
       
  2388 	ASSERT_EQUALS(lockInfo2.iSetting, RMobilePhone::ELockSetDisabled, _L("RMobilePhone::NotifyLockInfoChange returned wrong iSetting"));
       
  2389 	
       
  2390 	// Check RMobilePhone::GetLockInfo with aLock=ELockPhoneDevice returns aLockInfo.iSetting=ELockSetDisabled
       
  2391 	mobilePhone.GetLockInfo(getLockInfoStatus, RMobilePhone::ELockPhoneDevice, lockInfoPckg2); 
       
  2392 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getLockInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetLockInfo timed-out"));
       
  2393 	ASSERT_EQUALS(getLockInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetLockInfo returned with an error"));
       
  2394 	ASSERT_EQUALS(lockInfo2.iSetting, RMobilePhone::ELockSetDisabled, _L("RMobilePhone::GetLockInfo returned wrong iSetting"));
       
  2395 
       
  2396 	//
       
  2397 	// TEST END
       
  2398 	//
       
  2399 
       
  2400     StartCleanup();
       
  2401     //ChangePhoneLockSetting(mobilePhone, RMobilePhone::ELockICC, RMobilePhone::ELockSetDisabled, pin1);
       
  2402 
       
  2403 	// Pop
       
  2404 	// notifyNotifyLockInfoChangeStatus
       
  2405 	// kStatus
       
  2406 	CleanupStack::PopAndDestroy(2, &notifyNotifyLockInfoChangeStatus);
       
  2407 	
       
  2408 	return TestStepResult();
       
  2409 	}
       
  2410 
       
  2411 TPtrC CCTSYIntegrationTestPhoneSecurity0017::GetTestStepName()
       
  2412 /**
       
  2413  * @return The test step name.
       
  2414  */
       
  2415 	{
       
  2416 	return _L("CCTSYIntegrationTestPhoneSecurity0017");
       
  2417 	}
       
  2418 
       
  2419 
       
  2420 
       
  2421 CCTSYIntegrationTestPhoneSecurity0018::CCTSYIntegrationTestPhoneSecurity0018(CEtelSessionMgr& aEtelSessionMgr)
       
  2422 	: CCTSYIntegrationTestPhoneSecurityBase(aEtelSessionMgr)
       
  2423 /**
       
  2424  * Constructor.
       
  2425  */
       
  2426 	{
       
  2427 	SetTestStepName(CCTSYIntegrationTestPhoneSecurity0018::GetTestStepName());
       
  2428 	}
       
  2429 
       
  2430 CCTSYIntegrationTestPhoneSecurity0018::~CCTSYIntegrationTestPhoneSecurity0018()
       
  2431 /**
       
  2432  * Destructor.
       
  2433  */
       
  2434 	{
       
  2435 	}
       
  2436 
       
  2437 TVerdict CCTSYIntegrationTestPhoneSecurity0018::doTestStepL()
       
  2438 /**
       
  2439  * @SYMTestCaseID BA-CTSY-INT-PSEC-0018
       
  2440  * @SYMFssID BA/CTSY/PSEC-0018
       
  2441  * @SYMTestCaseDesc Verify PIN1 needed at startup when PIN1 locked
       
  2442  * @SYMTestPriority High
       
  2443  * @SYMTestActions RMobilePhone::NotifySecurityEvent
       
  2444  * @SYMTestExpectedResults Pass - PIN1 entry is required at boot
       
  2445  * @SYMTestType CIT
       
  2446  * @SYMTestCaseDependencies live/automatic
       
  2447  *
       
  2448  * Reason for test: Verify PIN1 notification is received.
       
  2449  *
       
  2450  * @return - TVerdict code
       
  2451  */
       
  2452 	{
       
  2453 
       
  2454 	//
       
  2455 	// SET UP
       
  2456 	//
       
  2457 
       
  2458 	
       
  2459 	// Enable PIN1 with RMobilePhone::SetLockSetting with aLock=ELockICC, aSetting=ELockSetEnabled 
       
  2460 
       
  2461 	// Close down all subsessions and unload TSY 
       
  2462 
       
  2463 
       
  2464 	//
       
  2465 	// SET UP END
       
  2466 	//
       
  2467 	
       
  2468 	StartTest();
       
  2469 	
       
  2470 	//
       
  2471 	// TEST START
       
  2472 	//
       
  2473 	
       
  2474 	
       
  2475 	// Load the TSY 
       
  2476 
       
  2477 	// Open a phone session 
       
  2478 
       
  2479 	// Check RMobilePhone::NotifySecurityEvent completes with aEvent=EPin1Required
       
  2480 
       
  2481 	// Verify PIN1 with RMobilePhone::VerifySecurityCode with aType=ESecurityCodePin1, aCode=PIN1 
       
  2482 
       
  2483 	
       
  2484 	//
       
  2485 	// TEST END
       
  2486 	//
       
  2487 
       
  2488     StartCleanup();
       
  2489 	
       
  2490 	// Put any required test clean up here, then remove this comment
       
  2491 	
       
  2492 	return TestStepResult();
       
  2493 	}
       
  2494 
       
  2495 TPtrC CCTSYIntegrationTestPhoneSecurity0018::GetTestStepName()
       
  2496 /**
       
  2497  * @return The test step name.
       
  2498  */
       
  2499 	{
       
  2500 	return _L("CCTSYIntegrationTestPhoneSecurity0018");
       
  2501 	}
       
  2502 
       
  2503 
       
  2504