telephonyserverplugins/common_tsy/test/integration/src/tsimtsytesthelper.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "tsimtsytesthelper.h" 
       
    17 #include "cctsyinidata.h"
       
    18 
       
    19 /**
       
    20 * Constructor
       
    21 */	
       
    22 TSimTsyTestHelper::TSimTsyTestHelper(CCTSYIntegrationTestSuiteStepBase& aTestStep)
       
    23 			: TTsyTestHelperBase( aTestStep )
       
    24 	{
       
    25 	}
       
    26 /**
       
    27 * Notify reset for RMobilePhone::NotifyUSimApplicationsInfoChange
       
    28 */	
       
    29 void TSimTsyTestHelper::WaitForMobilePhoneNotifyUSimApplicationsInfoChange( 
       
    30 				RMobilePhone& aMobilePhone,
       
    31 				TEtelRequestBase& aRequestStatus,
       
    32 				TInt& aCount, 
       
    33 				TInt aExpectedCount,
       
    34 				RMobilePhone::TAID &aActiveAID,
       
    35 				TInt aWantedStatus )
       
    36 
       
    37 	{
       
    38 	// Wait for the request to complete	
       
    39 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
    40 	ASSERT_EQUALS(err, KErrNone, _L("RMobilePhone::NotifyUSimApplicationsInfoChange did not complete"))
       
    41 	
       
    42 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
    43 							&& aCount != aExpectedCount )
       
    44 		{
       
    45 		// Request has completed with incorrect result. Consume any outstanding
       
    46 		// Repost notification until timeout or we get the right result.
       
    47 		
       
    48 		aMobilePhone.NotifyUSimApplicationsInfoChange(aRequestStatus, aCount, aActiveAID);
       
    49 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
    50 		}
       
    51 		
       
    52 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobilePhone::NotifyUSimApplicationsInfoChange Wrong completion status"))	
       
    53 	ASSERT_EQUALS(aCount, aExpectedCount, 
       
    54 				_L("RMobilePhone::NotifyUSimApplicationsInfoChange Wrong result"))	
       
    55 	
       
    56 	// Cancel request if it is still pending	
       
    57 	if (aRequestStatus.Int() == KRequestPending)	
       
    58 		{
       
    59 		aRequestStatus.Cancel();
       
    60 		}
       
    61 	}
       
    62 
       
    63 		
       
    64 /**
       
    65 * Notify reset for RMobilePhone::NotifyUSimAppsSelectionModeChange
       
    66 */	
       
    67 void TSimTsyTestHelper::WaitForMobilePhoneNotifyUSimAppsSelectionModeChange( 
       
    68 				RMobilePhone& aMobilePhone,
       
    69 				TEtelRequestBase& aRequestStatus,
       
    70 				RMobilePhone::TUSimSelectionMode& aUSimSelectionMode, 
       
    71 				RMobilePhone::TUSimSelectionMode aExpectedUSimSelectionMode,
       
    72 				TInt aWantedStatus )
       
    73 
       
    74 	{
       
    75 	// Wait for the request to complete	
       
    76 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
    77 	ASSERT_EQUALS(err, KErrNone, _L("RMobilePhone::NotifyUSimAppsSelectionModeChange did not complete"))
       
    78 	
       
    79 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
    80 							&& aUSimSelectionMode != aExpectedUSimSelectionMode )
       
    81 		{
       
    82 		// Request has completed with incorrect result. Consume any outstanding
       
    83 		// Repost notification until timeout or we get the right result.
       
    84 		
       
    85 		aMobilePhone.NotifyUSimAppsSelectionModeChange(aRequestStatus, aUSimSelectionMode);
       
    86 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
    87 		}
       
    88 		
       
    89 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobilePhone::NotifyUSimAppsSelectionModeChange Wrong completion status"))	
       
    90 	ASSERT_EQUALS(aUSimSelectionMode, aExpectedUSimSelectionMode, 
       
    91 				_L("RMobilePhone::NotifyUSimAppsSelectionModeChange Wrong result"))	
       
    92 	
       
    93 	// Cancel request if it is still pending	
       
    94 	if (aRequestStatus.Int() == KRequestPending)	
       
    95 		{
       
    96 		aRequestStatus.Cancel();
       
    97 		}
       
    98 	}
       
    99 
       
   100 		
       
   101 /**
       
   102 * Notify reset for RMobilePhone::NotifyUUSSettingChange
       
   103 */	
       
   104 void TSimTsyTestHelper::WaitForMobilePhoneNotifyUUSSettingChange( 
       
   105 				RMobilePhone& aMobilePhone,
       
   106 				TEtelRequestBase& aRequestStatus,
       
   107 				RMobilePhone::TMobilePhoneUUSSetting& aSetting, 
       
   108 				RMobilePhone::TMobilePhoneUUSSetting aExpectedSetting,
       
   109 				TInt aWantedStatus )
       
   110 
       
   111 	{
       
   112 	// Wait for the request to complete	
       
   113 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
   114 	ASSERT_EQUALS(err, KErrNone, _L("RMobilePhone::NotifyUUSSettingChange did not complete"))
       
   115 	
       
   116 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
   117 							&& aSetting != aExpectedSetting )
       
   118 		{
       
   119 		// Request has completed with incorrect result. Consume any outstanding
       
   120 		// Repost notification until timeout or we get the right result.
       
   121 		
       
   122 		aMobilePhone.NotifyUUSSettingChange(aRequestStatus, aSetting);
       
   123 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
   124 		}
       
   125 		
       
   126 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobilePhone::NotifyUUSSettingChange Wrong completion status"))	
       
   127 	ASSERT_EQUALS(aSetting, aExpectedSetting, 
       
   128 				_L("RMobilePhone::NotifyUUSSettingChange Wrong result"))	
       
   129 	
       
   130 	// Cancel request if it is still pending	
       
   131 	if (aRequestStatus.Int() == KRequestPending)	
       
   132 		{
       
   133 		aRequestStatus.Cancel();
       
   134 		}
       
   135 	}
       
   136 
       
   137 		
       
   138 /**
       
   139 * Notify reset for RMobilePhone::NotifyIccMessageWaitingIndicatorsChange
       
   140 */	
       
   141 void TSimTsyTestHelper::WaitForMobilePhoneNotifyIccMessageWaitingIndicatorsChange( 
       
   142 				RMobilePhone& aMobilePhone,
       
   143 				TEtelRequestBase& aRequestStatus,
       
   144 				TCmpBase<RMobilePhone::TMobilePhoneMessageWaitingV1> &aMobilePhoneMessageWaitingV1,
       
   145 				TInt aWantedStatus )
       
   146 
       
   147 	{
       
   148 	// Wait for the request to complete	
       
   149 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
   150 	ASSERT_EQUALS(err, KErrNone, _L("RMobilePhone::NotifyIccMessageWaitingIndicatorsChange did not complete"))
       
   151 	
       
   152 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
   153 							&& !aMobilePhoneMessageWaitingV1.IsEqual(ENoLogError) )
       
   154 		{
       
   155 		// Request has completed with incorrect result. Consume any outstanding
       
   156 		// Repost notification until timeout or we get the right result.		
       
   157 		RMobilePhone::TMobilePhoneMessageWaitingV1Pckg pkgParam( aMobilePhoneMessageWaitingV1.GetValue() );
       
   158 		aMobilePhone.NotifyIccMessageWaitingIndicatorsChange(aRequestStatus, pkgParam);
       
   159 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
   160 		}
       
   161 
       
   162 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobilePhone::NotifyIccMessageWaitingIndicatorsChange Wrong completion status"))	
       
   163 	ASSERT_TRUE(aMobilePhoneMessageWaitingV1.IsEqual(ELogError), 
       
   164 				_L("RMobilePhone::NotifyIccMessageWaitingIndicatorsChange Wrong result"))	
       
   165 	
       
   166 	// Cancel request if it is still pending	
       
   167 	if (aRequestStatus.Int() == KRequestPending)	
       
   168 		{
       
   169 		aRequestStatus.Cancel();
       
   170 		}
       
   171 	}
       
   172 
       
   173 		
       
   174 /**
       
   175 * Notify reset for RMobilePhone::NotifyImsAuthorizationInfoChange
       
   176 */	
       
   177 void TSimTsyTestHelper::WaitForMobilePhoneNotifyImsAuthorizationInfoChange( 
       
   178 				TEtelRequestBase& aRequestStatus,
       
   179 				TInt aWantedStatus )
       
   180 
       
   181 	{
       
   182 	// Wait for the request to complete	
       
   183 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
   184 	ASSERT_EQUALS(err, KErrNone, _L("RMobilePhone::NotifyImsAuthorizationInfoChange did not complete"))
       
   185 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobilePhone::NotifyImsAuthorizationInfoChange Wrong completion status"))		
       
   186 	// Cancel request if it is still pending	
       
   187 	if (aRequestStatus.Int() == KRequestPending)	
       
   188 		{
       
   189 		aRequestStatus.Cancel();
       
   190 		}
       
   191 	}
       
   192 
       
   193 		
       
   194 /**
       
   195 * Notify reset for RMobilePhone::NotifySmartCardApplicationInfoChange
       
   196 */	
       
   197 void TSimTsyTestHelper::WaitForMobilePhoneNotifySmartCardApplicationInfoChange( 
       
   198 				RMobilePhone& aMobilePhone,
       
   199 				TEtelRequestBase& aRequestStatus,
       
   200 				RMobilePhone::TAID& aAID, 
       
   201 				RMobilePhone::TAID& aExpectedAID,
       
   202 				RMobilePhone::TSmartCardApplicationEvent &aEvent,
       
   203 				TInt aWantedStatus )
       
   204 
       
   205 	{
       
   206 	// Wait for the request to complete	
       
   207 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
   208 	ASSERT_EQUALS(err, KErrNone, _L("RMobilePhone::NotifySmartCardApplicationInfoChange did not complete"))
       
   209 	
       
   210 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
   211 							&& aAID != aExpectedAID )
       
   212 		{
       
   213 		// Request has completed with incorrect result. Consume any outstanding
       
   214 		// Repost notification until timeout or we get the right result.
       
   215 		
       
   216 		aMobilePhone.NotifySmartCardApplicationInfoChange(aRequestStatus, aAID, aEvent);
       
   217 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
   218 		}
       
   219 		
       
   220 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobilePhone::NotifySmartCardApplicationInfoChange Wrong completion status"))	
       
   221 	ASSERT_EQUALS_DES8(aAID, aExpectedAID, 
       
   222 				_L("RMobilePhone::NotifySmartCardApplicationInfoChange Wrong result"))	
       
   223 	
       
   224 	// Cancel request if it is still pending	
       
   225 	if (aRequestStatus.Int() == KRequestPending)	
       
   226 		{
       
   227 		aRequestStatus.Cancel();
       
   228 		}
       
   229 	}
       
   230 
       
   231 		
       
   232 /**
       
   233 * Notify reset for RMobilePhone::NotifyMailboxNumbersChange
       
   234 */	
       
   235 void TSimTsyTestHelper::WaitForMobilePhoneNotifyMailboxNumbersChange( 
       
   236 				RMobilePhone& aMobilePhone,
       
   237 				TEtelRequestBase& aRequestStatus,
       
   238 				TCmpBase<RMobilePhone::TMobilePhoneVoicemailIdsV3> &aMobilePhoneVoicemailIdsV3,
       
   239 				TInt aWantedStatus )
       
   240 
       
   241 	{
       
   242 	// Wait for the request to complete	
       
   243 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
   244 	ASSERT_EQUALS(err, KErrNone, _L("RMobilePhone::NotifyMailboxNumbersChange did not complete"))
       
   245 	
       
   246 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
   247 							&& !aMobilePhoneVoicemailIdsV3.IsEqual(ENoLogError) )
       
   248 		{
       
   249 		// Request has completed with incorrect result. Consume any outstanding
       
   250 		// Repost notification until timeout or we get the right result.		
       
   251 		RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg pkgParam( aMobilePhoneVoicemailIdsV3.GetValue() );
       
   252 		aMobilePhone.NotifyMailboxNumbersChange(aRequestStatus, pkgParam);
       
   253 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
   254 		}
       
   255 
       
   256 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobilePhone::NotifyMailboxNumbersChange Wrong completion status"))	
       
   257 	ASSERT_TRUE(aMobilePhoneVoicemailIdsV3.IsEqual(ELogError), 
       
   258 				_L("RMobilePhone::NotifyMailboxNumbersChange Wrong result"))	
       
   259 	
       
   260 	// Cancel request if it is still pending	
       
   261 	if (aRequestStatus.Int() == KRequestPending)	
       
   262 		{
       
   263 		aRequestStatus.Cancel();
       
   264 		}
       
   265 	}
       
   266 
       
   267 		
       
   268 /**
       
   269 * Notify reset for RMobilePhoneStore::NotifyStoreEvent
       
   270 */	
       
   271 void TSimTsyTestHelper::WaitForMobilePhoneStoreNotifyStoreEvent( 
       
   272 				RMobilePhoneStore& aMobilePhoneStore,
       
   273 				TEtelRequestBase& aRequestStatus,
       
   274 				TUint32& aEvent, 
       
   275 				TUint32 aExpectedEvent,
       
   276 				TInt &aIndex,
       
   277 				TInt aWantedStatus )
       
   278 
       
   279 	{
       
   280 	// Wait for the request to complete	
       
   281 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeMedium);	
       
   282 	ASSERT_EQUALS(err, KErrNone, _L("RMobilePhoneStore::NotifyStoreEvent did not complete"))
       
   283 
       
   284 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
   285 							&& aEvent != aExpectedEvent )
       
   286 		{
       
   287 		// Request has completed with incorrect result. Consume any outstanding
       
   288 		// Repost notification until timeout or we get the right result.
       
   289 		
       
   290 		aMobilePhoneStore.NotifyStoreEvent(aRequestStatus, aEvent, aIndex);
       
   291 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeMedium);
       
   292 		}
       
   293 		
       
   294 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobilePhoneStore::NotifyStoreEvent Wrong completion status"))	
       
   295 	ASSERT_EQUALS(aEvent, aExpectedEvent, 
       
   296 				_L("RMobilePhoneStore::NotifyStoreEvent Wrong result"))	
       
   297 	
       
   298 	// Cancel request if it is still pending	
       
   299 	if (aRequestStatus.Int() == KRequestPending)	
       
   300 		{
       
   301 		aRequestStatus.Cancel();
       
   302 		}
       
   303 	}
       
   304 
       
   305 		
       
   306 /**
       
   307 * Notify reset for RMobileSmartCardEap::NotifyEapMethodAccessStatusChange
       
   308 */	
       
   309 void TSimTsyTestHelper::WaitForMobileSmartCardEapNotifyEapMethodAccessStatusChange( 
       
   310 				RMobileSmartCardEap& aMobileSmartCardEap,
       
   311 				TEtelRequestBase& aRequestStatus,
       
   312 				RMobileSmartCardEap::TEapMethodAccessStatus& aEapMethodStatus, 
       
   313 				RMobileSmartCardEap::TEapMethodAccessStatus aExpectedEapMethodStatus,
       
   314 				TInt aWantedStatus )
       
   315 
       
   316 	{
       
   317 	// Wait for the request to complete	
       
   318 	TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);	
       
   319 	ASSERT_EQUALS(err, KErrNone, _L("RMobileSmartCardEap::NotifyEapMethodAccessStatusChange did not complete"))
       
   320 	
       
   321 	while (	err == KErrNone && aRequestStatus.Int() == KErrNone  	
       
   322 							&& aEapMethodStatus != aExpectedEapMethodStatus )
       
   323 		{
       
   324 		// Request has completed with incorrect result. Consume any outstanding
       
   325 		// Repost notification until timeout or we get the right result.
       
   326 		
       
   327 		aMobileSmartCardEap.NotifyEapMethodAccessStatusChange(aRequestStatus, aEapMethodStatus);
       
   328 		err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort);
       
   329 		}
       
   330 		
       
   331 	ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMobileSmartCardEap::NotifyEapMethodAccessStatusChange Wrong completion status"))	
       
   332 	ASSERT_EQUALS(aEapMethodStatus, aExpectedEapMethodStatus, 
       
   333 				_L("RMobileSmartCardEap::NotifyEapMethodAccessStatusChange Wrong result"))	
       
   334 	
       
   335 	// Cancel request if it is still pending	
       
   336 	if (aRequestStatus.Int() == KRequestPending)	
       
   337 		{
       
   338 		aRequestStatus.Cancel();
       
   339 		}
       
   340 	}
       
   341 #if 0
       
   342 template<typename T>		
       
   343 TInt TSimTsyTestHelper::GetNumberOfUsedEntriesInStoreL(	
       
   344 		RMobilePhoneStore& aPhoneStore, 
       
   345 		const TDesC& aStoreName,
       
   346 		T& aInfoPkg,
       
   347 		RMobilePhone& aPhone,
       
   348 		TInt& aUsedEntries1, 
       
   349 		TInt& aUsedEntries2)
       
   350 /**
       
   351  * Uses two methods of getting the number of entries in the ICC SMS store.
       
   352  * 
       
   353  * @param aSmsStore SMS store subsession
       
   354  * @param aGetInfoError Error returned by RMobilePhoneStore::GetInfo. If this is  
       
   355  * KErrNone, aUsedEntries is valid.
       
   356  * @param aUsedEntries Number of used entries as returned by RMobilePhoneStore::GetInfo
       
   357  * @param aGetPhoneStoreInfoError Error returned by RMobilePhone::GetPhoneStoreInfo. If this is
       
   358  * KErrNone, this indicates that aUsedEntries2 is valid.
       
   359  * @param aUsedEntriews2 Number of used entries as returned by RMobilePhone::GetPhoneStoreInfo
       
   360  * 
       
   361  * @return KErrNone if one of the get info APIs are supported, KErrNotSupported if neither
       
   362  * are supported.
       
   363  */
       
   364 	{
       
   365 	// Get number of entries using RMobilePhoneStore::GetInfo
       
   366 	TExtEtelRequestStatus getInfoStatus (aPhoneStore,EMobilePhoneStoreGetInfo);	
       
   367 	CleanupStack::PushL(getInfoStatus);
       
   368 	aPhoneStore.GetInfo(getInfoStatus,aInfoPkg);
       
   369 	ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
   370 	if (getInfoStatus.Int() == KErrNone)
       
   371 		{
       
   372 		aUsedEntries1 = aInfoPkg().iUsedEntries;
       
   373 		}
       
   374 	else
       
   375 		{
       
   376 		DEBUG_PRINTF2(_L("RMobilePhoneStore::GetInfo returned with error = %d"), getInfoStatus.Int());
       
   377 		}
       
   378 
       
   379 	// Get number of entries using RMobilePhone::GetPhoneStoreInfo
       
   380 	TExtEtelRequestStatus getInfoStatus2 (aPhoneStore,EMobilePhoneStoreGetInfo);	
       
   381 	CleanupStack::PushL(getInfoStatus2);	
       
   382 	aPhone.GetPhoneStoreInfo(getInfoStatus2,aInfoPkg, aStoreName);
       
   383 	ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus2, ETimeMedium), KErrNone,_L("RMobilePhone::GetPhoneStoreInfo timed out"));
       
   384 	if (getInfoStatus2.Int() == KErrNone)
       
   385 		{
       
   386 		aUsedEntries2 = aInfoPkg().iUsedEntries;
       
   387 		}
       
   388 	else
       
   389 		{
       
   390 		DEBUG_PRINTF2(_L("RMobilePhone::GetPhoneStoreInfo returned with error = %d"), getInfoStatus2.Int());
       
   391 		}
       
   392 	
       
   393 	if (getInfoStatus.Int() == KErrNone || getInfoStatus2.Int() == KErrNone)
       
   394 		{
       
   395 		CleanupStack::PopAndDestroy(2);
       
   396 		return KErrNone;
       
   397 		}
       
   398 	else
       
   399 		{
       
   400 		CleanupStack::PopAndDestroy(2);
       
   401 		return KErrNotSupported;
       
   402 		}
       
   403 	}
       
   404 
       
   405 
       
   406 TInt TSimTsyTestHelper::AssertNumberOfUsedEntriesCorrectL
       
   407 						(RMobilePhoneStore& aPhoneStore, 
       
   408 						const TDesC& aStoreName,
       
   409 						T& aInfoPkg,
       
   410 						RMobilePhone& aPhone,
       
   411 						TInt aExpectedGetInfoEntries, 
       
   412 						TInt aExpectedGetPhoneStoreInfoEntries)
       
   413 /**
       
   414  * Call RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo  and checks
       
   415  * that the number of used entries in the phone book is the expected value if the
       
   416  * API is supported.
       
   417  * 
       
   418  * @param aPhoneStore Reference to phone store subsession.
       
   419  * @param aStoreName Store name from Etelmm
       
   420  * @param aExpectedGetInfoEntries A expected number of entries to be returned by 
       
   421  * RMobilePhoneStore::GetInfo
       
   422  * @param aExpectedGetPhoneStoreInfoEntries A expected number of entries to be
       
   423  * returned by RMobilePhone::GetPhoneStoreInfo
       
   424  * 
       
   425  * @return KErrNone if RMobilePhone::GetPhoneStoreInfo or RMobilePhoneStore::GetInfo
       
   426  * completed with KErrNone. KErrNotSupported otherwise.
       
   427  */
       
   428 	{
       
   429 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is equal to aExpectedGetInfoEntries
       
   430 	TExtEtelRequestStatus getInfoStatus (aPhoneStore, EMobilePhoneStoreGetInfo);	
       
   431 	CleanupStack::PushL(getInfoStatus);
       
   432 	aPhoneStore.GetInfo(getInfoStatus,aInfoPkg);
       
   433 	ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhoneStore::GetInfo, Timed out"))	
       
   434 
       
   435 	if (getInfoStatus.Int() == KErrNone)
       
   436 		{
       
   437 		ASSERT_EQUALS(getInfoStatus.Int(), KErrNone, _L("RMobilePhoneStore::GetInfo returned an error"))			
       
   438 		ASSERT_EQUALS(aExpectedGetInfoEntries, (aInfoPkg().iUsedEntries), _L("RMobilePhoneStore::GetInfo Unexpected number of iUsedEntries returned" ))
       
   439 		}
       
   440 	
       
   441 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is equal to aExpectedGetPhoneStoreInfoEntries
       
   442 	TExtEtelRequestStatus getInfoStatus2 (aPhoneStore, EMobilePhoneStoreGetInfo);
       
   443 	CleanupStack::PushL(getInfoStatus2);	
       
   444 	aPhone.GetPhoneStoreInfo(getInfoStatus2,aInfoPkg, aStoreName);
       
   445 	ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus2, ETimeMedium), KErrNone, _L("RMobilePhone::GetPhoneStoreInfo timed out"))
       
   446 
       
   447 	if (getInfoStatus2.Int() == KErrNone)
       
   448 		{
       
   449 		ASSERT_EQUALS(getInfoStatus2.Int(), KErrNone, _L("RMobilePhone::GetPhoneStoreInfo returned an error"))			
       
   450 		ASSERT_EQUALS(aExpectedGetPhoneStoreInfoEntries, (aInfoPkg().iUsedEntries ), _L("RMobilePhone::GetPhoneStoreInfo Unexpected number of iUsedEntries returned" ))
       
   451 		}
       
   452 	
       
   453 	if (getInfoStatus.Int() == KErrNone || getInfoStatus2.Int() == KErrNone)
       
   454 		{
       
   455 		CleanupStack::PopAndDestroy(2);
       
   456 		return KErrNone;
       
   457 		}
       
   458 	else
       
   459 		{
       
   460 		CleanupStack::PopAndDestroy(2);
       
   461 		return KErrNotSupported;
       
   462 		}
       
   463 	}
       
   464 #endif
       
   465 
       
   466 void TSimTsyTestHelper::VerifyPin2L(RMobilePhone& aMobilePhone, TNetworkTsyTestHelper& aNetworkTsyTestHelper)
       
   467 /**
       
   468  * member function for enabling pin2 for FDN phone book
       
   469  * @param aMobilePhone reference to RMobilePhone
       
   470  * @param aNetworkTsyTestHelper reference to TNetworkTsyTestHelper
       
   471  *
       
   472  * @return void.
       
   473  */
       
   474 	{
       
   475 
       
   476 	const TDesC* networkSection = NULL;
       
   477 	aNetworkTsyTestHelper.GetNetworkPasswordsSectionL(aMobilePhone,networkSection);
       
   478 	
       
   479 	// Get the password from the ini file
       
   480 	TPtrC password; 
       
   481 	CHECK_TRUE_L(iTestStep.GetStringFromConfig(*networkSection, KIniPin2, password) != EFalse, 
       
   482 			_L("GetStringFromConfig returned with an error"));
       
   483 
       
   484 	TExtEtelRequestStatus notifySecurityEventStatus(aMobilePhone, EMobilePhoneNotifySecurityEvent);
       
   485 	CleanupStack::PushL( notifySecurityEventStatus );
       
   486 	RMobilePhone::TMobilePhoneSecurityEvent securityEvent;
       
   487 	aMobilePhone.NotifySecurityEvent(notifySecurityEventStatus, securityEvent);
       
   488 
       
   489 	TExtEtelRequestStatus verifySecurityCodeStatus(aMobilePhone, EMobilePhoneVerifySecurityCode);
       
   490 	CleanupStack::PushL( verifySecurityCodeStatus );
       
   491 	RMobilePhone::TMobilePassword dummyUnblockCode; 
       
   492 	
       
   493 	aMobilePhone.VerifySecurityCode( verifySecurityCodeStatus, RMobilePhone::ESecurityCodePin2, 
       
   494 								password, dummyUnblockCode );
       
   495 							
       
   496 	CHECK_EQUALS_L(iTestStep.WaitForRequestWithTimeOut(verifySecurityCodeStatus, ETimeMedium), 
       
   497 			KErrNone, _L("RMobilePhone::VerifySecurityCode timed-out"));
       
   498 	CHECK_EQUALS_L( verifySecurityCodeStatus.Int(), KErrNone, _L("RMobilePhone::VerifySecurityCode returned with an error"));
       
   499 	
       
   500 	TInt err = iTestStep.WaitForRequestWithTimeOut(notifySecurityEventStatus, ETimeShort);	
       
   501 	CHECK_EQUALS_L(err, KErrNone, _L("RMobilePhone::NotifySecurityEvent did not complete"))
       
   502 	
       
   503 	while (	err == KErrNone && notifySecurityEventStatus.Int() == KErrNone  	
       
   504 							&& securityEvent != RMobilePhone::EPin2Verified )
       
   505 		{
       
   506 		// Request has completed with incorrect result. Consume any outstanding
       
   507 		// Repost notification until timeout or we get the right result.
       
   508 		
       
   509 		aMobilePhone.NotifySecurityEvent(notifySecurityEventStatus, securityEvent);
       
   510 		err = iTestStep.WaitForRequestWithTimeOut(notifySecurityEventStatus, ETimeShort);
       
   511 		}
       
   512 		
       
   513 	CHECK_EQUALS_L(notifySecurityEventStatus.Int(), KErrNone, _L("RMobilePhone::NotifySecurityEvent Wrong completion status"))	
       
   514 	CHECK_EQUALS_L(securityEvent, RMobilePhone::EPin2Verified, 
       
   515 				_L("RMobilePhone::NotifySecurityEvent Wrong result"))	
       
   516 	
       
   517 	// Cancel request if it is still pending	
       
   518 	if (notifySecurityEventStatus.Int() == KRequestPending)	
       
   519 		{
       
   520 		notifySecurityEventStatus.Cancel();
       
   521 		}
       
   522 	
       
   523 	CleanupStack::PopAndDestroy(2,&notifySecurityEventStatus);
       
   524 
       
   525 	}