telephonyserverplugins/common_tsy/test/component/src/cctsyphonesecurityfu.cpp
changeset 0 3553901f7fa8
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 // The TEFUnit test suite for PhoneSecurity in the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsyphonesecurityfu.h"
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <et_clsvr.h>
       
    26 #include <ctsy/mmtsy_names.h>
       
    27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    28 #include "tmockltsydata.h"
       
    29 #include <ctsy/serviceapi/gsmerror.h>
       
    30 #include <ctsy/serviceapi/mmtsy_defaults.h>
       
    31 
       
    32 CTestSuite* CCTsyPhoneSecurityFU::CreateSuiteL(const TDesC& aName)
       
    33 	{
       
    34 	SUB_SUITE;
       
    35 
       
    36 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetLockInfo0001L);
       
    37 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetLockInfo0002L);
       
    38 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetLockInfo0003L);
       
    39 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetLockInfo0005L);
       
    40 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestClearBlacklist0001L);
       
    41 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestSetLockSetting0001L);
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestSetLockSetting0002L);
       
    43 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestSetLockSetting0004L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestSetLockSetting0005L);
       
    45 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestSetLockSetting0006L);
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetSecurityCaps0001L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestAbortSecurityCode0001L);
       
    48 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestAbortSecurityCode0005L);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestAbortSecurityCode0006L);
       
    50 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestAbortSecurityCode0007L);
       
    51 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestChangeSecurityCode0001L);
       
    52 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestChangeSecurityCode0002L);
       
    53 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestChangeSecurityCode0004L);
       
    54 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestChangeSecurityCode0005L);
       
    55 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0001L);
       
    56 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0002L);
       
    57 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0004L);
       
    58 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0005L);
       
    59 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0006L);
       
    60 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0007L);
       
    61 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0008L);
       
    62 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0009L);
       
    63 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0010L);
       
    64 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0011L);
       
    65 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0012L);
       
    66 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0013L);
       
    67 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestVerifySecurityCode0014L);
       
    68 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityEvent0001L);
       
    69 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityEvent0002L);
       
    70 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityEvent0004L);
       
    71 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityEvent0006L);
       
    72 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityEvent0007L);
       
    73 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityEvent0008L);
       
    74 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityEvent0009L);
       
    75 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityEvent0010L);
       
    76 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifyLockInfoChange0001L);
       
    77 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifyLockInfoChange0002L);
       
    78 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifyLockInfoChange0003L);
       
    79 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifyLockInfoChange0004L);
       
    80 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetSecurityCodeInfo0001L);
       
    81 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetSecurityCodeInfo0002L);
       
    82 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetSecurityCodeInfo0003L);
       
    83 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetSecurityCodeInfo0004L);
       
    84 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetSecurityCodeInfo0005L);
       
    85 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetSecurityCodeInfo0006L);
       
    86 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestGetSecurityCodeInfo0007L);
       
    87 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityCodeInfoChange0001L);
       
    88 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityCodeInfoChange0002L);
       
    89 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityCodeInfoChange0003L);
       
    90 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityCodeInfoChange0004L);
       
    91 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityCapsChange0001L);
       
    92 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityCapsChange0002L);
       
    93 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneSecurityFU, TestNotifySecurityCapsChange0004L);
       
    94 
       
    95 
       
    96 	END_SUITE;
       
    97 	}
       
    98 
       
    99 //
       
   100 // Actual test cases
       
   101 //
       
   102 
       
   103 
       
   104 /**
       
   105 @SYMTestCaseID BA-CTSY-PSEC-MGLI-0001
       
   106 @SYMComponent  telephony_ctsy
       
   107 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetLockInfo
       
   108 @SYMTestPriority High
       
   109 @SYMTestActions Invokes RMobilePhone::GetLockInfo
       
   110 @SYMTestExpectedResults Pass
       
   111 @SYMTestType CT
       
   112 */
       
   113 void CCTsyPhoneSecurityFU::TestGetLockInfo0001L()
       
   114 	{
       
   115 	OpenEtelServerL();
       
   116 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   117 	OpenPhoneL();
       
   118 
       
   119 	RBuf8 dataExpect;
       
   120 	CleanupClosePushL(dataExpect);
       
   121 	RBuf8 dataComplete;
       
   122 	CleanupClosePushL(dataComplete);
       
   123 
       
   124  	//-------------------------------------------------------------------------
       
   125 	// TEST A: failure to dispatch request to LTSY
       
   126  	//-------------------------------------------------------------------------
       
   127 	RMobilePhone::TMobilePhoneLock currentLock = RMobilePhone::ELockICC;
       
   128 	TMockLtsyData1<RMobilePhone::TMobilePhoneLock> phoneLockType(currentLock);
       
   129 	phoneLockType.SerialiseL(dataExpect);
       
   130 
       
   131 	iMockLTSY.ExpectL(EMobilePhoneGetLockInfo, dataExpect, KErrNotSupported);
       
   132 
       
   133 	TRequestStatus reqStatus;
       
   134 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
   135 	RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg(lockInfo);
       
   136 	iPhone.GetLockInfo(reqStatus, currentLock, lockInfoPckg);
       
   137     User::WaitForRequest(reqStatus);
       
   138    	AssertMockLtsyStatusL();
       
   139 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
   140 
       
   141 	//-------------------------------------------------------------------------
       
   142 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   143  	//-------------------------------------------------------------------------
       
   144 	iMockLTSY.ExpectL(EMobilePhoneGetLockInfo, dataExpect);
       
   145 
       
   146 	RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;
       
   147 	RMobilePhone::TMobilePhoneLockStatus lockStatus = RMobilePhone::EStatusLocked;
       
   148 
       
   149     TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> phoneLockData(lockStatus, lockSetting);
       
   150 	phoneLockData.SerialiseL(dataComplete);
       
   151 
       
   152 	iMockLTSY.CompleteL(EMobilePhoneGetLockInfo, KErrGeneral , dataComplete);
       
   153 	iPhone.GetLockInfo(reqStatus, currentLock, lockInfoPckg);
       
   154 	User::WaitForRequest(reqStatus);
       
   155 	AssertMockLtsyStatusL();
       
   156 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
       
   157 
       
   158  	//-------------------------------------------------------------------------
       
   159 	// TEST C: Successful completion request of
       
   160 	// RMobilePhone::GetLockInfo when result is not cached.
       
   161  	//-------------------------------------------------------------------------
       
   162 	iMockLTSY.ExpectL(EMobilePhoneGetLockInfo, dataExpect);
       
   163 	iMockLTSY.CompleteL(EMobilePhoneGetLockInfo, KErrNone, dataComplete);
       
   164 
       
   165 	iPhone.GetLockInfo(reqStatus, currentLock, lockInfoPckg);
       
   166     User::WaitForRequest(reqStatus);
       
   167     
       
   168 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   169 	ASSERT_EQUALS(lockInfo.iSetting, lockSetting);
       
   170 	ASSERT_EQUALS(lockInfo.iStatus, lockStatus);	
       
   171    	AssertMockLtsyStatusL();	
       
   172 	
       
   173 	//-------------------------------------------------------------------------
       
   174 	// TEST E:
       
   175 	//-------------------------------------------------------------------------	
       
   176 	TRequestStatus mockLtsyStatus;
       
   177 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   178 	iMockLTSY.CompleteL(EMobilePhoneGetLockInfo, KErrNone, dataComplete);
       
   179 	User::WaitForRequest(mockLtsyStatus);
       
   180 	AssertMockLtsyStatusL();
       
   181 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   182 
       
   183 	CleanupStack::PopAndDestroy(3); // dataComplete, dataExpect, this
       
   184 	}
       
   185 
       
   186 
       
   187 /**
       
   188 @SYMTestCaseID BA-CTSY-PSEC-MGLI-0002
       
   189 @SYMComponent  telephony_ctsy
       
   190 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::GetLockInfo
       
   191 @SYMTestPriority High
       
   192 @SYMTestActions Invokes cancelling of RMobilePhone::GetLockInfo
       
   193 @SYMTestExpectedResults Pass
       
   194 @SYMTestType CT
       
   195 */
       
   196 void CCTsyPhoneSecurityFU::TestGetLockInfo0002L()
       
   197 	{
       
   198 	OpenEtelServerL(EUseExtendedError);
       
   199 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   200 	OpenPhoneL();
       
   201 
       
   202 	TRequestStatus mockLtsyStatus;
       
   203 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   204 
       
   205 	RBuf8 data;
       
   206 	CleanupClosePushL(data);
       
   207 
       
   208  	//-------------------------------------------------------------------------
       
   209 	// Test cancelling of RMobilePhone::GetLockInfo
       
   210  	//-------------------------------------------------------------------------
       
   211 	// Expect request in LTSY
       
   212 	RMobilePhone::TMobilePhoneLock currentLock = RMobilePhone::ELockICC;
       
   213 	TMockLtsyData1<RMobilePhone::TMobilePhoneLock> phoneLockType(currentLock);
       
   214 	phoneLockType.SerialiseL(data);
       
   215 	iMockLTSY.ExpectL(EMobilePhoneGetLockInfo, data);
       
   216 
       
   217 	// Complete request after a delay
       
   218 	RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;
       
   219 	RMobilePhone::TMobilePhoneLockStatus lockStatus = RMobilePhone::EStatusLocked;
       
   220     TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> phoneLockData(lockStatus, lockSetting);
       
   221 	data.Close();
       
   222 	phoneLockData.SerialiseL(data);
       
   223 	iMockLTSY.CompleteL(EMobilePhoneGetLockInfo, KErrNone , data, 20);
       
   224 
       
   225 	// Make request and cancel it
       
   226 	TRequestStatus reqStatus;
       
   227 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
   228 	RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg(lockInfo);
       
   229 	iPhone.GetLockInfo(reqStatus, currentLock, lockInfoPckg);
       
   230 	iPhone.CancelAsyncRequest(EMobilePhoneGetLockInfo);
       
   231 	User::WaitForRequest(reqStatus);
       
   232 
       
   233 	// Check status is KErrCancel
       
   234 	ASSERT_EQUALS(KErrCancel,reqStatus.Int());
       
   235 
       
   236 	// Wait for completion of iMockLTSY.NotifyTerminated
       
   237 	User::WaitForRequest(mockLtsyStatus);
       
   238 	CleanupStack::PopAndDestroy(2); // data, this
       
   239 	}
       
   240 
       
   241 
       
   242 /**
       
   243 @SYMTestCaseID BA-CTSY-PSEC-MGLI-0003
       
   244 @SYMComponent  telephony_ctsy
       
   245 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetLockInfo with bad parameter data
       
   246 @SYMTestPriority High
       
   247 @SYMTestActions Invokes RMobilePhone::GetLockInfo with bad parameter data
       
   248 @SYMTestExpectedResults Pass
       
   249 @SYMTestType CT
       
   250 */
       
   251 void CCTsyPhoneSecurityFU::TestGetLockInfo0003L()
       
   252 	{
       
   253 	OpenEtelServerL(EUseExtendedError);
       
   254 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   255 	OpenPhoneL();
       
   256 
       
   257 	//-------------------------------------------------------------------------
       
   258 	// Test B: Test passing wrong descriptor size to parameter in
       
   259 	// RMobilePhone::GetLockInfo
       
   260  	//-------------------------------------------------------------------------
       
   261  	
       
   262 	// CTSY should return an error straight away
       
   263 	
       
   264 	TTestMultimodeType badType(KETelExtMultimodeV1);
       
   265 	TTestMultimodeTypePckg badTypePckg(badType);
       
   266 
       
   267 	TRequestStatus reqStatus;
       
   268 	iPhone.GetLockInfo(reqStatus, RMobilePhone::ELockICC, badTypePckg);
       
   269     User::WaitForRequest(reqStatus);
       
   270 	ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
   271    	AssertMockLtsyStatusL();
       
   272 
       
   273 	// Done !
       
   274 	CleanupStack::PopAndDestroy(this); // this
       
   275 	}
       
   276 
       
   277 
       
   278 /**
       
   279 @SYMTestCaseID BA-CTSY-PSEC-MGLI-0005
       
   280 @SYMComponent  telephony_ctsy
       
   281 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetLockInfo with timeout
       
   282 @SYMTestPriority High
       
   283 @SYMTestActions Invokes RMobilePhone::GetLockInfo and tests for timeout
       
   284 @SYMTestExpectedResults Pass
       
   285 @SYMTestType CT
       
   286 */
       
   287 void CCTsyPhoneSecurityFU::TestGetLockInfo0005L()
       
   288 	{
       
   289 	OpenEtelServerL(EUseExtendedError);
       
   290 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   291 	OpenPhoneL();
       
   292 
       
   293 	RBuf8 data;
       
   294 	CleanupClosePushL(data);
       
   295 
       
   296 	//-------------------------------------------------------------------------
       
   297 	// Test A: Test timeout of RMobilePhone::GetLockInfo
       
   298  	//-------------------------------------------------------------------------
       
   299 	// Expect request in LTSY
       
   300 	RMobilePhone::TMobilePhoneLock currentLock = RMobilePhone::ELockICC;
       
   301 	TMockLtsyData1<RMobilePhone::TMobilePhoneLock> phoneLockType(currentLock);
       
   302 	phoneLockType.SerialiseL(data);
       
   303 	iMockLTSY.ExpectL(EMobilePhoneGetLockInfo, data);
       
   304 
       
   305 	// Make request and wait for it to timeout
       
   306 	TRequestStatus reqStatus;
       
   307 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
   308 	RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg(lockInfo);
       
   309 	iPhone.GetLockInfo(reqStatus, currentLock, lockInfoPckg);
       
   310 	User::WaitForRequest(reqStatus);
       
   311 
       
   312 	// Check status is KErrTimedOut
       
   313 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int())
       
   314 
       
   315 	// Done !
       
   316 	CleanupStack::PopAndDestroy(2); // data, this
       
   317 	}
       
   318 
       
   319 
       
   320 /**
       
   321 @SYMTestCaseID BA-CTSY-PSEC-MCB-0001
       
   322 @SYMComponent  telephony_ctsy
       
   323 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::ClearBlacklist
       
   324 @SYMTestPriority High
       
   325 @SYMTestActions Invokes RMobilePhone::ClearBlacklist
       
   326 @SYMTestExpectedResults Pass
       
   327 @SYMTestType CT
       
   328 */
       
   329 void CCTsyPhoneSecurityFU::TestClearBlacklist0001L()
       
   330 	{
       
   331 
       
   332 	OpenEtelServerL(EUseExtendedError);
       
   333 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   334 	OpenPhoneL();
       
   335 
       
   336 	RBuf8 data;
       
   337 	CleanupClosePushL(data);
       
   338 
       
   339 	TRequestStatus reqStatus;
       
   340 	iPhone.ClearBlacklist(reqStatus);
       
   341 	User::WaitForRequest(reqStatus);
       
   342 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   343 	// Test API is not supported
       
   344 
       
   345 	AssertMockLtsyStatusL();
       
   346 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   347 	
       
   348 	}
       
   349 
       
   350 
       
   351 /**
       
   352 @SYMTestCaseID BA-CTSY-PSEC-MSLS-0001
       
   353 @SYMComponent  telephony_ctsy
       
   354 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetLockSetting
       
   355 @SYMTestPriority High
       
   356 @SYMTestActions Invokes RMobilePhone::SetLockSetting
       
   357 @SYMTestExpectedResults Pass
       
   358 @SYMTestType CT
       
   359 */
       
   360 void CCTsyPhoneSecurityFU::TestSetLockSetting0001L()
       
   361 	{
       
   362 	OpenEtelServerL(EUseExtendedError);
       
   363 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   364 	OpenPhoneL();
       
   365 
       
   366 	RBuf8 data;
       
   367 	CleanupClosePushL(data);
       
   368 	
       
   369 	RBuf8 dataComplete;
       
   370 	CleanupClosePushL(dataComplete);
       
   371 
       
   372 	TRequestStatus status;
       
   373 	
       
   374 	// data for ExpectL for test B
       
   375 	RMobilePhone::TMobilePhoneLockStatus lockStatusB = RMobilePhone::EStatusLocked;
       
   376 	RMobilePhone::TMobilePhoneLock lockB = RMobilePhone::ELockPhoneDevice;
       
   377 	RMobilePhone::TMobilePhoneLockSetting lockSettingB = RMobilePhone::ELockSetEnabled;	
       
   378 
       
   379 	// data for CompleteL
       
   380 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> 
       
   381 															lockStatusDataB(lockStatusB,lockSettingB);
       
   382 	lockStatusDataB.SerialiseL(dataComplete);
       
   383 	
       
   384 		
       
   385 	//-------------------------------------------------------------------------
       
   386 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   387  	//-------------------------------------------------------------------------	
       
   388 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 70305);
       
   389 	iPhone.SetLockSetting(status, lockB, lockSettingB);	
       
   390 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrGeneral, dataComplete);
       
   391 	User::WaitForRequest(status);
       
   392 	ASSERT_EQUALS(KErrGeneral, status.Int());
       
   393 	AssertMockLtsyStatusL();
       
   394 		 	 
       
   395 	
       
   396 	// data for ExpectL
       
   397 	TLockSettingPassword lockSettingPassword;
       
   398 	lockSettingPassword.iPassword.Copy(KNullDesC);
       
   399 	RMobilePhone::TMobilePhoneLock& lock( lockSettingPassword.iLock );
       
   400 	RMobilePhone::TMobilePhoneLockSetting& lockSetting( lockSettingPassword.iSetting );
       
   401 	lock        = RMobilePhone::ELockHiddenKey;//ELockUSimApp;
       
   402 	lockSetting = RMobilePhone::ELockSetEnabled;	
       
   403 	TMockLtsyData1<TLockSettingPassword> phoneLockData(lockSettingPassword);
       
   404 	phoneLockData.SerialiseL(data);
       
   405 
       
   406  	//-------------------------------------------------------------------------
       
   407 	// TEST E: Unsolicited completion of RMobilePhone::SetLockSetting
       
   408 	// from LTSY.
       
   409  	//------------------------------------------------------------------------- 	
       
   410 	TRequestStatus mockLtsyStatus;
       
   411 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   412 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);
       
   413 	User::WaitForRequest(mockLtsyStatus);
       
   414 	AssertMockLtsyStatusL();
       
   415 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   416 	
       
   417 
       
   418   	//-------------------------------------------------------------------------
       
   419 	// TEST C: Successful completion request of
       
   420 	// RMobilePhone::SetLockSetting when result is not cached.
       
   421  	//-------------------------------------------------------------------------
       
   422 	iMockLTSY.ExpectL(EMobilePhoneSetLockSetting, data);
       
   423 
       
   424 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   425 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);
       
   426 	User::WaitForRequest(status);
       
   427 	AssertMockLtsyStatusL();
       
   428 	ASSERT_EQUALS(KErrNone, status.Int());	
       
   429 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 70302);
       
   430 		
       
   431 	//-------------------------------------------------------------------------
       
   432 	// TEST E2: Unsolicited completion of RMobilePhone::SetLockSetting
       
   433 	// from LTSY.
       
   434  	//------------------------------------------------------------------------- 	
       
   435 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   436 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);
       
   437 	User::WaitForRequest(mockLtsyStatus);
       
   438 	AssertMockLtsyStatusL();
       
   439 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
   440 	
       
   441 	
       
   442 	//-------------------------------------------------------------------------
       
   443 	// TEST A: failure to dispatch request to LTSY
       
   444  	//-------------------------------------------------------------------------
       
   445 	iMockLTSY.ExpectL(EMobilePhoneSetLockSetting, data);		
       
   446 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   447 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);
       
   448 	User::WaitForRequest(status);
       
   449 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 70302);
       
   450 	AssertMockLtsyStatusL();
       
   451 	ASSERT_EQUALS(KErrNone, status.Int());
       
   452 	
       
   453 	
       
   454 	AssertMockLtsyStatusL();	
       
   455 	CleanupStack::PopAndDestroy(3, this); // data, this	
       
   456 	}
       
   457 
       
   458 
       
   459 /**
       
   460 @SYMTestCaseID BA-CTSY-PSEC-MSLS-0002
       
   461 @SYMComponent  telephony_ctsy
       
   462 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::SetLockSetting
       
   463 @SYMTestPriority High
       
   464 @SYMTestActions Invokes cancelling of RMobilePhone::SetLockSetting
       
   465 @SYMTestExpectedResults Pass
       
   466 @SYMTestType CT
       
   467 */
       
   468 void CCTsyPhoneSecurityFU::TestSetLockSetting0002L()
       
   469 	{
       
   470 
       
   471 // This test should test cancellation of SetLockSetting
       
   472 // If this API does not have a cancel, the test step should be completely removed.
       
   473 
       
   474 	OpenEtelServerL(EUseExtendedError);
       
   475 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   476 	OpenPhoneL();
       
   477 
       
   478 	TRequestStatus mockLtsyStatus;
       
   479 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   480 
       
   481 	RBuf8 data;
       
   482 	CleanupClosePushL(data);
       
   483 
       
   484  	//-------------------------------------------------------------------------
       
   485 	// Test cancelling of RMobilePhone::SetLockSetting
       
   486  	//-------------------------------------------------------------------------  	
       
   487  	RMobilePhone::TMobilePhoneLockStatus lockStatus = RMobilePhone::EStatusLocked;
       
   488 	RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockPhoneDevice;
       
   489 	RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;
       
   490  	
       
   491  	TMockLtsyData2 <RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> ltsyData(lockStatus, lockSetting);
       
   492 	ltsyData.SerialiseL(data);	
       
   493 	
       
   494 	TRequestStatus requestStatus;
       
   495 	//send request
       
   496 	iPhone.SetLockSetting(requestStatus, lock, lockSetting);	
       
   497 	// send canceling...
       
   498 	iPhone.CancelAsyncRequest(EMobilePhoneSetLockSetting);
       
   499 	
       
   500 	//send completion
       
   501 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, data);
       
   502 	// wait for completion
       
   503 	User::WaitForRequest(mockLtsyStatus);
       
   504 	
       
   505 	// wait for NotifyStatusChange
       
   506 	User::WaitForRequest(requestStatus);
       
   507 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
   508 	
       
   509 	CleanupStack::PopAndDestroy(2); // data, this	
       
   510 	}
       
   511 
       
   512 
       
   513 /**
       
   514 @SYMTestCaseID BA-CTSY-PSEC-MSLS-0004
       
   515 @SYMComponent  telephony_ctsy
       
   516 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::SetLockSetting
       
   517 @SYMTestPriority High
       
   518 @SYMTestActions Invokes multiple client requests to RMobilePhone::SetLockSetting
       
   519 @SYMTestExpectedResults Pass
       
   520 @SYMTestType CT
       
   521 */
       
   522 void CCTsyPhoneSecurityFU::TestSetLockSetting0004L()
       
   523 	{
       
   524 					
       
   525 	OpenEtelServerL(EUseExtendedError);
       
   526 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   527 	OpenPhoneL();
       
   528 
       
   529 	RBuf8 dataExpect;
       
   530 	CleanupClosePushL(dataExpect);
       
   531 	
       
   532 	RBuf8 dataExpect2;
       
   533 	CleanupClosePushL(dataExpect2);
       
   534 	
       
   535 	RBuf8 dataComplete;
       
   536 	CleanupClosePushL(dataComplete);
       
   537 	
       
   538 	// Open second client
       
   539 	RTelServer telServer2;
       
   540 	TInt ret = telServer2.Connect();
       
   541 	ASSERT_EQUALS(KErrNone, ret);
       
   542 	CleanupClosePushL(telServer2);
       
   543 
       
   544 	RMobilePhone phone2;
       
   545 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
   546 	ASSERT_EQUALS(KErrNone, ret);
       
   547 	CleanupClosePushL(phone2);	
       
   548 	
       
   549 	//-------------------------------------------------------------------------
       
   550 	// Test A: Test multiple clients requesting RMobilePhone::SetLockSetting
       
   551  	//-------------------------------------------------------------------------
       
   552 	// initialize data for first mobile phone's SetLockSetting
       
   553 	TLockSettingPassword lockSettingPassword;
       
   554 	lockSettingPassword.iPassword.Copy(KNullDesC);
       
   555 	RMobilePhone::TMobilePhoneLock& lock( lockSettingPassword.iLock );
       
   556 	RMobilePhone::TMobilePhoneLockSetting& lockSetting( lockSettingPassword.iSetting );
       
   557 	lock        = RMobilePhone::ELockHiddenKey;
       
   558 	lockSetting = RMobilePhone::ELockSetEnabled;
       
   559 	TMockLtsyData1<TLockSettingPassword> expData(lockSettingPassword);
       
   560 	expData.SerialiseL(dataExpect);	
       
   561  
       
   562 	// initialize data for second mobile phone's SetLockSetting
       
   563 	TLockSettingPassword lockSettingPassword2;
       
   564 	lockSettingPassword2.iPassword.Copy(KNullDesC);
       
   565 	RMobilePhone::TMobilePhoneLock& lock2( lockSettingPassword2.iLock );
       
   566 	RMobilePhone::TMobilePhoneLockSetting& lockSetting2( lockSettingPassword2.iSetting );
       
   567 	lock2        = RMobilePhone::ELockUSimApp;
       
   568 	lockSetting2 = RMobilePhone::ELockSetDisabled;
       
   569 	TMockLtsyData1<TLockSettingPassword> expData2(lockSettingPassword2);
       
   570 	expData2.SerialiseL(dataExpect2);
       
   571 	
       
   572 	// data for complete
       
   573 	RMobilePhone::TMobilePhoneLockStatus complete_lockStatus = RMobilePhone::EStatusLocked;
       
   574 	RMobilePhone::TMobilePhoneLockSetting complete_lockSetting = RMobilePhone::ELockSetEnabled;	
       
   575 	
       
   576 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> 
       
   577 															lockStatusData(complete_lockStatus,complete_lockSetting);
       
   578 	lockStatusData.SerialiseL(dataComplete);
       
   579 	TRequestStatus	requestStatus; 	
       
   580 	TRequestStatus	requestStatus2;	
       
   581 			
       
   582 	// send first request		
       
   583 	iMockLTSY.ExpectL(EMobilePhoneSetLockSetting, dataExpect);	
       
   584 	iPhone.SetLockSetting(requestStatus, lock, lockSetting);
       
   585 	
       
   586 	// send second request	
       
   587 	phone2.SetLockSetting(requestStatus2, lock2, lockSetting2);	
       
   588 	
       
   589 	// send completion for first phone SetlockSetting
       
   590 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);	
       
   591 		
       
   592 	// wait for first phone SetLockSetting
       
   593 	User::WaitForRequest(requestStatus);
       
   594 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
   595 		
       
   596 	// wait for second phone SetLockSetting.
       
   597 	User::WaitForRequest(requestStatus2);
       
   598 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
   599 	
       
   600 	AssertMockLtsyStatusL();	
       
   601 	// Done !
       
   602 	CleanupStack::PopAndDestroy(6, this); //  this ...
       
   603 
       
   604 	}
       
   605 
       
   606 
       
   607 /**
       
   608 @SYMTestCaseID BA-CTSY-PSEC-MSLS-0005
       
   609 @SYMComponent  telephony_ctsy
       
   610 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetLockSetting with timeout
       
   611 @SYMTestPriority High
       
   612 @SYMTestActions Invokes RMobilePhone::SetLockSetting and tests for timeout
       
   613 @SYMTestExpectedResults Pass
       
   614 @SYMTestType CT
       
   615 */
       
   616 void CCTsyPhoneSecurityFU::TestSetLockSetting0005L()
       
   617 	{
       
   618 	OpenEtelServerL(EUseExtendedError);
       
   619 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   620 	OpenPhoneL();
       
   621 
       
   622 	RBuf8 data;
       
   623 	CleanupClosePushL(data);
       
   624 	
       
   625 	RBuf8 dataExpect;
       
   626 	CleanupClosePushL(dataExpect);
       
   627 
       
   628 	//-------------------------------------------------------------------------
       
   629 	// Test A: Test timeout of RMobilePhone::SetLockSetting
       
   630  	//-------------------------------------------------------------------------
       
   631 	RMobilePhone::TMobilePhoneLockStatus lockStatus = RMobilePhone::EStatusLocked;
       
   632 	TLockSettingPassword lockSettingPassword;
       
   633 	lockSettingPassword.iPassword.Copy(KNullDesC);
       
   634 	RMobilePhone::TMobilePhoneLock& lock( lockSettingPassword.iLock );
       
   635 	RMobilePhone::TMobilePhoneLockSetting& lockSetting( lockSettingPassword.iSetting );
       
   636 	lock = RMobilePhone::ELockPhoneDevice;
       
   637 	lockSetting = RMobilePhone::ELockSetEnabled; 	
       
   638 	TMockLtsyData1<TLockSettingPassword> expData(lockSettingPassword);
       
   639 	expData.SerialiseL(dataExpect);
       
   640 	
       
   641  	TMockLtsyData2 <RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> ltsyData(lockStatus, lockSetting);
       
   642 	ltsyData.SerialiseL(data);
       
   643 	
       
   644 	TRequestStatus	requestStatus; 
       
   645 		
       
   646 	iMockLTSY.ExpectL(EMobilePhoneSetLockSetting, dataExpect);
       
   647 	
       
   648 	iPhone.SetLockSetting(requestStatus, lock, lockSetting);			
       
   649 		
       
   650 	// wait for first phone SetLockSetting
       
   651 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 70303);
       
   652 	User::WaitForRequest(requestStatus);
       
   653 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
   654 	
       
   655 	AssertMockLtsyStatusL();
       
   656 	// Done !
       
   657 	CleanupStack::PopAndDestroy(3, this); // data, this
       
   658 
       
   659 	}
       
   660 
       
   661 /**
       
   662 @SYMTestCaseID BA-CTSY-PSEC-MSLS-0006
       
   663 @SYMComponent  telephony_ctsy
       
   664 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetLockSetting
       
   665 @SYMTestPriority High
       
   666 @SYMTestActions Invokes RMobilePhone::SetLockSetting
       
   667 @SYMTestExpectedResults Pass
       
   668 @SYMTestType CT
       
   669 */
       
   670 void CCTsyPhoneSecurityFU::TestSetLockSetting0006L()
       
   671 	{
       
   672 
       
   673 	OpenEtelServerL(EUseExtendedError);
       
   674 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   675 	OpenPhoneL();
       
   676 
       
   677 	RBuf8 data;
       
   678 	CleanupClosePushL(data);
       
   679 		
       
   680 	RBuf8 dataComplete;
       
   681 	CleanupClosePushL(dataComplete);
       
   682 	
       
   683 	
       
   684 	//-------------------------------------------------------------------------
       
   685 	// TEST for case RMobilePhone::ELockICC:
       
   686  	//-------------------------------------------------------------------------	
       
   687  	// data for ExpectL 
       
   688 	RMobilePhone::TMobilePhoneLockStatus lockStatus = RMobilePhone::EStatusLocked;
       
   689 	TLockSettingPassword lockSettingPassword;
       
   690 	lockSettingPassword.iPassword.Copy(KNullDesC);
       
   691 	RMobilePhone::TMobilePhoneLock& lock( lockSettingPassword.iLock );
       
   692 	RMobilePhone::TMobilePhoneLockSetting& lockSetting( lockSettingPassword.iSetting );
       
   693 	lock        = RMobilePhone::ELockICC;
       
   694 	lockSetting = RMobilePhone::ELockSetEnabled;	
       
   695 	TMockLtsyData1<TLockSettingPassword> phoneLockData(lockSettingPassword);
       
   696 	phoneLockData.SerialiseL(data);
       
   697 	
       
   698 	// data for CompleteL
       
   699 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> 
       
   700 															lockStatusData(lockStatus,lockSetting);
       
   701 	lockStatusData.SerialiseL(dataComplete);
       
   702 	TRequestStatus status;
       
   703 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   704 	// send completion
       
   705 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);
       
   706 	User::WaitForRequest(status);
       
   707 	ASSERT_EQUALS(KErrNone, status.Int());
       
   708 	AssertMockLtsyStatusL();
       
   709 	
       
   710 	//-------------------------------------------------------------------------
       
   711 	// TEST for case RMobilePhone::ELockPin2
       
   712  	//-------------------------------------------------------------------------	
       
   713  	// data for ExpectL 
       
   714 	lockStatus = RMobilePhone::EStatusLocked;
       
   715 	lock = RMobilePhone::ELockPin2;
       
   716 	lockSetting = RMobilePhone::ELockSetEnabled;	
       
   717 	data.Close();
       
   718 	phoneLockData.SerialiseL(data);
       
   719 	
       
   720 	// data for CompleteL
       
   721 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> 
       
   722 															lockStatusData1(lockStatus,lockSetting);
       
   723 	dataComplete.Close();
       
   724 	lockStatusData.SerialiseL(dataComplete);
       
   725 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   726 	// send completion
       
   727 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);
       
   728 	User::WaitForRequest(status);
       
   729 	ASSERT_EQUALS(KErrNone, status.Int());
       
   730 	AssertMockLtsyStatusL();
       
   731 	
       
   732 
       
   733 	//-------------------------------------------------------------------------
       
   734 	// TEST for case RMobilePhone::ELockUniversalPin 
       
   735  	//-------------------------------------------------------------------------	
       
   736  	// data for ExpectL 
       
   737 	lockStatus = RMobilePhone::EStatusLocked;
       
   738 	lock = RMobilePhone::ELockUniversalPin;
       
   739 	lockSetting = RMobilePhone::ELockSetEnabled;	
       
   740 	data.Close();
       
   741 	phoneLockData.SerialiseL(data);
       
   742 	
       
   743 	// data for CompleteL
       
   744 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> 
       
   745 															lockStatusData2(lockStatus,lockSetting);
       
   746 	dataComplete.Close();
       
   747 	lockStatusData2.SerialiseL(dataComplete);
       
   748 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   749 	// send completion
       
   750 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);
       
   751 	User::WaitForRequest(status);
       
   752 	ASSERT_EQUALS(KErrNone, status.Int());
       
   753 	AssertMockLtsyStatusL();
       
   754 	
       
   755 	
       
   756 	//-------------------------------------------------------------------------
       
   757 	// TEST for case RMobilePhone::ELockUniversalPin and with  lockSetting == ELockReplaced
       
   758  	//-------------------------------------------------------------------------	
       
   759  	// data for ExpectL 
       
   760 	lockStatus = RMobilePhone::EStatusLocked;
       
   761 	lock = RMobilePhone::ELockUniversalPin;
       
   762 	lockSetting = RMobilePhone::ELockReplaced;	
       
   763 	data.Close();
       
   764 	phoneLockData.SerialiseL(data);
       
   765 	
       
   766 	// data for CompleteL
       
   767 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> 
       
   768 															lockStatusData3(lockStatus,lockSetting);
       
   769 	dataComplete.Close();
       
   770 	lockStatusData3.SerialiseL(dataComplete);
       
   771 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   772 	// send completion
       
   773 	iMockLTSY.CompleteL(EMobilePhoneSetLockSetting, KErrNone, dataComplete);
       
   774 	User::WaitForRequest(status);
       
   775 	ASSERT_EQUALS(KErrNone, status.Int());
       
   776 	AssertMockLtsyStatusL();
       
   777 	
       
   778 	
       
   779 	//-------------------------------------------------------------------------
       
   780 	// TEST for case RMobilePhone::ELockPhoneToFirstICC 
       
   781  	//-------------------------------------------------------------------------	
       
   782  	// data for ExpectL 
       
   783 	lockStatus = RMobilePhone::EStatusLocked;
       
   784 	lock = RMobilePhone::ELockPhoneToFirstICC;
       
   785 	lockSetting = RMobilePhone::ELockReplaced;	
       
   786 	data.Close();
       
   787 	phoneLockData.SerialiseL(data);
       
   788 	
       
   789 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   790 	User::WaitForRequest(status);
       
   791 	ASSERT_EQUALS(KErrNotSupported, status.Int());
       
   792 	AssertMockLtsyStatusL();  
       
   793 	
       
   794 	
       
   795 	//-------------------------------------------------------------------------
       
   796 	// TEST for condition RMobilePhone::ELockSetUnknown != *setting
       
   797  	//-------------------------------------------------------------------------	
       
   798  	// data for ExpectL 
       
   799 	lockStatus = RMobilePhone::EStatusLocked;
       
   800 	lock = RMobilePhone::ELockPhoneToFirstICC;
       
   801 	lockSetting = RMobilePhone::ELockSetUnknown;	
       
   802 	data.Close();
       
   803 	phoneLockData.SerialiseL(data);
       
   804 
       
   805 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   806 	User::WaitForRequest(status);
       
   807 	ASSERT_EQUALS(KErrNotSupported, status.Int());
       
   808 	AssertMockLtsyStatusL();  
       
   809 
       
   810 	//-------------------------------------------------------------------------
       
   811 	// TEST for condition
       
   812 	//		 if (
       
   813   	//          ( RMobilePhone::ELockSetDisabled == *setting ) &&
       
   814  	//          ( RMobilePhone::ELockICC == *lock ||
       
   815  	//            RMobilePhone::ELockUniversalPin == *lock ) &&
       
   816   	//            !iPin1DisableSupported )
       
   817  	//-------------------------------------------------------------------------	
       
   818  	
       
   819  	//------- Set iPin1DisableSupported-member to False state ----------------- 	
       
   820  	// data for CompleteL
       
   821  	TBool supported = EFalse;
       
   822 	TMockLtsyData1<TBool> ltsyData(supported);
       
   823 	dataComplete.Close();
       
   824 	ltsyData.SerialiseL(dataComplete);	
       
   825 	
       
   826 	TRequestStatus mockLtsyStatus;
       
   827 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   828  	// send completion for calling SetPin1DisableNotSupported
       
   829 	iMockLTSY.CompleteL(EMmTsyPhoneGetPin1DisableSupportedIPC, KErrNone, dataComplete);
       
   830 	User::WaitForRequest(mockLtsyStatus);
       
   831 	AssertMockLtsyStatusL();
       
   832 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
   833 	//-------------------------------------------------------------------------
       
   834  	
       
   835  	// data for ExpectL 
       
   836 	lockStatus = RMobilePhone::EStatusLocked;
       
   837 	lock = RMobilePhone::ELockICC;
       
   838 	lockSetting = RMobilePhone::ELockSetDisabled;	
       
   839 	data.Close();
       
   840 	phoneLockData.SerialiseL(data);
       
   841  	
       
   842  	// call SetLockSetting itself
       
   843 	iPhone.SetLockSetting(status, lock, lockSetting);
       
   844 	User::WaitForRequest(status);
       
   845 	ASSERT_EQUALS(KErrGsm0707OperationNotAllowed, status.Int());
       
   846 	AssertMockLtsyStatusL();  
       
   847 	
       
   848 	CleanupStack::PopAndDestroy(3, this); // data, this
       
   849 	}
       
   850 /**
       
   851 @SYMTestCaseID BA-CTSY-PSEC-MGSC-0001
       
   852 @SYMComponent  telephony_ctsy
       
   853 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSecurityCaps
       
   854 @SYMTestPriority High
       
   855 @SYMTestActions Invokes RMobilePhone::GetSecurityCaps
       
   856 @SYMTestExpectedResults Pass
       
   857 @SYMTestType CT
       
   858 */
       
   859 void CCTsyPhoneSecurityFU::TestGetSecurityCaps0001L()
       
   860 	{
       
   861 
       
   862 	OpenEtelServerL(EUseExtendedError);
       
   863 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   864 	OpenPhoneL();
       
   865 
       
   866 	RBuf8 data;
       
   867 	CleanupClosePushL(data);	
       
   868 	
       
   869 	TRequestStatus mockLtsyStatus;
       
   870 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   871 
       
   872 	// Get default Caps
       
   873     TUint32 oldCaps;	
       
   874     iPhone.GetSecurityCaps(oldCaps);
       
   875 	ASSERT_EQUALS(KMultimodeTsyGsmSecurityInitCaps, oldCaps)
       
   876 
       
   877 	// Change securityCaps
       
   878 	RMobilePhone::TMobilePhoneSecurityEvent ev(RMobilePhone::EICCTerminated);
       
   879 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> evData(ev);
       
   880 	evData.SerialiseL(data);
       
   881 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
   882 
       
   883 	// Wait for completion of iMockLTSY.NotifyTerminated
       
   884 	User::WaitForRequest(mockLtsyStatus);
       
   885 	AssertMockLtsyStatusL();
       
   886    
       
   887     // operations taken from CMmPhoneGsmWcdmaExt::UpdateSecurityCaps()
       
   888     TUint32 capsToCompare(0);	    	
       
   889     if ( oldCaps & RMobilePhone::KCapsLockPhone )
       
   890         {
       
   891         capsToCompare |= RMobilePhone::KCapsLockPhone;
       
   892         }
       
   893     if ( oldCaps & RMobilePhone::KCapsAccessPhonePassword )
       
   894         {
       
   895         capsToCompare |= RMobilePhone::KCapsAccessPhonePassword;
       
   896         }
       
   897 
       
   898 	// Get changed Caps        
       
   899     TUint32 newCaps;
       
   900     iPhone.GetSecurityCaps(newCaps);
       
   901 	
       
   902 	ASSERT_EQUALS(capsToCompare, newCaps); 
       
   903 
       
   904 	AssertMockLtsyStatusL();
       
   905 	CleanupStack::PopAndDestroy(2, this); // data, this	
       
   906 	}
       
   907 	
       
   908 
       
   909 /**
       
   910 @SYMTestCaseID BA-CTSY-PSEC-MASC-0001
       
   911 @SYMComponent  telephony_ctsy
       
   912 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::AbortSecurityCode
       
   913 @SYMTestPriority High
       
   914 @SYMTestActions Invokes RMobilePhone::AbortSecurityCode
       
   915 @SYMTestExpectedResults Pass
       
   916 @SYMTestType CT
       
   917 */
       
   918 void CCTsyPhoneSecurityFU::TestAbortSecurityCode0001L()
       
   919 	{
       
   920 
       
   921 	OpenEtelServerL(EUseExtendedError);
       
   922 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   923 	OpenPhoneL();
       
   924 
       
   925 	RBuf8 data;
       
   926 	CleanupClosePushL(data);
       
   927 	
       
   928 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
   929 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> secCodeData(secCode);
       
   930 	secCodeData.SerialiseL(data);
       
   931 	
       
   932  	//-------------------------------------------------------------------------
       
   933 	// TEST A: failure to dispatch request to LTSY
       
   934  	//-------------------------------------------------------------------------	
       
   935 	iMockLTSY.ExpectL(EMobilePhoneAbortSecurityCode, data, KErrNotSupported);
       
   936 	TInt res = iPhone.AbortSecurityCode(secCode);
       
   937 	
       
   938 	ASSERT_EQUALS(KErrNotSupported, res)
       
   939 	AssertMockLtsyStatusL();
       
   940 
       
   941 	//-------------------------------------------------------------------------
       
   942 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   943  	//-------------------------------------------------------------------------	
       
   944 	iMockLTSY.ExpectL(EMobilePhoneAbortSecurityCode, data);
       
   945 	iMockLTSY.CompleteL(EMobilePhoneAbortSecurityCode, KErrGeneral);
       
   946 
       
   947 	res = iPhone.AbortSecurityCode(secCode);
       
   948 	ASSERT_EQUALS(KErrGeneral, res)
       
   949 	AssertMockLtsyStatusL();
       
   950 
       
   951  	//-------------------------------------------------------------------------
       
   952 	// TEST C: Successful completion request of
       
   953 	// RMobilePhone::AbortSecurityCode when result is not cached.
       
   954  	//-------------------------------------------------------------------------	
       
   955 	iMockLTSY.ExpectL(EMobilePhoneAbortSecurityCode, data);
       
   956 	iMockLTSY.CompleteL(EMobilePhoneAbortSecurityCode, KErrNone);
       
   957 
       
   958 	res = iPhone.AbortSecurityCode(secCode);
       
   959 	ASSERT_EQUALS(KErrNone, res)
       
   960 	AssertMockLtsyStatusL();
       
   961 
       
   962  	//-------------------------------------------------------------------------
       
   963 	// TEST E: Unsolicited completion of RMobilePhone::AbortSecurityCode
       
   964 	// from LTSY.
       
   965  	//-------------------------------------------------------------------------
       
   966 	TRequestStatus mockLtsyStatus;
       
   967 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   968 	iMockLTSY.CompleteL(EMobilePhoneAbortSecurityCode, KErrNone);
       
   969 	User::WaitForRequest(mockLtsyStatus);
       
   970 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
       
   971 
       
   972 	AssertMockLtsyStatusL();
       
   973 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   974 	
       
   975 	}
       
   976 
       
   977 
       
   978 
       
   979 /**
       
   980 @SYMTestCaseID BA-CTSY-PSEC-MASC-0005
       
   981 @SYMComponent  telephony_ctsy
       
   982 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::AbortSecurityCode with timeout
       
   983 @SYMTestPriority High
       
   984 @SYMTestActions Invokes RMobilePhone::AbortSecurityCode and tests for timeout
       
   985 @SYMTestExpectedResults Pass
       
   986 @SYMTestType CT
       
   987 */
       
   988 void CCTsyPhoneSecurityFU::TestAbortSecurityCode0005L()
       
   989 	{
       
   990 	OpenEtelServerL(EUseExtendedError);
       
   991 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   992 	OpenPhoneL();
       
   993 
       
   994 	RBuf8 data;
       
   995 	CleanupClosePushL(data);
       
   996 
       
   997 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
   998 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> secCodeData(secCode);
       
   999 	secCodeData.SerialiseL(data);
       
  1000 	//-------------------------------------------------------------------------
       
  1001 	// Test A: Test timeout of RMobilePhone::AbortSecurityCode
       
  1002  	//-------------------------------------------------------------------------
       
  1003 	iMockLTSY.ExpectL(EMobilePhoneAbortSecurityCode, data);
       
  1004 
       
  1005 	TInt res = iPhone.AbortSecurityCode(secCode);
       
  1006 	ASSERT_EQUALS(KErrTimedOut, res)
       
  1007 
       
  1008 	// Done !
       
  1009 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1010 
       
  1011 	}
       
  1012 
       
  1013 
       
  1014 /**
       
  1015 @SYMTestCaseID BA-CTSY-PSEC-MASC-0006
       
  1016 @SYMComponent  telephony_ctsy
       
  1017 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::AbortSecurityCode
       
  1018 @SYMTestPriority High
       
  1019 @SYMTestActions Invokes RMobilePhone::AbortSecurityCode
       
  1020 @SYMTestExpectedResults Pass
       
  1021 @SYMTestType CT
       
  1022 */
       
  1023 void CCTsyPhoneSecurityFU::TestAbortSecurityCode0006L()
       
  1024 	{
       
  1025 	OpenEtelServerL(EUseExtendedError);
       
  1026 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1027 	OpenPhoneL();
       
  1028 	
       
  1029 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1030 		
       
  1031 	TRequestStatus status;
       
  1032 	RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockPhoneDevice;//ELockUSimApp;
       
  1033 	RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;	
       
  1034 	
       
  1035 	//-------------------------------------------------------------------------
       
  1036 	// Verify that SetLockSetting will be completed
       
  1037  	//------------------------------------------------------------------------	
       
  1038 	iPhone.SetLockSetting(status, lock, lockSetting);
       
  1039 	
       
  1040 	TInt res = iPhone.AbortSecurityCode(secCode);
       
  1041 	ASSERT_EQUALS(KErrNone, res)
       
  1042 	
       
  1043 	//SetLockSetting should be completed with KErrAbort.
       
  1044 	User::WaitForRequest(status);
       
  1045 	ASSERT_EQUALS(KErrAbort, status.Int()) 
       
  1046 	AssertMockLtsyStatusL();
       
  1047 	// Done !
       
  1048 	CleanupStack::PopAndDestroy(1, this); //this
       
  1049 
       
  1050 	}
       
  1051 
       
  1052 /**
       
  1053 @SYMTestCaseID BA-CTSY-PSEC-MASC-0007
       
  1054 @SYMComponent  telephony_ctsy
       
  1055 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::AbortSecurityCode
       
  1056 @SYMTestPriority High
       
  1057 @SYMTestActions Invokes RMobilePhone::AbortSecurityCode
       
  1058 @SYMTestExpectedResults Pass
       
  1059 @SYMTestType CT
       
  1060 */
       
  1061 void CCTsyPhoneSecurityFU::TestAbortSecurityCode0007L()
       
  1062 	{
       
  1063 	OpenEtelServerL(EUseExtendedError);
       
  1064 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1065 	OpenPhoneL();
       
  1066 
       
  1067 	RBuf8 data;
       
  1068 	CleanupClosePushL(data);
       
  1069 
       
  1070 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1071 	
       
  1072 	TRequestStatus status;
       
  1073 	RMobilePhone::TMobilePhoneFdnSetting fdnSetting = RMobilePhone::EFdnSetOn;
       
  1074 	
       
  1075 	//-------------------------------------------------------------------------
       
  1076 	// Verify that SetFdnSetting will be completed
       
  1077  	//-------------------------------------------------------------------------	
       
  1078 	iPhone.SetFdnSetting(status, fdnSetting);
       
  1079 	
       
  1080 	TInt res = iPhone.AbortSecurityCode(secCode);
       
  1081 	ASSERT_EQUALS(KErrNone, res)
       
  1082 	
       
  1083 	//SetFdnSetting should be completed with KErrAbort.
       
  1084 	User::WaitForRequest(status);
       
  1085 	ASSERT_EQUALS(KErrAbort, status.Int()) 
       
  1086 	AssertMockLtsyStatusL();
       
  1087 	// Done !
       
  1088 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1089 
       
  1090 	}
       
  1091 
       
  1092 
       
  1093 /**
       
  1094 @SYMTestCaseID BA-CTSY-PSEC-MCSC-0001
       
  1095 @SYMComponent  telephony_ctsy
       
  1096 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::ChangeSecurityCode
       
  1097 @SYMTestPriority High
       
  1098 @SYMTestActions Invokes RMobilePhone::ChangeSecurityCode
       
  1099 @SYMTestExpectedResults Pass
       
  1100 @SYMTestType CT
       
  1101 */
       
  1102 void CCTsyPhoneSecurityFU::TestChangeSecurityCode0001L()
       
  1103 	{
       
  1104 
       
  1105 	OpenEtelServerL(EUseExtendedError);
       
  1106 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1107 	OpenPhoneL();
       
  1108 
       
  1109 	RBuf8 data;
       
  1110 	CleanupClosePushL(data);
       
  1111 	
       
  1112 	RBuf8 dataComplete;
       
  1113 	CleanupClosePushL(dataComplete);
       
  1114 	
       
  1115 	TRequestStatus reqStatus;
       
  1116 
       
  1117 	_LIT(KOldPwd,"old");
       
  1118 	_LIT(KNewPwd,"new");
       
  1119 
       
  1120 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1121 	RMobilePhone::TMobilePhonePasswordChangeV1 pwdChange;
       
  1122 	pwdChange.iNewPassword.Copy(KNewPwd);
       
  1123 	pwdChange.iOldPassword.Copy(KOldPwd);
       
  1124 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhonePasswordChangeV1> pwdData(secCode,pwdChange);
       
  1125  	pwdData.SerialiseL(data);
       
  1126  	//-------------------------------------------------------------------------
       
  1127 	// TEST A: failure to dispatch request to LTSY
       
  1128  	//------------------------------------------------------------------------- 	
       
  1129  	iMockLTSY.ExpectL(EMobilePhoneChangeSecurityCode,data,KErrNotSupported);
       
  1130 
       
  1131 	iPhone.ChangeSecurityCode(reqStatus,secCode, pwdChange);
       
  1132 	User::WaitForRequest(reqStatus);
       
  1133 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
  1134 	AssertMockLtsyStatusL();
       
  1135 
       
  1136 	//-------------------------------------------------------------------------
       
  1137 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  1138  	//-------------------------------------------------------------------------	
       
  1139  	iMockLTSY.ExpectL(EMobilePhoneChangeSecurityCode,data);
       
  1140  	iMockLTSY.CompleteL(EMobilePhoneChangeSecurityCode, KErrGeneral, dataComplete);
       
  1141 
       
  1142 	iPhone.ChangeSecurityCode(reqStatus,secCode, pwdChange);
       
  1143 	User::WaitForRequest(reqStatus);
       
  1144 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
       
  1145 	AssertMockLtsyStatusL();
       
  1146 
       
  1147  	//-------------------------------------------------------------------------
       
  1148 	// TEST C: Successful completion request of
       
  1149 	// RMobilePhone::ChangeSecurityCode when result is not cached.
       
  1150  	//-------------------------------------------------------------------------		
       
  1151  	iMockLTSY.ExpectL(EMobilePhoneChangeSecurityCode,data);
       
  1152  	iMockLTSY.CompleteL(EMobilePhoneChangeSecurityCode, KErrNone, dataComplete);
       
  1153 
       
  1154 	iPhone.ChangeSecurityCode(reqStatus,secCode, pwdChange);
       
  1155 	User::WaitForRequest(reqStatus);
       
  1156 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1157 	AssertMockLtsyStatusL();
       
  1158 
       
  1159  	//-------------------------------------------------------------------------
       
  1160 	// TEST E: Unsolicited completion of RMobilePhone::ChangeSecurityCode
       
  1161 	// from LTSY.
       
  1162  	//-------------------------------------------------------------------------
       
  1163 	iMockLTSY.NotifyTerminated(reqStatus);
       
  1164 	iMockLTSY.CompleteL(EMobilePhoneChangeSecurityCode, KErrNone, dataComplete);
       
  1165 	User::WaitForRequest(reqStatus);
       
  1166 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1167 
       
  1168 	AssertMockLtsyStatusL();
       
  1169 	CleanupStack::PopAndDestroy(3, this); // data, dataComplete, this
       
  1170 	
       
  1171 	}
       
  1172 
       
  1173 
       
  1174 /**
       
  1175 @SYMTestCaseID BA-CTSY-PSEC-MCSC-0002
       
  1176 @SYMComponent  telephony_ctsy
       
  1177 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::ChangeSecurityCode
       
  1178 @SYMTestPriority High
       
  1179 @SYMTestActions Invokes cancelling of RMobilePhone::ChangeSecurityCode
       
  1180 @SYMTestExpectedResults Pass
       
  1181 @SYMTestType CT
       
  1182 */
       
  1183 void CCTsyPhoneSecurityFU::TestChangeSecurityCode0002L()
       
  1184 	{
       
  1185 
       
  1186 // This test should test cancellation of ChangeSecurityCode
       
  1187 // If this API does not have a cancel, the test step should be completely removed.
       
  1188 
       
  1189 	OpenEtelServerL(EUseExtendedError);
       
  1190 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1191 	OpenPhoneL();
       
  1192 
       
  1193 	TRequestStatus mockLtsyStatus;
       
  1194 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1195 
       
  1196 	RBuf8 data;
       
  1197 	CleanupClosePushL(data);
       
  1198 	
       
  1199 	RBuf8 dataComplete;
       
  1200 	CleanupClosePushL(dataComplete);
       
  1201 	
       
  1202 	TRequestStatus reqStatus;
       
  1203 
       
  1204 	_LIT(KOldPwd,"old");
       
  1205 	_LIT(KNewPwd,"new");
       
  1206 
       
  1207 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1208 	RMobilePhone::TMobilePhonePasswordChangeV1 pwdChange;
       
  1209 	pwdChange.iNewPassword.Copy(KNewPwd);
       
  1210 	pwdChange.iOldPassword.Copy(KOldPwd);
       
  1211 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhonePasswordChangeV1> pwdData(secCode,pwdChange);
       
  1212  	pwdData.SerialiseL(data);
       
  1213  	
       
  1214  	//-------------------------------------------------------------------------
       
  1215 	// Test cancelling of RMobilePhone::ChangeSecurityCode
       
  1216  	//------------------------------------------------------------------------- 	
       
  1217  	iMockLTSY.ExpectL(EMobilePhoneChangeSecurityCode, data);
       
  1218 	iPhone.ChangeSecurityCode(reqStatus, secCode, pwdChange);	
       
  1219 	// send canceling...
       
  1220 	iPhone.CancelAsyncRequest(EMobilePhoneChangeSecurityCode);
       
  1221 	
       
  1222 	//send completion
       
  1223 	iMockLTSY.CompleteL(EMobilePhoneChangeSecurityCode, KErrNone, dataComplete);
       
  1224 	// wait for completion
       
  1225 	User::WaitForRequest(mockLtsyStatus);
       
  1226 	
       
  1227 	// wait for NotifyStatusChange
       
  1228 	User::WaitForRequest(reqStatus);
       
  1229 	ASSERT_EQUALS(KErrNone, reqStatus.Int()); //Common TSY doesn't cancel this function.
       
  1230 	
       
  1231 	AssertMockLtsyStatusL();
       
  1232 
       
  1233 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  1234 	// User::WaitForRequest(mockLtsyStatus);
       
  1235 	CleanupStack::PopAndDestroy(3); // data, this
       
  1236 	
       
  1237 	}
       
  1238 
       
  1239 
       
  1240 /**
       
  1241 @SYMTestCaseID BA-CTSY-PSEC-MCSC-0004
       
  1242 @SYMComponent  telephony_ctsy
       
  1243 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::ChangeSecurityCode
       
  1244 @SYMTestPriority High
       
  1245 @SYMTestActions Invokes multiple client requests to RMobilePhone::ChangeSecurityCode
       
  1246 @SYMTestExpectedResults Pass
       
  1247 @SYMTestType CT
       
  1248 */
       
  1249 void CCTsyPhoneSecurityFU::TestChangeSecurityCode0004L()
       
  1250 	{					
       
  1251 	OpenEtelServerL(EUseExtendedError);
       
  1252 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1253 	OpenPhoneL();
       
  1254 
       
  1255 	RBuf8 data;
       
  1256 	CleanupClosePushL(data);
       
  1257 	
       
  1258 	RBuf8 dataComplete;
       
  1259 	CleanupClosePushL(dataComplete);
       
  1260 	
       
  1261 	RBuf8 data2;
       
  1262 	CleanupClosePushL(data2);
       
  1263 
       
  1264 	// Open second client
       
  1265 	RTelServer telServer2;
       
  1266 	TInt ret = telServer2.Connect();
       
  1267 	ASSERT_EQUALS(KErrNone, ret);
       
  1268 	CleanupClosePushL(telServer2);
       
  1269 
       
  1270 	RMobilePhone phone2;
       
  1271 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  1272 	ASSERT_EQUALS(KErrNone, ret);
       
  1273 	CleanupClosePushL(phone2);
       
  1274 
       
  1275 	TRequestStatus reqStatus;
       
  1276 
       
  1277 	_LIT(KOldPwd,"old");
       
  1278 	_LIT(KNewPwd,"new");
       
  1279 
       
  1280 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1281 	RMobilePhone::TMobilePhonePasswordChangeV1 pwdChange;
       
  1282 	pwdChange.iNewPassword.Copy(KNewPwd);
       
  1283 	pwdChange.iOldPassword.Copy(KOldPwd);
       
  1284 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhonePasswordChangeV1> pwdData(secCode,pwdChange);
       
  1285  	pwdData.SerialiseL(data);
       
  1286  	
       
  1287  	TRequestStatus reqStatus2;
       
  1288 
       
  1289 	_LIT(KOldPwd2,"old2");
       
  1290 	_LIT(KNewPwd2,"new2");
       
  1291 
       
  1292 	RMobilePhone::TMobilePhoneSecurityCode secCode2 = RMobilePhone::ESecurityCodePin1;
       
  1293 	RMobilePhone::TMobilePhonePasswordChangeV1 pwdChange2;
       
  1294 	pwdChange2.iNewPassword.Copy(KNewPwd2);
       
  1295 	pwdChange2.iOldPassword.Copy(KOldPwd2);
       
  1296 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhonePasswordChangeV1> pwdData2(secCode2,pwdChange2);
       
  1297  	pwdData2.SerialiseL(data2);
       
  1298  	
       
  1299  	//-------------------------------------------------------------------------
       
  1300 	// Test A: Test multiple clients requesting RMobilePhone::ChangeSecurityCode
       
  1301  	//-------------------------------------------------------------------------
       
  1302 	iMockLTSY.ExpectL(EMobilePhoneChangeSecurityCode, data);
       
  1303 	iMockLTSY.CompleteL(EMobilePhoneChangeSecurityCode, KErrNone, dataComplete);
       
  1304 	
       
  1305 	iMockLTSY.ExpectL(EMobilePhoneChangeSecurityCode, data2);
       
  1306 	iMockLTSY.CompleteL(EMobilePhoneChangeSecurityCode, KErrNone, dataComplete);
       
  1307 	
       
  1308 	iPhone.ChangeSecurityCode(reqStatus, secCode, pwdChange);	
       
  1309 	phone2.ChangeSecurityCode(reqStatus2, secCode2, pwdChange2);	
       
  1310 		
       
  1311 		
       
  1312 	// wait for first phone SetLockSetting
       
  1313 	User::WaitForRequest(reqStatus);
       
  1314 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1315 	
       
  1316 		
       
  1317 	// wait for second phone SetLockSetting.
       
  1318 	User::WaitForRequest(reqStatus2);
       
  1319 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
  1320 	
       
  1321 	AssertMockLtsyStatusL();
       
  1322 	
       
  1323 	// Done !
       
  1324 	CleanupStack::PopAndDestroy(6, this); // phone2, telServer2, data, this
       
  1325 	}
       
  1326 
       
  1327 
       
  1328 /**
       
  1329 @SYMTestCaseID BA-CTSY-PSEC-MCSC-0005
       
  1330 @SYMComponent  telephony_ctsy
       
  1331 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::ChangeSecurityCode with timeout
       
  1332 @SYMTestPriority High
       
  1333 @SYMTestActions Invokes RMobilePhone::ChangeSecurityCode and tests for timeout
       
  1334 @SYMTestExpectedResults Pass
       
  1335 @SYMTestType CT
       
  1336 */
       
  1337 void CCTsyPhoneSecurityFU::TestChangeSecurityCode0005L()
       
  1338 	{
       
  1339 	OpenEtelServerL(EUseExtendedError);
       
  1340 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1341 	OpenPhoneL();
       
  1342 
       
  1343 	RBuf8 data;
       
  1344 	CleanupClosePushL(data);
       
  1345 	
       
  1346 	TRequestStatus reqStatus;
       
  1347 
       
  1348 	_LIT(KOldPwd,"old");
       
  1349 	_LIT(KNewPwd,"new");
       
  1350 
       
  1351 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1352 	RMobilePhone::TMobilePhonePasswordChangeV1 pwdChange;
       
  1353 	pwdChange.iNewPassword.Copy(KNewPwd);
       
  1354 	pwdChange.iOldPassword.Copy(KOldPwd);
       
  1355 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhonePasswordChangeV1> pwdData(secCode,pwdChange);
       
  1356  	pwdData.SerialiseL(data);
       
  1357 	//-------------------------------------------------------------------------
       
  1358 	// Test A: Test timeout of RMobilePhone::ChangeSecurityCode
       
  1359  	//-------------------------------------------------------------------------
       
  1360 
       
  1361 	iMockLTSY.ExpectL(EMobilePhoneChangeSecurityCode, data);
       
  1362 	iPhone.ChangeSecurityCode(reqStatus, secCode, pwdChange);
       
  1363 	
       
  1364 	User::WaitForRequest(reqStatus);
       
  1365 	
       
  1366 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int())
       
  1367 	AssertMockLtsyStatusL();
       
  1368 
       
  1369 	// Done !
       
  1370 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1371 
       
  1372 	}
       
  1373 
       
  1374 
       
  1375 /**
       
  1376 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0001
       
  1377 @SYMComponent  telephony_ctsy
       
  1378 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  1379 @SYMTestPriority High
       
  1380 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  1381 @SYMTestExpectedResults Pass
       
  1382 @SYMTestType CT
       
  1383 */
       
  1384 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0001L()
       
  1385 	{
       
  1386 	OpenEtelServerL(EUseExtendedError);
       
  1387 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1388 	OpenPhoneL();
       
  1389 
       
  1390 	RBuf8 data;
       
  1391 	CleanupClosePushL(data);
       
  1392 	
       
  1393 	RBuf8 dataComplete;
       
  1394 	CleanupClosePushL(dataComplete);
       
  1395 	
       
  1396 	_LIT(KPwd,"pwd");
       
  1397 	_LIT(KUnblockPwd, "unblock");
       
  1398 
       
  1399 	TRequestStatus reqStatus;
       
  1400 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1401 	RMobilePhone::TMobilePassword pwd;
       
  1402 	RMobilePhone::TMobilePassword unblockPwd;
       
  1403 	
       
  1404 	pwd.Copy(KPwd);
       
  1405 	unblockPwd.Copy(KUnblockPwd);
       
  1406 	
       
  1407 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  1408 	twoCodes.iCode.Copy(KPwd);
       
  1409 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  1410 
       
  1411 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  1412 	verifyData.SerialiseL(data);
       
  1413 	
       
  1414  	//-------------------------------------------------------------------------
       
  1415 	// TEST A: failure to dispatch request to LTSY
       
  1416  	//-------------------------------------------------------------------------
       
  1417 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data, KErrNotSupported);
       
  1418 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1419 	User::WaitForRequest(reqStatus);
       
  1420 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
  1421 	AssertMockLtsyStatusL();
       
  1422 
       
  1423 	//-------------------------------------------------------------------------
       
  1424 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  1425  	//-------------------------------------------------------------------------
       
  1426 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  1427 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrGeneral, dataComplete);
       
  1428 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1429 	User::WaitForRequest(reqStatus);
       
  1430 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  1431 	AssertMockLtsyStatusL();
       
  1432 
       
  1433  	//-------------------------------------------------------------------------
       
  1434 	// TEST C: Successful completion request of
       
  1435 	// RMobilePhone::VerifySecurityCode when result is not cached.
       
  1436  	//-------------------------------------------------------------------------
       
  1437 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  1438 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  1439 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1440 	User::WaitForRequest(reqStatus);
       
  1441 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  1442 	AssertMockLtsyStatusL();
       
  1443 
       
  1444  	//-------------------------------------------------------------------------
       
  1445 	// TEST E: Unsolicited completion of RMobilePhone::VerifySecurityCode
       
  1446 	// from LTSY.
       
  1447  	//-------------------------------------------------------------------------
       
  1448 	iMockLTSY.NotifyTerminated(reqStatus);
       
  1449 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  1450 	User::WaitForRequest(reqStatus);
       
  1451 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  1452 
       
  1453     //-------------------------------------------------------------------------
       
  1454     // TEST E: Unsolicited completion of RMobilePhone::VerifySecurityCode
       
  1455     // from LTSY.
       
  1456     //-------------------------------------------------------------------------	
       
  1457 	AssertMockLtsyStatusL();
       
  1458 	
       
  1459 	_LIT(KGoodPin,"12345");
       
  1460 	_LIT(KBadPin1,"12");
       
  1461 	_LIT(KBadPin2,"1a345");
       
  1462     _LIT(KGoodPuk,"12345678");
       
  1463     _LIT(KBadPuk1,"1");
       
  1464     _LIT(KBadPuk2,"12345z78");    
       
  1465 
       
  1466     // short PIN
       
  1467     secCode = RMobilePhone::ESecurityCodePin1;
       
  1468     iPhone.VerifySecurityCode(reqStatus, secCode, KBadPin1(), KGoodPuk());
       
  1469     User::WaitForRequest(reqStatus);
       
  1470     ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
  1471     
       
  1472     // PIN with non-numeric characters
       
  1473     secCode = RMobilePhone::ESecurityCodePin2;
       
  1474     iPhone.VerifySecurityCode(reqStatus, secCode, KBadPin2(), KGoodPuk());
       
  1475     User::WaitForRequest(reqStatus);
       
  1476     ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
  1477     
       
  1478     // short PUK
       
  1479     secCode = RMobilePhone::ESecurityCodePuk1;
       
  1480     iPhone.VerifySecurityCode(reqStatus, secCode, KGoodPin(), KBadPuk1());
       
  1481     User::WaitForRequest(reqStatus);
       
  1482     ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
  1483  
       
  1484     // PUK with non-numeric characters
       
  1485     secCode = RMobilePhone::ESecurityCodePuk2;
       
  1486     iPhone.VerifySecurityCode(reqStatus, secCode, KGoodPin(), KBadPuk2());
       
  1487     User::WaitForRequest(reqStatus);
       
  1488     ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
  1489     
       
  1490     AssertMockLtsyStatusL();
       
  1491 	CleanupStack::PopAndDestroy(3, this); // data, this
       
  1492 	
       
  1493 	}
       
  1494 
       
  1495 
       
  1496 /**
       
  1497 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0002
       
  1498 @SYMComponent  telephony_ctsy
       
  1499 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::VerifySecurityCode
       
  1500 @SYMTestPriority High
       
  1501 @SYMTestActions Invokes cancelling of RMobilePhone::VerifySecurityCode
       
  1502 @SYMTestExpectedResults Pass
       
  1503 @SYMTestType CT
       
  1504 */
       
  1505 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0002L()
       
  1506 	{
       
  1507 
       
  1508 // This test should test cancellation of VerifySecurityCode
       
  1509 // If this API does not have a cancel, the test step should be completely removed.
       
  1510 
       
  1511 	OpenEtelServerL(EUseExtendedError);
       
  1512 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1513 	OpenPhoneL();
       
  1514 
       
  1515 	TRequestStatus mockLtsyStatus;
       
  1516 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1517 
       
  1518 	RBuf8 data;
       
  1519 	CleanupClosePushL(data);
       
  1520 
       
  1521 	RBuf8 dataComplete;
       
  1522 	CleanupClosePushL(dataComplete);
       
  1523 	
       
  1524 	_LIT(KPwd,"pwd");
       
  1525 	_LIT(KUnblockPwd, "unblock");
       
  1526 
       
  1527 	TRequestStatus reqStatus;
       
  1528 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1529 	RMobilePhone::TMobilePassword pwd;
       
  1530 	RMobilePhone::TMobilePassword unblockPwd;
       
  1531 	
       
  1532 	pwd.Copy(KPwd);
       
  1533 	unblockPwd.Copy(KUnblockPwd);
       
  1534 	
       
  1535 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  1536 	twoCodes.iCode.Copy(KPwd);
       
  1537 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  1538 
       
  1539 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  1540 	verifyData.SerialiseL(data);
       
  1541 	
       
  1542  	//-------------------------------------------------------------------------
       
  1543 	// Test cancelling of RMobilePhone::VerifySecurityCode
       
  1544  	//------------------------------------------------------------------------- 	
       
  1545  	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  1546 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1547 	iPhone.CancelAsyncRequest(EMobilePhoneVerifySecurityCode);
       
  1548 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  1549 	
       
  1550 	User::WaitForRequest(mockLtsyStatus);
       
  1551 	User::WaitForRequest(reqStatus);
       
  1552 	
       
  1553 	ASSERT_EQUALS(KErrNone, reqStatus.Int()) //Common TSY doesn't cancel this function.
       
  1554 	AssertMockLtsyStatusL();
       
  1555 
       
  1556 	CleanupStack::PopAndDestroy(3); // data, this	
       
  1557 	}
       
  1558 
       
  1559 
       
  1560 
       
  1561 /**
       
  1562 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0004
       
  1563 @SYMComponent  telephony_ctsy
       
  1564 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::VerifySecurityCode
       
  1565 @SYMTestPriority High
       
  1566 @SYMTestActions Invokes multiple client requests to RMobilePhone::VerifySecurityCode
       
  1567 @SYMTestExpectedResults Pass
       
  1568 @SYMTestType CT
       
  1569 */
       
  1570 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0004L()
       
  1571 	{					
       
  1572 	OpenEtelServerL(EUseExtendedError);
       
  1573 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1574 	OpenPhoneL();
       
  1575 
       
  1576 	RBuf8 data;
       
  1577 	CleanupClosePushL(data);
       
  1578 
       
  1579 	RBuf8 data2;
       
  1580 	CleanupClosePushL(data2);
       
  1581 
       
  1582 	RBuf8 dataComplete;
       
  1583 	CleanupClosePushL(dataComplete);
       
  1584 
       
  1585 	// Open second client
       
  1586 	RTelServer telServer2;
       
  1587 	TInt ret = telServer2.Connect();
       
  1588 	ASSERT_EQUALS(KErrNone, ret);
       
  1589 	CleanupClosePushL(telServer2);
       
  1590 
       
  1591 	RMobilePhone phone2;
       
  1592 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  1593 	ASSERT_EQUALS(KErrNone, ret);
       
  1594 	CleanupClosePushL(phone2);
       
  1595 
       
  1596 
       
  1597 	_LIT(KPwd,"pwd");
       
  1598 	_LIT(KUnblockPwd, "unblock");
       
  1599 
       
  1600 	TRequestStatus reqStatus;
       
  1601 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1602 	RMobilePhone::TMobilePassword pwd;
       
  1603 	RMobilePhone::TMobilePassword unblockPwd;
       
  1604 	
       
  1605 	pwd.Copy(KPwd);
       
  1606 	unblockPwd.Copy(KUnblockPwd);
       
  1607 	
       
  1608 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  1609 	twoCodes.iCode.Copy(KPwd);
       
  1610 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  1611 
       
  1612 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  1613 	verifyData.SerialiseL(data);
       
  1614 	
       
  1615 	_LIT(KPwd2,"pwd2");
       
  1616 	_LIT(KUnblockPwd2, "unblock2");
       
  1617 
       
  1618 	TRequestStatus reqStatus2;
       
  1619 	RMobilePhone::TMobilePhoneSecurityCode secCode2 = RMobilePhone::ESecurityCodePhonePassword;
       
  1620 	RMobilePhone::TMobilePassword pwd2;
       
  1621 	RMobilePhone::TMobilePassword unblockPwd2;
       
  1622 	
       
  1623 	pwd2.Copy(KPwd2);
       
  1624 	unblockPwd2.Copy(KUnblockPwd2);
       
  1625 	
       
  1626 	RMobilePhone::TCodeAndUnblockCode twoCodes2;
       
  1627 	twoCodes2.iCode.Copy(KPwd2);
       
  1628 	twoCodes2.iUnblockCode.Copy(KUnblockPwd2);
       
  1629 
       
  1630 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData2(secCode2,twoCodes2);
       
  1631 	verifyData2.SerialiseL(data2);
       
  1632 	
       
  1633 	//-------------------------------------------------------------------------
       
  1634 	// Test A: Test multiple clients requesting RMobilePhone::VerifySecurityCode
       
  1635  	//-------------------------------------------------------------------------
       
  1636 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  1637 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  1638 	
       
  1639 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  1640 	
       
  1641 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);	
       
  1642 	phone2.VerifySecurityCode(reqStatus2, secCode2, pwd2, unblockPwd2);	
       
  1643 		
       
  1644 		
       
  1645 	// wait for first phone SetLockSetting
       
  1646 	User::WaitForRequest(reqStatus);
       
  1647 	ASSERT_EQUALS(KErrNone, reqStatus.Int());	
       
  1648 		
       
  1649 	// wait for second phone SetLockSetting.
       
  1650 	User::WaitForRequest(reqStatus2);
       
  1651 	ASSERT_EQUALS(KErrServerBusy, reqStatus2.Int());
       
  1652 	
       
  1653 	AssertMockLtsyStatusL();
       
  1654 
       
  1655 	// Done !
       
  1656 	CleanupStack::PopAndDestroy(6, this); // phone2, telServer2, data, this
       
  1657 	}
       
  1658 
       
  1659 
       
  1660 /**
       
  1661 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0005
       
  1662 @SYMComponent  telephony_ctsy
       
  1663 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode with timeout
       
  1664 @SYMTestPriority High
       
  1665 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode and tests for timeout
       
  1666 @SYMTestExpectedResults Pass
       
  1667 @SYMTestType CT
       
  1668 */
       
  1669 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0005L()
       
  1670 	{
       
  1671 	
       
  1672 	OpenEtelServerL(EUseExtendedError);
       
  1673 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1674 	OpenPhoneL();
       
  1675 
       
  1676 	RBuf8 data;
       
  1677 	CleanupClosePushL(data);
       
  1678 
       
  1679 	_LIT(KPwd,"pwd");
       
  1680 	_LIT(KUnblockPwd, "unblock");
       
  1681 
       
  1682 	TRequestStatus reqStatus;
       
  1683 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1684 	RMobilePhone::TMobilePassword pwd;
       
  1685 	RMobilePhone::TMobilePassword unblockPwd;
       
  1686 	
       
  1687 	pwd.Copy(KPwd);
       
  1688 	unblockPwd.Copy(KUnblockPwd);
       
  1689 	
       
  1690 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  1691 	twoCodes.iCode.Copy(KPwd);
       
  1692 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  1693 
       
  1694 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  1695 	verifyData.SerialiseL(data);
       
  1696 	
       
  1697 	//-------------------------------------------------------------------------
       
  1698 	// Test A: Test timeout of RMobilePhone::VerifySecurityCode
       
  1699  	//-------------------------------------------------------------------------
       
  1700 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  1701 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1702 	User::WaitForRequest(reqStatus);
       
  1703 	
       
  1704 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
  1705 	AssertMockLtsyStatusL();
       
  1706 
       
  1707 	// Done !
       
  1708 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1709 
       
  1710 	}
       
  1711 
       
  1712 /**
       
  1713 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0006
       
  1714 @SYMComponent  telephony_ctsy
       
  1715 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  1716 @SYMTestPriority High
       
  1717 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  1718 @SYMTestExpectedResults Pass
       
  1719 @SYMTestType CT
       
  1720 */
       
  1721 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0006L()
       
  1722 	{
       
  1723 
       
  1724 	OpenEtelServerL(EUseExtendedError);
       
  1725 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1726 	OpenPhoneL();
       
  1727 
       
  1728 	_LIT(KEmpty,"");
       
  1729 
       
  1730 	TRequestStatus reqStatus;
       
  1731 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  1732 	RMobilePhone::TMobilePassword pwd;
       
  1733 	RMobilePhone::TMobilePassword unblockPwd;
       
  1734 	
       
  1735 	pwd.Copy(KEmpty);
       
  1736 	unblockPwd.Copy(KEmpty);
       
  1737 	
       
  1738  	//-------------------------------------------------------------------------	
       
  1739 	// RMobilePhone::VerifySecurityCode when code length is 0.
       
  1740  	//-------------------------------------------------------------------------
       
  1741 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1742 	User::WaitForRequest(reqStatus);
       
  1743 	ASSERT_EQUALS(KErrArgument, reqStatus.Int())
       
  1744 	AssertMockLtsyStatusL();
       
  1745 
       
  1746 	CleanupStack::PopAndDestroy(1, this); // data, this
       
  1747 	
       
  1748 	}
       
  1749 
       
  1750 /**
       
  1751 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0007
       
  1752 @SYMComponent  telephony_ctsy
       
  1753 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  1754 @SYMTestPriority High
       
  1755 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  1756 @SYMTestExpectedResults Pass
       
  1757 @SYMTestType CT
       
  1758 */
       
  1759 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0007L()
       
  1760 	{
       
  1761 
       
  1762 	OpenEtelServerL(EUseExtendedError);
       
  1763 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1764 	OpenPhoneL();
       
  1765 
       
  1766 	RBuf8 data;
       
  1767 	CleanupClosePushL(data);
       
  1768 	
       
  1769 	RBuf8 dataComplete;
       
  1770 	CleanupClosePushL(dataComplete);
       
  1771 	
       
  1772 	_LIT(KPwd,"pwd");
       
  1773 	_LIT(KUnblockPwd, "unblock");
       
  1774 
       
  1775 	TRequestStatus reqStatus;
       
  1776 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePuk1;
       
  1777 	RMobilePhone::TMobilePassword pwd;
       
  1778 	RMobilePhone::TMobilePassword unblockPwd;
       
  1779 	
       
  1780 	pwd.Copy(KPwd);
       
  1781 	unblockPwd.Copy(KUnblockPwd);
       
  1782 	
       
  1783 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  1784 	twoCodes.iCode.Copy(KPwd);
       
  1785 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  1786 
       
  1787 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  1788 	verifyData.SerialiseL(data);
       
  1789 	
       
  1790  	//-------------------------------------------------------------------------
       
  1791 	//
       
  1792 	// RMobilePhone::VerifySecurityCode when security code is ESecurityCodePuk1 or ESecurityCodePuk2.
       
  1793  	//-------------------------------------------------------------------------
       
  1794 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  1795 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  1796 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1797 	User::WaitForRequest(reqStatus);
       
  1798 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  1799 	AssertMockLtsyStatusL();
       
  1800 
       
  1801 	CleanupStack::PopAndDestroy(3, this); // data, this
       
  1802 	
       
  1803 	}
       
  1804 
       
  1805 /**
       
  1806 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0008
       
  1807 @SYMComponent  telephony_ctsy
       
  1808 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  1809 @SYMTestPriority High
       
  1810 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  1811 @SYMTestExpectedResults Pass
       
  1812 @SYMTestType CT
       
  1813 */
       
  1814 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0008L()
       
  1815 	{
       
  1816 
       
  1817 	OpenEtelServerL(EUseExtendedError);
       
  1818 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1819 	OpenPhoneL();
       
  1820 
       
  1821 	RBuf8 data;
       
  1822 	CleanupClosePushL(data);
       
  1823 	
       
  1824 	RBuf8 dataComplete;
       
  1825 	CleanupClosePushL(dataComplete);
       
  1826 	
       
  1827 	_LIT(KPwd,"pwd");
       
  1828 	_LIT(KUnblockPwd, "unblock");
       
  1829 
       
  1830 	TRequestStatus reqStatus;
       
  1831 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePuk1;
       
  1832 	RMobilePhone::TMobilePassword pwd;
       
  1833 	RMobilePhone::TMobilePassword unblockPwd;
       
  1834 	
       
  1835 	pwd.Copy(KPwd);
       
  1836 	unblockPwd.Copy(KUnblockPwd);
       
  1837 	
       
  1838 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  1839 	twoCodes.iCode.Copy(KPwd);
       
  1840 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  1841 
       
  1842 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  1843 	verifyData.SerialiseL(data);
       
  1844 		
       
  1845 	RBuf8 dataSls;
       
  1846 	CleanupClosePushL(dataSls);
       
  1847 	
       
  1848 	TRequestStatus status;
       
  1849 	RMobilePhone::TMobilePhoneLockStatus lockStatus = RMobilePhone::EStatusLocked;
       
  1850 	TLockSettingPassword lockSettingPassword;
       
  1851 	lockSettingPassword.iPassword.Copy(KNullDesC);
       
  1852 	RMobilePhone::TMobilePhoneLock& lock( lockSettingPassword.iLock );
       
  1853 	RMobilePhone::TMobilePhoneLockSetting& lockSetting( lockSettingPassword.iSetting );
       
  1854 	lock        = RMobilePhone::ELockHiddenKey;
       
  1855 	lockSetting = RMobilePhone::ELockSetEnabled;
       
  1856 	TMockLtsyData1<TLockSettingPassword> phoneLockData(lockSettingPassword);
       
  1857 	phoneLockData.SerialiseL(dataSls);
       
  1858 	
       
  1859 	RBuf8 dataSls_;
       
  1860 	CleanupClosePushL(dataSls_);
       
  1861 	
       
  1862 	RBuf8 dataCompleteSls;
       
  1863 	CleanupClosePushL(dataCompleteSls);
       
  1864 	
       
  1865 	TLockSettingPassword lockSettingPassword_;
       
  1866 	lockSettingPassword_.iPassword.Copy(KPwd);
       
  1867 	RMobilePhone::TMobilePhoneLock& lock_( lockSettingPassword_.iLock );
       
  1868 	RMobilePhone::TMobilePhoneLockSetting& lockSetting_( lockSettingPassword_.iSetting );
       
  1869 	lock_        = RMobilePhone::ELockPhoneDevice;
       
  1870 	lockSetting_ = RMobilePhone::ELockSetUnknown;
       
  1871 	TMockLtsyData1<TLockSettingPassword> phoneLockData_(lockSettingPassword_);
       
  1872 	phoneLockData_.SerialiseL(dataSls_);
       
  1873 	
       
  1874 	TRequestStatus mockLtsyStatus;
       
  1875 	
       
  1876 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> lockStatusData(lockStatus,lockSetting);
       
  1877 	lockStatusData.SerialiseL(dataCompleteSls);
       
  1878 	
       
  1879  	//-------------------------------------------------------------------------
       
  1880 	//
       
  1881 	// RMobilePhone::VerifySecurityCode when SetLockSetting is called.
       
  1882  	//-------------------------------------------------------------------------
       
  1883 	iMockLTSY.ExpectL(EMobilePhoneSetLockSetting, dataSls);
       
  1884 	iPhone.SetLockSetting(status, lock, lockSetting);
       
  1885 	
       
  1886 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1887 	iMockLTSY.ExpectL(EMobilePhoneSetLockSetting, dataSls_);
       
  1888 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1889 
       
  1890 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  1891 	User::WaitForRequest(mockLtsyStatus);
       
  1892 	User::WaitForRequest(reqStatus);
       
  1893 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  1894 	User::WaitForRequest(status);
       
  1895 	ASSERT_EQUALS(KErrNone, status.Int())
       
  1896 	AssertMockLtsyStatusL();
       
  1897 
       
  1898 	CleanupStack::PopAndDestroy(6, this); // data, this
       
  1899 	
       
  1900 	}
       
  1901 
       
  1902 /**
       
  1903 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0009
       
  1904 @SYMComponent  telephony_ctsy
       
  1905 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  1906 @SYMTestPriority High
       
  1907 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  1908 @SYMTestExpectedResults Pass
       
  1909 @SYMTestType CT
       
  1910 */
       
  1911 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0009L()
       
  1912 	{
       
  1913 
       
  1914 	OpenEtelServerL(EUseExtendedError);
       
  1915 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1916 	OpenPhoneL();
       
  1917 
       
  1918 	RBuf8 data;
       
  1919 	CleanupClosePushL(data);
       
  1920 	
       
  1921 	_LIT(KPwd,"pwd");
       
  1922 	_LIT(KUnblockPwd, "unblock");
       
  1923 
       
  1924 	TRequestStatus reqStatus;
       
  1925 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePuk1;
       
  1926 	RMobilePhone::TMobilePassword pwd;
       
  1927 	RMobilePhone::TMobilePassword unblockPwd;
       
  1928 	
       
  1929 	pwd.Copy(KPwd);
       
  1930 	unblockPwd.Copy(KUnblockPwd);
       
  1931 	
       
  1932 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  1933 	twoCodes.iCode.Copy(KPwd);
       
  1934 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  1935 
       
  1936 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  1937 	verifyData.SerialiseL(data);
       
  1938 	
       
  1939 	
       
  1940 	TRequestStatus status;
       
  1941 	RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockUniversalPin;
       
  1942 	RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockReplaced;
       
  1943 	
       
  1944  	//-------------------------------------------------------------------------
       
  1945 	//
       
  1946 	// RMobilePhone::VerifySecurityCode when security code is ESecurityCodePuk1 or ESecurityCodePuk2.
       
  1947  	//-------------------------------------------------------------------------
       
  1948 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data, KErrGeneral);
       
  1949 	iPhone.SetLockSetting(status, lock, lockSetting);
       
  1950 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  1951 	User::WaitForRequest(reqStatus);
       
  1952 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  1953 	User::WaitForRequest(status);
       
  1954 	ASSERT_EQUALS(KErrGeneral, status.Int())
       
  1955 	AssertMockLtsyStatusL();
       
  1956 
       
  1957 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1958 	
       
  1959 	}
       
  1960 
       
  1961 
       
  1962 /**
       
  1963 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0010
       
  1964 @SYMComponent  telephony_ctsy
       
  1965 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  1966 @SYMTestPriority High
       
  1967 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  1968 @SYMTestExpectedResults Pass
       
  1969 @SYMTestType CT
       
  1970 */
       
  1971 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0010L()
       
  1972 	{
       
  1973 
       
  1974 	OpenEtelServerL(EUseExtendedError);
       
  1975 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1976 	OpenPhoneL();
       
  1977 
       
  1978 	RBuf8 data;
       
  1979 	CleanupClosePushL(data);
       
  1980 	
       
  1981 	_LIT(KPwd,"pwd");
       
  1982 	_LIT(KUnblockPwd, "unblock");
       
  1983 
       
  1984 	TRequestStatus reqStatus;
       
  1985 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePuk1;
       
  1986 	RMobilePhone::TMobilePassword pwd;
       
  1987 	RMobilePhone::TMobilePassword unblockPwd;
       
  1988 	
       
  1989 	pwd.Copy(KPwd);
       
  1990 	unblockPwd.Copy(KUnblockPwd);
       
  1991 	
       
  1992 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  1993 	twoCodes.iCode.Copy(KPwd);
       
  1994 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  1995 
       
  1996 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  1997 	verifyData.SerialiseL(data);
       
  1998 	
       
  1999 	
       
  2000 	TRequestStatus status;
       
  2001 	RMobilePhone::TMobilePhoneFdnSetting fdnSetting = RMobilePhone::EFdnSetOn;
       
  2002 	
       
  2003  	//-------------------------------------------------------------------------
       
  2004 	//
       
  2005 	// RMobilePhone::VerifySecurityCode when security code is ESecurityCodePuk1 or ESecurityCodePuk2.
       
  2006  	//-------------------------------------------------------------------------
       
  2007 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data, KErrGeneral);
       
  2008 	iPhone.SetFdnSetting(status, fdnSetting);
       
  2009 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  2010 	User::WaitForRequest(reqStatus);
       
  2011 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  2012 	User::WaitForRequest(status);
       
  2013 	ASSERT_EQUALS(KErrGeneral, status.Int())
       
  2014 	AssertMockLtsyStatusL();
       
  2015 
       
  2016 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  2017 	
       
  2018 	}
       
  2019 
       
  2020 /**
       
  2021 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0011
       
  2022 @SYMComponent  telephony_ctsy
       
  2023 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  2024 @SYMTestPriority High
       
  2025 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  2026 @SYMTestExpectedResults Pass
       
  2027 @SYMTestType CT
       
  2028 */
       
  2029 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0011L()
       
  2030 	{
       
  2031 
       
  2032 	OpenEtelServerL(EUseExtendedError);
       
  2033 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2034 	OpenPhoneL();
       
  2035 
       
  2036 	RBuf8 data;
       
  2037 	CleanupClosePushL(data);
       
  2038 	
       
  2039 	RBuf8 dataComplete;
       
  2040 	CleanupClosePushL(dataComplete);
       
  2041 	
       
  2042 	_LIT(KPwd,"pwd");
       
  2043 	_LIT(KUnblockPwd, "unblock");
       
  2044 
       
  2045 	TRequestStatus reqStatus;
       
  2046 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePuk1;
       
  2047 	RMobilePhone::TMobilePassword pwd;
       
  2048 	RMobilePhone::TMobilePassword unblockPwd;
       
  2049 	
       
  2050 	pwd.Copy(KPwd);
       
  2051 	unblockPwd.Copy(KUnblockPwd);
       
  2052 	
       
  2053 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  2054 	twoCodes.iCode.Copy(KPwd);
       
  2055 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  2056 
       
  2057 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  2058 	verifyData.SerialiseL(data);
       
  2059 		
       
  2060 	TRequestStatus status;
       
  2061 	RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockUniversalPin;
       
  2062 	RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockReplaced;
       
  2063 	
       
  2064  	//-------------------------------------------------------------------------
       
  2065 	//
       
  2066 	// RMobilePhone::VerifySecurityCode when security code is ESecurityCodePuk1 or ESecurityCodePuk2.
       
  2067  	//-------------------------------------------------------------------------
       
  2068 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  2069 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrGeneral, dataComplete);
       
  2070 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  2071 	iPhone.SetLockSetting(status, lock, lockSetting);
       
  2072 	User::WaitForRequest(reqStatus);
       
  2073 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  2074 	User::WaitForRequest(status);
       
  2075 	ASSERT_EQUALS(KErrAccessDenied, status.Int())
       
  2076 	AssertMockLtsyStatusL();
       
  2077 
       
  2078 	CleanupStack::PopAndDestroy(3, this); // data, this	
       
  2079 	}
       
  2080 
       
  2081 
       
  2082 /**
       
  2083 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0012
       
  2084 @SYMComponent  telephony_ctsy
       
  2085 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  2086 @SYMTestPriority High
       
  2087 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  2088 @SYMTestExpectedResults Pass
       
  2089 @SYMTestType CT
       
  2090 */
       
  2091 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0012L()
       
  2092 	{
       
  2093 
       
  2094 	OpenEtelServerL(EUseExtendedError);
       
  2095 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2096 	OpenPhoneL();
       
  2097 
       
  2098 	RBuf8 data;
       
  2099 	CleanupClosePushL(data);
       
  2100 	
       
  2101 	RBuf8 dataComplete;
       
  2102 	CleanupClosePushL(dataComplete);
       
  2103 	
       
  2104 	_LIT(KPwd,"pwd");
       
  2105 	_LIT(KUnblockPwd, "unblock");
       
  2106 
       
  2107 	// Initialize data for VerifySecurityEvent
       
  2108 
       
  2109 	TRequestStatus reqStatus;
       
  2110 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePuk1;
       
  2111 	RMobilePhone::TMobilePassword pwd;
       
  2112 	RMobilePhone::TMobilePassword unblockPwd;
       
  2113 	
       
  2114 	pwd.Copy(KPwd);
       
  2115 	unblockPwd.Copy(KUnblockPwd);
       
  2116 	
       
  2117 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  2118 	twoCodes.iCode.Copy(KPwd);
       
  2119 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  2120 
       
  2121 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  2122 	verifyData.SerialiseL(data);
       
  2123 	
       
  2124 	//Initialize data for SetLockSetting	
       
  2125 	TRequestStatus status;
       
  2126 	RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockUniversalPin;
       
  2127 	RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockReplaced;
       
  2128 	
       
  2129 	
       
  2130  	//-------------------------------------------------------------------------
       
  2131 	// RMobilePhone::VerifySecurityCode 
       
  2132  	//-------------------------------------------------------------------------
       
  2133 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  2134 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  2135 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  2136 	iPhone.SetLockSetting(status, lock, lockSetting);
       
  2137 	User::WaitForRequest(reqStatus);
       
  2138 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2139 	
       
  2140 	User::WaitForRequest(status);
       
  2141 	ASSERT_EQUALS(KErrAccessDenied, status.Int())
       
  2142 	AssertMockLtsyStatusL();
       
  2143 
       
  2144 	CleanupStack::PopAndDestroy(3, this); // data, this
       
  2145 	
       
  2146 	}
       
  2147 
       
  2148 /**
       
  2149 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0013
       
  2150 @SYMComponent  telephony_ctsy
       
  2151 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  2152 @SYMTestPriority High
       
  2153 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  2154 @SYMTestExpectedResults Pass
       
  2155 @SYMTestType CT
       
  2156 */
       
  2157 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0013L()
       
  2158 	{
       
  2159 
       
  2160 	OpenEtelServerL(EUseExtendedError);
       
  2161 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2162 	OpenPhoneL();
       
  2163 
       
  2164 	RBuf8 data;
       
  2165 	CleanupClosePushL(data);
       
  2166 	
       
  2167 	RBuf8 dataComplete;
       
  2168 	CleanupClosePushL(dataComplete);
       
  2169 	
       
  2170 	_LIT(KPwd,"pwd");
       
  2171 	_LIT(KUnblockPwd, "unblock");
       
  2172 
       
  2173 	// Initialize data for VerifySecurityEvent
       
  2174 	TRequestStatus reqStatus;
       
  2175 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePuk1;
       
  2176 	RMobilePhone::TMobilePassword pwd;
       
  2177 	RMobilePhone::TMobilePassword unblockPwd;
       
  2178 	
       
  2179 	pwd.Copy(KPwd);
       
  2180 	unblockPwd.Copy(KUnblockPwd);
       
  2181 	
       
  2182 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  2183 	twoCodes.iCode.Copy(KPwd);
       
  2184 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  2185 
       
  2186 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  2187 	verifyData.SerialiseL(data);
       
  2188 	
       
  2189 	//Initialize data for SetFdnSetting	
       
  2190 	RBuf8 dataFdn;
       
  2191 	CleanupClosePushL(dataFdn);
       
  2192 	
       
  2193 	TRequestStatus status;
       
  2194 	RMobilePhone::TMobilePhoneFdnSetting fdnSetting = RMobilePhone::EFdnSetOff;
       
  2195 	TMockLtsyData1<RMobilePhone::TMobilePhoneFdnSetting> fdnData(fdnSetting);
       
  2196 	fdnData.SerialiseL(dataFdn);
       
  2197 	
       
  2198  	//-------------------------------------------------------------------------
       
  2199 	//
       
  2200 	// RMobilePhone::VerifySecurityCode complete with KErrGeneral
       
  2201  	//-------------------------------------------------------------------------
       
  2202 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  2203 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrGeneral, dataComplete);
       
  2204 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  2205 	iPhone.SetFdnSetting(status, fdnSetting);
       
  2206 	User::WaitForRequest(reqStatus);
       
  2207 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  2208 	
       
  2209 	User::WaitForRequest(status);
       
  2210 	ASSERT_EQUALS(KErrGeneral, status.Int())
       
  2211 	AssertMockLtsyStatusL();
       
  2212 	
       
  2213 	//-------------------------------------------------------------------------
       
  2214 	// Now complete it with KErrNone
       
  2215 	//-------------------------------------------------------------------------
       
  2216 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  2217 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataComplete);
       
  2218 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  2219 	iPhone.SetFdnSetting(status, fdnSetting);
       
  2220 
       
  2221 	//CompleteVerifySecurityL will transfer SetFdnSetting call to MockL.
       
  2222 	iMockLTSY.ExpectL(EMobilePhoneSetFdnSetting, dataFdn);
       
  2223 	iMockLTSY.CompleteL(EMobilePhoneSetFdnSetting, KErrNone);
       
  2224 	User::WaitForRequest(reqStatus);
       
  2225 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2226 	
       
  2227 	User::WaitForRequest(status);
       
  2228 	ASSERT_EQUALS(KErrNone, status.Int())
       
  2229 	AssertMockLtsyStatusL();
       
  2230 	CleanupStack::PopAndDestroy(4, this); // data, this
       
  2231 	
       
  2232 	}
       
  2233 
       
  2234 
       
  2235 /**
       
  2236 @SYMTestCaseID BA-CTSY-PSEC-MVSC-0014
       
  2237 @SYMComponent  telephony_ctsy
       
  2238 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::VerifySecurityCode
       
  2239 @SYMTestPriority High
       
  2240 @SYMTestActions Invokes RMobilePhone::VerifySecurityCode
       
  2241 @SYMTestExpectedResults Pass
       
  2242 @SYMTestType CT
       
  2243 */
       
  2244 void CCTsyPhoneSecurityFU::TestVerifySecurityCode0014L()
       
  2245 	{
       
  2246 
       
  2247 	OpenEtelServerL(EUseExtendedError);
       
  2248 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2249 	OpenPhoneL();
       
  2250 
       
  2251 	RBuf8 data;
       
  2252 	CleanupClosePushL(data);
       
  2253 	
       
  2254 	RBuf8 dataComplete;
       
  2255 	CleanupClosePushL(dataComplete);
       
  2256 	
       
  2257 	_LIT(KPwd,"pwd");
       
  2258 	_LIT(KUnblockPwd, "unblock");
       
  2259 
       
  2260 	// Initialize data for VerifySecurityEvent
       
  2261 
       
  2262 	TRequestStatus reqStatus;
       
  2263 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1;
       
  2264 	RMobilePhone::TMobilePassword pwd;
       
  2265 	RMobilePhone::TMobilePassword unblockPwd;
       
  2266 	
       
  2267 	pwd.Copy(KPwd);
       
  2268 	unblockPwd.Copy(KUnblockPwd);
       
  2269 	
       
  2270 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  2271 	twoCodes.iCode.Copy(KPwd);
       
  2272 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  2273 
       
  2274 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  2275 	verifyData.SerialiseL(data);
       
  2276 	
       
  2277 	//Initialize data for SetLockSetting
       
  2278 	
       
  2279  	//-------------------------------------------------------------------------
       
  2280 	//
       
  2281 	// RMobilePhone::VerifySecurityCode 
       
  2282  	//-------------------------------------------------------------------------
       
  2283  	TRequestStatus mockLtsyStatus;
       
  2284  	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2285  	
       
  2286  	iMockLTSY.CompleteL(EMmTsyBootNotifySecurityReadyIPC, KErrNone);
       
  2287  	User::WaitForRequest(mockLtsyStatus);
       
  2288  	
       
  2289 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, data);
       
  2290 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrGeneral, dataComplete);
       
  2291 	iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
       
  2292 
       
  2293 	User::WaitForRequest(reqStatus);
       
  2294 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  2295 	
       
  2296 	AssertMockLtsyStatusL();
       
  2297 	CleanupStack::PopAndDestroy(3, this); // data, this	
       
  2298 	}
       
  2299 
       
  2300 
       
  2301 
       
  2302 
       
  2303 /**
       
  2304 @SYMTestCaseID BA-CTSY-PSEC-MNSE-0001
       
  2305 @SYMComponent  telephony_ctsy
       
  2306 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityEvent
       
  2307 @SYMTestPriority High
       
  2308 @SYMTestActions Invokes RMobilePhone::NotifySecurityEvent
       
  2309 @SYMTestExpectedResults Pass
       
  2310 @SYMTestType CT
       
  2311 */
       
  2312 void CCTsyPhoneSecurityFU::TestNotifySecurityEvent0001L()
       
  2313 	{
       
  2314 	OpenEtelServerL(EUseExtendedError);
       
  2315 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2316 	OpenPhoneL();
       
  2317 
       
  2318 	RBuf8 data;
       
  2319 	CleanupClosePushL(data);
       
  2320 	
       
  2321 	RBuf8 dataExpect;
       
  2322 	CleanupClosePushL(dataExpect);
       
  2323 	
       
  2324 	TRequestStatus mockLtsyStatus;
       
  2325 
       
  2326 	TRequestStatus reqStatus;
       
  2327 	RMobilePhone::TMobilePhoneSecurityEvent secEventRes;
       
  2328 	RMobilePhone::TMobilePhoneSecurityEvent secEvent = RMobilePhone::EPhonePasswordRequired;
       
  2329 	
       
  2330 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> eventData(secEvent);
       
  2331 	eventData.SerialiseL(data);
       
  2332 	
       
  2333 	//-------------------------------------------------------------------------
       
  2334 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  2335  	//-------------------------------------------------------------------------
       
  2336 	iMockLTSY.ExpectL(EMmTsySimGetICCType, dataExpect);
       
  2337 	iPhone.NotifySecurityEvent(reqStatus, secEventRes);
       
  2338 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrGeneral, data);
       
  2339 	User::WaitForRequest(reqStatus);
       
  2340 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  2341 	AssertMockLtsyStatusL();
       
  2342 	
       
  2343  	//-------------------------------------------------------------------------
       
  2344 	// TEST C: Successful completion request of
       
  2345 	// RMobilePhone::NotifySecurityEvent when result is not cached.
       
  2346  	//-------------------------------------------------------------------------	
       
  2347 	iPhone.NotifySecurityEvent(reqStatus, secEventRes);
       
  2348 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  2349 	User::WaitForRequest(reqStatus);
       
  2350 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2351 	ASSERT_EQUALS(secEvent, secEventRes)
       
  2352 	AssertMockLtsyStatusL();
       
  2353 
       
  2354 
       
  2355  	//-------------------------------------------------------------------------
       
  2356 	// TEST E: Unsolicited completion of RMobilePhone::NotifySecurityEvent
       
  2357 	// from LTSY.
       
  2358  	//-------------------------------------------------------------------------
       
  2359 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2360 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  2361 	User::WaitForRequest(mockLtsyStatus);
       
  2362 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
       
  2363 	AssertMockLtsyStatusL();
       
  2364 
       
  2365  	//-------------------------------------------------------------------------
       
  2366 	// TEST D: RMobilePhone::NotifySecurityEvent again, this time CTSY
       
  2367 	// will get result from the cache.
       
  2368  	//-------------------------------------------------------------------------
       
  2369  	secEventRes = RMobilePhone::EPhonePasswordVerified; //change the value to make shure that NotifySecurityEvent will write the correct value to secEventRes.
       
  2370 	iPhone.NotifySecurityEvent(reqStatus, secEventRes);
       
  2371 	User::WaitForRequest(reqStatus);
       
  2372 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2373 	ASSERT_EQUALS(secEvent, secEventRes)
       
  2374 
       
  2375 	AssertMockLtsyStatusL();
       
  2376 	CleanupStack::PopAndDestroy(3, this); // data, this
       
  2377 	
       
  2378 	}
       
  2379 
       
  2380 
       
  2381 /**
       
  2382 @SYMTestCaseID BA-CTSY-PSEC-MNSE-0002
       
  2383 @SYMComponent  telephony_ctsy
       
  2384 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifySecurityEvent
       
  2385 @SYMTestPriority High
       
  2386 @SYMTestActions Invokes cancelling of RMobilePhone::NotifySecurityEvent
       
  2387 @SYMTestExpectedResults Pass
       
  2388 @SYMTestType CT
       
  2389 */
       
  2390 void CCTsyPhoneSecurityFU::TestNotifySecurityEvent0002L()
       
  2391 	{
       
  2392 
       
  2393 // This test should test cancellation of NotifySecurityEvent
       
  2394 // If this API does not have a cancel, the test step should be completely removed.
       
  2395 
       
  2396 	OpenEtelServerL(EUseExtendedError);
       
  2397 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2398 	OpenPhoneL();
       
  2399 
       
  2400 	TRequestStatus mockLtsyStatus;
       
  2401 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2402 
       
  2403 	RBuf8 data;
       
  2404 	CleanupClosePushL(data);
       
  2405 	
       
  2406 
       
  2407 	TRequestStatus reqStatus;
       
  2408 	RMobilePhone::TMobilePhoneSecurityEvent secEventRes;
       
  2409 	
       
  2410  	//-------------------------------------------------------------------------
       
  2411 	// Test cancelling of RMobilePhone::NotifySecurityEvent
       
  2412  	//------------------------------------------------------------------------- 	
       
  2413 	iMockLTSY.ExpectL(EMmTsySimGetICCType, data);
       
  2414 	iPhone.NotifySecurityEvent(reqStatus, secEventRes);
       
  2415 	iPhone.CancelAsyncRequest(EMobilePhoneNotifySecurityEvent);
       
  2416 	User::WaitForRequest(mockLtsyStatus);
       
  2417 	User::WaitForRequest(reqStatus);
       
  2418 	ASSERT_EQUALS(KErrCancel, reqStatus.Int())
       
  2419 	AssertMockLtsyStatusL();
       
  2420 
       
  2421 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  2422 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  2423 	
       
  2424 	}
       
  2425 
       
  2426 
       
  2427 
       
  2428 /**
       
  2429 @SYMTestCaseID BA-CTSY-PSEC-MNSE-0004
       
  2430 @SYMComponent  telephony_ctsy
       
  2431 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifySecurityEvent
       
  2432 @SYMTestPriority High
       
  2433 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifySecurityEvent
       
  2434 @SYMTestExpectedResults Pass
       
  2435 @SYMTestType CT
       
  2436 */
       
  2437 void CCTsyPhoneSecurityFU::TestNotifySecurityEvent0004L()
       
  2438 	{
       
  2439 					
       
  2440 	OpenEtelServerL(EUseExtendedError);
       
  2441 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2442 	OpenPhoneL();
       
  2443 
       
  2444 	RBuf8 data;
       
  2445 	CleanupClosePushL(data);
       
  2446 
       
  2447 	RBuf8 dataExpect;
       
  2448 	CleanupClosePushL(dataExpect);
       
  2449 
       
  2450 	// Open second client
       
  2451 	RTelServer telServer2;
       
  2452 	TInt ret = telServer2.Connect();
       
  2453 	ASSERT_EQUALS(KErrNone, ret);
       
  2454 	CleanupClosePushL(telServer2);
       
  2455 
       
  2456 	RMobilePhone phone2;
       
  2457 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  2458 	ASSERT_EQUALS(KErrNone, ret);
       
  2459 	CleanupClosePushL(phone2);
       
  2460 
       
  2461 	TRequestStatus reqStatus;
       
  2462 	RMobilePhone::TMobilePhoneSecurityEvent secEventRes;
       
  2463 	RMobilePhone::TMobilePhoneSecurityEvent secEvent = RMobilePhone::EPhonePasswordVerified;
       
  2464 	
       
  2465 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> eventData(secEvent);
       
  2466 	eventData.SerialiseL(data);
       
  2467 	
       
  2468 	TRequestStatus reqStatus2;
       
  2469 	RMobilePhone::TMobilePhoneSecurityEvent secEventRes2;
       
  2470 	
       
  2471 	//-------------------------------------------------------------------------
       
  2472 	// Test A: Test multiple clients requesting RMobilePhone::NotifySecurityEvent
       
  2473  	//-------------------------------------------------------------------------
       
  2474 	
       
  2475 	iMockLTSY.ExpectL(EMmTsySimGetICCType, dataExpect);
       
  2476 	iPhone.NotifySecurityEvent(reqStatus, secEventRes);
       
  2477 	phone2.NotifySecurityEvent(reqStatus2, secEventRes2);
       
  2478 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  2479 	
       
  2480 	User::WaitForRequest(reqStatus);
       
  2481 	User::WaitForRequest(reqStatus2);
       
  2482 	
       
  2483 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2484 	ASSERT_EQUALS(secEvent, secEventRes)
       
  2485 	ASSERT_EQUALS(KErrNone, reqStatus2.Int())
       
  2486 	ASSERT_EQUALS(secEvent, secEventRes2)
       
  2487 	AssertMockLtsyStatusL();
       
  2488 
       
  2489 	CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, dataExpect, data, this
       
  2490 
       
  2491 	}
       
  2492 
       
  2493 
       
  2494 /**
       
  2495 @SYMTestCaseID BA-CTSY-PSEC-MNSE-0006
       
  2496 @SYMComponent  telephony_ctsy
       
  2497 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityEvent
       
  2498 @SYMTestPriority High
       
  2499 @SYMTestActions Invokes RMobilePhone::NotifySecurityEvent
       
  2500 @SYMTestExpectedResults Pass
       
  2501 @SYMTestType CT
       
  2502 */
       
  2503 void CCTsyPhoneSecurityFU::TestNotifySecurityEvent0006L()
       
  2504 	{
       
  2505 
       
  2506 	OpenEtelServerL(EUseExtendedError);
       
  2507 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2508 	OpenPhoneL();
       
  2509 
       
  2510 	RBuf8 data;
       
  2511 	CleanupClosePushL(data);
       
  2512 	
       
  2513 	RBuf8 dataExpect;
       
  2514 	CleanupClosePushL(dataExpect);
       
  2515 	
       
  2516 	RBuf8 dataVerify;
       
  2517 	CleanupClosePushL(dataVerify);
       
  2518 	
       
  2519 	RBuf8 dataCompleteVerify;
       
  2520 	CleanupClosePushL(dataCompleteVerify);
       
  2521 	
       
  2522 	TRequestStatus mockLtsyStatus;
       
  2523 
       
  2524 	TRequestStatus reqStatus;
       
  2525 	RMobilePhone::TMobilePhoneSecurityEvent secEventRes;
       
  2526 	RMobilePhone::TMobilePhoneSecurityEvent secEvent = RMobilePhone::EPin1Verified;
       
  2527 	
       
  2528 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> eventData(secEvent);
       
  2529 	eventData.SerialiseL(data);
       
  2530 	
       
  2531 	
       
  2532 	_LIT(KPwd,"1234");
       
  2533 	_LIT(KUnblockPwd, "12345678");
       
  2534 
       
  2535 	TRequestStatus reqStatusVerify;
       
  2536 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1;
       
  2537 	RMobilePhone::TMobilePassword pwd;
       
  2538 	RMobilePhone::TMobilePassword unblockPwd;
       
  2539 	
       
  2540 	pwd.Copy(KPwd);
       
  2541 	unblockPwd.Copy(KUnblockPwd);
       
  2542 	
       
  2543 	RMobilePhone::TCodeAndUnblockCode twoCodes;
       
  2544 	twoCodes.iCode.Copy(KPwd);
       
  2545 	twoCodes.iUnblockCode.Copy(KUnblockPwd);
       
  2546 
       
  2547 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
       
  2548 	verifyData.SerialiseL(dataVerify);
       
  2549 	
       
  2550 	//--------------------------------------------------------------------------------
       
  2551 	//for coverage increase
       
  2552 	//--------------------------------------------------------------------------------
       
  2553 		
       
  2554 	iMockLTSY.ExpectL(EMmTsySimGetICCType, dataExpect);
       
  2555 	iPhone.NotifySecurityEvent(reqStatus, secEventRes);
       
  2556 	
       
  2557 	iMockLTSY.ExpectL(EMobilePhoneVerifySecurityCode, dataVerify);
       
  2558 	iMockLTSY.CompleteL(EMobilePhoneVerifySecurityCode, KErrNone, dataCompleteVerify);
       
  2559 	iPhone.VerifySecurityCode(reqStatusVerify, secCode, pwd, unblockPwd);
       
  2560 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  2561 	
       
  2562 	User::WaitForRequest(reqStatus);
       
  2563 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2564 	ASSERT_EQUALS(secEvent, secEventRes)
       
  2565 	
       
  2566 	User::WaitForRequest(reqStatusVerify);
       
  2567 	ASSERT_EQUALS(KErrNone, reqStatusVerify.Int())
       
  2568 	AssertMockLtsyStatusL();
       
  2569 
       
  2570 	// Done !
       
  2571 	CleanupStack::PopAndDestroy(5, this); 
       
  2572 
       
  2573 	}
       
  2574 
       
  2575 /**
       
  2576 @SYMTestCaseID BA-CTSY-PSEC-MNSE-0007
       
  2577 @SYMComponent  telephony_ctsy
       
  2578 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityEvent
       
  2579 @SYMTestPriority High
       
  2580 @SYMTestActions Invokes RMobilePhone::NotifySecurityEvent
       
  2581 @SYMTestExpectedResults Pass
       
  2582 @SYMTestType CT
       
  2583 */
       
  2584 void CCTsyPhoneSecurityFU::TestNotifySecurityEvent0007L()
       
  2585 	{
       
  2586 
       
  2587 	OpenEtelServerL(EUseExtendedError);
       
  2588 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2589 	OpenPhoneL();
       
  2590 
       
  2591 	RBuf8 data;
       
  2592 	CleanupClosePushL(data);
       
  2593 	
       
  2594 	TRequestStatus mockLtsyStatus;
       
  2595 
       
  2596 	TRequestStatus reqStatus;
       
  2597 	RMobilePhone::TMobilePhoneSecurityEvent secEvent = RMobilePhone::EPin2Required;
       
  2598 	
       
  2599 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> eventData(secEvent);
       
  2600 	eventData.SerialiseL(data);
       
  2601 	
       
  2602 	//--------------------------------------------------------------------------------
       
  2603 	// Unsolicited completion of RMobilePhone::NotifySecurityEvent
       
  2604 	// from LTSY. when event is EPin2Required.
       
  2605 	//--------------------------------------------------------------------------------	
       
  2606 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2607 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  2608 	User::WaitForRequest(mockLtsyStatus);
       
  2609 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())	
       
  2610 	
       
  2611 	AssertMockLtsyStatusL();
       
  2612 	// Done !
       
  2613 	CleanupStack::PopAndDestroy(2, this); 
       
  2614 
       
  2615 	}
       
  2616 
       
  2617 
       
  2618 /**
       
  2619 @SYMTestCaseID BA-CTSY-PSEC-MNSE-0008
       
  2620 @SYMComponent  telephony_ctsy
       
  2621 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityEvent
       
  2622 @SYMTestPriority High
       
  2623 @SYMTestActions Invokes RMobilePhone::NotifySecurityEvent
       
  2624 @SYMTestExpectedResults Pass
       
  2625 @SYMTestType CT
       
  2626 */
       
  2627 void CCTsyPhoneSecurityFU::TestNotifySecurityEvent0008L()
       
  2628 	{
       
  2629 
       
  2630 	OpenEtelServerL(EUseExtendedError);
       
  2631 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2632 	OpenPhoneL();
       
  2633 
       
  2634 	RBuf8 data;
       
  2635 	CleanupClosePushL(data);
       
  2636 	
       
  2637 	TRequestStatus mockLtsyStatus;
       
  2638 
       
  2639 	TRequestStatus reqStatus;
       
  2640 	RMobilePhone::TMobilePhoneSecurityEvent secEvent = RMobilePhone::EPhonePasswordRequired;
       
  2641 	
       
  2642 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> eventData(secEvent);
       
  2643 	eventData.SerialiseL(data);
       
  2644 	
       
  2645 	//--------------------------------------------------------------------------------
       
  2646 	//for coverage increase
       
  2647 	//--------------------------------------------------------------------------------	
       
  2648 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2649 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  2650 	User::WaitForRequest(mockLtsyStatus);
       
  2651 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
       
  2652 
       
  2653 	
       
  2654 	AssertMockLtsyStatusL();
       
  2655 	// Done !
       
  2656 	CleanupStack::PopAndDestroy(2, this); 
       
  2657 
       
  2658 	}
       
  2659 
       
  2660 
       
  2661 
       
  2662 /**
       
  2663 @SYMTestCaseID BA-CTSY-PSEC-MNSE-0009
       
  2664 @SYMComponent  telephony_ctsy
       
  2665 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityEvent
       
  2666 @SYMTestPriority High
       
  2667 @SYMTestActions Invokes RMobilePhone::NotifySecurityEvent
       
  2668 @SYMTestExpectedResults Pass
       
  2669 @SYMTestType CT
       
  2670 */
       
  2671 void CCTsyPhoneSecurityFU::TestNotifySecurityEvent0009L()
       
  2672 	{
       
  2673 
       
  2674 	OpenEtelServerL(EUseExtendedError);
       
  2675 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2676 	OpenPhoneL();
       
  2677 
       
  2678 	RBuf8 data;
       
  2679 	CleanupClosePushL(data);
       
  2680 	
       
  2681 	TRequestStatus mockLtsyStatus;
       
  2682 
       
  2683 	TRequestStatus reqStatus;
       
  2684 	RMobilePhone::TMobilePhoneSecurityEvent secEvent = RMobilePhone::EPhonePasswordRequired;
       
  2685 	
       
  2686 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> eventData(secEvent);
       
  2687 	eventData.SerialiseL(data);
       
  2688 	
       
  2689 	RBuf8 dataSls;
       
  2690 	CleanupClosePushL(dataSls);
       
  2691 	
       
  2692 	TRequestStatus status;
       
  2693 	RMobilePhone::TMobilePhoneLockStatus lockStatus = RMobilePhone::EStatusLocked;
       
  2694 	TLockSettingPassword lockSettingPassword;
       
  2695 	lockSettingPassword.iPassword.Copy(KNullDesC);
       
  2696 	RMobilePhone::TMobilePhoneLock& lock( lockSettingPassword.iLock );
       
  2697 	RMobilePhone::TMobilePhoneLockSetting& lockSetting( lockSettingPassword.iSetting );
       
  2698 	lock        = RMobilePhone::ELockPhoneDevice;//ELockUSimApp;
       
  2699 	lockSetting = RMobilePhone::ELockSetEnabled;
       
  2700 	TMockLtsyData1<TLockSettingPassword> phoneLockData(lockSettingPassword);
       
  2701 	phoneLockData.SerialiseL(dataSls);
       
  2702 	
       
  2703 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> lockStatusData(lockStatus,lockSetting);
       
  2704 	
       
  2705 	//--------------------------------------------------------------------------------
       
  2706 	//for coverage increase
       
  2707 	//--------------------------------------------------------------------------------
       
  2708 	iPhone.SetLockSetting(status, lock, lockSetting);
       
  2709 	
       
  2710 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2711 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  2712 	User::WaitForRequest(mockLtsyStatus);
       
  2713 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
       
  2714 	// Request status passed to set lock setting should be completed with KErrACcessDenied.
       
  2715 	User::WaitForRequest(status);
       
  2716 	ASSERT_EQUALS(KErrAccessDenied, status.Int())
       
  2717 	
       
  2718 	AssertMockLtsyStatusL();
       
  2719 	// Done !
       
  2720 	CleanupStack::PopAndDestroy(3, this); 
       
  2721 
       
  2722 	}
       
  2723 
       
  2724 
       
  2725 /**
       
  2726 @SYMTestCaseID BA-CTSY-PSEC-MNSE-0010
       
  2727 @SYMComponent  telephony_ctsy
       
  2728 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityEvent
       
  2729 @SYMTestPriority High
       
  2730 @SYMTestActions Invokes RMobilePhone::NotifySecurityEvent
       
  2731 @SYMTestExpectedResults Pass
       
  2732 @SYMTestType CT
       
  2733 */
       
  2734 void CCTsyPhoneSecurityFU::TestNotifySecurityEvent0010L()
       
  2735 	{
       
  2736 
       
  2737 	OpenEtelServerL(EUseExtendedError);
       
  2738 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2739 	OpenPhoneL();
       
  2740 
       
  2741 	RBuf8 data;
       
  2742 	CleanupClosePushL(data);
       
  2743 	
       
  2744 	TRequestStatus mockLtsyStatus;
       
  2745 
       
  2746 	TRequestStatus reqStatus;
       
  2747 	RMobilePhone::TMobilePhoneSecurityEvent secEvent = RMobilePhone::EPhonePasswordRequired;
       
  2748 	
       
  2749 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> eventData(secEvent);
       
  2750 	eventData.SerialiseL(data);
       
  2751 	
       
  2752 	//--------------------------------------------------------------------------------
       
  2753 	//for coverage increase
       
  2754 	//--------------------------------------------------------------------------------	
       
  2755 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2756 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  2757 	User::WaitForRequest(mockLtsyStatus);
       
  2758 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
       
  2759 	
       
  2760 	AssertMockLtsyStatusL();
       
  2761 	
       
  2762 	// Done !
       
  2763 	CleanupStack::PopAndDestroy(2, this); 
       
  2764 
       
  2765 	}
       
  2766 
       
  2767 
       
  2768 /**
       
  2769 @SYMTestCaseID BA-CTSY-PSEC-MNLIC-0001
       
  2770 @SYMComponent  telephony_ctsy
       
  2771 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyLockInfoChange
       
  2772 @SYMTestPriority High
       
  2773 @SYMTestActions Invokes RMobilePhone::NotifyLockInfoChange
       
  2774 @SYMTestExpectedResults Pass
       
  2775 @SYMTestType CT
       
  2776 */
       
  2777 void CCTsyPhoneSecurityFU::TestNotifyLockInfoChange0001L()
       
  2778 	{
       
  2779 	OpenEtelServerL(EUseExtendedError);
       
  2780 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2781 	OpenPhoneL();
       
  2782 
       
  2783 	RBuf8 data;
       
  2784 	CleanupClosePushL(data);
       
  2785 	
       
  2786 	RBuf8 data3G;
       
  2787 	CleanupClosePushL(data3G);
       
  2788 
       
  2789 	TRequestStatus reqStatus;
       
  2790 	RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockPhoneDevice;
       
  2791 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfoV1;
       
  2792 	lockInfoV1.iSetting = RMobilePhone::ELockSetEnabled;
       
  2793 	lockInfoV1.iStatus = RMobilePhone::EStatusLocked;
       
  2794 	
       
  2795 	RMobilePhone::TMobilePhoneLockInfoV1Pckg pckgData(lockInfoV1);
       
  2796 	
       
  2797 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockInfoV1, RMobilePhone::TMobilePhoneLock> lockInfoData(lockInfoV1, lock);
       
  2798 	lockInfoData.SerialiseL(data);
       
  2799 	
       
  2800  	//-------------------------------------------------------------------------
       
  2801 	// TEST C: Successful completion request of
       
  2802 	// RMobilePhone::NotifyLockInfoChange when result is not cached.
       
  2803  	//-------------------------------------------------------------------------
       
  2804 	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2805 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2806 	User::WaitForRequest(reqStatus);
       
  2807 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2808 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2809 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2810 	AssertMockLtsyStatusL();	
       
  2811 	
       
  2812 	//-------------------------------------------------------------------------
       
  2813 	//Repeat the previos tesat for coverage increase	
       
  2814  	//------------------------------------------------------------------------- 	
       
  2815  	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2816 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2817 	User::WaitForRequest(reqStatus);
       
  2818 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2819 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2820 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2821 	AssertMockLtsyStatusL();	
       
  2822 	
       
  2823 	//-------------------------------------------------------------------------
       
  2824 	// TEST C:  for coverage increasing with RMobilePhone::ELockPhoneToICC 
       
  2825 	// as parameter 	
       
  2826  	//-------------------------------------------------------------------------
       
  2827  	lock = RMobilePhone::ELockPhoneToICC;
       
  2828  	
       
  2829  	TMockLtsyData2<RMobilePhone::TMobilePhoneLockInfoV1, RMobilePhone::TMobilePhoneLock> 
       
  2830  								lockInfoData2(lockInfoV1, lock);
       
  2831 	data.Close();
       
  2832 	lockInfoData2.SerialiseL(data);
       
  2833  	
       
  2834 	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2835 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2836 	User::WaitForRequest(reqStatus);
       
  2837 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2838 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2839 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2840 	AssertMockLtsyStatusL();		
       
  2841 	
       
  2842 	//-------------------------------------------------------------------------
       
  2843 	// TEST C:  repeat the test with RMobilePhone::ELockPhoneToICC 
       
  2844 	// as parameter for coverage increase
       
  2845  	//-------------------------------------------------------------------------
       
  2846  	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2847 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2848 	User::WaitForRequest(reqStatus);
       
  2849 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2850 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2851 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2852 	AssertMockLtsyStatusL();		
       
  2853 	
       
  2854 	//-------------------------------------------------------------------------
       
  2855 	// TEST C:  for coverage increasing with RMobilePhone::ELockUniversalPin
       
  2856 	// as parameter 	
       
  2857  	//-------------------------------------------------------------------------
       
  2858  	
       
  2859  	lock = RMobilePhone::ELockUniversalPin;
       
  2860  	
       
  2861  	TMockLtsyData2<RMobilePhone::TMobilePhoneLockInfoV1, RMobilePhone::TMobilePhoneLock> 
       
  2862  								lockInfoData3(lockInfoV1, lock);
       
  2863 	data.Close();
       
  2864 	lockInfoData3.SerialiseL(data);
       
  2865  	
       
  2866 	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2867 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2868 	User::WaitForRequest(reqStatus);
       
  2869 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2870 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2871 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2872 	AssertMockLtsyStatusL();	
       
  2873 		
       
  2874 	
       
  2875 	//-------------------------------------------------------------------------
       
  2876 	// TEST C:  for coverage increasing with RMobilePhone::ELockUniversalPin
       
  2877 	// as parameter and iCurrentICCType == EICCTypeSim3G  	
       
  2878  	//-------------------------------------------------------------------------
       
  2879  	
       
  2880     //----------- making ICC3G ----------------------------
       
  2881     TRequestStatus mockLtsyStatus;
       
  2882     
       
  2883 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2884 
       
  2885     TICCType type(EICCTypeSim3G);
       
  2886 
       
  2887 	TMockLtsyData1<TICCType> iccData(type);
       
  2888 	iccData.SerialiseL(data3G);
       
  2889 
       
  2890 	iMockLTSY.CompleteL(EMmTsySimGetICCType, KErrNone, data3G);    
       
  2891 
       
  2892 	iMockLTSY.ExpectL(EMmTsySecurityGetSimActivePinStateIPC);
       
  2893 	iMockLTSY.CompleteL(EMmTsySecurityGetSimActivePinStateIPC, KErrNone);
       
  2894 
       
  2895 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  2896 	User::WaitForRequest(mockLtsyStatus);
       
  2897 	AssertMockLtsyStatusL();
       
  2898  	//------------------------------------------------------
       
  2899  	
       
  2900 	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2901 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2902 	User::WaitForRequest(reqStatus);
       
  2903 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2904 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2905 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2906 	AssertMockLtsyStatusL();	
       
  2907 	
       
  2908 	//-------------------------------------------------------------------------
       
  2909 	// TEST C:  repeat the test with RMobilePhone::ELockUniversalPin
       
  2910 	// as parameter for coverage increase
       
  2911  	//-------------------------------------------------------------------------
       
  2912  	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2913 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2914 	User::WaitForRequest(reqStatus);
       
  2915 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2916 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2917 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2918 	AssertMockLtsyStatusL();	
       
  2919 	
       
  2920 	//-------------------------------------------------------------------------
       
  2921 	// TEST C:  for coverage increasing with RMobilePhone::ELockICC 
       
  2922 	// as parameter 	
       
  2923  	//-------------------------------------------------------------------------
       
  2924  	lock = RMobilePhone::ELockICC;
       
  2925  	
       
  2926  	TMockLtsyData2<RMobilePhone::TMobilePhoneLockInfoV1, RMobilePhone::TMobilePhoneLock> 
       
  2927  								lockInfoData4(lockInfoV1, lock);
       
  2928 	data.Close();
       
  2929 	lockInfoData4.SerialiseL(data);
       
  2930  	
       
  2931 	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2932 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2933 	User::WaitForRequest(reqStatus);
       
  2934 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2935 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2936 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2937 	AssertMockLtsyStatusL();			
       
  2938 	
       
  2939 	//-------------------------------------------------------------------------
       
  2940 	// TEST C:  repeat the test with RMobilePhone::ELockICC 
       
  2941 	// as parameter for coverage increase
       
  2942  	//-------------------------------------------------------------------------
       
  2943  	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2944 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2945 	User::WaitForRequest(reqStatus);
       
  2946 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2947 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2948 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2949 	AssertMockLtsyStatusL();		
       
  2950 		
       
  2951 	//-------------------------------------------------------------------------
       
  2952 	// TEST C:  for coverage increasing with RMobilePhone::ELockPhoneToFirstICC
       
  2953 	// as parameter 	
       
  2954  	//-------------------------------------------------------------------------
       
  2955  	lock = RMobilePhone::ELockPhoneToFirstICC;
       
  2956  	
       
  2957  	TMockLtsyData2<RMobilePhone::TMobilePhoneLockInfoV1, RMobilePhone::TMobilePhoneLock> 
       
  2958  								lockInfoData5(lockInfoV1, lock);
       
  2959 	data.Close();
       
  2960 	lockInfoData5.SerialiseL(data);
       
  2961  	
       
  2962 	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2963 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2964 	User::WaitForRequest(reqStatus);
       
  2965 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2966 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  2967 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  2968 	AssertMockLtsyStatusL();	
       
  2969 
       
  2970  	
       
  2971     //-------------------------------------------------------------------------
       
  2972 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  2973  	//-------------------------------------------------------------------------
       
  2974 	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  2975 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrGeneral, data);
       
  2976 	User::WaitForRequest(reqStatus);
       
  2977 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  2978 	AssertMockLtsyStatusL();
       
  2979 
       
  2980 	//-------------------------------------------------------------------------
       
  2981     // TEST E: Unsolicited completion of RMobilePhone::NotifyLockInfoChange
       
  2982     // from LTSY.
       
  2983     //-------------------------------------------------------------------------
       
  2984     iMockLTSY.NotifyTerminated(reqStatus);
       
  2985     iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  2986     User::WaitForRequest(reqStatus);
       
  2987     ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  2988     AssertMockLtsyStatusL();
       
  2989 	CleanupStack::PopAndDestroy(3, this); // data3G, data, this
       
  2990 	
       
  2991 	}
       
  2992 
       
  2993 
       
  2994 /**
       
  2995 @SYMTestCaseID BA-CTSY-PSEC-MNLIC-0002
       
  2996 @SYMComponent  telephony_ctsy
       
  2997 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifyLockInfoChange
       
  2998 @SYMTestPriority High
       
  2999 @SYMTestActions Invokes cancelling of RMobilePhone::NotifyLockInfoChange
       
  3000 @SYMTestExpectedResults Pass
       
  3001 @SYMTestType CT
       
  3002 */
       
  3003 void CCTsyPhoneSecurityFU::TestNotifyLockInfoChange0002L()
       
  3004 	{
       
  3005 
       
  3006 // This test should test cancellation of NotifyLockInfoChange
       
  3007 // If this API does not have a cancel, the test step should be completely removed.
       
  3008 
       
  3009 	OpenEtelServerL(EUseExtendedError);
       
  3010 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3011 	OpenPhoneL();
       
  3012 
       
  3013 	TRequestStatus mockLtsyStatus;
       
  3014 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3015 
       
  3016 	RBuf8 data;
       
  3017 	CleanupClosePushL(data);
       
  3018 
       
  3019 	TRequestStatus reqStatus;
       
  3020 	RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockPhoneDevice;
       
  3021 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfoV1;
       
  3022 	lockInfoV1.iSetting = RMobilePhone::ELockSetEnabled;
       
  3023 	lockInfoV1.iStatus = RMobilePhone::EStatusLocked;
       
  3024 	
       
  3025 	RMobilePhone::TMobilePhoneLockInfoV1Pckg pckgData(lockInfoV1);
       
  3026 	
       
  3027 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockInfoV1, RMobilePhone::TMobilePhoneLock> lockInfoData(lockInfoV1, lock);
       
  3028 	lockInfoData.SerialiseL(data);
       
  3029 	
       
  3030  	//-------------------------------------------------------------------------
       
  3031 	// Test cancelling of RMobilePhone::NotifyLockInfoChange
       
  3032  	//------------------------------------------------------------------------- 	
       
  3033 	iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
       
  3034 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyLockInfoChange);
       
  3035 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  3036 	User::WaitForRequest(mockLtsyStatus);
       
  3037 	User::WaitForRequest(reqStatus);
       
  3038 	ASSERT_EQUALS(KErrCancel, reqStatus.Int())
       
  3039 	AssertMockLtsyStatusL();
       
  3040 
       
  3041 	CleanupStack::PopAndDestroy(2); // data, this	
       
  3042 	}
       
  3043 
       
  3044 
       
  3045 /**
       
  3046 @SYMTestCaseID BA-CTSY-PSEC-MNLIC-0003
       
  3047 @SYMComponent  telephony_ctsy
       
  3048 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyLockInfoChange with bad parameter data
       
  3049 @SYMTestPriority High
       
  3050 @SYMTestActions Invokes RMobilePhone::NotifyLockInfoChange with bad parameter data
       
  3051 @SYMTestExpectedResults Pass
       
  3052 @SYMTestType CT
       
  3053 */
       
  3054 void CCTsyPhoneSecurityFU::TestNotifyLockInfoChange0003L()
       
  3055 	{
       
  3056 	OpenEtelServerL(EUseExtendedError);
       
  3057 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3058 	OpenPhoneL();
       
  3059 
       
  3060 	//-------------------------------------------------------------------------
       
  3061 	// Test B: Test passing wrong descriptor size to parameter in
       
  3062 	// RMobilePhone::NotifyLockInfoChange
       
  3063  	//-------------------------------------------------------------------------
       
  3064 	TRequestStatus reqStatus;
       
  3065 	RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockPhoneDevice;
       
  3066 	TBuf8<1> lockInfo;
       
  3067 	
       
  3068 	iPhone.NotifyLockInfoChange(reqStatus, lock, lockInfo);
       
  3069 	User::WaitForRequest(reqStatus);
       
  3070 	ASSERT_EQUALS(KErrArgument, reqStatus.Int())
       
  3071 	AssertMockLtsyStatusL();
       
  3072 	
       
  3073 	// Done !
       
  3074 	CleanupStack::PopAndDestroy(this); // this
       
  3075 	}
       
  3076 
       
  3077 
       
  3078 /**
       
  3079 @SYMTestCaseID BA-CTSY-PSEC-MNLIC-0004
       
  3080 @SYMComponent  telephony_ctsy
       
  3081 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifyLockInfoChange
       
  3082 @SYMTestPriority High
       
  3083 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifyLockInfoChange
       
  3084 @SYMTestExpectedResults Pass
       
  3085 @SYMTestType CT
       
  3086 */
       
  3087 void CCTsyPhoneSecurityFU::TestNotifyLockInfoChange0004L()
       
  3088 	{					
       
  3089 	OpenEtelServerL(EUseExtendedError);
       
  3090 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3091 	OpenPhoneL();
       
  3092 
       
  3093 	RBuf8 data;
       
  3094 	CleanupClosePushL(data);
       
  3095 	
       
  3096 	// Open second client
       
  3097 	RTelServer telServer2;
       
  3098 	TInt ret = telServer2.Connect();
       
  3099 	ASSERT_EQUALS(KErrNone, ret);
       
  3100 	CleanupClosePushL(telServer2);
       
  3101 
       
  3102 	RMobilePhone phone2;
       
  3103 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  3104 	ASSERT_EQUALS(KErrNone, ret);
       
  3105 	CleanupClosePushL(phone2);
       
  3106 
       
  3107 	TRequestStatus reqStatus;
       
  3108 	TRequestStatus reqStatus2;
       
  3109 	
       
  3110 	//Data for iMockLTSY->CompleteL
       
  3111 	RMobilePhone::TMobilePhoneLock lockComplete = RMobilePhone::ELockPhoneDevice;
       
  3112 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfoV1;
       
  3113 	lockInfoV1.iSetting = RMobilePhone::ELockSetEnabled;
       
  3114 	lockInfoV1.iStatus = RMobilePhone::EStatusLocked;
       
  3115 	
       
  3116 	TMockLtsyData2<RMobilePhone::TMobilePhoneLockInfoV1, RMobilePhone::TMobilePhoneLock> lockInfoData(lockInfoV1, lockComplete);
       
  3117 	lockInfoData.SerialiseL(data);
       
  3118 	
       
  3119 	//Variables that will contain result data after request status will be completed.
       
  3120 	RMobilePhone::TMobilePhoneLock lock1;
       
  3121 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
  3122 	RMobilePhone::TMobilePhoneLockInfoV1Pckg pckgData(lockInfo);
       
  3123 	
       
  3124 	//Variables that will contain result data after second request status will be completed.
       
  3125 	RMobilePhone::TMobilePhoneLock lock2;
       
  3126 	RMobilePhone::TMobilePhoneLockInfoV1 lockInfo2;
       
  3127 	RMobilePhone::TMobilePhoneLockInfoV1Pckg pckgData2(lockInfo2);
       
  3128 	
       
  3129 	//-------------------------------------------------------------------------
       
  3130 	// Test A: Test multiple clients requesting RMobilePhone::NotifyLockInfoChange
       
  3131  	//-------------------------------------------------------------------------
       
  3132 	
       
  3133 	iPhone.NotifyLockInfoChange(reqStatus, lock1, pckgData);
       
  3134 	phone2.NotifyLockInfoChange(reqStatus2, lock2, pckgData2);
       
  3135 	
       
  3136 	iMockLTSY.CompleteL(EMobilePhoneNotifyLockInfoChange, KErrNone, data);
       
  3137 	
       
  3138 	User::WaitForRequest(reqStatus);
       
  3139 	User::WaitForRequest(reqStatus2);
       
  3140 	
       
  3141 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  3142 	ASSERT_EQUALS(KErrNone, reqStatus2.Int())
       
  3143 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
       
  3144 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
       
  3145 	ASSERT_EQUALS(lockInfoV1.iSetting,pckgData2().iSetting)
       
  3146 	ASSERT_EQUALS(lockInfoV1.iStatus,pckgData2().iStatus)
       
  3147 	
       
  3148 	AssertMockLtsyStatusL();
       
  3149 
       
  3150 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  3151 	}
       
  3152 
       
  3153 
       
  3154 /**
       
  3155 @SYMTestCaseID BA-CTSY-PSEC-MGSCI-0001
       
  3156 @SYMComponent  telephony_ctsy
       
  3157 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSecurityCodeInfo
       
  3158 @SYMTestPriority High
       
  3159 @SYMTestActions Invokes RMobilePhone::GetSecurityCodeInfo
       
  3160 @SYMTestExpectedResults Pass
       
  3161 @SYMTestType CT
       
  3162 */
       
  3163 void CCTsyPhoneSecurityFU::TestGetSecurityCodeInfo0001L()
       
  3164 	{
       
  3165 
       
  3166 	OpenEtelServerL(EUseExtendedError);
       
  3167 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3168 	OpenPhoneL();
       
  3169 
       
  3170 	RBuf8 data;
       
  3171 	CleanupClosePushL(data);
       
  3172 
       
  3173 	RBuf8 dataExpect;
       
  3174 	CleanupClosePushL(dataExpect);
       
  3175 
       
  3176 	TRequestStatus reqStatus;
       
  3177 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3178 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3179 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3180 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  3181 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
       
  3182 	
       
  3183 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData(secCode);
       
  3184 	codeData.SerialiseL(dataExpect);
       
  3185 	
       
  3186 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCode, codeInfoV5);
       
  3187 	codeInfoData.SerialiseL(data);
       
  3188 	
       
  3189 	//-------------------------------------------------------------------------
       
  3190 	// TEST A: failure to dispatch request to LTSY
       
  3191  	//------------------------------------------------------------------------- 	
       
  3192  	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, dataExpect, KErrNotSupported);
       
  3193 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
       
  3194 	User::WaitForRequest(reqStatus);
       
  3195 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
  3196 	AssertMockLtsyStatusL();
       
  3197  	
       
  3198  	//-------------------------------------------------------------------------
       
  3199 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  3200  	//------------------------------------------------------------------------- 	
       
  3201  	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, dataExpect);
       
  3202 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrGeneral, data);
       
  3203 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
       
  3204 	User::WaitForRequest(reqStatus);
       
  3205 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  3206 	AssertMockLtsyStatusL();
       
  3207 	
       
  3208  	//-------------------------------------------------------------------------
       
  3209 	// TEST C: Successful completion request of
       
  3210 	// RMobilePhone::GetSecurityCodeInfo when result is not cached.
       
  3211  	//------------------------------------------------------------------------- 	
       
  3212 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, dataExpect);
       
  3213 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrNone, data);
       
  3214 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
       
  3215 	User::WaitForRequest(reqStatus);
       
  3216 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  3217 	ASSERT_EQUALS(codeInfoV5.iRemainingEntryAttempts, pckgData().iRemainingEntryAttempts)
       
  3218 	AssertMockLtsyStatusL();
       
  3219 	
       
  3220  	//-------------------------------------------------------------------------
       
  3221 	// TEST E: Unsolicited completion of RMobilePhone::GetSecurityCodeInfo
       
  3222 	// from LTSY.
       
  3223  	//-------------------------------------------------------------------------
       
  3224 	TRequestStatus mockLtsyStatus;
       
  3225 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3226 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrNone, data);
       
  3227 	User::WaitForRequest(mockLtsyStatus);
       
  3228 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
       
  3229 
       
  3230 	AssertMockLtsyStatusL();
       
  3231 	CleanupStack::PopAndDestroy(3, this); // data, this
       
  3232 	
       
  3233 	}
       
  3234 
       
  3235 /**
       
  3236 @SYMTestCaseID BA-CTSY-PSEC-MGSCI-0002
       
  3237 @SYMComponent  telephony_ctsy
       
  3238 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::GetSecurityCodeInfo
       
  3239 @SYMTestPriority High
       
  3240 @SYMTestActions Invokes cancelling of RMobilePhone::GetSecurityCodeInfo
       
  3241 @SYMTestExpectedResults Pass
       
  3242 @SYMTestType CT
       
  3243 */
       
  3244 void CCTsyPhoneSecurityFU::TestGetSecurityCodeInfo0002L()
       
  3245 	{
       
  3246 	OpenEtelServerL(EUseExtendedError);
       
  3247 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3248 	OpenPhoneL();
       
  3249 
       
  3250 	TRequestStatus mockLtsyStatus;
       
  3251 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3252 
       
  3253 	RBuf8 data;
       
  3254 	CleanupClosePushL(data);
       
  3255 
       
  3256 	RBuf8 dataExpect;
       
  3257 	CleanupClosePushL(dataExpect);
       
  3258 
       
  3259 	TRequestStatus reqStatus;
       
  3260 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3261 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3262 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3263 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  3264 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
       
  3265 	
       
  3266 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData(secCode);
       
  3267 	codeData.SerialiseL(dataExpect);
       
  3268 	
       
  3269 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCode, codeInfoV5);
       
  3270 	codeInfoData.SerialiseL(data);
       
  3271 	
       
  3272  	//-------------------------------------------------------------------------
       
  3273 	// Test cancelling of RMobilePhone::GetSecurityCodeInfo
       
  3274  	//-------------------------------------------------------------------------	
       
  3275 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, dataExpect);
       
  3276 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
       
  3277 	iPhone.CancelAsyncRequest(EMobilePhoneGetSecurityCodeInfo);
       
  3278 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  3279 	User::WaitForRequest(mockLtsyStatus);
       
  3280 	// Wait for completion of GetSecurityCodeInfo
       
  3281 	User::WaitForRequest(reqStatus);
       
  3282 	// Check status is KErrCancel
       
  3283 	ASSERT_EQUALS(KErrCancel,reqStatus.Int());
       
  3284 	AssertMockLtsyStatusL();
       
  3285 
       
  3286 	CleanupStack::PopAndDestroy(3); // data, this
       
  3287 	}
       
  3288 	
       
  3289 /**
       
  3290 @SYMTestCaseID BA-CTSY-PSEC-MGSCI-0003
       
  3291 @SYMComponent  telephony_ctsy
       
  3292 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSecurityCodeInfo with bad parameter data
       
  3293 @SYMTestPriority High
       
  3294 @SYMTestActions Invokes RMobilePhone::GetSecurityCodeInfo with bad parameter data
       
  3295 @SYMTestExpectedResults Pass
       
  3296 @SYMTestType CT
       
  3297 */
       
  3298 void CCTsyPhoneSecurityFU::TestGetSecurityCodeInfo0003L()
       
  3299 	{
       
  3300 	OpenEtelServerL(EUseExtendedError);
       
  3301 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3302 	OpenPhoneL();
       
  3303 
       
  3304 	TRequestStatus reqStatus;
       
  3305 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3306 	TBuf8<1> smallBuf;
       
  3307 	
       
  3308 	//-------------------------------------------------------------------------
       
  3309 	// Test B: Test passing wrong descriptor size to parameter in
       
  3310 	// RMobilePhone::GetSecurityCodeInfo
       
  3311  	//-------------------------------------------------------------------------
       
  3312 	// CTSY should return an error straight away
       
  3313 
       
  3314 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, smallBuf);
       
  3315     User::WaitForRequest(reqStatus);
       
  3316    	AssertMockLtsyStatusL();
       
  3317 	ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
  3318 
       
  3319 	// Done !
       
  3320 	CleanupStack::PopAndDestroy(this); // this
       
  3321 	}
       
  3322 	
       
  3323 	
       
  3324 /**
       
  3325 @SYMTestCaseID BA-CTSY-PSEC-MGSCI-0004
       
  3326 @SYMComponent  telephony_ctsy
       
  3327 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::GetSecurityCodeInfo
       
  3328 @SYMTestPriority High
       
  3329 @SYMTestActions Invokes multiple client requests to RMobilePhone::GetSecurityCodeInfo
       
  3330 @SYMTestExpectedResults Pass
       
  3331 @SYMTestType CT
       
  3332 */
       
  3333 void CCTsyPhoneSecurityFU::TestGetSecurityCodeInfo0004L()
       
  3334 	{			
       
  3335 	OpenEtelServerL(EUseExtendedError);
       
  3336 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3337 	OpenPhoneL();
       
  3338 
       
  3339 	RBuf8 data;
       
  3340 	CleanupClosePushL(data);
       
  3341 
       
  3342 	RBuf8 data2;
       
  3343 	CleanupClosePushL(data2);
       
  3344 
       
  3345 	RBuf8 dataComplete;
       
  3346 	CleanupClosePushL(dataComplete);
       
  3347 
       
  3348 	RBuf8 dataComplete2;
       
  3349 	CleanupClosePushL(dataComplete2);
       
  3350 
       
  3351 	// Open second client
       
  3352 	RTelServer telServer2;
       
  3353 	TInt ret = telServer2.Connect();
       
  3354 	ASSERT_EQUALS(KErrNone, ret);
       
  3355 	CleanupClosePushL(telServer2);
       
  3356 
       
  3357 	RMobilePhone phone2;
       
  3358 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  3359 	ASSERT_EQUALS(KErrNone, ret);
       
  3360 	CleanupClosePushL(phone2);
       
  3361 
       
  3362 
       
  3363 	TRequestStatus reqStatus;
       
  3364 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3365 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3366 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3367 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  3368 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
       
  3369 	
       
  3370 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData(secCode);
       
  3371 	codeData.SerialiseL(data);
       
  3372 	
       
  3373 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCode, codeInfoV5);
       
  3374 	codeInfoData.SerialiseL(dataComplete);
       
  3375 	
       
  3376 	TRequestStatus reqStatus2;
       
  3377 	RMobilePhone::TMobilePhoneSecurityCode secCode2 = RMobilePhone::ESecurityCodePin1;
       
  3378 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV52;
       
  3379 	codeInfoV52.iRemainingEntryAttempts = 3;
       
  3380 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV52;
       
  3381 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData2(codeV52);
       
  3382 	
       
  3383 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData2(secCode2);
       
  3384 	codeData2.SerialiseL(data2);
       
  3385 	
       
  3386 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData2(secCode2, codeInfoV52);
       
  3387 	codeInfoData2.SerialiseL(dataComplete2);
       
  3388 	
       
  3389 	//-------------------------------------------------------------------------
       
  3390 	// Test A: Test multiple clients requesting RMobilePhone::GetSecurityCodeInfo
       
  3391  	//-------------------------------------------------------------------------
       
  3392 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, data);
       
  3393 	
       
  3394 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrNone, dataComplete);
       
  3395 	
       
  3396 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, data2);
       
  3397 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrNone, dataComplete2);
       
  3398 	
       
  3399 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);	
       
  3400 	phone2.GetSecurityCodeInfo(reqStatus2, secCode2, pckgData2);	
       
  3401 		
       
  3402 		
       
  3403 	// wait for first phone GetSecurityCodeInfo
       
  3404 	User::WaitForRequest(reqStatus);
       
  3405 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  3406 	ASSERT_EQUALS(codeInfoV5.iRemainingEntryAttempts, pckgData().iRemainingEntryAttempts)
       
  3407 	
       
  3408 		
       
  3409 	// wait for second phone GetsecurityCodeInfo.
       
  3410 	User::WaitForRequest(reqStatus2);
       
  3411 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
  3412 	ASSERT_EQUALS(codeInfoV52.iRemainingEntryAttempts, pckgData2().iRemainingEntryAttempts)
       
  3413 	AssertMockLtsyStatusL();
       
  3414 	
       
  3415 	// Done !
       
  3416 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, data, this
       
  3417 
       
  3418 	}
       
  3419 	
       
  3420 /**
       
  3421 @SYMTestCaseID BA-CTSY-PSEC-MGSCI-0005
       
  3422 @SYMComponent  telephony_ctsy
       
  3423 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSecurityCodeInfo with timeout
       
  3424 @SYMTestPriority High
       
  3425 @SYMTestActions Invokes RMobilePhone::GetSecurityCodeInfo and tests for timeout
       
  3426 @SYMTestExpectedResults Pass
       
  3427 @SYMTestType CT
       
  3428 */
       
  3429 void CCTsyPhoneSecurityFU::TestGetSecurityCodeInfo0005L()
       
  3430 	{
       
  3431 
       
  3432 
       
  3433 	OpenEtelServerL(EUseExtendedError);
       
  3434 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3435 	OpenPhoneL();
       
  3436 
       
  3437 	RBuf8 data;
       
  3438 	CleanupClosePushL(data);
       
  3439 	
       
  3440 	RBuf8 data2;
       
  3441 	CleanupClosePushL(data2);
       
  3442 
       
  3443 	RBuf8 dataComplete;
       
  3444 	CleanupClosePushL(dataComplete);
       
  3445 
       
  3446 	// Open second client
       
  3447 	RTelServer telServer2;
       
  3448 	TInt ret = telServer2.Connect();
       
  3449 	ASSERT_EQUALS(KErrNone, ret);
       
  3450 	CleanupClosePushL(telServer2);
       
  3451 
       
  3452 	RMobilePhone phone2;
       
  3453 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  3454 	ASSERT_EQUALS(KErrNone, ret);
       
  3455 	CleanupClosePushL(phone2);
       
  3456 
       
  3457 	TRequestStatus reqStatus;
       
  3458 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3459 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3460 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3461 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  3462 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
       
  3463 	
       
  3464 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData(secCode);
       
  3465 	codeData.SerialiseL(data);
       
  3466 	
       
  3467 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCode, codeInfoV5);
       
  3468 	codeInfoData.SerialiseL(dataComplete);
       
  3469 	//-------------------------------------------------------------------------
       
  3470 	// Test A: Send multiple client requests RMobilePhone::ChangeSecurityCode
       
  3471 	//			One request successfully returns, other one timed out.
       
  3472 	//			Multiple request is sent just to test that the proper one is timed out.
       
  3473  	//-------------------------------------------------------------------------
       
  3474 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, data);
       
  3475 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrNone, dataComplete);
       
  3476 
       
  3477 	TRequestStatus reqStatus2;
       
  3478 	RMobilePhone::TMobilePhoneSecurityCode secCode2 = RMobilePhone::ESecurityCodePin1;
       
  3479 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV52;
       
  3480 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData2(codeV52);
       
  3481 	
       
  3482 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData2(secCode2);
       
  3483 	codeData2.SerialiseL(data2);
       
  3484 
       
  3485 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, data2);
       
  3486 
       
  3487 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
       
  3488 
       
  3489 	phone2.GetSecurityCodeInfo(reqStatus2, secCode2, pckgData2);
       
  3490 
       
  3491 	// wait for first phone GetSecurityCodeInfo
       
  3492 	User::WaitForRequest(reqStatus);
       
  3493 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  3494 	ASSERT_EQUALS(codeInfoV5.iRemainingEntryAttempts, pckgData().iRemainingEntryAttempts)
       
  3495 
       
  3496 	// wait for second phone GetsecurityCodeInfo which will be timed out.
       
  3497 	User::WaitForRequest(reqStatus2);
       
  3498 	ASSERT_EQUALS(KErrTimedOut, reqStatus2.Int())
       
  3499 
       
  3500 	AssertMockLtsyStatusL();
       
  3501 
       
  3502 	// Done !
       
  3503 	CleanupStack::PopAndDestroy(6, this); // data, this
       
  3504 
       
  3505 	}
       
  3506 
       
  3507 /**
       
  3508 @SYMTestCaseID BA-CTSY-PSEC-MGSCI-0006
       
  3509 @SYMComponent  telephony_ctsy
       
  3510 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSecurityCodeInfo
       
  3511 @SYMTestPriority High
       
  3512 @SYMTestActions Invokes RMobilePhone::GetSecurityCodeInfo
       
  3513 @SYMTestExpectedResults Pass
       
  3514 @SYMTestType CT
       
  3515 */
       
  3516 void CCTsyPhoneSecurityFU::TestGetSecurityCodeInfo0006L()
       
  3517 	{
       
  3518 	OpenEtelServerL(EUseExtendedError);
       
  3519 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3520 	OpenPhoneL();
       
  3521 
       
  3522 	RBuf8 data;
       
  3523 	CleanupClosePushL(data);
       
  3524 
       
  3525 	RBuf8 data2;
       
  3526 	CleanupClosePushL(data2);
       
  3527 
       
  3528 	RBuf8 dataComplete;
       
  3529 	CleanupClosePushL(dataComplete);
       
  3530 
       
  3531 	RBuf8 dataComplete2;
       
  3532 	CleanupClosePushL(dataComplete2);
       
  3533 
       
  3534 	// Open second client
       
  3535 	RTelServer telServer2;
       
  3536 	TInt ret = telServer2.Connect();
       
  3537 	ASSERT_EQUALS(KErrNone, ret);
       
  3538 	CleanupClosePushL(telServer2);
       
  3539 
       
  3540 	RMobilePhone phone2;
       
  3541 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  3542 	ASSERT_EQUALS(KErrNone, ret);
       
  3543 	CleanupClosePushL(phone2);
       
  3544 
       
  3545 
       
  3546 	TRequestStatus reqStatus;
       
  3547 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3548 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3549 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3550 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  3551 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
       
  3552 	
       
  3553 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData(secCode);
       
  3554 	codeData.SerialiseL(data);
       
  3555 	
       
  3556 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCode, codeInfoV5);
       
  3557 	codeInfoData.SerialiseL(dataComplete);
       
  3558 	
       
  3559 	TRequestStatus reqStatus2;
       
  3560 	RMobilePhone::TMobilePhoneSecurityCode secCode2 = RMobilePhone::ESecurityCodePin1;
       
  3561 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV52;
       
  3562 	codeInfoV52.iRemainingEntryAttempts = 3;
       
  3563 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV52;
       
  3564 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData2(codeV52);
       
  3565 	
       
  3566 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData2(secCode2);
       
  3567 	codeData2.SerialiseL(data2);
       
  3568 	
       
  3569 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData2(secCode2, codeInfoV52);
       
  3570 	codeInfoData2.SerialiseL(dataComplete2);
       
  3571 	
       
  3572 	//----------------------------------------------------------------------------
       
  3573 	// Covering condition when there is already one request for security code and
       
  3574 	// a second one is done.
       
  3575 	//----------------------------------------------------------------------------
       
  3576 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 71003);
       
  3577 	ASSERT_TRUE(EFalse)
       
  3578 	
       
  3579 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, data);
       
  3580 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrNone, dataComplete);
       
  3581 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
       
  3582 	
       
  3583 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrNone, dataComplete2);	
       
  3584 	phone2.GetSecurityCodeInfo(reqStatus2, secCode, pckgData2);	
       
  3585 		
       
  3586 		
       
  3587 	// wait for first phone GetSecurityCodeInfo
       
  3588 	User::WaitForRequest(reqStatus);
       
  3589 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  3590 	ASSERT_EQUALS(codeInfoV5.iRemainingEntryAttempts, pckgData().iRemainingEntryAttempts)
       
  3591 	
       
  3592 		
       
  3593 	// wait for second phone GetsecurityCodeInfo.
       
  3594 	User::WaitForRequest(reqStatus2);
       
  3595 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
  3596 	ASSERT_EQUALS(codeInfoV52.iRemainingEntryAttempts, pckgData2().iRemainingEntryAttempts)
       
  3597 	AssertMockLtsyStatusL();
       
  3598 	
       
  3599 	// Done !
       
  3600 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, data, this
       
  3601 
       
  3602 	}
       
  3603 
       
  3604 /**
       
  3605 @SYMTestCaseID BA-CTSY-PSEC-MGSCI-0007
       
  3606 @SYMComponent  telephony_ctsy
       
  3607 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSecurityCodeInfo
       
  3608 @SYMTestPriority High
       
  3609 @SYMTestActions Invokes RMobilePhone::GetSecurityCodeInfo
       
  3610 @SYMTestExpectedResults Pass
       
  3611 @SYMTestType CT
       
  3612 */
       
  3613 void CCTsyPhoneSecurityFU::TestGetSecurityCodeInfo0007L()
       
  3614 	{
       
  3615 	OpenEtelServerL(EUseExtendedError);
       
  3616 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3617 	OpenPhoneL();
       
  3618 
       
  3619 	TRequestStatus mockLtsyStatus;
       
  3620 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3621 
       
  3622 	RBuf8 data;
       
  3623 	CleanupClosePushL(data);
       
  3624 
       
  3625 	RBuf8 data2;
       
  3626 	CleanupClosePushL(data2);
       
  3627 
       
  3628 	RBuf8 dataComplete;
       
  3629 	CleanupClosePushL(dataComplete);
       
  3630 
       
  3631 	RBuf8 dataComplete2;
       
  3632 	CleanupClosePushL(dataComplete2);
       
  3633 
       
  3634 	// Open second client
       
  3635 	RTelServer telServer2;
       
  3636 	TInt ret = telServer2.Connect();
       
  3637 	ASSERT_EQUALS(KErrNone, ret);
       
  3638 	CleanupClosePushL(telServer2);
       
  3639 
       
  3640 	RMobilePhone phone2;
       
  3641 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  3642 	ASSERT_EQUALS(KErrNone, ret);
       
  3643 	CleanupClosePushL(phone2);
       
  3644 
       
  3645 
       
  3646 	TRequestStatus reqStatus;
       
  3647 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3648 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3649 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3650 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  3651 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
       
  3652 	
       
  3653 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData(secCode);
       
  3654 	codeData.SerialiseL(data);
       
  3655 	
       
  3656 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCode, codeInfoV5);
       
  3657 	codeInfoData.SerialiseL(dataComplete);
       
  3658 	
       
  3659 	TRequestStatus reqStatus2;
       
  3660 	RMobilePhone::TMobilePhoneSecurityCode secCode2 = RMobilePhone::ESecurityCodePin1;
       
  3661 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV52;
       
  3662 	codeInfoV52.iRemainingEntryAttempts = 3;
       
  3663 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV52;
       
  3664 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData2(codeV52);
       
  3665 	
       
  3666 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData2(secCode2);
       
  3667 	codeData2.SerialiseL(data2);
       
  3668 	
       
  3669 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData2(secCode2, codeInfoV52);
       
  3670 	codeInfoData2.SerialiseL(dataComplete2);
       
  3671 	
       
  3672 	//-----------------------------------------------------------------------------
       
  3673 	// Cover condition if there are more than one GetSecurityCodeInfo request when cancelling some request.
       
  3674 	//-----------------------------------------------------------------------------
       
  3675 	// This defect was fixed. For more information see defect description 
       
  3676 	//ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 71004);
       
  3677 	
       
  3678 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, data);
       
  3679 	iMockLTSY.CompleteL(EMobilePhoneGetSecurityCodeInfo, KErrNone, dataComplete);
       
  3680 	
       
  3681 	iMockLTSY.ExpectL(EMobilePhoneGetSecurityCodeInfo, data2);
       
  3682 	
       
  3683 	
       
  3684 	iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);	
       
  3685 	phone2.GetSecurityCodeInfo(reqStatus2, secCode2, pckgData2);
       
  3686 	phone2.CancelAsyncRequest(EMobilePhoneGetSecurityCodeInfo);
       
  3687 		
       
  3688 	User::WaitForRequest(mockLtsyStatus);		
       
  3689 		
       
  3690 	// wait for second phone GetsecurityCodeInfo.
       
  3691 	User::WaitForRequest(reqStatus2);
       
  3692 	ASSERT_EQUALS(KErrCancel, reqStatus2.Int());
       
  3693 	
       
  3694 	
       
  3695 	// wait for first phone GetSecurityCodeInfo
       
  3696 	User::WaitForRequest(reqStatus);
       
  3697 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  3698 	ASSERT_EQUALS(codeInfoV5.iRemainingEntryAttempts, pckgData().iRemainingEntryAttempts)
       
  3699 	
       
  3700 	AssertMockLtsyStatusL();
       
  3701 	
       
  3702 
       
  3703 
       
  3704 	// Done !
       
  3705 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, data, this
       
  3706 
       
  3707 	}
       
  3708 
       
  3709 /**
       
  3710 @SYMTestCaseID BA-CTSY-PSEC-MNSCIC-0001
       
  3711 @SYMComponent  telephony_ctsy
       
  3712 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityCodeInfoChange
       
  3713 @SYMTestPriority High
       
  3714 @SYMTestActions Invokes RMobilePhone::NotifySecurityCodeInfoChange
       
  3715 @SYMTestExpectedResults Pass
       
  3716 @SYMTestType CT
       
  3717 */
       
  3718 void CCTsyPhoneSecurityFU::TestNotifySecurityCodeInfoChange0001L()
       
  3719 	{
       
  3720 
       
  3721 	OpenEtelServerL(EUseExtendedError);
       
  3722 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3723 	OpenPhoneL();
       
  3724 
       
  3725 	RBuf8 data;
       
  3726 	CleanupClosePushL(data);
       
  3727 
       
  3728 	TRequestStatus reqStatus;
       
  3729 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3730 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3731 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3732 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  3733 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
       
  3734 	
       
  3735 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCode, codeInfoV5);
       
  3736 	codeInfoData.SerialiseL(data);
       
  3737 	
       
  3738  	//-------------------------------------------------------------------------
       
  3739 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  3740  	//------------------------------------------------------------------------- 	
       
  3741 	iPhone.NotifySecurityCodeInfoChange(reqStatus, secCode, pckgData);
       
  3742 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityCodeInfoChange, KErrGeneral, data);
       
  3743 	User::WaitForRequest(reqStatus);
       
  3744 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
       
  3745 	AssertMockLtsyStatusL();
       
  3746 	
       
  3747  	//-------------------------------------------------------------------------
       
  3748 	// TEST C: Successful completion request of
       
  3749 	// RMobilePhone::GetSecurityCodeInfo when result is not cached.
       
  3750  	//------------------------------------------------------------------------- 	
       
  3751 	iPhone.NotifySecurityCodeInfoChange(reqStatus, secCode, pckgData);
       
  3752 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityCodeInfoChange, KErrNone, data);
       
  3753 	User::WaitForRequest(reqStatus);
       
  3754 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  3755 	ASSERT_EQUALS(codeInfoV5.iRemainingEntryAttempts, pckgData().iRemainingEntryAttempts)
       
  3756 	AssertMockLtsyStatusL();
       
  3757 	
       
  3758  	//-------------------------------------------------------------------------
       
  3759 	// TEST E: Unsolicited completion of RMobilePhone::GetSecurityCodeInfo
       
  3760 	// from LTSY.
       
  3761  	//-------------------------------------------------------------------------
       
  3762 	TRequestStatus mockLtsyStatus;
       
  3763 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3764 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityCodeInfoChange, KErrNone, data);
       
  3765 	User::WaitForRequest(mockLtsyStatus);
       
  3766 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
       
  3767 	
       
  3768 	AssertMockLtsyStatusL();
       
  3769 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  3770 	
       
  3771 	}
       
  3772 
       
  3773 
       
  3774 /**
       
  3775 @SYMTestCaseID BA-CTSY-PSEC-MNSCIC-0002
       
  3776 @SYMComponent  telephony_ctsy
       
  3777 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::GetSecurityCodeInfo
       
  3778 @SYMTestPriority High
       
  3779 @SYMTestActions Invokes cancelling of RMobilePhone::GetSecurityCodeInfo
       
  3780 @SYMTestExpectedResults Pass
       
  3781 @SYMTestType CT
       
  3782 */
       
  3783 void CCTsyPhoneSecurityFU::TestNotifySecurityCodeInfoChange0002L()
       
  3784 	{
       
  3785 	OpenEtelServerL(EUseExtendedError);
       
  3786 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3787 	OpenPhoneL();
       
  3788 
       
  3789 	TRequestStatus mockLtsyStatus;
       
  3790 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3791 
       
  3792 	RBuf8 data;
       
  3793 	CleanupClosePushL(data);
       
  3794 
       
  3795 	TRequestStatus reqStatus;
       
  3796 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3797 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3798 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3799 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
       
  3800 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
       
  3801 	
       
  3802 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCode, codeInfoV5);
       
  3803 	codeInfoData.SerialiseL(data);
       
  3804 	
       
  3805  	//-------------------------------------------------------------------------
       
  3806 	// Test cancelling of RMobilePhone::GetLockInfo
       
  3807  	//-------------------------------------------------------------------------	
       
  3808 	iPhone.NotifySecurityCodeInfoChange(reqStatus, secCode, pckgData);
       
  3809 	iPhone.CancelAsyncRequest(EMobilePhoneNotifySecurityCodeInfoChange);
       
  3810 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  3811 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityCodeInfoChange, KErrNone, data);
       
  3812 	User::WaitForRequest(mockLtsyStatus);
       
  3813 	// Wait for completion of GetSecurityCodeInfo
       
  3814 	User::WaitForRequest(reqStatus);
       
  3815 	// Check status is KErrCancel
       
  3816 	ASSERT_EQUALS(KErrCancel,reqStatus.Int());
       
  3817 	AssertMockLtsyStatusL();
       
  3818 
       
  3819 	CleanupStack::PopAndDestroy(2); // data, this
       
  3820 	}
       
  3821 	
       
  3822 /**
       
  3823 @SYMTestCaseID BA-CTSY-PSEC-MNSCIC-0003
       
  3824 @SYMComponent  telephony_ctsy
       
  3825 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSecurityCodeInfo with bad parameter data
       
  3826 @SYMTestPriority High
       
  3827 @SYMTestActions Invokes RMobilePhone::NotifySecurityCodeInfoChange with bad parameter data
       
  3828 @SYMTestExpectedResults Pass
       
  3829 @SYMTestType CT
       
  3830 */
       
  3831 void CCTsyPhoneSecurityFU::TestNotifySecurityCodeInfoChange0003L()
       
  3832 	{
       
  3833 	
       
  3834 	OpenEtelServerL(EUseExtendedError);
       
  3835 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3836 	OpenPhoneL();
       
  3837 	
       
  3838 	TRequestStatus reqStatus;
       
  3839 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
       
  3840 	TBuf8<1> smallBuf;
       
  3841 	
       
  3842 	//-------------------------------------------------------------------------
       
  3843 	// Test B: Test passing wrong descriptor size to parameter in
       
  3844 	// RMobilePhone::GetLockInfo
       
  3845  	//-------------------------------------------------------------------------
       
  3846 
       
  3847 	// CTSY should return an error straight away
       
  3848 
       
  3849 	iPhone.NotifySecurityCodeInfoChange(reqStatus, secCode, smallBuf);
       
  3850     User::WaitForRequest(reqStatus);
       
  3851     
       
  3852 	ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
  3853    	AssertMockLtsyStatusL();
       
  3854 
       
  3855 	// Done !
       
  3856 	CleanupStack::PopAndDestroy( this ); // this
       
  3857 	}
       
  3858 		
       
  3859 	
       
  3860 /**
       
  3861 @SYMTestCaseID BA-CTSY-PSEC-MNSCIC-0004
       
  3862 @SYMComponent  telephony_ctsy
       
  3863 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifySecurityCodeInfoChange
       
  3864 @SYMTestPriority High
       
  3865 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifySecurityCodeInfoChange
       
  3866 @SYMTestExpectedResults Pass
       
  3867 @SYMTestType CT
       
  3868 */
       
  3869 void CCTsyPhoneSecurityFU::TestNotifySecurityCodeInfoChange0004L()
       
  3870 	{
       
  3871 					
       
  3872 	OpenEtelServerL(EUseExtendedError);
       
  3873 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3874 	OpenPhoneL();
       
  3875 
       
  3876 	RBuf8 data;
       
  3877 	CleanupClosePushL(data);
       
  3878 
       
  3879 	// Open second client
       
  3880 	RTelServer telServer2;
       
  3881 	TInt ret = telServer2.Connect();
       
  3882 	ASSERT_EQUALS(KErrNone, ret);
       
  3883 	CleanupClosePushL(telServer2);
       
  3884 
       
  3885 	RMobilePhone phone2;
       
  3886 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  3887 	ASSERT_EQUALS(KErrNone, ret);
       
  3888 	CleanupClosePushL(phone2);
       
  3889 
       
  3890 	TRequestStatus reqStatus;
       
  3891 	TRequestStatus reqStatus2;
       
  3892 	
       
  3893 	RMobilePhone::TMobilePhoneSecurityCode secCodeComplete = RMobilePhone::ESecurityCodePhonePassword;
       
  3894 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfoV5;
       
  3895 	codeInfoV5.iRemainingEntryAttempts = 4;
       
  3896 	
       
  3897 	TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TMobilePhoneSecurityCodeInfoV5> codeInfoData(secCodeComplete, codeInfoV5);
       
  3898 	codeInfoData.SerialiseL(data);
       
  3899 	
       
  3900 	// For first request
       
  3901 	RMobilePhone::TMobilePhoneSecurityCode secCode1 = RMobilePhone::ESecurityCodePin1;
       
  3902 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV51;
       
  3903 	codeV51.iRemainingEntryAttempts = 0;
       
  3904 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData1(codeV51);
       
  3905 	
       
  3906 	// For second request
       
  3907 	RMobilePhone::TMobilePhoneSecurityCode secCode2 = RMobilePhone::ESecurityCodePin1;
       
  3908 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV52;
       
  3909 	codeV52.iRemainingEntryAttempts = 0;
       
  3910 	TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData2(codeV52);
       
  3911 	
       
  3912 	//-------------------------------------------------------------------------
       
  3913 	// Test A: Test multiple clients requesting RMobilePhone::NotifySecurityCodeInfoChange
       
  3914  	//-------------------------------------------------------------------------
       
  3915 	
       
  3916 	iPhone.NotifySecurityCodeInfoChange(reqStatus, secCode1, pckgData1);	
       
  3917 	phone2.NotifySecurityCodeInfoChange(reqStatus2, secCode2, pckgData2);	
       
  3918 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityCodeInfoChange, KErrNone, data);		
       
  3919 		
       
  3920 	// Wait for the first complete.
       
  3921 	User::WaitForRequest(reqStatus);
       
  3922 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  3923 	ASSERT_EQUALS(codeInfoV5.iRemainingEntryAttempts, pckgData1().iRemainingEntryAttempts);	
       
  3924 	ASSERT_EQUALS(secCodeComplete, secCode1);	
       
  3925 		
       
  3926 	// Wait for the second complete.
       
  3927 	User::WaitForRequest(reqStatus2);
       
  3928 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
  3929 	ASSERT_EQUALS(codeInfoV5.iRemainingEntryAttempts, pckgData2().iRemainingEntryAttempts);
       
  3930 	ASSERT_EQUALS(secCodeComplete, secCode2);		
       
  3931 	
       
  3932 	AssertMockLtsyStatusL();
       
  3933 
       
  3934 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  3935 
       
  3936 	}
       
  3937 	
       
  3938 
       
  3939 /**
       
  3940 @SYMTestCaseID BA-CTSY-NTWS-MNSCC-0001
       
  3941 @SYMComponent  telephony_ctsy
       
  3942 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityCapsChange
       
  3943 @SYMTestPriority High
       
  3944 @SYMTestActions Invokes RMobilePhone::NotifySecurityCapsChange
       
  3945 @SYMTestExpectedResults Pass
       
  3946 @SYMTestType CT
       
  3947 */
       
  3948 void CCTsyPhoneSecurityFU::TestNotifySecurityCapsChange0001L()
       
  3949 	{
       
  3950 
       
  3951 	OpenEtelServerL(EUseExtendedError);
       
  3952 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3953 	OpenPhoneL();
       
  3954 
       
  3955 	RBuf8 data;
       
  3956 	CleanupClosePushL(data);
       
  3957 
       
  3958 
       
  3959 	// Check basic expected operation
       
  3960 	
       
  3961 	TRequestStatus mockLtsyStatus;
       
  3962 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3963 
       
  3964     TUint32 oldCaps;
       
  3965     iPhone.GetSecurityCaps(oldCaps);
       
  3966     
       
  3967 	TRequestStatus requestStatus;
       
  3968     TUint32 newCaps;
       
  3969 
       
  3970     //----------------------------
       
  3971 	iPhone.NotifySecurityCapsChange(requestStatus, newCaps);
       
  3972 
       
  3973 	RMobilePhone::TMobilePhoneSecurityEvent ev(RMobilePhone::ENoICCFound);
       
  3974 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> evData(ev);
       
  3975 
       
  3976     ev = RMobilePhone::ENoICCFound;
       
  3977 	evData.SerialiseL(data);
       
  3978 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  3979 	User::WaitForRequest(mockLtsyStatus);
       
  3980 	AssertMockLtsyStatusL();
       
  3981 
       
  3982 	User::WaitForRequest(requestStatus);
       
  3983 
       
  3984     TUint32 capsToCompare(0);    
       
  3985 
       
  3986     if ( oldCaps & RMobilePhone::KCapsLockPhone )
       
  3987         {
       
  3988         capsToCompare |= RMobilePhone::KCapsLockPhone;
       
  3989         }
       
  3990     if ( oldCaps & RMobilePhone::KCapsAccessPhonePassword )
       
  3991         {
       
  3992         capsToCompare |= RMobilePhone::KCapsAccessPhonePassword;
       
  3993         }
       
  3994 
       
  3995 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3996 	ASSERT_EQUALS(capsToCompare, newCaps);
       
  3997     //----------------------------
       
  3998 
       
  3999 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4000 
       
  4001     ev = RMobilePhone::EICCTerminated;
       
  4002 	data.Close();
       
  4003 	evData.SerialiseL(data);
       
  4004 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4005 
       
  4006 
       
  4007 	iPhone.NotifySecurityCapsChange(requestStatus, newCaps);
       
  4008 
       
  4009     ev = RMobilePhone::EPin1Required;
       
  4010 	data.Close();
       
  4011 	evData.SerialiseL(data);
       
  4012 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4013 
       
  4014     ev = RMobilePhone::EPuk1Required;
       
  4015 	data.Close();
       
  4016 	evData.SerialiseL(data);
       
  4017 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4018 
       
  4019     ev = RMobilePhone::EPin2Required;
       
  4020 	data.Close();
       
  4021 	evData.SerialiseL(data);
       
  4022 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4023 
       
  4024     ev = RMobilePhone::EPuk2Required;
       
  4025 	data.Close();
       
  4026 	evData.SerialiseL(data);
       
  4027 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4028 
       
  4029     ev = RMobilePhone::EPhonePasswordRequired;
       
  4030 	data.Close();
       
  4031 	evData.SerialiseL(data);
       
  4032 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4033 
       
  4034     ev = RMobilePhone::EPin1Verified;
       
  4035 	data.Close();
       
  4036 	evData.SerialiseL(data);
       
  4037 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4038 
       
  4039     ev = RMobilePhone::EPin2Verified;
       
  4040 	data.Close();
       
  4041 	evData.SerialiseL(data);
       
  4042 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4043 
       
  4044     ev = RMobilePhone::EPuk1Verified;
       
  4045 	data.Close();
       
  4046 	evData.SerialiseL(data);
       
  4047 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4048 
       
  4049     ev = RMobilePhone::EPuk2Verified;
       
  4050 	data.Close();
       
  4051 	evData.SerialiseL(data);
       
  4052 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4053 
       
  4054 	User::WaitForRequest(mockLtsyStatus);
       
  4055 	AssertMockLtsyStatusL();
       
  4056 
       
  4057 	User::WaitForRequest(requestStatus);
       
  4058 
       
  4059     capsToCompare = 0;
       
  4060 
       
  4061 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4062 	ASSERT_EQUALS(capsToCompare, newCaps);
       
  4063 
       
  4064     //- making ICC3G ----------------------------
       
  4065     
       
  4066 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4067 
       
  4068     TICCType type(EICCTypeSim3G);
       
  4069 
       
  4070 	TMockLtsyData1<TICCType> iccData(type);
       
  4071 	data.Close();
       
  4072 	iccData.SerialiseL(data);
       
  4073 
       
  4074 	iMockLTSY.CompleteL(EMmTsySimGetICCType, KErrNone, data);    
       
  4075 
       
  4076 	iMockLTSY.ExpectL(EMmTsySecurityGetSimActivePinStateIPC);
       
  4077 	iMockLTSY.CompleteL(EMmTsySecurityGetSimActivePinStateIPC, KErrNone);
       
  4078 
       
  4079 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  4080 	User::WaitForRequest(mockLtsyStatus);
       
  4081 	AssertMockLtsyStatusL();
       
  4082 
       
  4083     //--------------------------------------------
       
  4084 
       
  4085     iPhone.GetSecurityCaps(oldCaps);
       
  4086 
       
  4087 
       
  4088 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4089 
       
  4090 	iPhone.NotifySecurityCapsChange(requestStatus, newCaps);
       
  4091 
       
  4092 	ev = RMobilePhone::EUniversalPinRequired;
       
  4093 	data.Close();
       
  4094 	evData.SerialiseL(data);
       
  4095 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4096 
       
  4097 	ev = RMobilePhone::EUniversalPukRequired;
       
  4098 	data.Close();
       
  4099 	evData.SerialiseL(data);
       
  4100 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4101 
       
  4102 	ev = RMobilePhone::EPhonePasswordRequired;
       
  4103 	data.Close();
       
  4104 	evData.SerialiseL(data);
       
  4105 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4106 
       
  4107 	ev = RMobilePhone::EUniversalPinVerified;
       
  4108 	data.Close();
       
  4109 	evData.SerialiseL(data);
       
  4110 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4111 
       
  4112 	ev = RMobilePhone::EUniversalPukVerified;
       
  4113 	data.Close();
       
  4114 	evData.SerialiseL(data);
       
  4115 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4116 
       
  4117 	ev = RMobilePhone::EPhonePasswordVerified;
       
  4118 	data.Close();
       
  4119 	evData.SerialiseL(data);
       
  4120 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4121 
       
  4122 	User::WaitForRequest(mockLtsyStatus);
       
  4123 	AssertMockLtsyStatusL();
       
  4124 		
       
  4125 	User::WaitForRequest(requestStatus);
       
  4126 	
       
  4127 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4128 	ASSERT_EQUALS(oldCaps, newCaps);
       
  4129 
       
  4130 
       
  4131 	AssertMockLtsyStatusL();
       
  4132 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  4133 
       
  4134 }
       
  4135 
       
  4136 /**
       
  4137 @SYMTestCaseID BA-CTSY-NTWS-MNSCC-0002
       
  4138 @SYMComponent  telephony_ctsy
       
  4139 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifySecurityCapsChange
       
  4140 @SYMTestPriority High
       
  4141 @SYMTestActions Invokes cancelling of RMobilePhone::NotifySecurityCapsChange
       
  4142 @SYMTestExpectedResults Pass
       
  4143 @SYMTestType CT
       
  4144 */
       
  4145 void CCTsyPhoneSecurityFU::TestNotifySecurityCapsChange0002L()
       
  4146 	{
       
  4147 
       
  4148 // This test should test cancellation of NotifySecurityCapsChange
       
  4149 // If this API does not have a cancel, the test step should be completely removed.
       
  4150 
       
  4151 	OpenEtelServerL(EUseExtendedError);
       
  4152 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4153 	OpenPhoneL();
       
  4154 
       
  4155 	TRequestStatus mockLtsyStatus;
       
  4156 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4157 
       
  4158 	RBuf8 data;
       
  4159 	CleanupClosePushL(data);
       
  4160 
       
  4161  	//-------------------------------------------------------------------------
       
  4162 	// Test cancelling of RMobilePhone::NotifySecurityCapsChange
       
  4163  	//------------------------------------------------------------------------- 	
       
  4164 	TRequestStatus requestStatus;
       
  4165 	TUint32 caps;	
       
  4166 
       
  4167 	iPhone.NotifySecurityCapsChange(requestStatus, caps);
       
  4168 
       
  4169 	RMobilePhone::TMobilePhoneSecurityEvent ev(RMobilePhone::EICCTerminated);
       
  4170 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> evData(ev);
       
  4171 	evData.SerialiseL(data);
       
  4172 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data, 2);
       
  4173 
       
  4174     iPhone.CancelAsyncRequest(EMobilePhoneNotifySecurityCapsChange);
       
  4175 
       
  4176 	User::WaitForRequest(requestStatus);
       
  4177 	
       
  4178 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  4179 
       
  4180 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  4181     User::WaitForRequest(mockLtsyStatus);
       
  4182    	AssertMockLtsyStatusL();
       
  4183 
       
  4184 	CleanupStack::PopAndDestroy(2); // data, this
       
  4185 	}
       
  4186 
       
  4187 
       
  4188 /**
       
  4189 @SYMTestCaseID BA-CTSY-NTWS-MNSCC-0004
       
  4190 @SYMComponent  telephony_ctsy
       
  4191 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifySecurityCapsChange
       
  4192 @SYMTestPriority High
       
  4193 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifySecurityCapsChange
       
  4194 @SYMTestExpectedResults Pass
       
  4195 @SYMTestType CT
       
  4196 */
       
  4197 void CCTsyPhoneSecurityFU::TestNotifySecurityCapsChange0004L()
       
  4198 	{
       
  4199 	OpenEtelServerL(EUseExtendedError);
       
  4200 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4201 	OpenPhoneL();
       
  4202 
       
  4203 	RBuf8 data;
       
  4204 	CleanupClosePushL(data);
       
  4205 
       
  4206 	// Open second client
       
  4207 	RTelServer telServer2;
       
  4208 	TInt ret = telServer2.Connect();
       
  4209 	ASSERT_EQUALS(KErrNone, ret);
       
  4210 	CleanupClosePushL(telServer2);
       
  4211 
       
  4212 	RMobilePhone phone2;
       
  4213 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  4214 	ASSERT_EQUALS(KErrNone, ret);
       
  4215 	CleanupClosePushL(phone2);
       
  4216 
       
  4217 	//-------------------------------------------------------------------------
       
  4218 	// Test A: Test multiple clients requesting RMobilePhone::NotifySecurityCapsChange
       
  4219  	//-------------------------------------------------------------------------
       
  4220 	// If this API is flow controlled by Etel or if this API is
       
  4221 	// synchronous, remove this test completely.
       
  4222 
       
  4223 	TRequestStatus mockLtsyStatus;
       
  4224 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4225 
       
  4226     TUint32 oldCaps;	
       
  4227     iPhone.GetSecurityCaps(oldCaps);
       
  4228     
       
  4229 	TRequestStatus requestStatus1;
       
  4230 	TUint32 caps1;	
       
  4231 	iPhone.NotifySecurityCapsChange(requestStatus1, caps1);
       
  4232 
       
  4233 	TRequestStatus requestStatus2;
       
  4234 	TUint32 caps2;	
       
  4235 	phone2.NotifySecurityCapsChange(requestStatus2, caps2);
       
  4236 
       
  4237 	RMobilePhone::TMobilePhoneSecurityEvent ev(RMobilePhone::EICCTerminated);
       
  4238 	TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> evData(ev);
       
  4239 	evData.SerialiseL(data);
       
  4240 	iMockLTSY.CompleteL(EMobilePhoneNotifySecurityEvent, KErrNone, data);
       
  4241 
       
  4242 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  4243 	User::WaitForRequest(mockLtsyStatus);
       
  4244 	AssertMockLtsyStatusL();
       
  4245 
       
  4246 
       
  4247     TUint32 capsToCompare(0);	
       
  4248 	
       
  4249     if ( oldCaps & RMobilePhone::KCapsLockPhone )
       
  4250         {
       
  4251         capsToCompare |= RMobilePhone::KCapsLockPhone;
       
  4252         }
       
  4253 
       
  4254     if ( oldCaps & RMobilePhone::KCapsAccessPhonePassword )
       
  4255         {
       
  4256         capsToCompare |= RMobilePhone::KCapsAccessPhonePassword;
       
  4257         }	
       
  4258 
       
  4259 	User::WaitForRequest(requestStatus1);
       
  4260 	ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  4261 	ASSERT_EQUALS(capsToCompare, caps1);
       
  4262 
       
  4263 	User::WaitForRequest(requestStatus2);
       
  4264 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  4265 	ASSERT_EQUALS(capsToCompare, caps2);
       
  4266 
       
  4267 
       
  4268 	AssertMockLtsyStatusL();
       
  4269 	
       
  4270 	// Done !	
       
  4271 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  4272 
       
  4273 	}
       
  4274