telephonyserverplugins/common_tsy/test/integration/src/cctsyintegrationtestonstore.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Test step definitions for the ONStore functional unit.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @internalTechnology
       
    20 */
       
    21 
       
    22 #include "cctsyintegrationtestonstore.h"
       
    23 
       
    24 CCTSYIntegrationTestONStoreBase::CCTSYIntegrationTestONStoreBase(
       
    25 		CEtelSessionMgr& aEtelSessionMgr) : CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr),
       
    26 		iSimTestHelper(*this),iPhoneTsyTestHelper(*this)
       
    27 /**
       
    28  * Constructor
       
    29  */
       
    30 	{
       
    31 	}
       
    32 
       
    33 CCTSYIntegrationTestONStoreBase::~CCTSYIntegrationTestONStoreBase()
       
    34 /*
       
    35  * Destructor
       
    36  */
       
    37 	{
       
    38 	}
       
    39 
       
    40 
       
    41 	
       
    42 TBool CCTSYIntegrationTestONStoreBase::CompareEntries(const RMobileONStore::TMobileONEntryV1 &aEntry1,
       
    43 		const RMobileONStore::TMobileONEntryV1 &aEntry2)
       
    44 /*
       
    45  * This function compare two ON store entries
       
    46  *
       
    47  * @param aEntry1 a reference to the first entry.
       
    48  * @param aEntry2 a reference to the second entry.
       
    49  *
       
    50  * @return - Returns ETrue iff both entries have the same parameters, EFalse otherwise.
       
    51  */	
       
    52 	{
       
    53 	TBool ret=ETrue;
       
    54 	ASSERT_EQUALS_DES16(aEntry1.iNumber.iTelNumber, aEntry2.iNumber.iTelNumber, _L("RMobileONStore::Read Entry has the wrong iNumber.iTelNumber"));
       
    55 	if(aEntry1.iNumber.iTelNumber!= aEntry2.iNumber.iTelNumber)
       
    56 		{
       
    57 		ret=EFalse;
       
    58 		}
       
    59 	ASSERT_EQUALS_DES16(aEntry1.iText, aEntry2.iText, _L("RMobileONStore::Read Entry has the wrong iText"));
       
    60 	if(aEntry1.iText!= aEntry2.iText)
       
    61 		{
       
    62 		ret=EFalse;
       
    63 		}
       
    64 	return ret;
       
    65 	}
       
    66 
       
    67 TBool CCTSYIntegrationTestONStoreBase::GetUsedEntriesL(RMobileONStore& aOnStore,RMobilePhone& aPhone,TInt& aUsedEntries)
       
    68 /**
       
    69  * This function return the number of used entries in the store
       
    70  * 
       
    71  * @param aOnStore a reference to the on store
       
    72  * @param aPhone a reference to the phone session
       
    73  * @param aUsedEntries a reference to an integer wich the function will put the number of used entries in
       
    74  * 
       
    75  * @return ETrue iff the function succeed
       
    76  */
       
    77 	{
       
    78 	TBool ret=ETrue;
       
    79 	TInt usedEntries1=-1, usedEntries2=-1;
       
    80 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
    81 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
    82 	ASSERT_TRUE(ret=(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(aOnStore,KETelOwnNumberStore,storeInfoPckg,aPhone,usedEntries1,usedEntries2)==KErrNone),
       
    83 			_L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
    84 	if(usedEntries1!=-1)
       
    85 		aUsedEntries=usedEntries1;
       
    86 	else
       
    87 		aUsedEntries=usedEntries2;
       
    88 	return ret;
       
    89 	}
       
    90 TInt CCTSYIntegrationTestONStoreBase::GetNumberOfUsedAndTotalEntriesInStoreL(RMobileONStore& aOnStore,
       
    91 		RMobilePhone& aPhone,
       
    92 		TInt& aUsedEntries, 
       
    93 		TInt& aUsedEntries2,
       
    94 		TInt& aTotalEntries, 
       
    95 		TInt& aTotalEntries2)
       
    96 /**
       
    97  * This function return the number of used entries and total entries in the store, using both the RMobileONStore and the RMobilePhone
       
    98  * 
       
    99  * @param aOnStore a reference to the on store
       
   100  * @param aPhone a reference to the phone session
       
   101  * @param aUsedEntries a reference to an integer wich the function will put the number of used entries in returned by RMobileONStore
       
   102  * @param aUsedEntries2 a reference to an integer wich the function will put the number of used entries in returned by RMobilePhone
       
   103  * @param aTotalEntries a reference to an integer wich the function will put the number of total entries in returned by RMobileONStore
       
   104  * @param aTotalEntries2 a reference to an integer wich the function will put the number of total  entries in returned by RMobilePhone
       
   105  * 
       
   106  * @return KErrNone if one of the get info APIs are supported, KErrNotSupported if neither are supported.
       
   107  */
       
   108 	{
       
   109 	// Get number of entries using RMobilePhoneStore::GetInfo
       
   110 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
   111 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
   112 	TExtEtelRequestStatus getInfoStatus (aOnStore,EMobilePhoneStoreGetInfo);	
       
   113 	CleanupStack::PushL(getInfoStatus);
       
   114 	aOnStore.GetInfo(getInfoStatus,storeInfoPckg);
       
   115 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
   116 	if (getInfoStatus.Int() == KErrNone)
       
   117 		{
       
   118 		aUsedEntries = storeInfo.iUsedEntries;
       
   119 		aTotalEntries = storeInfo.iTotalEntries;
       
   120 		}
       
   121 	else
       
   122 		{
       
   123 		DEBUG_PRINTF2(_L("RMobilePhoneStore::GetInfo returned with error = %d"), getInfoStatus.Int());
       
   124 		}
       
   125 
       
   126 	// Get number of entries using RMobilePhone::GetPhoneStoreInfo
       
   127 	RMobileONStore::TMobileONStoreInfoV1 storeInfo2;
       
   128 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg2 (storeInfo2);
       
   129 	TExtEtelRequestStatus getInfoStatus2 (aOnStore,EMobilePhoneStoreGetInfo);	
       
   130 	CleanupStack::PushL(getInfoStatus2);	
       
   131 	aPhone.GetPhoneStoreInfo(getInfoStatus2,storeInfoPckg2, KETelOwnNumberStore);
       
   132 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getInfoStatus2, ETimeMedium), KErrNone,_L("RMobilePhone::GetPhoneStoreInfo timed out"));
       
   133 	if (getInfoStatus2.Int() == KErrNone)
       
   134 		{
       
   135 		aTotalEntries2 = storeInfo2.iTotalEntries;
       
   136 		aUsedEntries2 = storeInfo2.iUsedEntries;
       
   137 		}
       
   138 	else
       
   139 		{
       
   140 		DEBUG_PRINTF2(_L("RMobilePhone::GetPhoneStoreInfo returned with error = %d"), getInfoStatus2.Int());
       
   141 		}
       
   142 	
       
   143 	if (getInfoStatus.Int() == KErrNone || getInfoStatus2.Int() == KErrNone)
       
   144 		{
       
   145 		CleanupStack::PopAndDestroy(2);
       
   146 		return KErrNone;
       
   147 		}
       
   148 	else
       
   149 		{
       
   150 		CleanupStack::PopAndDestroy(2);
       
   151 		return KErrNotSupported;
       
   152 		}
       
   153 	
       
   154 	}
       
   155 
       
   156 TBool CCTSYIntegrationTestONStoreBase::GetUsedandTotalEntriesL(RMobileONStore& aOnStore,RMobilePhone& aPhone,
       
   157 		TInt& aUsedEntries,TInt& aTotalEntries)
       
   158 /**
       
   159  * This function return the number of used entries in the store
       
   160  * 
       
   161  * @param aOnStore a reference to the on store
       
   162  * @param aPhone a reference to the phone session
       
   163  * @param aUsedEntries a reference to an integer wich the function will put the number of used entries in
       
   164  * 
       
   165  * @return ETrue iff the function succeed
       
   166  */
       
   167 	{
       
   168 	TBool ret=ETrue;
       
   169 	TInt usedEntries1=-1, usedEntries2=-1;
       
   170 	TInt totalEntries1=-1, totalEntries2=-1;
       
   171 	ASSERT_TRUE(ret=(GetNumberOfUsedAndTotalEntriesInStoreL(aOnStore,
       
   172 			aPhone,usedEntries1,usedEntries2,totalEntries1,totalEntries2)==KErrNone),
       
   173 			_L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
   174 	if(usedEntries1!=-1)
       
   175 		{
       
   176 		aUsedEntries=usedEntries1;
       
   177 		}
       
   178 	else
       
   179 		{
       
   180 		aUsedEntries=usedEntries2;
       
   181 		}
       
   182 	if(totalEntries1!=-1)
       
   183 		{
       
   184 		aTotalEntries=totalEntries1;
       
   185 		}
       
   186 	else
       
   187 		{
       
   188 		aTotalEntries=totalEntries2;
       
   189 		}
       
   190 	return ret;
       
   191 	}
       
   192 
       
   193 TBool  CCTSYIntegrationTestONStoreBase::OpenADNStoreL()
       
   194 /**
       
   195  * This function open a session for the ADN store,
       
   196  * this is since the ON store work only if there is a subsession of the ADN store open.
       
   197  * 
       
   198  * @return ETrue iff the function succeed
       
   199  */
       
   200     {
       
   201 	// Open the ADN phone book subsession  
       
   202 	RMobilePhoneBookStore& adnPhoneBookStore = iEtelSessionMgr.GetPhoneBookStoreL(KMainServer, KMainPhone, KIccAdnPhoneBook);
       
   203 	RMmCustomAPI& mmCustomAPI = iEtelSessionMgr.GetCustomApiL(KMainServer, KMainPhone,KMainCustomApi);
       
   204 	iPhoneTsyTestHelper.WaitForPhoneBookStoreCacheReadyL(mmCustomAPI,KIccAdnPhoneBook);
       
   205 	return ETrue;
       
   206     }
       
   207 
       
   208 
       
   209 CCTSYIntegrationTestONStore0001::CCTSYIntegrationTestONStore0001(
       
   210 		CEtelSessionMgr& aEtelSessionMgr) :
       
   211 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
   212 /**
       
   213  * Constructor.
       
   214  */
       
   215 	{
       
   216 	SetTestStepName(CCTSYIntegrationTestONStore0001::GetTestStepName());
       
   217 	}
       
   218 
       
   219 CCTSYIntegrationTestONStore0001::~CCTSYIntegrationTestONStore0001()
       
   220 /**
       
   221  * Destructor.
       
   222  */
       
   223 	{
       
   224 	}
       
   225 
       
   226 TVerdict CCTSYIntegrationTestONStore0001::doTestStepL()
       
   227 /**
       
   228  * @SYMTestCaseID BA-CTSY-INT-PBON-0001
       
   229  * @SYMFssID BA/CTSY/PBON-0001
       
   230  * @SYMTestCaseDesc Get ON store info. 
       
   231  * @SYMTestPriority High
       
   232  * @SYMTestActions 
       
   233  * @SYMTestExpectedResults Pass - Phone store information returned correctly.
       
   234  * @SYMTestType CIT
       
   235  * @SYMTestCaseDependencies live/automatic
       
   236  *
       
   237  * Reason for test: Verify ON store information is valid.
       
   238  *
       
   239  * @return - TVerdict code
       
   240  */
       
   241 	{
       
   242 
       
   243 	//
       
   244 	// SET UP
       
   245 	//
       
   246 
       
   247 	// Open the ADN store
       
   248 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
   249 	
       
   250 	// Open ONStore subsession
       
   251 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
   252 			KMainPhone, KMainONStore);
       
   253 
       
   254 	//
       
   255 	// SET UP END
       
   256 	//
       
   257 
       
   258 	StartTest ();
       
   259 	
       
   260 	
       
   261 	//
       
   262 	// TEST START
       
   263 	//
       
   264 
       
   265 
       
   266 	// Get ON store info. using RMobilePhoneStore::GetInfo with RMobileONStore::TMobileONStoreInfoV1 
       
   267 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
   268 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
   269 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
   270 	CleanupStack::PushL (onStoreInfoStatus);
       
   271 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
   272 	ASSERT_EQUALS(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
   273 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
   274 	ASSERT_EQUALS(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
   275 	ASSERT_EQUALS_DES16(onStoreInfo.iName,KETelOwnNumberStore, _L("RMobileONStore::GetInfo returned wrong ON Store name"));
       
   276 
       
   277 	// iType == RMobilePhoneStore::EOwnNumberStore 
       
   278 	ASSERT_EQUALS(onStoreInfo.iType, RMobilePhoneStore::EOwnNumberStore, _L("RMobileONStore::GetInfo returned wrong type"));
       
   279 
       
   280 	// iTotalEntries >= -1 
       
   281 	ASSERT_TRUE(onStoreInfo.iTotalEntries >= -1 , _L("RMobileONStore::GetInfo returned wrong Total Entries"));
       
   282 
       
   283 	// iUsedEntries >= -1 
       
   284 	ASSERT_TRUE(onStoreInfo.iUsedEntries >= -1 , _L("RMobileONStore::GetInfo returned wrong Used Entries"));
       
   285 
       
   286 	// iCaps == RMobilePhoneStore::KCapsIndividualEntry 
       
   287 	//         | RMobilePhoneStore::KCapsReadAccess 
       
   288 	//         | RMobilePhoneStore::KCapsWriteAccess 
       
   289 	//         | RMobilePhoneStore::KCapsDeleteAll 
       
   290 	//         | RMobilePhoneStore::KCapsNotifyEvent 
       
   291 	//         | RMobilePhoneStore::KCapsWholeStore  
       
   292 	TUint wantedBits = RMobilePhoneStore::KCapsIndividualEntry| RMobilePhoneStore::KCapsReadAccess| RMobilePhoneStore::KCapsWriteAccess| RMobilePhoneStore::KCapsDeleteAll| RMobilePhoneStore::KCapsNotifyEvent| RMobilePhoneStore::KCapsWholeStore;
       
   293 	ASSERT_BITS_SET(onStoreInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned unexpected iCaps"));
       
   294 
       
   295 	// iNumberLen >= -1 
       
   296 	ASSERT_TRUE(onStoreInfo.iNumberLen >= -1 , _L("RMobileONStore::GetInfo returned wrong Number Length"));
       
   297 
       
   298 	// iTextLen >= -1  (actually hard coded to 20 in CTSY) 
       
   299 	ASSERT_TRUE(onStoreInfo.iTextLen >= -1 , _L("RMobileONStore::GetInfo returned wrong Text Length"));
       
   300 
       
   301 	//
       
   302 	// TEST END
       
   303 	//
       
   304 
       
   305 	StartCleanup();
       
   306 
       
   307 	
       
   308 	// Pop:
       
   309 	//	onStoreInfoStatus
       
   310 	CleanupStack::PopAndDestroy(&onStoreInfoStatus);
       
   311 	return TestStepResult();
       
   312 	}
       
   313 
       
   314 TPtrC CCTSYIntegrationTestONStore0001::GetTestStepName()
       
   315 /**
       
   316  * @return The test step name.
       
   317  */
       
   318 	{
       
   319 	return _L("CCTSYIntegrationTestONStore0001");
       
   320 	}
       
   321 
       
   322 CCTSYIntegrationTestONStore0002::CCTSYIntegrationTestONStore0002(
       
   323 		CEtelSessionMgr& aEtelSessionMgr) :
       
   324 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
   325 /**
       
   326  * Constructor.
       
   327  */
       
   328 	{
       
   329 	SetTestStepName(CCTSYIntegrationTestONStore0002::GetTestStepName());
       
   330 	}
       
   331 
       
   332 CCTSYIntegrationTestONStore0002::~CCTSYIntegrationTestONStore0002()
       
   333 /**
       
   334  * Destructor.
       
   335  */
       
   336 	{
       
   337 	}
       
   338 
       
   339 TVerdict CCTSYIntegrationTestONStore0002::doTestStepL()
       
   340 /**
       
   341  * @SYMTestCaseID BA-CTSY-INT-PBON-0002
       
   342  * @SYMFssID BA/CTSY/PBON-0002
       
   343  * @SYMTestCaseDesc Read entries from the ON store.
       
   344  * @SYMTestPriority High
       
   345  * @SYMTestActions 
       
   346  * @SYMTestExpectedResults Pass - Entry read successfully.
       
   347  * @SYMTestType CIT
       
   348  * @SYMTestCaseDependencies live/automatic
       
   349  *
       
   350  * Reason for test: Verify entries are read correctly.
       
   351  *
       
   352  * @return - TVerdict code
       
   353  */
       
   354 	{
       
   355 
       
   356 	//
       
   357 	// SET UP
       
   358 	//
       
   359 
       
   360 	// Open the ADN store
       
   361 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
   362 
       
   363 	// Get ON store subsession. 
       
   364 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
   365 			KMainPhone, KMainONStore);
       
   366 
       
   367 	// Backup first Entry
       
   368 	TBackupAllEntries backup(*this,onStore);
       
   369 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
   370 	CleanupStack::PushL (backup);
       
   371 	
       
   372 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess 
       
   373 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
   374 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
   375 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
   376 	CleanupStack::PushL (onStoreInfoStatus);
       
   377 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
   378 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
   379 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
   380 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
   381 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsReadAccess,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
   382 
       
   383 	// Write entries to the first slot, second slot, and the maximum slot in the phone book. 
       
   384 	RMobileONStore::TMobileONEntryV1 entry1, entry2, entryLast;
       
   385 	RMobileONStore::TMobileONEntryV1Pckg writePckg1(entry1);
       
   386 	RMobileONStore::TMobileONEntryV1Pckg writePckg2(entry2);
       
   387 	RMobileONStore::TMobileONEntryV1Pckg writePckgLast(entryLast);
       
   388 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
   389 	CleanupStack::PushL (writeStatus);
       
   390 
       
   391 	// Create and write entry for 1st slot
       
   392 	entry1.iMode=RMobilePhone::ENetworkModeGsm;
       
   393 	entry1.iService=RMobilePhone::ETelephony;
       
   394 	entry1.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
   395 	entry1.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
   396 	_LIT(KNumber, "12345");
       
   397 	entry1.iNumber.iTelNumber = KNumber;
       
   398 	entry1.iText = _L("Entry 1");
       
   399 	entry1.iIndex=1;
       
   400 	onStore.Write (writeStatus, writePckg1);
       
   401 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
   402 			KErrNone, _L("RMobileONStore::Write timed out"));
       
   403 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
   404 
       
   405 	// Create and write entry for 2nd slot
       
   406 	entry2.iMode=RMobilePhone::ENetworkModeGsm;
       
   407 	entry2.iService=RMobilePhone::EAllTele;
       
   408 	entry2.iNumber.iNumberPlan = RMobilePhone::EPrivateNumberPlan;
       
   409 	entry2.iNumber.iTypeOfNumber = RMobilePhone::ENetworkSpecificNumber;
       
   410 	_LIT(KNumber2, "647852");
       
   411 	entry2.iNumber.iTelNumber = KNumber2;
       
   412 	entry2.iText = _L("entry 2");
       
   413 	entry2.iIndex=2;
       
   414 	onStore.Write (writeStatus, writePckg2);
       
   415 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
   416 			KErrNone, _L("RMobileONStore::Write timed out"));
       
   417 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
   418 
       
   419 
       
   420 	// Create and write entry for last slot	
       
   421 	entryLast.iMode=RMobilePhone::ENetworkModeGsm;
       
   422 	entryLast.iService=RMobilePhone::EAllDataExSms;
       
   423 	entryLast.iNumber.iNumberPlan = RMobilePhone::EUnknownNumberingPlan;
       
   424 	entryLast.iNumber.iTypeOfNumber = RMobilePhone::EInternationalNumber;
       
   425 	_LIT(KNumberLast, "341231233");
       
   426 	entryLast.iNumber.iTelNumber = KNumberLast;
       
   427 	entryLast.iText = _L("last entry");
       
   428 	entryLast.iIndex=onStoreInfo.iTotalEntries;
       
   429 	onStore.Write (writeStatus, writePckgLast);
       
   430 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
   431 			KErrNone, _L("RMobileONStore::Write timed out"));
       
   432 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
   433 	//
       
   434 	// SET UP END
       
   435 	//
       
   436 
       
   437 	StartTest ();
       
   438 
       
   439 	//
       
   440 	// TEST START
       
   441 	//
       
   442 
       
   443 
       
   444 	// Read entry from the first slot, second slot and the maximum slot from the phone book in turn passing an RMobileONStore::TMobileONEntryV1 as aEntry. 
       
   445 	RMobileONStore::TMobileONEntryV1 readEntry1, readEntry2, readEntryLast;
       
   446 	RMobileONStore::TMobileONEntryV1Pckg entryPckg1(readEntry1);
       
   447 	RMobileONStore::TMobileONEntryV1Pckg entryPckg2(readEntry2);
       
   448 	RMobileONStore::TMobileONEntryV1Pckg entryPckgLast(readEntryLast);
       
   449 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
   450 	CleanupStack::PushL (readStatus);
       
   451 	readEntry1.iIndex=1;
       
   452 	readEntry2.iIndex=2;
       
   453 	readEntryLast.iIndex=onStoreInfo.iTotalEntries;
       
   454 
       
   455 	// Slot 1
       
   456 	onStore.Read (readStatus, entryPckg1);
       
   457 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   458 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   459 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
   460 
       
   461 	// Slot 2
       
   462 	onStore.Read (readStatus, entryPckg2);
       
   463 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   464 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   465 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
   466 
       
   467 	// last Slot
       
   468 	onStore.Read (readStatus, entryPckgLast);
       
   469 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   470 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   471 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
   472 
       
   473 	// For each one: 
       
   474 
       
   475 	// Check iMode is the same as that written to the phone book in set up.
       
   476     ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10036);
       
   477 	ASSERT_EQUALS(readEntry1.iMode,entry1.iMode, _L("RMobileONStore::Read ::Read 1st Read Entry has the wrong iMode"));
       
   478 	ASSERT_EQUALS(readEntry2.iMode,entry2.iMode, _L("RMobileONStore::Read ::Read 2nd Read Entry has the wrong iMode"));
       
   479 	ASSERT_EQUALS(readEntryLast.iMode,entryLast.iMode, _L("RMobileONStore::Read ::Read last Read Entry has the wrong iMode"));
       
   480 
       
   481 	// Check iNumber is the same as that written to the phone book in set up.
       
   482 	ASSERT_EQUALS(readEntry1.iNumber.iNumberPlan,entry1.iNumber.iNumberPlan, _L("RMobileONStore::Read ::Read 1st Read Entry has the wrong iNumber.iNumberPlan"));
       
   483 	ASSERT_EQUALS(readEntry2.iNumber.iNumberPlan,entry2.iNumber.iNumberPlan, _L("RMobileONStore::Read ::Read 2nd Read Entry has the wrong iNumber.iNumberPlan"));
       
   484 	ASSERT_EQUALS(readEntryLast.iNumber.iNumberPlan,entryLast.iNumber.iNumberPlan, _L("RMobileONStore::Read ::Read last Read Entry has the wrong iNumber.iNumberPlan"));
       
   485 	ASSERT_EQUALS(readEntry1.iNumber.iTypeOfNumber,entry1.iNumber.iTypeOfNumber, _L("RMobileONStore::Read ::Read 1st Read Entry has the wrong iNumber.iTypeOfNumber"));
       
   486 	ASSERT_EQUALS(readEntry2.iNumber.iTypeOfNumber,entry2.iNumber.iTypeOfNumber, _L("RMobileONStore::Read ::Read 2nd Read Entry has the wrong iNumber.iTypeOfNumber"));
       
   487 	ASSERT_EQUALS(readEntryLast.iNumber.iTypeOfNumber,entryLast.iNumber.iTypeOfNumber, _L("RMobileONStore::Read ::Read last Read Entry has the wrong iNumber.iTypeOfNumber"));
       
   488 	ASSERT_EQUALS_DES16(readEntry1.iNumber.iTelNumber,entry1.iNumber.iTelNumber, _L("RMobileONStore::Read ::Read 1st Read Entry has the wrong iNumber.iTelNumber"));
       
   489 	ASSERT_EQUALS_DES16(readEntry2.iNumber.iTelNumber,entry2.iNumber.iTelNumber, _L("RMobileONStore::Read ::Read 2nd Read Entry has the wrong iNumber.iTelNumber"));
       
   490 	ASSERT_EQUALS_DES16(readEntryLast.iNumber.iTelNumber,entryLast.iNumber.iTelNumber, _L("RMobileONStore::Read ::Read last Read Entry has the wrong iNumber.iTelNumber"));
       
   491 
       
   492 	// Check iService is the same as that written to the phone book in set up.
       
   493 	ASSERT_EQUALS(readEntry1.iService,entry1.iService, _L("RMobileONStore::Read ::Read 1st Read Entry has the wrong iService"));
       
   494 	ASSERT_EQUALS(readEntry2.iService,entry2.iService, _L("RMobileONStore::Read ::Read 2nd Read Entry has the wrong iService"));
       
   495 	ASSERT_EQUALS(readEntryLast.iService,entryLast.iService, _L("RMobileONStore::Read ::Read last Read Entry has the wrong iService"));
       
   496 
       
   497 	// Check iText is the same as that written to the phone book in set up.
       
   498 	ASSERT_EQUALS_DES16(readEntry1.iText,entry1.iText, _L("RMobileONStore::Read ::Read 1st Read Entry has the wrong iText"));
       
   499 	ASSERT_EQUALS_DES16(readEntry2.iText,entry2.iText, _L("RMobileONStore::Read ::Read 2nd Read Entry has the wrong iText"));
       
   500 	ASSERT_EQUALS_DES16(readEntryLast.iText,entryLast.iText, _L("RMobileONStore::Read ::Read last Read Entry has the wrong iText"));
       
   501 
       
   502 	//
       
   503 	// TEST END
       
   504 	//
       
   505 
       
   506 	StartCleanup();
       
   507 
       
   508 	
       
   509 	// Pop:
       
   510 	//	readStatus
       
   511 	//	writeStatus
       
   512 	//	onStoreInfoStatus
       
   513 	//	backup
       
   514 	CleanupStack::PopAndDestroy(4,&backup);
       
   515 
       
   516 	return TestStepResult();
       
   517 	}
       
   518 
       
   519 TPtrC CCTSYIntegrationTestONStore0002::GetTestStepName()
       
   520 /**
       
   521  * @return The test step name.
       
   522  */
       
   523 	{
       
   524 	return _L("CCTSYIntegrationTestONStore0002");
       
   525 	}
       
   526 
       
   527 CCTSYIntegrationTestONStore0003::CCTSYIntegrationTestONStore0003(
       
   528 		CEtelSessionMgr& aEtelSessionMgr) :
       
   529 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
   530 /**
       
   531  * Constructor.
       
   532  */
       
   533 	{
       
   534 	SetTestStepName(CCTSYIntegrationTestONStore0003::GetTestStepName());
       
   535 	}
       
   536 
       
   537 CCTSYIntegrationTestONStore0003::~CCTSYIntegrationTestONStore0003()
       
   538 /**
       
   539  * Destructor.
       
   540  */
       
   541 	{
       
   542 	}
       
   543 
       
   544 TVerdict CCTSYIntegrationTestONStore0003::doTestStepL()
       
   545 /**
       
   546  * @SYMTestCaseID BA-CTSY-INT-PBON-0003
       
   547  * @SYMFssID BA/CTSY/PBON-0003
       
   548  * @SYMTestCaseDesc Read entry that is not present in the ON store.
       
   549  * @SYMTestPriority High
       
   550  * @SYMTestActions 
       
   551  * @SYMTestExpectedResults Pass - KErrNotFound returned when reading a non-existent entry.
       
   552  * @SYMTestType CIT
       
   553  * @SYMTestCaseDependencies live/automatic
       
   554  *
       
   555  * Reason for test: Verify KErrNotFound is returned.
       
   556  *
       
   557  * @return - TVerdict code
       
   558  */
       
   559 	{
       
   560 
       
   561 	//
       
   562 	// SET UP
       
   563 	//
       
   564 
       
   565 	// Open the ADN store
       
   566 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
   567 
       
   568 	// Get ON store subsession. 
       
   569 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
   570 			KMainPhone, KMainONStore);
       
   571 
       
   572 	// Backup first Entry
       
   573 	TBackupAllEntries backup(*this,onStore);
       
   574 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
   575 	CleanupStack::PushL (backup);
       
   576 
       
   577 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess 
       
   578 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
   579 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
   580 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
   581 	CleanupStack::PushL (onStoreInfoStatus);
       
   582 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
   583 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
   584 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
   585 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
   586 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsReadAccess,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
   587 
       
   588 	// Delete all entries from the phone book. 
       
   589 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
   590 	CleanupStack::PushL (deleteAllStatus);
       
   591 	onStore.DeleteAll (deleteAllStatus);
       
   592 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
   593 	CHECK_EQUALS_L(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
   594 
       
   595 	//
       
   596 	// SET UP END
       
   597 	//
       
   598 
       
   599 	StartTest ();
       
   600 
       
   601 	//
       
   602 	// TEST START
       
   603 	//
       
   604 
       
   605 
       
   606 	// Read an entry from a valid index. 
       
   607 	RMobileONStore::TMobileONEntryV1 readEntry;
       
   608 	readEntry.iIndex=1;
       
   609 	RMobileONStore::TMobileONEntryV1Pckg entryPckg(readEntry);
       
   610 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
   611 	CleanupStack::PushL (readStatus);
       
   612 	onStore.Read (readStatus, entryPckg);
       
   613 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   614 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   615 
       
   616 	// Check KErrNotFound is returned.
       
   617 	// $CTSYProblem The LTSY returns KErrNone to CTSY when an entry is read from an empty slot
       
   618 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
   619 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
   620 	// should be expected in this case.
       
   621 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
   622 
       
   623 	//
       
   624 	// TEST END
       
   625 	//
       
   626 
       
   627 	StartCleanup();
       
   628 
       
   629 	
       
   630 	// Pop:
       
   631 	//	readStatus
       
   632 	//	deleteAllStatus
       
   633 	//	onStoreInfoStatus
       
   634 	//	backup
       
   635 	CleanupStack::PopAndDestroy(4,&backup);
       
   636 
       
   637 	return TestStepResult();
       
   638 	}
       
   639 
       
   640 TPtrC CCTSYIntegrationTestONStore0003::GetTestStepName()
       
   641 /**
       
   642  * @return The test step name.
       
   643  */
       
   644 	{
       
   645 	return _L("CCTSYIntegrationTestONStore0003");
       
   646 	}
       
   647 
       
   648 CCTSYIntegrationTestONStore0004::CCTSYIntegrationTestONStore0004(
       
   649 		CEtelSessionMgr& aEtelSessionMgr) :
       
   650 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
   651 /**
       
   652  * Constructor.
       
   653  */
       
   654 	{
       
   655 	SetTestStepName(CCTSYIntegrationTestONStore0004::GetTestStepName());
       
   656 	}
       
   657 
       
   658 CCTSYIntegrationTestONStore0004::~CCTSYIntegrationTestONStore0004()
       
   659 /**
       
   660  * Destructor.
       
   661  */
       
   662 	{
       
   663 	}
       
   664 
       
   665 TVerdict CCTSYIntegrationTestONStore0004::doTestStepL()
       
   666 /**
       
   667  * @SYMTestCaseID BA-CTSY-INT-PBON-0004
       
   668  * @SYMFssID BA/CTSY/PBON-0004
       
   669  * @SYMTestCaseDesc Read entries from the ON store using invalid index.
       
   670  * @SYMTestPriority High
       
   671  * @SYMTestActions 
       
   672  * @SYMTestExpectedResults Pass - Error returned on read.
       
   673  * @SYMTestType CIT
       
   674  * @SYMTestCaseDependencies live/automatic
       
   675  *
       
   676  * Reason for test: Verify KErrArgument is returned.
       
   677  *
       
   678  * @return - TVerdict code
       
   679  */
       
   680 	{
       
   681 
       
   682 	//
       
   683 	// SET UP
       
   684 	//
       
   685 
       
   686 	// Open the ADN store
       
   687 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
   688 
       
   689 	// Get ON store subsession. 
       
   690 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
   691 			KMainPhone, KMainONStore);
       
   692 
       
   693 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess 
       
   694 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
   695 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
   696 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
   697 	CleanupStack::PushL (onStoreInfoStatus);
       
   698 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
   699 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
   700 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
   701 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
   702 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsReadAccess,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
   703 
       
   704 
       
   705 	//
       
   706 	// SET UP END
       
   707 	//
       
   708 
       
   709 	StartTest ();
       
   710 
       
   711 	//
       
   712 	// TEST START
       
   713 	//
       
   714 
       
   715 
       
   716 	// ===  Read an entry with an invalid slot number ===
       
   717 
       
   718 	// Read a single entry from the phone book using aIndex = -1 
       
   719 	RMobileONStore::TMobileONEntryV1 readEntry;
       
   720 	RMobileONStore::TMobileONEntryV1Pckg entryPckg(readEntry);
       
   721 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
   722 	CleanupStack::PushL (readStatus);
       
   723 	readEntry.iIndex=-1;
       
   724 	onStore.Read (readStatus, entryPckg);
       
   725 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   726 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   727 
       
   728 	// Check KErrGsmSMSInvalidMemoryIndex is returned.
       
   729     ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10041);
       
   730 	ASSERT_EQUALS(readStatus.Int(), KErrGsmSMSInvalidMemoryIndex, _L("RMobileONStore::Read returned unexpected result"));
       
   731 
       
   732 	// Read a single entry from the phone book using aIndex = -10 
       
   733 	readEntry.iIndex=-10;
       
   734 	onStore.Read (readStatus, entryPckg);
       
   735 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   736 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   737 
       
   738 	// Check KErrGsmSMSInvalidMemoryIndex is returned.
       
   739 	ASSERT_EQUALS(readStatus.Int(), KErrGsmSMSInvalidMemoryIndex, _L("RMobileONStore::Read returned unexpected result"));
       
   740 
       
   741 	// Read a single entry from the phone book using aIndex = -50 
       
   742 	readEntry.iIndex=-50;
       
   743 	onStore.Read (readStatus, entryPckg);
       
   744 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   745 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   746 
       
   747 	// Check KErrGsmSMSInvalidMemoryIndex is returned.
       
   748 	ASSERT_EQUALS(readStatus.Int(), KErrGsmSMSInvalidMemoryIndex, _L("RMobileONStore::Read returned unexpected result"));
       
   749 
       
   750 
       
   751 	//
       
   752 	// TEST END
       
   753 	//
       
   754 
       
   755 	StartCleanup();
       
   756 
       
   757 	// Pop:
       
   758 	//	readStatus
       
   759 	//	onStoreInfoStatus
       
   760 	CleanupStack::PopAndDestroy(2,&onStoreInfoStatus);
       
   761 	
       
   762 
       
   763 	return TestStepResult();
       
   764 	}
       
   765 
       
   766 TPtrC CCTSYIntegrationTestONStore0004::GetTestStepName()
       
   767 /**
       
   768  * @return The test step name.
       
   769  */
       
   770 	{
       
   771 	return _L("CCTSYIntegrationTestONStore0004");
       
   772 	}
       
   773 
       
   774 CCTSYIntegrationTestONStore0005::CCTSYIntegrationTestONStore0005(
       
   775 		CEtelSessionMgr& aEtelSessionMgr) :
       
   776 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
   777 /**
       
   778  * Constructor.
       
   779  */
       
   780 	{
       
   781 	SetTestStepName(CCTSYIntegrationTestONStore0005::GetTestStepName());
       
   782 	}
       
   783 
       
   784 CCTSYIntegrationTestONStore0005::~CCTSYIntegrationTestONStore0005()
       
   785 /**
       
   786  * Destructor.
       
   787  */
       
   788 	{
       
   789 	}
       
   790 
       
   791 TVerdict CCTSYIntegrationTestONStore0005::doTestStepL()
       
   792 /**
       
   793  * @SYMTestCaseID BA-CTSY-INT-PBON-0005
       
   794  * @SYMFssID BA/CTSY/PBON-0005
       
   795  * @SYMTestCaseDesc Write entries to the ON store.
       
   796  * @SYMTestPriority High
       
   797  * @SYMTestActions 
       
   798  * @SYMTestExpectedResults Pass - Write successful.
       
   799  * @SYMTestType CIT
       
   800  * @SYMTestCaseDependencies live/automatic
       
   801  *
       
   802  * Reason for test: Verify entries are written correctly and can be read.
       
   803  *
       
   804  * @return - TVerdict code
       
   805  */
       
   806 	{
       
   807 
       
   808 	//
       
   809 	// SET UP
       
   810 	//
       
   811 
       
   812 	// Open the ADN store
       
   813 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
   814 
       
   815 	// Get ON store subsession. 
       
   816 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
   817 			KMainPhone, KMainONStore);
       
   818 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
   819 
       
   820 	// Backup first Entry
       
   821 	TBackupAllEntries backup(*this,onStore);
       
   822 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
   823 	CleanupStack::PushL (backup);
       
   824 
       
   825 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess | KCapsWriteAccess | KCapsNotifyEvent 
       
   826 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
   827 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
   828 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
   829 	CleanupStack::PushL (onStoreInfoStatus);
       
   830 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
   831 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
   832 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
   833 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
   834 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsWriteAccess | RMobilePhoneStore::KCapsNotifyEvent),
       
   835 			KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
   836 
       
   837 
       
   838 	// Ensure phone book is not full. 
       
   839 	TInt clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
   840 	CHECK_TRUE_L(clearSpace>=0,_L("TSimTsyTestHelper::EnsureBookIsNotFullL was unable to get an empty space"));
       
   841 
       
   842 	//
       
   843 	// SET UP END
       
   844 	//
       
   845 
       
   846 	StartTest ();
       
   847 
       
   848 	//
       
   849 	// TEST START
       
   850 	//
       
   851 
       
   852 
       
   853 	// ===  Find out how many entries are used in the phone book ===
       
   854 
       
   855 	// Get phone store information using RMobilePhone::GetPhoneStoreInfo and KETelOwnNumberStore 
       
   856 
       
   857 	// Store the iUsedEntries returned. 
       
   858 
       
   859 	// Get phone book store information using RMobilePhoneStore::GetInfo 
       
   860 
       
   861 	// Store the iUsedEntries returned. 
       
   862 	TInt usedEntries =-1;
       
   863 	TInt usedEntries2 = -1;
       
   864 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
   865 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
   866 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,usedEntries,usedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
   867 
       
   868 	// ===  Write a valid entry ===
       
   869 
       
   870 	// Post notify event
       
   871 	TUint32 storeEvent;
       
   872 	TInt index;
       
   873 	TExtEtelRequestStatus notifyStoreEventStatus(onStore,
       
   874 			EMobilePhoneStoreNotifyStoreEvent);
       
   875 	CleanupStack::PushL (notifyStoreEventStatus);
       
   876 	onStore.NotifyStoreEvent (notifyStoreEventStatus, storeEvent, index);
       
   877 
       
   878 	// Write a valid entry with a national number to the phone book specifying a specific index to store the entry which does not contain an entry. 
       
   879 	RMobileONStore::TMobileONEntryV1 entry;
       
   880 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
   881 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
   882 	CleanupStack::PushL (writeStatus);
       
   883 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
   884 	entry.iService=RMobilePhone::ETelephony;
       
   885 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
   886 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
   887 	_LIT(KNumber, "01632960000");
       
   888 	entry.iNumber.iTelNumber = KNumber;
       
   889 	entry.iText = _L("An Entry");
       
   890 	entry.iIndex=clearSpace;
       
   891 	onStore.Write (writeStatus, writePckg);
       
   892 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
   893 			KErrNone, _L("RMobileONStore::Write timed out"));
       
   894 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
   895 
       
   896 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreEntryAdded
       
   897 	RMobilePhoneStore::TMobileStoreEvent
       
   898 			expectedEvent = RMobilePhoneStore::KStoreEntryAdded;
       
   899 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent(onStore,notifyStoreEventStatus, storeEvent, expectedEvent, index,KErrNone);
       
   900 
       
   901 	// ===  Read the written entry ===
       
   902 
       
   903 	// Read the entry from the phone book. 
       
   904 	RMobileONStore::TMobileONEntryV1 readEntry;
       
   905 	RMobileONStore::TMobileONEntryV1Pckg pckgReadEntry(readEntry);
       
   906 	readEntry.iIndex = clearSpace;
       
   907 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
   908 	CleanupStack::PushL (readStatus);
       
   909 	onStore.Read (readStatus, pckgReadEntry);
       
   910 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   911 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   912 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
   913 
       
   914 	// Check that the entry information is the same as that written.
       
   915 	ASSERT_TRUE(CompareEntries (readEntry, entry), _L("RMobileONStore::Read entries are not the same"));
       
   916 
       
   917 	// ===  Get the number of used entries and check it is 1 higher than before writing the new entry ===
       
   918 
       
   919 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 higher than that stored.
       
   920 
       
   921 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 higher than that stored.
       
   922 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,
       
   923 			phone,usedEntries+1,usedEntries2+1), 
       
   924 			KErrNone, 
       
   925 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
   926 
       
   927 	// ===  Write a valid entry ===
       
   928 
       
   929 	// post notifier for RMobilePhoneStore::NotifyStoreEvent
       
   930 	onStore.NotifyStoreEvent (notifyStoreEventStatus, storeEvent, index);
       
   931 	
       
   932 	// Write a valid entry with an international number (containing a '+' sign) to the phone book specifying a specific index to store the entry which does not contain an entry. 
       
   933 	RMobileONStore::TMobileONEntryV1 entry2;
       
   934 	RMobileONStore::TMobileONEntryV1Pckg writePckg2(entry2);
       
   935 	entry2.iMode=RMobilePhone::ENetworkModeGsm;
       
   936 	entry2.iService=RMobilePhone::ETelephony;
       
   937 	entry2.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
   938 	entry2.iNumber.iTypeOfNumber = RMobilePhone::EInternationalNumber;
       
   939 	_LIT(KNumber2, "+441632960000");
       
   940 	entry2.iNumber.iTelNumber = KNumber2;
       
   941 	entry2.iText = _L("IEntry");
       
   942 	entry2.iIndex=clearSpace;
       
   943 	onStore.Write (writeStatus, writePckg2);
       
   944 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
   945 			KErrNone, _L("RMobileONStore::Write timed out"));
       
   946 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
   947 
       
   948 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreEntryAdded
       
   949 	expectedEvent = RMobilePhoneStore::KStoreEntryAdded;
       
   950 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
   951 			notifyStoreEventStatus, storeEvent, expectedEvent, entry2.iIndex,KErrNone);
       
   952 
       
   953 	// ===  Read the written entry ===
       
   954 
       
   955 	// Read the entry from the phone book. 
       
   956 	readEntry.iIndex = entry2.iIndex;
       
   957 	onStore.Read (readStatus, pckgReadEntry);
       
   958 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
   959 			KErrNone, _L("RMobileONStore::Read timed out"));
       
   960 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
   961 
       
   962 	// Check that the entry information is the same as that written.
       
   963 	ASSERT_TRUE(CompareEntries (entry2, readEntry), _L("RMobileONStore::Read entries are not the same"));
       
   964 
       
   965 	// ===  Get the number of used entries and check it is 1 higher than before writing the new entry ===
       
   966 
       
   967 
       
   968 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 higher than that stored.
       
   969 
       
   970 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 higher than that stored.
       
   971 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,usedEntries+1,usedEntries2+1), 
       
   972 			KErrNone, 
       
   973 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
   974 
       
   975 	//
       
   976 	// TEST END
       
   977 	//
       
   978 
       
   979 	StartCleanup();
       
   980 
       
   981 	
       
   982 	// Pop:
       
   983 	//	readStatus
       
   984 	//	writeStatus
       
   985 	//	notifyStoreEventStatus
       
   986 	//	onStoreInfoStatus
       
   987 	//	backup
       
   988 	CleanupStack::PopAndDestroy(5,&backup);
       
   989 
       
   990 	return TestStepResult();
       
   991 	}
       
   992 
       
   993 TPtrC CCTSYIntegrationTestONStore0005::GetTestStepName()
       
   994 /**
       
   995  * @return The test step name.
       
   996  */
       
   997 	{
       
   998 	return _L("CCTSYIntegrationTestONStore0005");
       
   999 	}
       
  1000 
       
  1001 CCTSYIntegrationTestONStore0006::CCTSYIntegrationTestONStore0006(
       
  1002 		CEtelSessionMgr& aEtelSessionMgr) :
       
  1003 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  1004 /**
       
  1005  * Constructor.
       
  1006  */
       
  1007 	{
       
  1008 	SetTestStepName(CCTSYIntegrationTestONStore0006::GetTestStepName());
       
  1009 	}
       
  1010 
       
  1011 CCTSYIntegrationTestONStore0006::~CCTSYIntegrationTestONStore0006()
       
  1012 /**
       
  1013  * Destructor.
       
  1014  */
       
  1015 	{
       
  1016 	}
       
  1017 
       
  1018 TVerdict CCTSYIntegrationTestONStore0006::doTestStepL()
       
  1019 /**
       
  1020  * @SYMTestCaseID BA-CTSY-INT-PBON-0006
       
  1021  * @SYMFssID BA/CTSY/PBON-0006
       
  1022  * @SYMTestCaseDesc Write an entry to phonebook at index of -1 (first free slot).
       
  1023  * @SYMTestPriority High
       
  1024  * @SYMTestActions 
       
  1025  * @SYMTestExpectedResults Pass - Entry written.
       
  1026  * @SYMTestType CIT
       
  1027  * @SYMTestCaseDependencies live/automatic
       
  1028  *
       
  1029  * Reason for test: Verify entry is written correctly and correct slot number is returned.
       
  1030  *
       
  1031  * @return - TVerdict code
       
  1032  */
       
  1033 	{
       
  1034 
       
  1035 	//
       
  1036 	// SET UP
       
  1037 	//
       
  1038 
       
  1039 	// Open the ADN store
       
  1040 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  1041 
       
  1042 	
       
  1043 	// Backup first Entry
       
  1044 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  1045 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  1046 			KMainPhone, KMainONStore);
       
  1047 	TBackupAllEntries backup(*this,onStore);
       
  1048 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  1049 	CleanupStack::PushL (backup);
       
  1050 
       
  1051 	// SIM phone book is not full. 
       
  1052 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  1053 	TInt clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
  1054 	CHECK_TRUE_L(clearSpace>=0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL was unable to get an empty space"));
       
  1055 
       
  1056 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsReadAccess | KCapsNotifyEvent 
       
  1057 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  1058 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  1059 	CleanupStack::PushL (onStoreInfoStatus);
       
  1060 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  1061 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  1062 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  1063 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  1064 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsNotifyEvent | RMobilePhoneStore::KCapsWriteAccess),
       
  1065 			KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  1066 
       
  1067 	//
       
  1068 	// SET UP END
       
  1069 	//
       
  1070 
       
  1071 	StartTest ();
       
  1072 
       
  1073 	//
       
  1074 	// TEST START
       
  1075 	//
       
  1076 
       
  1077 
       
  1078 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  1079 
       
  1080 	// Store iUsedEntries returned for future use 
       
  1081 	
       
  1082 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  1083 
       
  1084 	// Store iUsedEntries returned for future use 
       
  1085 	TInt savedUsedEntries = -1;
       
  1086 	TInt savedUsedEntries2 = -1;
       
  1087 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  1088 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1089 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1090 	
       
  1091 
       
  1092 	// ===  Write an entry to the first free slot ===
       
  1093 
       
  1094 	// Post notify event
       
  1095 	TUint32 storeEvent;
       
  1096 	TInt index;
       
  1097 	TExtEtelRequestStatus notifyStoreEventStatus(onStore,
       
  1098 			EMobilePhoneStoreNotifyStoreEvent);
       
  1099 	CleanupStack::PushL (notifyStoreEventStatus);
       
  1100 	onStore.NotifyStoreEvent (notifyStoreEventStatus, storeEvent, index);
       
  1101 
       
  1102 	// Write a valid entry to the phone book using RMobilePhoneStore::Write supplying aEntry.index = -1 
       
  1103 	RMobileONStore::TMobileONEntryV1 entry;
       
  1104 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  1105 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  1106 	CleanupStack::PushL (writeStatus);
       
  1107 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  1108 	entry.iService=RMobilePhone::ETelephony;
       
  1109 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  1110 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  1111 	_LIT(KNumber, "01632960000");
       
  1112 	entry.iNumber.iTelNumber = KNumber;
       
  1113 	entry.iText = _L("Entry11");
       
  1114 	entry.iIndex=-1;
       
  1115 	onStore.Write (writeStatus, writePckg);
       
  1116 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  1117 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  1118 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  1119 
       
  1120 	// Store the aEntry.iIndex returned for future use 
       
  1121 	TInt savedIndex=entry.iIndex;
       
  1122 
       
  1123 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreEntryAdded
       
  1124 	RMobilePhoneStore::TMobileStoreEvent
       
  1125 			expectedEvent = RMobilePhoneStore::KStoreEntryAdded;
       
  1126 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  1127 			notifyStoreEventStatus, storeEvent, expectedEvent, index,KErrNone);
       
  1128 
       
  1129 	// ===  Get the number of used entries and check it is 1 higher than before writing the new entry ===
       
  1130 
       
  1131 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 higher than that stored.
       
  1132 
       
  1133 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 higher than that stored.
       
  1134 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries+1,savedUsedEntries2+1), 
       
  1135 			KErrNone, 
       
  1136 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1137 
       
  1138 	// ===  Read the written entry ===
       
  1139 
       
  1140 	// Read the written entry at index aEntry.iIndex returned from the write 
       
  1141 	RMobileONStore::TMobileONEntryV1 readEntry;
       
  1142 	RMobileONStore::TMobileONEntryV1Pckg entryPckg(readEntry);
       
  1143 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
  1144 	CleanupStack::PushL (readStatus);
       
  1145 	readEntry.iIndex = savedIndex;
       
  1146 	onStore.Read (readStatus, entryPckg);
       
  1147 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
  1148 			KErrNone, _L("RMobileONStore::Read timed out"));
       
  1149 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
  1150 
       
  1151 	// Check RMobilePhoneStore::Read returns correct entry information 
       
  1152 	ASSERT_TRUE(CompareEntries (entry, readEntry), _L("RMobileONStore::Read entries are not the same"));
       
  1153 
       
  1154 	//
       
  1155 	// TEST END
       
  1156 	//
       
  1157 
       
  1158 	StartCleanup();
       
  1159 
       
  1160 	
       
  1161 	// Pop:
       
  1162 	//	readStatus
       
  1163 	//	writeStatus
       
  1164 	//	notifyStoreEventStatus
       
  1165 	//	onStoreInfoStatus
       
  1166 	//	backup
       
  1167 	CleanupStack::PopAndDestroy(5,&backup);
       
  1168 
       
  1169 	return TestStepResult();
       
  1170 	}
       
  1171 
       
  1172 TPtrC CCTSYIntegrationTestONStore0006::GetTestStepName()
       
  1173 /**
       
  1174  * @return The test step name.
       
  1175  */
       
  1176 	{
       
  1177 	return _L("CCTSYIntegrationTestONStore0006");
       
  1178 	}
       
  1179 
       
  1180 CCTSYIntegrationTestONStore0007::CCTSYIntegrationTestONStore0007(
       
  1181 		CEtelSessionMgr& aEtelSessionMgr) :
       
  1182 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  1183 /**
       
  1184  * Constructor.
       
  1185  */
       
  1186 	{
       
  1187 	SetTestStepName(CCTSYIntegrationTestONStore0007::GetTestStepName());
       
  1188 	}
       
  1189 
       
  1190 CCTSYIntegrationTestONStore0007::~CCTSYIntegrationTestONStore0007()
       
  1191 /**
       
  1192  * Destructor.
       
  1193  */
       
  1194 	{
       
  1195 	}
       
  1196 
       
  1197 TVerdict CCTSYIntegrationTestONStore0007::doTestStepL()
       
  1198 /**
       
  1199  * @SYMTestCaseID BA-CTSY-INT-PBON-0007
       
  1200  * @SYMFssID BA/CTSY/PBON-0007
       
  1201  * @SYMTestCaseDesc Write entries to the ON store using invalid indexes.
       
  1202  * @SYMTestPriority High
       
  1203  * @SYMTestActions RMobilePhoneStore::Read, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo
       
  1204  * @SYMTestExpectedResults Pass - Error returned on write.
       
  1205  * @SYMTestType CIT
       
  1206  * @SYMTestCaseDependencies live/automatic
       
  1207  *
       
  1208  * Reason for test: Verify error is returned on attempt to write to an invalid index and number of used entries in the phone book is unchanged.
       
  1209  *
       
  1210  * @return - TVerdict code
       
  1211  */
       
  1212 	{
       
  1213 
       
  1214 	//
       
  1215 	// SET UP
       
  1216 	//
       
  1217 
       
  1218 	// Open the ADN store
       
  1219 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  1220 
       
  1221 	// Backup first Entry
       
  1222 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  1223 			KMainPhone, KMainONStore);
       
  1224 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  1225 	TBackupAllEntries backup(*this,onStore);
       
  1226 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  1227 	CleanupStack::PushL (backup);
       
  1228 
       
  1229 	// Ensure phone book is not full. 
       
  1230 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  1231 	TInt clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
  1232 	CHECK_TRUE_L(clearSpace>=0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL was unable to get an empty space"));
       
  1233 
       
  1234 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsReadAccess 
       
  1235 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  1236 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  1237 	CleanupStack::PushL (onStoreInfoStatus);
       
  1238 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  1239 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  1240 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  1241 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  1242 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsWriteAccess),
       
  1243 			KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  1244 
       
  1245 	//
       
  1246 	// SET UP END
       
  1247 	//
       
  1248 
       
  1249 	StartTest ();
       
  1250 
       
  1251 	//
       
  1252 	// TEST START
       
  1253 	//
       
  1254 
       
  1255 
       
  1256 	// ===  1. Find out how many entries are used in the phone book ===
       
  1257 	// ===  2. Attempt to write an entry to invalid index (0) ===
       
  1258 	DEBUG_PRINTF1(_L("Attempt to write an entry to invalid index (0)"));
       
  1259 	_LIT(KNumber0, "01632960000");
       
  1260 	WriteEntryAndCheckThatUsedEntriesDidNotChangedL (onStore, 0, KNumber0);
       
  1261     clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
  1262 	ASSERT_TRUE(clearSpace>=0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL was unable to get an empty space"));
       
  1263 	// Repeat steps 1 to 3 for aEntry.index = -2, -10 
       
  1264 	DEBUG_PRINTF1(_L("Attempt to write an entry to invalid index (-2)"));
       
  1265 	_LIT(KNumber2, "01632960000");
       
  1266 	WriteEntryAndCheckThatUsedEntriesDidNotChangedL (onStore, -2, KNumber2);
       
  1267     clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
  1268 	ASSERT_TRUE(clearSpace>=0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL was unable to get an empty space"));
       
  1269 	_LIT(KNumber3, "01632960000");
       
  1270 	
       
  1271 	DEBUG_PRINTF1(_L("Attempt to write an entry to invalid index (-10)"));
       
  1272 	WriteEntryAndCheckThatUsedEntriesDidNotChangedL (onStore, -10, KNumber3);
       
  1273     clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
  1274 	ASSERT_TRUE(clearSpace>=0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL was unable to get an empty space"));
       
  1275 
       
  1276 	// ===  Attempt to write an entry to an index that is higher than the max slot number ===
       
  1277 
       
  1278 	// Write an entry using RMobilePhoneStore::Write and aEntry.index = 10000 
       
  1279 	RMobileONStore::TMobileONEntryV1 entry;
       
  1280 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  1281 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  1282 	CleanupStack::PushL (writeStatus);
       
  1283 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  1284 	entry.iService=RMobilePhone::ETelephony;
       
  1285 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  1286 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  1287 	_LIT(KNumber4, "01632960000");
       
  1288 	entry.iNumber.iTelNumber = KNumber4;
       
  1289 	entry.iText = _L("Entry11");
       
  1290 	entry.iIndex=10000;
       
  1291 	onStore.Write (writeStatus, writePckg);
       
  1292 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  1293 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  1294 
       
  1295 	// Check error returned is not KErrNone
       
  1296 	ASSERT_TRUE((writeStatus.Int() != KErrNone), _L("RMobileONStore::Write returned an error") );
       
  1297 
       
  1298 	//
       
  1299 	// TEST END
       
  1300 	//
       
  1301 
       
  1302 	StartCleanup();
       
  1303 
       
  1304 	
       
  1305 	// Pop:
       
  1306 	//	writeStatus
       
  1307 	//	onStoreInfoStatus
       
  1308 	//	backup
       
  1309 	CleanupStack::PopAndDestroy(3,&backup);
       
  1310 
       
  1311 	return TestStepResult();
       
  1312 	}
       
  1313 
       
  1314 
       
  1315 void CCTSYIntegrationTestONStore0007::WriteEntryAndCheckThatUsedEntriesDidNotChangedL(
       
  1316 		RMobileONStore& aStore, TInt aIndex, const TDesC& aNumber)
       
  1317 /*
       
  1318  * This function write an entry to an invalid index and check that the number of used entries did not changed
       
  1319  *
       
  1320  * @param aStore Reference to On Store session.
       
  1321  * @param aIndex the (invald) index
       
  1322  * @param aNumber the number to write
       
  1323  *
       
  1324  */	
       
  1325 	{
       
  1326 
       
  1327 
       
  1328 	// ===  1. Find out how many entries are used in the phone book ===
       
  1329 
       
  1330 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1 
       
  1331 
       
  1332 	// Store iUsedEntries returned for future use 
       
  1333 
       
  1334 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  1335 
       
  1336 	// Store iUsedEntries returned for future use 
       
  1337 	TInt savedUsedEntries = -1;
       
  1338 	TInt savedUsedEntries2 = -1;
       
  1339 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  1340 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  1341 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1342 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(aStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1343 
       
  1344 	// ===  2. Attempt to write an entry to invalid index ===
       
  1345 
       
  1346 	// Write an entry using RMobilePhoneStore::Write and aEntry.index = aIndex 
       
  1347 	RMobileONStore::TMobileONEntryV1 entry;
       
  1348 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  1349 	TExtEtelRequestStatus writeStatus(aStore, EMobilePhoneStoreWrite);
       
  1350 	CleanupStack::PushL (writeStatus);
       
  1351 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  1352 	entry.iService=RMobilePhone::ETelephony;
       
  1353 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  1354 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  1355 	entry.iNumber.iTelNumber = aNumber;
       
  1356 	entry.iText = _L("Entry11");
       
  1357 	entry.iIndex=aIndex;
       
  1358 
       
  1359 	// Check KErrArgument is returned
       
  1360 	aStore.Write (writeStatus, writePckg);
       
  1361 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  1362 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  1363 
       
  1364     ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10042);
       
  1365 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  1366 	// ===  3. Get the number of used entries and check it is same as before the attempted write ===
       
  1367 
       
  1368 	// Check RMobilePhoneStore::GetInfo returns same iUsedEntries as before
       
  1369 
       
  1370 	// Check RMobilePhone::GetPhoneStoreInfo returns same iUsedEntries as before
       
  1371     ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(aStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2), 
       
  1372                   KErrNone, 
       
  1373                   _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1374 
       
  1375 	// Pop:
       
  1376 	//	writeStatus
       
  1377 	CleanupStack::PopAndDestroy(&writeStatus);
       
  1378 
       
  1379 	}
       
  1380 
       
  1381 TPtrC CCTSYIntegrationTestONStore0007::GetTestStepName()
       
  1382 /**
       
  1383  * @return The test step name.
       
  1384  */
       
  1385 	{
       
  1386 	return _L("CCTSYIntegrationTestONStore0007");
       
  1387 	}
       
  1388 
       
  1389 CCTSYIntegrationTestONStore0008::CCTSYIntegrationTestONStore0008(
       
  1390 		CEtelSessionMgr& aEtelSessionMgr) :
       
  1391 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  1392 /**
       
  1393  * Constructor.
       
  1394  */
       
  1395 	{
       
  1396 	SetTestStepName(CCTSYIntegrationTestONStore0008::GetTestStepName());
       
  1397 	}
       
  1398 
       
  1399 CCTSYIntegrationTestONStore0008::~CCTSYIntegrationTestONStore0008()
       
  1400 /**
       
  1401  * Destructor.
       
  1402  */
       
  1403 	{
       
  1404 	}
       
  1405 
       
  1406 TVerdict CCTSYIntegrationTestONStore0008::doTestStepL()
       
  1407 /**
       
  1408  * @SYMTestCaseID BA-CTSY-INT-PBON-0008
       
  1409  * @SYMFssID BA/CTSY/PBON-0008
       
  1410  * @SYMTestCaseDesc Write entry to the ON store when SIM is full.
       
  1411  * @SYMTestPriority High
       
  1412  * @SYMTestActions RMobilePhoneStore::Read, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo
       
  1413  * @SYMTestExpectedResults Pass - Error on attempt to write.
       
  1414  * @SYMTestType CIT
       
  1415  * @SYMTestCaseDependencies live/manual
       
  1416  *
       
  1417  * Reason for test: Verify error is returned and number of used entries is unchanged.
       
  1418  *
       
  1419  * @return - TVerdict code
       
  1420  */
       
  1421 	{
       
  1422 
       
  1423 	//
       
  1424 	// SET UP
       
  1425 	//
       
  1426 
       
  1427 	// Open the ADN store
       
  1428 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  1429 
       
  1430 	// Backup first Entry
       
  1431 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  1432 			KMainPhone, KMainONStore);
       
  1433 	TBackupAllEntries backup(*this,onStore);
       
  1434 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  1435 	CleanupStack::PushL (backup);
       
  1436 
       
  1437 	// Fill SIM phone book. 
       
  1438 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  1439 	RMobileONStore::TMobileONEntryV1 entry;
       
  1440 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  1441 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  1442 	CleanupStack::PushL (writeStatus);
       
  1443 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  1444 	entry.iService=RMobilePhone::ETelephony;
       
  1445 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  1446 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  1447 	entry.iNumber.iTelNumber = _L("12012030");
       
  1448 	entry.iText = _L("Entry11");
       
  1449 	TInt usedEntries,totalEntries;
       
  1450 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  1451 	for (; usedEntries<totalEntries;++usedEntries)
       
  1452 		{
       
  1453 		entry.iIndex=-1;
       
  1454 		onStore.Write (writeStatus, writePckg);
       
  1455 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  1456 				KErrNone, _L("RMobileONStore::Write timed out"));
       
  1457 		CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  1458 		}
       
  1459 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  1460 	CHECK_EQUALS_L(usedEntries,totalEntries, _L("RMobileONStore::GetInfo Unexpected number of iUsedEntries returned" ));
       
  1461 
       
  1462 	//
       
  1463 	// SET UP END
       
  1464 	//
       
  1465 
       
  1466 	StartTest ();
       
  1467 
       
  1468 	//
       
  1469 	// TEST START
       
  1470 	//
       
  1471 
       
  1472 
       
  1473 	// ===  Find out how many entries are used in the phone book ===
       
  1474 
       
  1475 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  1476 
       
  1477 	// Store iUsedEntries returned for future use 
       
  1478 
       
  1479 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  1480 
       
  1481 	// Store iUsedEntries returned for future use 
       
  1482 	TInt savedUsedEntries = -1;
       
  1483 	TInt savedUsedEntries2 = -1;
       
  1484 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  1485 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1486 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1487 
       
  1488 	// ===  Attempt to write an entry to the phone book ===
       
  1489 
       
  1490 	// Write an entry using RMobilePhoneStore::Write and aEntry.index = -1 
       
  1491 	entry.iNumber.iTelNumber = _L("12012034");
       
  1492 	entry.iIndex=-1;
       
  1493 
       
  1494 	// Check error != KErrNone is returned.
       
  1495 	onStore.Write (writeStatus, writePckg);
       
  1496 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  1497 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  1498 	ASSERT_TRUE((writeStatus.Int() != KErrNone), _L("RMobileONStore::Write did not returned an error") );
       
  1499 
       
  1500 	// ===  Get the number of used entries and check it is the same as before attempted write ===
       
  1501 
       
  1502 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is same as before
       
  1503 
       
  1504 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is same as before
       
  1505 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2), 
       
  1506 			KErrNone, 
       
  1507 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1508 
       
  1509 	//
       
  1510 	// TEST END
       
  1511 	//
       
  1512 
       
  1513 	StartCleanup();
       
  1514 
       
  1515 	
       
  1516 	// Pop:
       
  1517 	//	writeStatus
       
  1518 	//	backup
       
  1519 	CleanupStack::PopAndDestroy(2,&backup);
       
  1520 
       
  1521 	return TestStepResult();
       
  1522 	}
       
  1523 
       
  1524 TPtrC CCTSYIntegrationTestONStore0008::GetTestStepName()
       
  1525 /**
       
  1526  * @return The test step name.
       
  1527  */
       
  1528 	{
       
  1529 	return _L("CCTSYIntegrationTestONStore0008");
       
  1530 	}
       
  1531 
       
  1532 CCTSYIntegrationTestONStore0009::CCTSYIntegrationTestONStore0009(
       
  1533 		CEtelSessionMgr& aEtelSessionMgr) :
       
  1534 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  1535 /**
       
  1536  * Constructor.
       
  1537  */
       
  1538 	{
       
  1539 	SetTestStepName(CCTSYIntegrationTestONStore0009::GetTestStepName());
       
  1540 	}
       
  1541 
       
  1542 CCTSYIntegrationTestONStore0009::~CCTSYIntegrationTestONStore0009()
       
  1543 /**
       
  1544  * Destructor.
       
  1545  */
       
  1546 	{
       
  1547 	}
       
  1548 
       
  1549 TVerdict CCTSYIntegrationTestONStore0009::doTestStepL()
       
  1550 /**
       
  1551  * @SYMTestCaseID BA-CTSY-INT-PBON-0009
       
  1552  * @SYMFssID BA/CTSY/PBON-0009
       
  1553  * @SYMTestCaseDesc Write entry to the ON store making the store full.
       
  1554  * @SYMTestPriority High
       
  1555  * @SYMTestActions RMobilePhoneStore::Read, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::Write, RMobilePhoneStore::DeleteAll
       
  1556  * @SYMTestExpectedResults Pass - Entry written correctly.  Store event is retrieved indicating entry has been written and store is full.
       
  1557  * @SYMTestType CIT
       
  1558  * @SYMTestCaseDependencies live/automatic
       
  1559  *
       
  1560  * Reason for test: Verify entry written and store event completes indicating store is now full.
       
  1561  *
       
  1562  * @return - TVerdict code
       
  1563  */
       
  1564 	{
       
  1565 
       
  1566 	//
       
  1567 	// SET UP
       
  1568 	//
       
  1569 
       
  1570 	// Open the ADN store
       
  1571 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  1572 
       
  1573 	// Backup first Entry
       
  1574 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  1575 			KMainPhone, KMainONStore);
       
  1576 	TBackupAllEntries backup(*this,onStore);
       
  1577 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  1578 	CleanupStack::PushL (backup);
       
  1579 	
       
  1580 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsReadAccess | KCapsNotifyEvent 
       
  1581 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  1582 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  1583 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  1584 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  1585 	CleanupStack::PushL (onStoreInfoStatus);
       
  1586 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  1587 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  1588 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  1589 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  1590 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsNotifyEvent | RMobilePhoneStore::KCapsWriteAccess),KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  1591 
       
  1592 	// Fill phone book until there is only one slot free. 
       
  1593 	TInt usedEntries,totalEntries;
       
  1594 	TExtEtelRequestStatus deleteStatus(onStore, EMobilePhoneStoreDelete);
       
  1595 	CleanupStack::PushL (deleteStatus);
       
  1596 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  1597 	CleanupStack::PushL (writeStatus);
       
  1598 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  1599 	RMobileONStore::TMobileONEntryV1 entry;
       
  1600 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  1601 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  1602 	entry.iService=RMobilePhone::ETelephony;
       
  1603 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  1604 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  1605 	entry.iNumber.iTelNumber = _L("12012030");
       
  1606 	entry.iText = _L("Entry11");
       
  1607 	if(usedEntries==totalEntries)
       
  1608 		{
       
  1609 		onStore.Delete (deleteStatus, totalEntries);
       
  1610 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  1611 		CHECK_EQUALS_L(deleteStatus.Int(), KErrNone, _L("RMobileONStore::Delete returned an error"));
       
  1612 		}
       
  1613 	else
       
  1614 		{
       
  1615 		for (; usedEntries+1<totalEntries;++usedEntries)
       
  1616 			{
       
  1617 			entry.iIndex=-1;
       
  1618 			onStore.Write (writeStatus, writePckg);
       
  1619 			CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  1620 					KErrNone, _L("RMobileONStore::Write timed out"));
       
  1621 			CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  1622 			}
       
  1623 		}
       
  1624 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  1625 	CHECK_EQUALS_L(usedEntries,totalEntries-1, _L("RMobileONStore::GetInfo Unexpected number of iUsedEntries returned" ));
       
  1626 
       
  1627 
       
  1628 	//
       
  1629 	// SET UP END
       
  1630 	//
       
  1631 
       
  1632 	StartTest ();
       
  1633 
       
  1634 	//
       
  1635 	// TEST START
       
  1636 	//
       
  1637 
       
  1638 
       
  1639 	// ===  Find out how many entries are used in the phone book ===
       
  1640 
       
  1641 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  1642 
       
  1643 	// Store iUsedEntries returned for future use 
       
  1644 
       
  1645 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  1646 
       
  1647 	// Store iUsedEntries returned for future use 
       
  1648 	TInt savedUsedEntries = -1;
       
  1649 	TInt savedUsedEntries2 = -1;
       
  1650 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  1651 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1652 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1653 
       
  1654 	// ===  Write an entry into the last free slot in the phone book ===
       
  1655 
       
  1656 	// Post notify event
       
  1657 	TUint32 storeEvent;
       
  1658 	TInt index;
       
  1659 	TExtEtelRequestStatus notifyStoreEventStatus(onStore,
       
  1660 			EMobilePhoneStoreNotifyStoreEvent);
       
  1661 	CleanupStack::PushL (notifyStoreEventStatus);
       
  1662 	onStore.NotifyStoreEvent (notifyStoreEventStatus, storeEvent, index);
       
  1663 
       
  1664 	// Write an entry using RMobilePhoneStore::Write and aEntry.index = -1 
       
  1665 	entry.iIndex=-1;
       
  1666 	onStore.Write (writeStatus, writePckg);
       
  1667 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  1668 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  1669 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  1670 
       
  1671 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreFull | KStoreEntryAdded
       
  1672     TInt expectedEvent = RMobilePhoneStore::KStoreFull | RMobilePhoneStore::KStoreEntryAdded;
       
  1673     ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10037);
       
  1674     iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  1675 			notifyStoreEventStatus, storeEvent, expectedEvent, index,KErrNone);
       
  1676 
       
  1677 	// ===  Get the number of used entries and check it is 1 higher than before writing the new entry ===
       
  1678 
       
  1679 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 higher than that stored.
       
  1680 
       
  1681 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 higher than that stored.
       
  1682 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries+1,savedUsedEntries2+1), 
       
  1683 			KErrNone, 
       
  1684 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1685 
       
  1686 	// ===  Read the written entry ===
       
  1687 
       
  1688 	// Read the written entry with RMobilePhoneStore::Read 
       
  1689 	RMobileONStore::TMobileONEntryV1 readEntry;
       
  1690 	RMobileONStore::TMobileONEntryV1Pckg entryPckg(readEntry);
       
  1691 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
  1692 	CleanupStack::PushL (readStatus);
       
  1693 	readEntry.iIndex = savedUsedEntries+1;
       
  1694 	onStore.Read (readStatus, entryPckg);
       
  1695 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
  1696 			KErrNone, _L("RMobileONStore::Read timed out"));
       
  1697 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
  1698 
       
  1699 	// Check entry details are correct
       
  1700 	ASSERT_TRUE(CompareEntries (entry, readEntry), _L("RMobileONStore::Read entries are not the same"));
       
  1701 	// ===  Delete all entries from the phone book  ===
       
  1702 
       
  1703 	// Delete all entries from the ON Store 
       
  1704 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
  1705 	CleanupStack::PushL (deleteAllStatus);
       
  1706 	onStore.DeleteAll (deleteAllStatus);
       
  1707 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  1708 	ASSERT_EQUALS(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
  1709 
       
  1710 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries of 0.
       
  1711 
       
  1712 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries of 0.
       
  1713 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,0,0), 
       
  1714 		KErrNone, 
       
  1715 		_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1716 
       
  1717 	// ===  Fill the phone book using RMobileONStore::StoreAllL ===
       
  1718 
       
  1719 	// Populate a CMobilePhoneONList with enough entries to fill the ON store phone book. 
       
  1720 	CMobilePhoneONList *list = CMobilePhoneONList::NewL ();
       
  1721 	CleanupStack::PushL (list);
       
  1722 	RMobileONStore::TMobileONEntryV1 entry2;
       
  1723 	entry2.iMode=RMobilePhone::ENetworkModeGsm;
       
  1724 	entry2.iService=RMobilePhone::ETelephony;
       
  1725 	entry2.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  1726 	entry2.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  1727 	entry2.iText = _L("Entry2");
       
  1728 	entry2.iNumber.iTelNumber = _L("12012032");
       
  1729 	ASSERT_TRUE(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  1730 	for (TInt i=usedEntries+1; i <= totalEntries;++i)
       
  1731 		{
       
  1732 		entry2.iIndex=i;
       
  1733 		if ( entry2.iNumber.iTelNumber[0]=='9')
       
  1734 			{
       
  1735 			entry2.iNumber.iTelNumber[0]='0';
       
  1736 			}
       
  1737 		else
       
  1738 			{
       
  1739 			entry2.iNumber.iTelNumber[0]++;
       
  1740 			}
       
  1741 		list->AddEntryL (entry2);
       
  1742 		}
       
  1743 
       
  1744 	// Post notify event
       
  1745 	TUint32 storeEvent2;
       
  1746 	TInt index2;
       
  1747 	TExtEtelRequestStatus notifyStoreAllEventStatus(onStore,
       
  1748 			EMobilePhoneStoreNotifyStoreEvent);
       
  1749 	CleanupStack::PushL (notifyStoreAllEventStatus);
       
  1750 	onStore.NotifyStoreEvent (notifyStoreAllEventStatus, storeEvent2, index2);
       
  1751 
       
  1752 	// Use RMobileONStore::StoreAllL to add these entries to the phone book. 
       
  1753 	DEBUG_PRINTF1( _L("Store all has cause panic, using bypass"));
       
  1754 	// Bypass : The session manager can not be used, since a PANIC is created
       
  1755 	RMobileONStore byPassOnStore;
       
  1756 	User::LeaveIfError(byPassOnStore.Open(phone));
       
  1757 	CleanupClosePushL(byPassOnStore);
       
  1758 	// By pass end
       
  1759 	TExtEtelRequestStatus storeAllStatus(byPassOnStore, EMobileONStoreStoreAll);
       
  1760 	CleanupStack::PushL (storeAllStatus);
       
  1761 	byPassOnStore.StoreAllL (storeAllStatus, list);
       
  1762 	ASSERT_EQUALS(WaitForRequestWithTimeOut(storeAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::StoreAllL timed out"));
       
  1763 	ASSERT_EQUALS(storeAllStatus.Int(), KErrNone, _L("RMobileONStore::StoreAllL returned an error"));
       
  1764 
       
  1765 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreFull
       
  1766     ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10038);
       
  1767 	RMobilePhoneStore::TMobileStoreEvent
       
  1768 			expectedEvent2 = RMobilePhoneStore::KStoreFull;
       
  1769 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  1770 			notifyStoreAllEventStatus, storeEvent2, expectedEvent2, index2,KErrNone);
       
  1771 
       
  1772 	// ===  Read all the written entries ===
       
  1773 
       
  1774 	// Read all the entries in from the ON store. 
       
  1775 
       
  1776 	// Check that they are the same as that stored using the CMobilePhoneONList
       
  1777 	ASSERT_TRUE(GetUsedEntriesL(onStore,phone,usedEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  1778 	RMobileONStore::TMobileONEntryV1 readEntry2;
       
  1779 	RMobileONStore::TMobileONEntryV1Pckg entryPckg2(readEntry2);
       
  1780 	for (TInt i=1; i<=usedEntries;++i)
       
  1781 		{
       
  1782 		readEntry2.iIndex=i;
       
  1783 		onStore.Read (readStatus, entryPckg2);
       
  1784 		ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
  1785 				KErrNone, _L("RMobileONStore::Read timed out"));
       
  1786 		ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
  1787 		ASSERT_TRUE(CompareEntries (readEntry2, list->GetEntryL (i-1)), _L("RMobileONStore::Read entries are not the same"));
       
  1788 		}
       
  1789 
       
  1790 	//
       
  1791 	// TEST END
       
  1792 	//
       
  1793 
       
  1794 	StartCleanup();
       
  1795 
       
  1796 	
       
  1797 	// Pop:
       
  1798 	//	storeAllStatus
       
  1799 	//	byPassOnStore
       
  1800 	//	notifyStoreAllEventStatus
       
  1801 	//	list
       
  1802 	//	deleteAllStatus
       
  1803 	//	readStatus
       
  1804 	//	notifyStoreEventStatus
       
  1805 	//	writeStatus
       
  1806 	//	deleteStatus
       
  1807 	//	onStoreInfoStatus
       
  1808 	//	backup
       
  1809 	CleanupStack::PopAndDestroy(11,&backup);
       
  1810 	return TestStepResult();
       
  1811 	}
       
  1812 
       
  1813 TPtrC CCTSYIntegrationTestONStore0009::GetTestStepName()
       
  1814 /**
       
  1815  * @return The test step name.
       
  1816  */
       
  1817 	{
       
  1818 	return _L("CCTSYIntegrationTestONStore0009");
       
  1819 	}
       
  1820 
       
  1821 CCTSYIntegrationTestONStore0010::CCTSYIntegrationTestONStore0010(
       
  1822 		CEtelSessionMgr& aEtelSessionMgr) :
       
  1823 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  1824 /**
       
  1825  * Constructor.
       
  1826  */
       
  1827 	{
       
  1828 	SetTestStepName(CCTSYIntegrationTestONStore0010::GetTestStepName());
       
  1829 	}
       
  1830 
       
  1831 CCTSYIntegrationTestONStore0010::~CCTSYIntegrationTestONStore0010()
       
  1832 /**
       
  1833  * Destructor.
       
  1834  */
       
  1835 	{
       
  1836 	}
       
  1837 
       
  1838 TVerdict CCTSYIntegrationTestONStore0010::doTestStepL()
       
  1839 /**
       
  1840  * @SYMTestCaseID BA-CTSY-INT-PBON-0010
       
  1841  * @SYMFssID BA/CTSY/PBON-0010
       
  1842  * @SYMTestCaseDesc Write entry to ON store where name-tag and number are of maximum length.
       
  1843  * @SYMTestPriority High
       
  1844  * @SYMTestActions RMobilePhoneStore::Read, RMobilePhoneStore::NotifyStoreEvent, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo
       
  1845  * @SYMTestExpectedResults Pass - Write successful.
       
  1846  * @SYMTestType CIT
       
  1847  * @SYMTestCaseDependencies live/automatic
       
  1848  *
       
  1849  * Reason for test: Verify name and number are written correctly and can be read.
       
  1850  *
       
  1851  * @return - TVerdict code
       
  1852  */
       
  1853 	{
       
  1854 
       
  1855 	//
       
  1856 	// SET UP
       
  1857 	//
       
  1858 
       
  1859 	// Open the ADN store
       
  1860 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  1861 
       
  1862 	// Backup first Entry
       
  1863 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  1864 			KMainPhone, KMainONStore);
       
  1865 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  1866 	TBackupAllEntries backup(*this,onStore);
       
  1867 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  1868 	CleanupStack::PushL (backup);
       
  1869 
       
  1870 	// Ensure phone book is not full. 
       
  1871 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  1872 	TInt clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
  1873 	CHECK_TRUE_L(clearSpace>=0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL was unable to get an empty space"));
       
  1874 
       
  1875 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsNotifyEvent 
       
  1876 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  1877 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  1878 	CleanupStack::PushL (onStoreInfoStatus);
       
  1879 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  1880 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  1881 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  1882 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  1883 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsWriteAccess | RMobilePhoneStore::KCapsNotifyEvent),
       
  1884 			KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  1885 
       
  1886 
       
  1887 	//
       
  1888 	// SET UP END
       
  1889 	//
       
  1890 
       
  1891 	StartTest ();
       
  1892 
       
  1893 	//
       
  1894 	// TEST START
       
  1895 	//
       
  1896 
       
  1897 
       
  1898 	// ===  Find out how many entries are used in the phone book ===
       
  1899 
       
  1900 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  1901 
       
  1902 	// Store iUsedEntries returned for future use 
       
  1903 
       
  1904 	// Store iNumLength and iTextLength for future use 
       
  1905 	TInt numberLength = onStoreInfo.iNumberLen;
       
  1906 	TInt textLength = onStoreInfo.iTextLen;
       
  1907 	
       
  1908 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  1909 
       
  1910 	// Store iUsedEntries returned for future use 
       
  1911 	TInt usedEntries =-1;
       
  1912 	TInt usedEntries2 = -1;
       
  1913 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  1914 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1915 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,usedEntries,usedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1916 
       
  1917 	// ===  Write entry of maximum size to the ON store ===
       
  1918 
       
  1919 	// Post notify event
       
  1920 	TUint32 storeEvent;
       
  1921 	TInt index;
       
  1922 	TExtEtelRequestStatus notifyStoreEventStatus(onStore,
       
  1923 			EMobilePhoneStoreNotifyStoreEvent);
       
  1924 	CleanupStack::PushL (notifyStoreEventStatus);
       
  1925 	onStore.NotifyStoreEvent (notifyStoreEventStatus, storeEvent, index);
       
  1926 	
       
  1927 	// Create a RMobileONStore::TMobileONEntryV1 with a valid name in iText of length iTextLength and iNumber of length iNumLength 
       
  1928 	RMobileONStore::TMobileONEntryV1 entry;
       
  1929 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  1930 	entry.iService=RMobilePhone::ETelephony;
       
  1931 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  1932 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  1933 	entry.iIndex=clearSpace;
       
  1934 	entry.iText = TBuf<RMobileONStore::KOwnNumberTextSize>(textLength);
       
  1935 	entry.iText.Fill('A',textLength);
       
  1936 	entry.iNumber.iTelNumber = TBuf<RMobilePhone::KMaxMobileTelNumberSize>(numberLength);
       
  1937     entry.iNumber.iTelNumber.Zero();
       
  1938     entry.iNumber.iTelNumber.Append('+');
       
  1939     for(TInt i=1;i<numberLength;++i) //Apend numberLength digits, since the '+' is the first digit
       
  1940         {
       
  1941         entry.iNumber.iTelNumber.Append('0'+(i%10));
       
  1942         }
       
  1943 
       
  1944 	// Write the entry to the ON store
       
  1945 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  1946 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  1947 	CleanupStack::PushL (writeStatus);
       
  1948 	onStore.Write (writeStatus, writePckg);
       
  1949 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  1950 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  1951 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  1952 
       
  1953 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreEntryAdded
       
  1954 	RMobilePhoneStore::TMobileStoreEvent expectedEvent = RMobilePhoneStore::KStoreEntryAdded;
       
  1955 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent(onStore,notifyStoreEventStatus, storeEvent, expectedEvent, index,KErrNone);
       
  1956 
       
  1957 	// ===  Read the written entry ===
       
  1958 
       
  1959 	// Read the written entry with RMobilePhoneStore::Read 
       
  1960 	RMobileONStore::TMobileONEntryV1 readEntry;
       
  1961 	RMobileONStore::TMobileONEntryV1Pckg pckgReadEntry(readEntry);
       
  1962 	readEntry.iIndex = clearSpace;
       
  1963 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
  1964 	CleanupStack::PushL (readStatus);
       
  1965 	onStore.Read (readStatus, pckgReadEntry);
       
  1966 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
  1967 			KErrNone, _L("RMobileONStore::Read timed out"));
       
  1968 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
  1969 
       
  1970 	// Check entry details are correct
       
  1971 	ASSERT_TRUE(CompareEntries (readEntry, entry), _L("RMobileONStore::Read entries are not the same"));
       
  1972 
       
  1973 	// ===  Get the number of used entries and check used entries is one higher than before the write ===
       
  1974 
       
  1975 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries is one higher than before the write
       
  1976 
       
  1977 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries is one higher than before the write
       
  1978 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,usedEntries+1,usedEntries2+1), 
       
  1979 			KErrNone, 
       
  1980 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1981 
       
  1982 
       
  1983 	//
       
  1984 	// TEST END
       
  1985 	//
       
  1986 
       
  1987 	StartCleanup();
       
  1988 
       
  1989 	// Pop:
       
  1990 	//	readStatus
       
  1991 	//	writeStatus
       
  1992 	//	notifyStoreEventStatus
       
  1993 	//	onStoreInfoStatus
       
  1994 	//	backup
       
  1995 	CleanupStack::PopAndDestroy(5,&backup);
       
  1996 
       
  1997 	return TestStepResult();
       
  1998 	}
       
  1999 
       
  2000 TPtrC CCTSYIntegrationTestONStore0010::GetTestStepName()
       
  2001 /**
       
  2002  * @return The test step name.
       
  2003  */
       
  2004 	{
       
  2005 	return _L("CCTSYIntegrationTestONStore0010");
       
  2006 	}
       
  2007 
       
  2008 CCTSYIntegrationTestONStore0011::CCTSYIntegrationTestONStore0011(
       
  2009 		CEtelSessionMgr& aEtelSessionMgr) :
       
  2010 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  2011 /**
       
  2012  * Constructor.
       
  2013  */
       
  2014 	{
       
  2015 	SetTestStepName(CCTSYIntegrationTestONStore0011::GetTestStepName());
       
  2016 	}
       
  2017 
       
  2018 CCTSYIntegrationTestONStore0011::~CCTSYIntegrationTestONStore0011()
       
  2019 /**
       
  2020  * Destructor.
       
  2021  */
       
  2022 	{
       
  2023 	}
       
  2024 
       
  2025 TVerdict CCTSYIntegrationTestONStore0011::doTestStepL()
       
  2026 /**
       
  2027  * @SYMTestCaseID BA-CTSY-INT-PBON-0011
       
  2028  * @SYMFssID BA/CTSY/PBON-0011
       
  2029  * @SYMTestCaseDesc Delete entry from the ON store.
       
  2030  * @SYMTestPriority High
       
  2031  * @SYMTestActions RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  2032  * @SYMTestExpectedResults Pass - Entry deleted.
       
  2033  * @SYMTestType CIT
       
  2034  * @SYMTestCaseDependencies live/automatic
       
  2035  *
       
  2036  * Reason for test: Verify deletion is successful and deleted entry cannot be read.
       
  2037  *
       
  2038  * @return - TVerdict code
       
  2039  */
       
  2040 	{
       
  2041 
       
  2042 	//
       
  2043 	// SET UP
       
  2044 	//
       
  2045 
       
  2046 	// Open the ADN store
       
  2047 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  2048 
       
  2049 	// Backup first Entry
       
  2050 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  2051 			KMainPhone, KMainONStore);
       
  2052 	TBackupAllEntries backup(*this,onStore);
       
  2053 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  2054 	CleanupStack::PushL (backup);
       
  2055 
       
  2056 	// Ensure phone has KCapsReadAccess | KCapsWriteAccess | KCapsNotifyEvent capabilities. 
       
  2057 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  2058 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  2059 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  2060 	CleanupStack::PushL (onStoreInfoStatus);
       
  2061 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  2062 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  2063 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  2064 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  2065 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsWriteAccess | RMobilePhoneStore::KCapsNotifyEvent),KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  2066 
       
  2067 	// Fill the phone book. 
       
  2068 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  2069 	RMobileONStore::TMobileONEntryV1 entry;
       
  2070 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  2071 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  2072 	CleanupStack::PushL (writeStatus);
       
  2073 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  2074 	entry.iService=RMobilePhone::ETelephony;
       
  2075 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  2076 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  2077 	entry.iNumber.iTelNumber = _L("12012030");
       
  2078 	entry.iText = _L("Entry11");
       
  2079 	TInt usedEntries,totalEntries;
       
  2080 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  2081 	for (; usedEntries<totalEntries;++usedEntries)
       
  2082 		{
       
  2083 		entry.iIndex=-1;
       
  2084 		onStore.Write (writeStatus, writePckg);
       
  2085 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  2086 				KErrNone, _L("RMobileONStore::Write timed out"));
       
  2087 		CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  2088 		}
       
  2089 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  2090 	CHECK_EQUALS_L(usedEntries,totalEntries, _L("RMobileONStore::GetInfo Unexpected number of iUsedEntries returned" ));
       
  2091 
       
  2092 
       
  2093 	//
       
  2094 	// SET UP END
       
  2095 	//
       
  2096 
       
  2097 	StartTest ();
       
  2098 
       
  2099 	//
       
  2100 	// TEST START
       
  2101 	//
       
  2102 
       
  2103 
       
  2104 	// ===  Find out how many entries are used in the phone book ===
       
  2105 
       
  2106 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneBookStore::TMobileONStoreInfoV1  
       
  2107 
       
  2108 	// Store iUsedEntries returned for future use 
       
  2109 
       
  2110 	// Store iTotalEntries for future use 
       
  2111 
       
  2112 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2113 
       
  2114 	// Store iUsedEntries returned for future use 
       
  2115 	TInt savedUsedEntries = -1;
       
  2116 	TInt savedUsedEntries2 = -1;
       
  2117 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  2118 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2119 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2120 
       
  2121 	// ===  Delete an entry ===
       
  2122 
       
  2123 	// Post notify event
       
  2124 	TUint32 deleteEvent;
       
  2125 	TInt index;
       
  2126 	TExtEtelRequestStatus notifyDeleteEventStatus(onStore,
       
  2127 			EMobilePhoneStoreNotifyStoreEvent);
       
  2128 	CleanupStack::PushL (notifyDeleteEventStatus);
       
  2129 	onStore.NotifyStoreEvent (notifyDeleteEventStatus, deleteEvent, index);
       
  2130 
       
  2131 	// Delete entry from the phone book specifying aIndex = 1 
       
  2132 	TExtEtelRequestStatus deleteStatus(onStore, EMobilePhoneStoreDelete);
       
  2133 	CleanupStack::PushL (deleteStatus);
       
  2134 	onStore.Delete (deleteStatus, 1);
       
  2135 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  2136 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileONStore::Delete returned an error"));
       
  2137 
       
  2138 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreEntryDeleted
       
  2139 	RMobilePhoneStore::TMobileStoreEvent expectedEvent = RMobilePhoneStore::KStoreEntryDeleted;
       
  2140 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  2141 			notifyDeleteEventStatus, deleteEvent, expectedEvent, index,KErrNone);
       
  2142 
       
  2143 	// ===  Get the number of used entries and check it is 1 lower than before deleting the new entry ===
       
  2144 
       
  2145 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 lower  than that stored.
       
  2146 
       
  2147 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 lower than that stored.
       
  2148 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,
       
  2149 			phone,savedUsedEntries-1,savedUsedEntries2-1), 
       
  2150 			KErrNone, 
       
  2151 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2152 
       
  2153 	// ===  Attempt to read the deleted entry.  ===
       
  2154 
       
  2155 	// Read a single entry stored in the slot used in delete 
       
  2156 	RMobileONStore::TMobileONEntryV1 readEntry;
       
  2157 	RMobileONStore::TMobileONEntryV1Pckg entryPckg(readEntry);
       
  2158 	readEntry.iIndex=1;
       
  2159 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
  2160 	CleanupStack::PushL (readStatus);
       
  2161 	onStore.Read (readStatus, entryPckg);
       
  2162 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
  2163 			KErrNone, _L("RMobileONStore::Read timed out"));
       
  2164 
       
  2165 	// Check KErrNotFound is returned.
       
  2166 	// $CTSYProblem The LTSY returns KErrNone to CTSY when an entry is read from an empty slot
       
  2167 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
  2168 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
  2169 	// should be expected in this case.
       
  2170 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
  2171 
       
  2172 	// ===  Attempt to delete the already deleted entry again. ===
       
  2173 
       
  2174 	// Delete the already deleted entry 
       
  2175 	onStore.Delete (deleteStatus, 1);
       
  2176 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  2177 
       
  2178 	// Check KErrNotFound is returned
       
  2179 	// $CTSYProblem The LTSY returns KErrNone to CTSY when an entry is deleted from an empty slot
       
  2180 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
  2181 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
  2182 	// should be expected in this case.
       
  2183 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileONStore::Delete returned unexpected"));
       
  2184 
       
  2185 	// Repeat whole test with aIndex = TMobileONStoreInfoV1::iTotalEntries (the last slot) 
       
  2186 	onStore.NotifyStoreEvent (notifyDeleteEventStatus, deleteEvent, index);
       
  2187 	onStore.Delete (deleteStatus, storeInfo.iTotalEntries);
       
  2188 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  2189 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileONStore::Delete returned an error"));
       
  2190 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  2191 			notifyDeleteEventStatus, deleteEvent, expectedEvent, index,KErrNone);
       
  2192 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,
       
  2193 			phone,savedUsedEntries-2,savedUsedEntries2-2), 
       
  2194 			KErrNone, 
       
  2195 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2196 	readEntry.iIndex=storeInfo.iTotalEntries;
       
  2197 	onStore.Read (readStatus, entryPckg);
       
  2198 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
  2199 			KErrNone, _L("RMobileONStore::Read timed out"));
       
  2200 	// $CTSYProblem The LTSY returns KErrNone to CTSY when an entry is read from an empty slot
       
  2201 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
  2202 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
  2203 	// should be expected in this case.
       
  2204 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
  2205 	onStore.Delete (deleteStatus, storeInfo.iTotalEntries);
       
  2206 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  2207 	// $CTSYProblem The LTSY returns KErrNone to CTSY when an entry is deleted from an empty slot
       
  2208 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
  2209 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
  2210 	// should be expected in this case.
       
  2211 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileONStore::Delete returned unexpected"));
       
  2212 
       
  2213 
       
  2214 	//
       
  2215 	// TEST END
       
  2216 	//
       
  2217 
       
  2218 	StartCleanup();
       
  2219 
       
  2220 	
       
  2221 	// Pop:
       
  2222 	//	readStatus
       
  2223 	//	deleteStatus
       
  2224 	//	notifyDeleteEventStatus
       
  2225 	//	writeStatus
       
  2226 	//	onStoreInfoStatus
       
  2227 	//	backup
       
  2228 	CleanupStack::PopAndDestroy(6,&backup);
       
  2229 
       
  2230 	return TestStepResult();
       
  2231 	}
       
  2232 
       
  2233 TPtrC CCTSYIntegrationTestONStore0011::GetTestStepName()
       
  2234 /**
       
  2235  * @return The test step name.
       
  2236  */
       
  2237 	{
       
  2238 	return _L("CCTSYIntegrationTestONStore0011");
       
  2239 	}
       
  2240 
       
  2241 CCTSYIntegrationTestONStore0012::CCTSYIntegrationTestONStore0012(
       
  2242 		CEtelSessionMgr& aEtelSessionMgr) :
       
  2243 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  2244 /**
       
  2245  * Constructor.
       
  2246  */
       
  2247 	{
       
  2248 	SetTestStepName(CCTSYIntegrationTestONStore0012::GetTestStepName());
       
  2249 	}
       
  2250 
       
  2251 CCTSYIntegrationTestONStore0012::~CCTSYIntegrationTestONStore0012()
       
  2252 /**
       
  2253  * Destructor.
       
  2254  */
       
  2255 	{
       
  2256 	}
       
  2257 
       
  2258 TVerdict CCTSYIntegrationTestONStore0012::doTestStepL()
       
  2259 /**
       
  2260  * @SYMTestCaseID BA-CTSY-INT-PBON-0012
       
  2261  * @SYMFssID BA/CTSY/PBON-0012
       
  2262  * @SYMTestCaseDesc Delete entry from the ON store which does not exist.
       
  2263  * @SYMTestPriority High
       
  2264  * @SYMTestActions RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo
       
  2265  * @SYMTestExpectedResults Pass - Error returned on delete.
       
  2266  * @SYMTestType CIT
       
  2267  * @SYMTestCaseDependencies live/automatic
       
  2268  *
       
  2269  * Reason for test: Verify KErrNotFound is returned.
       
  2270  *
       
  2271  * @return - TVerdict code
       
  2272  */
       
  2273 	{
       
  2274 
       
  2275 	//
       
  2276 	// SET UP
       
  2277 	//
       
  2278 
       
  2279 	// Open the ADN store
       
  2280 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  2281 
       
  2282 	// Ensure phone has KCapsReadAccess and KCapsWriteAccess capabilities. 
       
  2283 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  2284 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  2285 			KMainPhone, KMainONStore);
       
  2286 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  2287 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  2288 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  2289 	CleanupStack::PushL (onStoreInfoStatus);
       
  2290 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  2291 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  2292 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  2293 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  2294 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsWriteAccess),
       
  2295 			KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  2296 
       
  2297 	// Backup first Entry
       
  2298 	TBackupAllEntries backup(*this,onStore);
       
  2299 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  2300 	CleanupStack::PushL (backup);
       
  2301 
       
  2302 	// Ensure there is an empty slot in a known location. 
       
  2303 	TInt clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
  2304 	CHECK_TRUE_L(clearSpace>=0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL was unable to get an empty space"));
       
  2305 
       
  2306 	//
       
  2307 	// SET UP END
       
  2308 	//
       
  2309 
       
  2310 	StartTest ();
       
  2311 
       
  2312 	//
       
  2313 	// TEST START
       
  2314 	//
       
  2315 
       
  2316 
       
  2317 	// ===  Find out how many entries are used in the phone book ===
       
  2318 
       
  2319 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  2320 
       
  2321 	// Store iUsedEntries returned for future use 
       
  2322 
       
  2323 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2324 
       
  2325 	// Store iUsedEntries returned for future use 
       
  2326 	TInt savedUsedEntries = -1;
       
  2327 	TInt savedUsedEntries2 = -1;
       
  2328 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  2329 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2330 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2331 
       
  2332 	// Delete an entry using RMobilePhoneStore::Delete where aIndex is the index of a known empty slot. 
       
  2333 	// Check KErrNotFound is returned.
       
  2334 	TExtEtelRequestStatus deleteStatus(onStore, EMobilePhoneStoreDelete);
       
  2335 	CleanupStack::PushL (deleteStatus);
       
  2336 	onStore.Delete (deleteStatus, clearSpace);
       
  2337 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  2338 	// $CTSYProblem The LTSY returns KErrNone to CTSY when an entry is deleted from a slot which is already empty
       
  2339 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
  2340 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
  2341 	// should be expected in this case.
       
  2342 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileONStore::Delete returned an error"));
       
  2343 
       
  2344 	// ===  Get the number of used entries and check it is the same as before attempted delete ===
       
  2345 
       
  2346 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is same as before
       
  2347 	
       
  2348 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is same as before
       
  2349 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedUsedEntries,savedUsedEntries2), 
       
  2350 			KErrNone, 
       
  2351 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2352 
       
  2353 	//
       
  2354 	// TEST END
       
  2355 	//
       
  2356 
       
  2357 	StartCleanup();
       
  2358 
       
  2359 	
       
  2360 	// Pop:
       
  2361 	//	deleteStatus
       
  2362 	//	backup
       
  2363 	//	onStoreInfoStatus
       
  2364 	CleanupStack::PopAndDestroy(3,&onStoreInfoStatus);
       
  2365 
       
  2366 	return TestStepResult();
       
  2367 	}
       
  2368 
       
  2369 TPtrC CCTSYIntegrationTestONStore0012::GetTestStepName()
       
  2370 /**
       
  2371  * @return The test step name.
       
  2372  */
       
  2373 	{
       
  2374 	return _L("CCTSYIntegrationTestONStore0012");
       
  2375 	}
       
  2376 
       
  2377 CCTSYIntegrationTestONStore0013::CCTSYIntegrationTestONStore0013(
       
  2378 		CEtelSessionMgr& aEtelSessionMgr) :
       
  2379 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  2380 /**
       
  2381  * Constructor.
       
  2382  */
       
  2383 	{
       
  2384 	SetTestStepName(CCTSYIntegrationTestONStore0013::GetTestStepName());
       
  2385 	}
       
  2386 
       
  2387 CCTSYIntegrationTestONStore0013::~CCTSYIntegrationTestONStore0013()
       
  2388 /**
       
  2389  * Destructor.
       
  2390  */
       
  2391 	{
       
  2392 	}
       
  2393 
       
  2394 TVerdict CCTSYIntegrationTestONStore0013::doTestStepL()
       
  2395 /**
       
  2396  * @SYMTestCaseID BA-CTSY-INT-PBON-0013
       
  2397  * @SYMFssID BA/CTSY/PBON-0013
       
  2398  * @SYMTestCaseDesc Delete entry from the ON store which makes the store empty.
       
  2399  * @SYMTestPriority High
       
  2400  * @SYMTestActions RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  2401  * @SYMTestExpectedResults Pass - Entry deleted, RMobilePhoneStore::KStoreEmpty event occurs.
       
  2402  * @SYMTestType CIT
       
  2403  * @SYMTestCaseDependencies live/automatic
       
  2404  *
       
  2405  * Reason for test: Verify entry deleted and KStoreEmpty event occurs.
       
  2406  *
       
  2407  * @return - TVerdict code
       
  2408  */
       
  2409 	{
       
  2410 
       
  2411 	//
       
  2412 	// SET UP
       
  2413 	//
       
  2414 
       
  2415 	// Open the ADN store
       
  2416 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  2417 
       
  2418 	// Backup first Entry
       
  2419 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  2420 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  2421 			KMainPhone, KMainONStore);
       
  2422 	TBackupAllEntries backup(*this,onStore);
       
  2423 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  2424 	CleanupStack::PushL (backup);
       
  2425 
       
  2426 	// Ensure phone has KCapsReadAccess | KCapsWriteAccess | KCapsNotifyEvent capabilities. 
       
  2427 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  2428 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  2429 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  2430 	CleanupStack::PushL (onStoreInfoStatus);
       
  2431 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  2432 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  2433 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  2434 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  2435 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsWriteAccess | RMobilePhoneStore::KCapsNotifyEvent),KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  2436 
       
  2437 	// Delete all the entries from the phone book then write one entry to a known location. 
       
  2438 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
  2439 	CleanupStack::PushL (deleteAllStatus);
       
  2440 	onStore.DeleteAll (deleteAllStatus);
       
  2441 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  2442 	CHECK_EQUALS_L(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
  2443 	RMobileONStore::TMobileONEntryV1 entry;
       
  2444 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  2445 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  2446 	CleanupStack::PushL (writeStatus);
       
  2447 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  2448 	entry.iService=RMobilePhone::ETelephony;
       
  2449 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  2450 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  2451 	_LIT(KNumber, "12345");
       
  2452 	entry.iNumber.iTelNumber = KNumber;
       
  2453 	entry.iText = _L("Entry 1");
       
  2454 	entry.iIndex=1;
       
  2455 	onStore.Write (writeStatus, writePckg);
       
  2456 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  2457 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  2458 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  2459 
       
  2460 
       
  2461 	//
       
  2462 	// SET UP END
       
  2463 	//
       
  2464 
       
  2465 	StartTest ();
       
  2466 
       
  2467 	//
       
  2468 	// TEST START
       
  2469 	//
       
  2470 
       
  2471 
       
  2472 	// ===  Find out how many entries are used in the phone book ===
       
  2473 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1 
       
  2474 	// Check iUsedEntries is 1
       
  2475 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2476 	// Store iUsedEntries is 1 
       
  2477 	TInt usedEntries =-1;
       
  2478 	TInt usedEntries2 = -1;
       
  2479 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  2480 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2481 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,usedEntries,usedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2482 	ASSERT_EQUALS(usedEntries,1,_L("RMobilePhoneStore::GetInfo returned an unexpected value."));
       
  2483 
       
  2484 	// Post notify event
       
  2485 	TUint32 deleteEvent;
       
  2486 	TInt index;
       
  2487 	TExtEtelRequestStatus notifyDeleteEventStatus(onStore,
       
  2488 			EMobilePhoneStoreNotifyStoreEvent);
       
  2489 	CleanupStack::PushL (notifyDeleteEventStatus);
       
  2490 	onStore.NotifyStoreEvent (notifyDeleteEventStatus, deleteEvent, index);
       
  2491 	
       
  2492 	// Delete the entry from the ON store 
       
  2493 	TExtEtelRequestStatus deleteStatus(onStore, EMobilePhoneStoreDelete);
       
  2494 	CleanupStack::PushL (deleteStatus);
       
  2495 	onStore.Delete (deleteStatus, 1);
       
  2496 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  2497 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileONStore::Delete returned an error"));
       
  2498 
       
  2499 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreEntryDeleted
       
  2500     // Due to defect 10039 (see above) KStoreEmpty will not returned
       
  2501 	TInt32 expectedEvent = RMobilePhoneStore::KStoreEntryDeleted;
       
  2502 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  2503 			notifyDeleteEventStatus, deleteEvent, expectedEvent, index,KErrNone);
       
  2504 
       
  2505 	// ===  Get the number of used entries and check it is the same as before attempted delete ===
       
  2506 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries of 0
       
  2507 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries of 0
       
  2508 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,usedEntries,usedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2509 	ASSERT_EQUALS(usedEntries,0,_L("RMobilePhoneStore::GetInfo returned an unexpected value."));
       
  2510 
       
  2511 
       
  2512 	//
       
  2513 	// TEST END
       
  2514 	//
       
  2515 
       
  2516 	StartCleanup();
       
  2517 
       
  2518 	// Pop:
       
  2519 	//	deleteStatus
       
  2520 	//	notifyDeleteEventStatus
       
  2521 	//	writeStatus
       
  2522 	//	deleteAllStatus
       
  2523 	//	onStoreInfoStatus
       
  2524 	//	backup
       
  2525 	CleanupStack::PopAndDestroy(6,&backup);
       
  2526 
       
  2527 	return TestStepResult();
       
  2528 	}
       
  2529 
       
  2530 TPtrC CCTSYIntegrationTestONStore0013::GetTestStepName()
       
  2531 /**
       
  2532  * @return The test step name.
       
  2533  */
       
  2534 	{
       
  2535 	return _L("CCTSYIntegrationTestONStore0013");
       
  2536 	}
       
  2537 
       
  2538 CCTSYIntegrationTestONStore0014::CCTSYIntegrationTestONStore0014(
       
  2539 		CEtelSessionMgr& aEtelSessionMgr) :
       
  2540 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  2541 /**
       
  2542  * Constructor.
       
  2543  */
       
  2544 	{
       
  2545 	SetTestStepName(CCTSYIntegrationTestONStore0014::GetTestStepName());
       
  2546 	}
       
  2547 
       
  2548 CCTSYIntegrationTestONStore0014::~CCTSYIntegrationTestONStore0014()
       
  2549 /**
       
  2550  * Destructor.
       
  2551  */
       
  2552 	{
       
  2553 	}
       
  2554 
       
  2555 TVerdict CCTSYIntegrationTestONStore0014::doTestStepL()
       
  2556 /**
       
  2557  * @SYMTestCaseID BA-CTSY-INT-PBON-0014
       
  2558  * @SYMFssID BA/CTSY/PBON-0014
       
  2559  * @SYMTestCaseDesc Delete an entry from a full ON store.
       
  2560  * @SYMTestPriority High
       
  2561  * @SYMTestActions RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  2562  * @SYMTestExpectedResults Pass - Entries deleted, RMobilePhoneStore::KStoreHasSpace event occurs.
       
  2563  * @SYMTestType CIT
       
  2564  * @SYMTestCaseDependencies live/manual
       
  2565  *
       
  2566  * Reason for test: Verify entry deleted and KStoreHasSpace event occurs.
       
  2567  *
       
  2568  * @return - TVerdict code
       
  2569  */
       
  2570 	{
       
  2571 
       
  2572 	//
       
  2573 	// SET UP
       
  2574 	//
       
  2575 
       
  2576 	// Open the ADN store
       
  2577 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  2578 
       
  2579 	// Backup first Entry
       
  2580 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  2581 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  2582 			KMainPhone, KMainONStore);
       
  2583 	TBackupAllEntries backup(*this,onStore);
       
  2584 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  2585 	CleanupStack::PushL (backup);
       
  2586 
       
  2587 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsNotifyEvent 
       
  2588 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  2589 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  2590 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  2591 	CleanupStack::PushL (onStoreInfoStatus);
       
  2592 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  2593 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  2594 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  2595 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  2596 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsWriteAccess | RMobilePhoneStore::KCapsNotifyEvent),KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  2597 
       
  2598 	// Ensure phone book is full 
       
  2599 	RMobileONStore::TMobileONEntryV1 entry;
       
  2600 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  2601 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  2602 	CleanupStack::PushL (writeStatus);
       
  2603 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  2604 	entry.iService=RMobilePhone::ETelephony;
       
  2605 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  2606 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  2607 	entry.iNumber.iTelNumber = _L("12012030");
       
  2608 	entry.iText = _L("Entry11");
       
  2609 	TInt usedEntries,totalEntries;
       
  2610 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  2611 	for (; usedEntries<totalEntries;++usedEntries)
       
  2612 		{
       
  2613 		entry.iIndex=-1;
       
  2614 		onStore.Write (writeStatus, writePckg);
       
  2615 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  2616 				KErrNone, _L("RMobileONStore::Write timed out"));
       
  2617 		CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  2618 		}
       
  2619 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  2620 	CHECK_EQUALS_L(usedEntries,totalEntries, _L("RMobileONStore::GetInfo Unexpected number of iUsedEntries returned" ));
       
  2621 
       
  2622 
       
  2623 	//
       
  2624 	// SET UP END
       
  2625 	//
       
  2626 
       
  2627 	StartTest ();
       
  2628 
       
  2629 	//
       
  2630 	// TEST START
       
  2631 	//
       
  2632 
       
  2633 
       
  2634 	// ===  Find out how many entries are used in the phone book ===
       
  2635 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  2636 	// Store iUsedEntries returned for future use 
       
  2637 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2638 	// Store iUsedEntries returned for future use 
       
  2639 	usedEntries =-1;
       
  2640 	TInt usedEntries2 = -1;
       
  2641 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  2642 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2643 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,usedEntries,usedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2644 
       
  2645 	// Post notify event
       
  2646 	TUint32 deleteEvent;
       
  2647 	TInt index;
       
  2648 	TExtEtelRequestStatus notifyDeleteEventStatus(onStore,
       
  2649 			EMobilePhoneStoreNotifyStoreEvent);
       
  2650 	CleanupStack::PushL (notifyDeleteEventStatus);
       
  2651 	onStore.NotifyStoreEvent (notifyDeleteEventStatus, deleteEvent, index);
       
  2652 
       
  2653 	// Delete an entry from the phone book. 
       
  2654 	TExtEtelRequestStatus deleteStatus(onStore, EMobilePhoneStoreDelete);
       
  2655 	CleanupStack::PushL (deleteStatus);
       
  2656 	onStore.Delete (deleteStatus, 1);
       
  2657 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  2658 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileONStore::Delete returned an error"));
       
  2659 
       
  2660 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreHasSpace | RMobilePhoneStore::KStoreEntryDeleted
       
  2661     // Checking for KStoreHasSpace will fail, see defect 10039
       
  2662 	TInt32 expectedEvent = RMobilePhoneStore::KStoreEntryDeleted;
       
  2663 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  2664 			notifyDeleteEventStatus, deleteEvent, expectedEvent, index,KErrNone);
       
  2665 
       
  2666 	// ===  Get the number of used entries and check it is one lower than before ===
       
  2667 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries is one lower than before
       
  2668 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries is one lower than before
       
  2669 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,
       
  2670 			phone,usedEntries-1,usedEntries2-1), 
       
  2671 			KErrNone, 
       
  2672 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2673 
       
  2674 
       
  2675 	//
       
  2676 	// TEST END
       
  2677 	//
       
  2678 
       
  2679 	StartCleanup();
       
  2680 
       
  2681 	// Pop:
       
  2682 	//	deleteStatus
       
  2683 	//	notifyDeleteEventStatus
       
  2684 	//	writeStatus
       
  2685 	//	onStoreInfoStatus
       
  2686 	//	backup
       
  2687 	CleanupStack::PopAndDestroy(5,&backup);
       
  2688 
       
  2689 	return TestStepResult();
       
  2690 	}
       
  2691 
       
  2692 TPtrC CCTSYIntegrationTestONStore0014::GetTestStepName()
       
  2693 /**
       
  2694  * @return The test step name.
       
  2695  */
       
  2696 	{
       
  2697 	return _L("CCTSYIntegrationTestONStore0014");
       
  2698 	}
       
  2699 
       
  2700 CCTSYIntegrationTestONStore0015::CCTSYIntegrationTestONStore0015(
       
  2701 		CEtelSessionMgr& aEtelSessionMgr) :
       
  2702 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  2703 /**
       
  2704  * Constructor.
       
  2705  */
       
  2706 	{
       
  2707 	SetTestStepName(CCTSYIntegrationTestONStore0015::GetTestStepName());
       
  2708 	}
       
  2709 
       
  2710 CCTSYIntegrationTestONStore0015::~CCTSYIntegrationTestONStore0015()
       
  2711 /**
       
  2712  * Destructor.
       
  2713  */
       
  2714 	{
       
  2715 	}
       
  2716 
       
  2717 TVerdict CCTSYIntegrationTestONStore0015::doTestStepL()
       
  2718 /**
       
  2719  * @SYMTestCaseID BA-CTSY-INT-PBON-0015
       
  2720  * @SYMFssID BA/CTSY/PBON-0015
       
  2721  * @SYMTestCaseDesc Delete all entries from the ON store.
       
  2722  * @SYMTestPriority High
       
  2723  * @SYMTestActions RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  2724  * @SYMTestExpectedResults Pass - Entries deleted, RMobilePhoneStore::KStoreEmpty event occurs.
       
  2725  * @SYMTestType CIT
       
  2726  * @SYMTestCaseDependencies live/automatic
       
  2727  *
       
  2728  * Reason for test: All entries deleted.
       
  2729  *
       
  2730  * @return - TVerdict code
       
  2731  */
       
  2732 	{
       
  2733 
       
  2734 	//
       
  2735 	// SET UP
       
  2736 	//
       
  2737 
       
  2738 	// Open the ADN store
       
  2739 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  2740 
       
  2741 	// Backup first Entry
       
  2742 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  2743 			KMainPhone, KMainONStore);
       
  2744 	TBackupAllEntries backup(*this,onStore);
       
  2745 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  2746 	CleanupStack::PushL (backup);
       
  2747 
       
  2748 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsNotifyEvent 
       
  2749 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  2750 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  2751 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  2752 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  2753 	CleanupStack::PushL (onStoreInfoStatus);
       
  2754 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  2755 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  2756 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  2757 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  2758 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsNotifyEvent |  RMobilePhoneStore::KCapsWriteAccess),KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  2759 	RMobileONStore::TMobileONEntryV1 entry;
       
  2760 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  2761 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  2762 	CleanupStack::PushL (writeStatus);
       
  2763 
       
  2764 	// Ensure phone book is not empty 
       
  2765 	TInt clearSpace;
       
  2766 	CHECK_TRUE_L(GetUsedEntriesL(onStore,phone,clearSpace),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  2767 	if ( clearSpace == 0)
       
  2768 		{
       
  2769 
       
  2770 		// Create and write entry for 1st slot
       
  2771 		entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  2772 		entry.iService=RMobilePhone::ETelephony;
       
  2773 		entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  2774 		entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  2775 		_LIT(KNumber, "12345");
       
  2776 		entry.iNumber.iTelNumber = KNumber;
       
  2777 		entry.iText = _L("Entry 1");
       
  2778 		entry.iIndex=1;
       
  2779 		onStore.Write (writeStatus, writePckg);
       
  2780 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  2781 				KErrNone, _L("RMobileONStore::Write timed out"));
       
  2782 		CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  2783 		CHECK_TRUE_L(GetUsedEntriesL(onStore,phone,clearSpace),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  2784 		CHECK_TRUE_L(clearSpace >0, _L("CCTSYIntegrationTestONStore0015::doTestStepL was unable to add entry"));
       
  2785 		}
       
  2786 
       
  2787 	//
       
  2788 	// SET UP END
       
  2789 	//
       
  2790 
       
  2791 	StartTest ();
       
  2792 
       
  2793 	//
       
  2794 	// TEST START
       
  2795 	//
       
  2796 
       
  2797 
       
  2798 	// ===  Delete all entries from the phone book ===
       
  2799 
       
  2800 	// Post notify event
       
  2801 	TUint32 storeEvent;
       
  2802 	TInt index;
       
  2803 	TExtEtelRequestStatus notifyStoreEventStatus(onStore,
       
  2804 			EMobilePhoneStoreNotifyStoreEvent);
       
  2805 	CleanupStack::PushL (notifyStoreEventStatus);
       
  2806 	onStore.NotifyStoreEvent (notifyStoreEventStatus, storeEvent, index);
       
  2807 
       
  2808 	// Delete all entries from the full phone book 
       
  2809 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
  2810 	CleanupStack::PushL (deleteAllStatus);
       
  2811 	onStore.DeleteAll (deleteAllStatus);
       
  2812 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  2813 	ASSERT_EQUALS(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
  2814 
       
  2815 	// Check RMobilePhoneStore::NotifyStoreEvent complete with KStoreEmpty
       
  2816 	RMobilePhoneStore::TMobileStoreEvent
       
  2817 			expectedEvent = RMobilePhoneStore::KStoreEmpty;
       
  2818 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  2819 			notifyStoreEventStatus, storeEvent, expectedEvent, index,KErrNone);
       
  2820 
       
  2821 	// ===  Check phone book is empty ===
       
  2822 
       
  2823 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  2824 
       
  2825 	// Check iUsedEntries == 0
       
  2826 
       
  2827 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2828 
       
  2829 	// Check iUsedEntries == 0
       
  2830 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  2831 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2832 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,0,0), 
       
  2833 			KErrNone, 
       
  2834 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2835 
       
  2836 	//
       
  2837 	// TEST END
       
  2838 	//
       
  2839 
       
  2840 	StartCleanup();
       
  2841 
       
  2842 	
       
  2843 	// Pop:
       
  2844 	//	deleteAllStatus
       
  2845 	//	notifyStoreEventStatus
       
  2846 	//	writeStatus
       
  2847 	//	onStoreInfoStatus
       
  2848 	//	backup
       
  2849 	CleanupStack::PopAndDestroy(5,&backup);
       
  2850 
       
  2851 	return TestStepResult();
       
  2852 	}
       
  2853 
       
  2854 TPtrC CCTSYIntegrationTestONStore0015::GetTestStepName()
       
  2855 /**
       
  2856  * @return The test step name.
       
  2857  */
       
  2858 	{
       
  2859 	return _L("CCTSYIntegrationTestONStore0015");
       
  2860 	}
       
  2861 
       
  2862 CCTSYIntegrationTestONStore0016::CCTSYIntegrationTestONStore0016(
       
  2863 		CEtelSessionMgr& aEtelSessionMgr) :
       
  2864 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  2865 /**
       
  2866  * Constructor.
       
  2867  */
       
  2868 	{
       
  2869 	SetTestStepName(CCTSYIntegrationTestONStore0016::GetTestStepName());
       
  2870 	}
       
  2871 
       
  2872 CCTSYIntegrationTestONStore0016::~CCTSYIntegrationTestONStore0016()
       
  2873 /**
       
  2874  * Destructor.
       
  2875  */
       
  2876 	{
       
  2877 	}
       
  2878 
       
  2879 TVerdict CCTSYIntegrationTestONStore0016::doTestStepL()
       
  2880 /**
       
  2881  * @SYMTestCaseID BA-CTSY-INT-PBON-0016
       
  2882  * @SYMFssID BA/CTSY/PBON-0016
       
  2883  * @SYMTestCaseDesc Cancel delete of all entries from the ON store.
       
  2884  * @SYMTestPriority High
       
  2885  * @SYMTestActions RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo
       
  2886  * @SYMTestExpectedResults Pass - Some entries deleted, request cancelled successfully. Store not empty.
       
  2887  * @SYMTestType CIT
       
  2888  * @SYMTestCaseDependencies live/automatic
       
  2889  *
       
  2890  * Reason for test: Verify some entries deleted before cancellation but cancellation occurs.
       
  2891  *
       
  2892  * @return - TVerdict code
       
  2893  */
       
  2894 	{
       
  2895 
       
  2896 	//
       
  2897 	// SET UP
       
  2898 	//
       
  2899 
       
  2900 	// Open the ADN store
       
  2901 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  2902 
       
  2903 	// Backup first Entry
       
  2904 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  2905 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  2906 			KMainPhone, KMainONStore);
       
  2907 	TBackupAllEntries backup(*this,onStore);
       
  2908 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  2909 	CleanupStack::PushL (backup);
       
  2910 
       
  2911 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess 
       
  2912 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  2913 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  2914 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  2915 	CleanupStack::PushL (onStoreInfoStatus);
       
  2916 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  2917 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  2918 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  2919 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  2920 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsWriteAccess),KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  2921 
       
  2922 	// Ensure phone book is full 
       
  2923 	RMobileONStore::TMobileONEntryV1 entry;
       
  2924 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  2925 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  2926 	CleanupStack::PushL (writeStatus);
       
  2927 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  2928 	entry.iService=RMobilePhone::ETelephony;
       
  2929 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  2930 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  2931 	entry.iNumber.iTelNumber = _L("12012030");
       
  2932 	entry.iText = _L("Entry11");
       
  2933 	TInt usedEntries,totalEntries;
       
  2934 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  2935 	for (; usedEntries<totalEntries;++usedEntries)
       
  2936 		{
       
  2937 		entry.iIndex=-1;
       
  2938 		onStore.Write (writeStatus, writePckg);
       
  2939 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  2940 				KErrNone, _L("RMobileONStore::Write timed out"));
       
  2941 		CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  2942 		}
       
  2943 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  2944 	CHECK_EQUALS_L(usedEntries,totalEntries, _L("RMobileONStore::GetInfo Unexpected number of iUsedEntries returned" ));
       
  2945 
       
  2946 
       
  2947 	//
       
  2948 	// SET UP END
       
  2949 	//
       
  2950 
       
  2951 	StartTest ();
       
  2952 
       
  2953 	//
       
  2954 	// TEST START
       
  2955 	//
       
  2956 
       
  2957 
       
  2958 	// ===  Find out how many entries are used in the phone book ===
       
  2959 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  2960 	// Store iUsedEntries returned for future use 
       
  2961 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2962 	// Store iUsedEntries returned for future use 
       
  2963 	usedEntries =-1;
       
  2964 	TInt usedEntries2 = -1;
       
  2965 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  2966 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2967 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,usedEntries,usedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2968 
       
  2969 	// ===  Delete all entries from the phone book ===
       
  2970 
       
  2971 	// Delete all entries from the full phone book 
       
  2972 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
  2973 	CleanupStack::PushL (deleteAllStatus);
       
  2974 	onStore.DeleteAll (deleteAllStatus);
       
  2975 
       
  2976 	// Do not wait for the request to complete. 
       
  2977 	// Wait for 1 second. 
       
  2978 	User::After(KOneSecond);
       
  2979 	
       
  2980 	// Cancel the DeleteAll operation. Check KErrCancel returned on status of DeleteAll 
       
  2981 	onStore.CancelAsyncRequest(EMobilePhoneStoreDeleteAll);
       
  2982 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  2983 	ASSERT_TRUE(((deleteAllStatus.Int()== KErrCancel) || (deleteAllStatus.Int()== KErrNone)) , _L("RMobileONStore::DeleteAll did not returned cancel"));
       
  2984 
       
  2985 	// ===  Check phone book is not empty but some entries have been deleted. ===
       
  2986 
       
  2987 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  2988 	TInt newUsedEntries =-1;
       
  2989 	TInt newUsedEntries2 = -1;
       
  2990 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,newUsedEntries,newUsedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2991 
       
  2992 	// Check iUsedEntries < before deletion.
       
  2993 	ASSERT_TRUE(newUsedEntries<=usedEntries,_L("RMobileONStore::DeleteAll failed to delete"));
       
  2994 
       
  2995 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2996 	// Check iUsedEntries < before deletion.
       
  2997 	ASSERT_TRUE(newUsedEntries2<=usedEntries2,_L("RMobileONStore::DeleteAll failed to delete"));
       
  2998 
       
  2999 
       
  3000 	//
       
  3001 	// TEST END
       
  3002 	//
       
  3003 
       
  3004 	StartCleanup();
       
  3005 
       
  3006 	// Pop:
       
  3007 	//	deleteAllStatus
       
  3008 	//	writeStatus
       
  3009 	//	onStoreInfoStatus
       
  3010 	//	backup
       
  3011 	CleanupStack::PopAndDestroy(4,&backup);
       
  3012 
       
  3013 	return TestStepResult();
       
  3014 	}
       
  3015 
       
  3016 TPtrC CCTSYIntegrationTestONStore0016::GetTestStepName()
       
  3017 /**
       
  3018  * @return The test step name.
       
  3019  */
       
  3020 	{
       
  3021 	return _L("CCTSYIntegrationTestONStore0016");
       
  3022 	}
       
  3023 
       
  3024 CCTSYIntegrationTestONStore0017::CCTSYIntegrationTestONStore0017(
       
  3025 		CEtelSessionMgr& aEtelSessionMgr) :
       
  3026 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  3027 /**
       
  3028  * Constructor.
       
  3029  */
       
  3030 	{
       
  3031 	SetTestStepName(CCTSYIntegrationTestONStore0017::GetTestStepName());
       
  3032 	}
       
  3033 
       
  3034 CCTSYIntegrationTestONStore0017::~CCTSYIntegrationTestONStore0017()
       
  3035 /**
       
  3036  * Destructor.
       
  3037  */
       
  3038 	{
       
  3039 	}
       
  3040 
       
  3041 TVerdict CCTSYIntegrationTestONStore0017::doTestStepL()
       
  3042 /**
       
  3043  * @SYMTestCaseID BA-CTSY-INT-PBON-0017
       
  3044  * @SYMFssID BA/CTSY/PBON-0017
       
  3045  * @SYMTestCaseDesc Write and delete all own number entries.
       
  3046  * @SYMTestPriority High
       
  3047  * @SYMTestActions RMobileONStore::StoreAllL, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  3048  * @SYMTestExpectedResults Pass - Own numbers stored, read and deleted successfully. KErrNotFound when deleting all entries from an empty store.
       
  3049  * @SYMTestType CIT
       
  3050  * @SYMTestCaseDependencies live/automatic
       
  3051  *
       
  3052  * Reason for test: Verify that entire store can be written to in one call and correct store event occurs.
       
  3053 
       
  3054  Verify KErrNotFound when attempting to delete all entries from an empty store.
       
  3055  *
       
  3056  * @return - TVerdict code
       
  3057  */
       
  3058 	{
       
  3059 
       
  3060 	//
       
  3061 	// SET UP
       
  3062 	//
       
  3063 
       
  3064 	// Open the ADN store
       
  3065 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  3066 
       
  3067 	// Backup first Entry
       
  3068 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  3069 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  3070 			KMainPhone, KMainONStore);
       
  3071 	TBackupAllEntries backup(*this,onStore);
       
  3072 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  3073 	CleanupStack::PushL (backup);
       
  3074 
       
  3075 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsNotifyEvent 
       
  3076 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  3077 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  3078 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  3079 	CleanupStack::PushL (onStoreInfoStatus);
       
  3080 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  3081 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  3082 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  3083 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  3084 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsNotifyEvent),KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  3085 
       
  3086 
       
  3087 	//
       
  3088 	// SET UP END
       
  3089 	//
       
  3090 
       
  3091 	StartTest ();
       
  3092 
       
  3093 	//
       
  3094 	// TEST START
       
  3095 	//
       
  3096 
       
  3097 
       
  3098 	// ===  Find out how many entries can be stored in the ON store ===
       
  3099 
       
  3100 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  3101 
       
  3102 	// Store iTotalEntries for future use 
       
  3103 	TInt usedEntries,savedTotalEntries,usedEntries2,savedTotalEntries2;
       
  3104 	ASSERT_EQUALS(GetNumberOfUsedAndTotalEntriesInStoreL(onStore,phone,usedEntries,usedEntries2,savedTotalEntries,savedTotalEntries2),KErrNone,
       
  3105 			_L("CCTSYIntegrationTestONStore0017::doTestStepL can not get the number of used entries"));
       
  3106 	
       
  3107 	// Populate a CMobilePhoneOnList with iTotalEntries number of valid entries 
       
  3108 	CMobilePhoneONList *list = CMobilePhoneONList::NewL ();
       
  3109 	CleanupStack::PushL (list);
       
  3110 	RMobileONStore::TMobileONEntryV1 entry;
       
  3111 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  3112 	entry.iService=RMobilePhone::ETelephony;
       
  3113 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  3114 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  3115 	entry.iText = _L("Entry2");
       
  3116 	entry.iNumber.iTelNumber = _L("12012032");
       
  3117 	for (TInt i=1; i <= savedTotalEntries;++i)
       
  3118 		{
       
  3119 		entry.iIndex=i;
       
  3120 		if ( entry.iNumber.iTelNumber[0]=='9')
       
  3121 			{
       
  3122 			entry.iNumber.iTelNumber[0]='0';
       
  3123 			}
       
  3124 		else
       
  3125 			{
       
  3126 			entry.iNumber.iTelNumber[0]++;
       
  3127 			}
       
  3128 		list->AddEntryL (entry);
       
  3129 		}
       
  3130 	
       
  3131 	// Post notify event
       
  3132 	TUint32 storeEvent;
       
  3133 	TInt index;
       
  3134 	TExtEtelRequestStatus notifyStoreEventStatus(onStore,
       
  3135 			EMobilePhoneStoreNotifyStoreEvent);
       
  3136 	CleanupStack::PushL (notifyStoreEventStatus);
       
  3137 	onStore.NotifyStoreEvent (notifyStoreEventStatus, storeEvent, index);
       
  3138 	
       
  3139 	// Use RMobileONStore::StoreAllL to store all the entries to the ON store. 
       
  3140 	// Bypass : The session manager can not be used, since a PANIC is created
       
  3141 	RMobileONStore byPassOnStore;
       
  3142 	User::LeaveIfError(byPassOnStore.Open(phone));
       
  3143 	CleanupClosePushL(byPassOnStore);
       
  3144 	// By pass end
       
  3145 	TExtEtelRequestStatus storeAllStatus(byPassOnStore, EMobileONStoreStoreAll);
       
  3146 	CleanupStack::PushL (storeAllStatus);
       
  3147 	byPassOnStore.StoreAllL (storeAllStatus, list);
       
  3148 	ASSERT_EQUALS(WaitForRequestWithTimeOut(storeAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::StoreAllL timed out"));
       
  3149 	ASSERT_EQUALS(storeAllStatus.Int(), KErrNone, _L("RMobileONStore::StoreAllL returned an error"));
       
  3150 
       
  3151 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreDoRefresh | KStoreFull event
       
  3152     //CANT USE KStoreFull, SEE defect 10038
       
  3153 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  3154 			notifyStoreEventStatus, storeEvent, (RMobilePhoneStore::KStoreDoRefresh), index,KErrNone);
       
  3155 
       
  3156 	// ===  Find out how many entries are used in the phone book ===
       
  3157 
       
  3158 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  3159 
       
  3160 	// Check iUsedEntries returned = iTotalEntries returned
       
  3161 	
       
  3162 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  3163 
       
  3164 	// Check iUsedEntries returned = iTotalEntries returnedx
       
  3165 	RMobileONStore::TMobileONStoreInfoV1 storeInfo;
       
  3166 	RMobileONStore::TMobileONStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  3167 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,savedTotalEntries,savedTotalEntries2), 
       
  3168 			KErrNone, 
       
  3169 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  3170 
       
  3171 	// Read all the entries from the ON store 
       
  3172 
       
  3173 	// Check all contain the same data as that written
       
  3174 	RMobileONStore::TMobileONEntryV1 readEntry;
       
  3175 	RMobileONStore::TMobileONEntryV1Pckg entryPckg(readEntry);
       
  3176 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
  3177 	CleanupStack::PushL (readStatus);
       
  3178 	TInt usedSpace;
       
  3179 	ASSERT_TRUE(GetUsedEntriesL(onStore,phone,usedSpace),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  3180 	for (TInt i=1; i<=usedSpace;++i)
       
  3181 		{
       
  3182 		readEntry.iIndex=i;
       
  3183 		onStore.Read (readStatus, entryPckg);
       
  3184 		ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
  3185 				KErrNone, _L("RMobileONStore::Read timed out"));
       
  3186 		ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileONStore::Read returned an error"));
       
  3187 		ASSERT_TRUE(CompareEntries (readEntry, list->GetEntryL (i-1)), _L("RMobileONStore::Read entries are not the same"));
       
  3188 		}
       
  3189 
       
  3190 	// Delete all the entries from the store 
       
  3191 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
  3192 	CleanupStack::PushL (deleteAllStatus);
       
  3193 	onStore.DeleteAll (deleteAllStatus);
       
  3194 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  3195 	ASSERT_EQUALS(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
  3196 
       
  3197 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreEmpty
       
  3198 	RMobilePhoneStore::TMobileStoreEvent
       
  3199 	expectedEvent = RMobilePhoneStore::KStoreEmpty;
       
  3200     ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10039);
       
  3201 	iSimTestHelper.WaitForMobilePhoneStoreNotifyStoreEvent ( onStore,
       
  3202 			notifyStoreEventStatus, storeEvent, expectedEvent, index,KErrNone);
       
  3203 
       
  3204 	// ===  Find out how many entries are used in the phone book ===
       
  3205 
       
  3206 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  3207 
       
  3208 	// Check iUsedEntries is 0
       
  3209 
       
  3210 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  3211 
       
  3212 	// Check iUsedEntries is 0
       
  3213 	ASSERT_EQUALS(iSimTestHelper.AssertNumberOfUsedEntriesCorrectL(onStore,KETelOwnNumberStore,storeInfoPckg,phone,0,0), 
       
  3214 			KErrNone, 
       
  3215 			_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  3216 
       
  3217 	// Delete all entries from the store 
       
  3218 	onStore.DeleteAll (deleteAllStatus);
       
  3219 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  3220 
       
  3221 	// Check KErrNotFound is returned
       
  3222 	// $CTSYProblem The LTSY returns KErrNone to CTSY when all the entries are deleted from an empty store
       
  3223 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
  3224 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
  3225 	// should be expected in this case.
       
  3226 	ASSERT_EQUALS(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
  3227 
       
  3228 
       
  3229 	//
       
  3230 	// TEST END
       
  3231 	//
       
  3232 
       
  3233 	StartCleanup();
       
  3234 
       
  3235 	
       
  3236 	// Pop:
       
  3237 	//	deleteAllStatus
       
  3238 	//	readStatus
       
  3239 	//	storeAllStatus
       
  3240 	//	byPassOnStore
       
  3241 	//	notifyStoreEventStatus
       
  3242 	//	list
       
  3243 	//	onStoreInfoStatus
       
  3244 	//	backup
       
  3245 	CleanupStack::PopAndDestroy(8,&backup);
       
  3246 	
       
  3247 	return TestStepResult();
       
  3248 	}
       
  3249 
       
  3250 TPtrC CCTSYIntegrationTestONStore0017::GetTestStepName()
       
  3251 /**
       
  3252  * @return The test step name.
       
  3253  */
       
  3254 	{
       
  3255 	return _L("CCTSYIntegrationTestONStore0017");
       
  3256 	}
       
  3257 
       
  3258 CCTSYIntegrationTestONStore0018::CCTSYIntegrationTestONStore0018(
       
  3259 		CEtelSessionMgr& aEtelSessionMgr) :
       
  3260 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  3261 /**
       
  3262  * Constructor.
       
  3263  */
       
  3264 	{
       
  3265 	SetTestStepName(CCTSYIntegrationTestONStore0018::GetTestStepName());
       
  3266 	}
       
  3267 
       
  3268 CCTSYIntegrationTestONStore0018::~CCTSYIntegrationTestONStore0018()
       
  3269 /**
       
  3270  * Destructor.
       
  3271  */
       
  3272 	{
       
  3273 	}
       
  3274 
       
  3275 TVerdict CCTSYIntegrationTestONStore0018::doTestStepL()
       
  3276 /**
       
  3277  * @SYMTestCaseID BA-CTSY-INT-PBON-0018
       
  3278  * @SYMFssID BA/CTSY/PBON-0018
       
  3279  * @SYMTestCaseDesc Cancel writing of all entries to the ON store
       
  3280  * @SYMTestPriority High
       
  3281  * @SYMTestActions RMobileONStore::StoreAllL, RMobilePhoneStore::DeleteAll, RMobilePhoneStore::Read, RMobilePhoneStore::GetInfo
       
  3282  * @SYMTestExpectedResults Pass - KErrCancel when cancelling StoreAll operation on ON store.
       
  3283  * @SYMTestType CIT
       
  3284  * @SYMTestCaseDependencies live/automatic
       
  3285  *
       
  3286  * Reason for test: Verify some but not all entries are written.
       
  3287  *
       
  3288  * @return - TVerdict code
       
  3289  */
       
  3290 	{
       
  3291 
       
  3292 	//
       
  3293 	// SET UP
       
  3294 	//
       
  3295 
       
  3296 	// Open the ADN store
       
  3297 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  3298 
       
  3299 	// Backup first Entry
       
  3300 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  3301 			KMainPhone, KMainONStore);
       
  3302 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  3303 	TBackupAllEntries backup(*this,onStore);
       
  3304 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  3305 	CleanupStack::PushL (backup);
       
  3306 
       
  3307 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess 
       
  3308 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  3309 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  3310 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  3311 	CleanupStack::PushL (onStoreInfoStatus);
       
  3312 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  3313 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  3314 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  3315 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  3316 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsWriteAccess),
       
  3317 			KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  3318 
       
  3319 	// Ensure ON store is empty 
       
  3320 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
  3321 	CleanupStack::PushL (deleteAllStatus);
       
  3322 	onStore.DeleteAll (deleteAllStatus);
       
  3323 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  3324 	CHECK_EQUALS_L(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
  3325 	TInt usedEntries;
       
  3326 	CHECK_TRUE_L(GetUsedEntriesL(onStore,phone,usedEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  3327 	CHECK_EQUALS_L(usedEntries,0,_L("RMobileONStore::DeleteAll did not delete all"));
       
  3328 	
       
  3329 	//
       
  3330 	// SET UP END
       
  3331 	//
       
  3332 
       
  3333 	StartTest ();
       
  3334 
       
  3335 	//
       
  3336 	// TEST START
       
  3337 	//
       
  3338 
       
  3339 
       
  3340 	// ===  Find out how many entries can be stored in the ON store ===
       
  3341 
       
  3342 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  3343 	// Store iTotalEntries for future use 
       
  3344 	TInt totalEntries;
       
  3345 	ASSERT_TRUE(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  3346 
       
  3347 	// Populate a CMobilePhoneOnList with iTotalEntries number of valid entries 
       
  3348 	CMobilePhoneONList *list = CMobilePhoneONList::NewL ();
       
  3349 	CleanupStack::PushL (list);
       
  3350 	RMobileONStore::TMobileONEntryV1 entry2;
       
  3351 	entry2.iMode=RMobilePhone::ENetworkModeGsm;
       
  3352 	entry2.iService=RMobilePhone::ETelephony;
       
  3353 	entry2.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  3354 	entry2.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  3355 	entry2.iText = _L("Entry2");
       
  3356 	entry2.iNumber.iTelNumber = _L("12012032");
       
  3357 	ASSERT_TRUE(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  3358 	for (TInt i=1; i <= totalEntries;++i)
       
  3359 		{
       
  3360 		entry2.iIndex=i;
       
  3361 		if ( entry2.iNumber.iTelNumber[0]=='9')
       
  3362 			{
       
  3363 			entry2.iNumber.iTelNumber[0]='0';
       
  3364 			}
       
  3365 		else
       
  3366 			{
       
  3367 			entry2.iNumber.iTelNumber[0]++;
       
  3368 			}
       
  3369 		list->AddEntryL (entry2);
       
  3370 		}
       
  3371 
       
  3372 	// Use RMobileONStore::StoreAllL to store all the entries to the ON store. 
       
  3373 	DEBUG_PRINTF1( _L("Store all has cause panic, using bypass"));
       
  3374 	// Bypass : The session manager can not be used, since a PANIC is created
       
  3375 	RMobileONStore byPassOnStore;
       
  3376 	User::LeaveIfError(byPassOnStore.Open(phone));
       
  3377 	CleanupClosePushL(byPassOnStore);
       
  3378 	// By pass end
       
  3379 	TExtEtelRequestStatus storeAllStatus(byPassOnStore, EMobileONStoreStoreAll);
       
  3380 	CleanupStack::PushL (storeAllStatus);
       
  3381 	byPassOnStore.StoreAllL (storeAllStatus, list);
       
  3382 
       
  3383 	// Do not wait for the request to complete before continuing. 
       
  3384 
       
  3385 	// Wait for 1 second. 
       
  3386 	User::After(KOneSecond);
       
  3387 	
       
  3388 	// Cancel the StoreAllL request. 
       
  3389 	onStore.CancelAsyncRequest(EMobileONStoreStoreAll);
       
  3390 
       
  3391 	// Check KErrCancel is returned.
       
  3392 	ASSERT_EQUALS(WaitForRequestWithTimeOut(storeAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::StoreAllL timed out"));
       
  3393 	ASSERT_TRUE(((storeAllStatus.Int() == KErrCancel) || (storeAllStatus.Int() == KErrNone)), _L("RMobileONStore::StoreAllL did not returned cancel"));
       
  3394 
       
  3395 	// ===  Find out how many entries are used in the phone book ===
       
  3396 
       
  3397 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  3398 	TInt newUsedEntries =-1;
       
  3399 	TInt newUsedEntries2 = -1;
       
  3400 	ASSERT_EQUALS(iSimTestHelper.GetNumberOfUsedEntriesInStoreL(onStore,KETelOwnNumberStore,onStoreInfoPckg,phone,newUsedEntries,newUsedEntries2),KErrNone, _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  3401 
       
  3402 	// Check iUsedEntries is > 0
       
  3403 	ASSERT_TRUE(newUsedEntries>=0,_L("RMobileONStore::StoreAllL failed to store"));
       
  3404 
       
  3405 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  3406 	// Check iUsedEntries is > 0
       
  3407 
       
  3408 
       
  3409 	//
       
  3410 	// TEST END
       
  3411 	//
       
  3412 
       
  3413 	StartCleanup();
       
  3414 
       
  3415 	// Pop:
       
  3416 	//	storeAllStatus
       
  3417     //  byPassOnStore
       
  3418 	//	list
       
  3419 	//	deleteAllStatus
       
  3420 	//	onStoreInfoStatus
       
  3421 	//	backup
       
  3422 	CleanupStack::PopAndDestroy(6,&backup);
       
  3423 
       
  3424 	return TestStepResult();
       
  3425 	}
       
  3426 
       
  3427 TPtrC CCTSYIntegrationTestONStore0018::GetTestStepName()
       
  3428 /**
       
  3429  * @return The test step name.
       
  3430  */
       
  3431 	{
       
  3432 	return _L("CCTSYIntegrationTestONStore0018");
       
  3433 	}
       
  3434 
       
  3435 CCTSYIntegrationTestONStore0019::CCTSYIntegrationTestONStore0019(
       
  3436 		CEtelSessionMgr& aEtelSessionMgr) :
       
  3437 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  3438 /**
       
  3439  * Constructor.
       
  3440  */
       
  3441 	{
       
  3442 	SetTestStepName(CCTSYIntegrationTestONStore0019::GetTestStepName());
       
  3443 	}
       
  3444 
       
  3445 CCTSYIntegrationTestONStore0019::~CCTSYIntegrationTestONStore0019()
       
  3446 /**
       
  3447  * Destructor.
       
  3448  */
       
  3449 	{
       
  3450 	}
       
  3451 
       
  3452 TVerdict CCTSYIntegrationTestONStore0019::doTestStepL()
       
  3453 /**
       
  3454  * @SYMTestCaseID BA-CTSY-INT-PBON-0019
       
  3455  * @SYMFssID BA/CTSY/PBON-0019
       
  3456  * @SYMTestCaseDesc Write a list of own numbers when there is not enough space in the phone book for the whole list.
       
  3457  * @SYMTestPriority High
       
  3458  * @SYMTestActions RMobileONStore::StoreAllL
       
  3459  * @SYMTestExpectedResults Pass - KErrTooBig returned.
       
  3460  * @SYMTestType CIT
       
  3461  * @SYMTestCaseDependencies live/automatic
       
  3462  *
       
  3463  * Reason for test: Verify error is returned when an attempt is made to store more entries than is possible into the ON store.
       
  3464  *
       
  3465  * @return - TVerdict code
       
  3466  */
       
  3467 	{
       
  3468 
       
  3469 	//
       
  3470 	// SET UP
       
  3471 	//
       
  3472 
       
  3473 	// Open the ADN store
       
  3474 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  3475 
       
  3476 	// Backup first Entry
       
  3477 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  3478 			KMainPhone, KMainONStore);
       
  3479 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  3480 	TBackupAllEntries backup(*this,onStore);
       
  3481 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  3482 	CleanupStack::PushL (backup);
       
  3483 
       
  3484 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess 
       
  3485 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  3486 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  3487 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  3488 	CleanupStack::PushL (onStoreInfoStatus);
       
  3489 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  3490 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  3491 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  3492 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  3493 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsWriteAccess,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  3494 
       
  3495 
       
  3496 	//
       
  3497 	// SET UP END
       
  3498 	//
       
  3499 
       
  3500 	StartTest ();
       
  3501 
       
  3502 	//
       
  3503 	// TEST START
       
  3504 	//
       
  3505 
       
  3506 
       
  3507 	// ===  Find out how many entries can be stored in the ON store ===
       
  3508 
       
  3509 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobileONStore::TMobileONStoreInfoV1  
       
  3510 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  3511 	ASSERT_EQUALS(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  3512 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  3513 	ASSERT_EQUALS(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  3514 
       
  3515 	
       
  3516 	// Populate a CMobilePhoneOnList with (iTotalEntries+1) number of valid entries 
       
  3517 	CMobilePhoneONList *list = CMobilePhoneONList::NewL ();
       
  3518 	CleanupStack::PushL (list);
       
  3519 	RMobileONStore::TMobileONEntryV1 entry;
       
  3520 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  3521 	entry.iService=RMobilePhone::ETelephony;
       
  3522 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  3523 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  3524 	entry.iText = _L("Entry2");
       
  3525 	entry.iNumber.iTelNumber = _L("12012032");
       
  3526 	for (TInt i=1; i <= onStoreInfo.iTotalEntries+1;++i)
       
  3527 		{
       
  3528 		entry.iIndex=i;
       
  3529 		if ( entry.iNumber.iTelNumber[0]=='9')
       
  3530 			{
       
  3531 			entry.iNumber.iTelNumber[0]='0';
       
  3532 			}
       
  3533 		else
       
  3534 			{
       
  3535 			entry.iNumber.iTelNumber[0]++;
       
  3536 			}
       
  3537 		list->AddEntryL (entry);
       
  3538 		}
       
  3539 
       
  3540 	// Use RMobileONStore::StoreAllL to store all the entries to the ON store. 
       
  3541 	// Bypass : The session manager can not be used, since a PANIC is created
       
  3542 	RMobileONStore byPassOnStore;
       
  3543 	User::LeaveIfError(byPassOnStore.Open(phone));
       
  3544 	CleanupClosePushL(byPassOnStore);
       
  3545 	// By pass end
       
  3546 	TExtEtelRequestStatus storeAllStatus(byPassOnStore, EMobileONStoreStoreAll);
       
  3547 	CleanupStack::PushL (storeAllStatus);
       
  3548 	byPassOnStore.StoreAllL (storeAllStatus, list);
       
  3549 	ASSERT_EQUALS(WaitForRequestWithTimeOut(storeAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::StoreAllL timed out"));
       
  3550 
       
  3551 	// Check KErrTooBig is returned.
       
  3552 	ASSERT_EQUALS(storeAllStatus.Int(), KErrTooBig, _L("RMobileONStore::StoreAllL returned an error"));
       
  3553 
       
  3554 
       
  3555 	//
       
  3556 	// TEST END
       
  3557 	//
       
  3558 
       
  3559 	StartCleanup();
       
  3560 
       
  3561 	
       
  3562 	// Pop:
       
  3563 	//	storeAllStatus
       
  3564 	//	byPassOnStore
       
  3565 	//	list
       
  3566 	//	onStoreInfoStatus
       
  3567 	//	backup
       
  3568 	CleanupStack::PopAndDestroy(5,&backup);
       
  3569 
       
  3570 	return TestStepResult();
       
  3571 	}
       
  3572 
       
  3573 TPtrC CCTSYIntegrationTestONStore0019::GetTestStepName()
       
  3574 /**
       
  3575  * @return The test step name.
       
  3576  */
       
  3577 	{
       
  3578 	return _L("CCTSYIntegrationTestONStore0019");
       
  3579 	}
       
  3580 
       
  3581 CCTSYIntegrationTestONStore0020::CCTSYIntegrationTestONStore0020(
       
  3582 		CEtelSessionMgr& aEtelSessionMgr) :
       
  3583 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  3584 /**
       
  3585  * Constructor.
       
  3586  */
       
  3587 	{
       
  3588 	SetTestStepName(CCTSYIntegrationTestONStore0020::GetTestStepName());
       
  3589 	}
       
  3590 
       
  3591 CCTSYIntegrationTestONStore0020::~CCTSYIntegrationTestONStore0020()
       
  3592 /**
       
  3593  * Destructor.
       
  3594  */
       
  3595 	{
       
  3596 	}
       
  3597 
       
  3598 TVerdict CCTSYIntegrationTestONStore0020::doTestStepL()
       
  3599 /**
       
  3600  * @SYMTestCaseID BA-CTSY-INT-PBON-0020
       
  3601  * @SYMFssID BA/CTSY/PBON-0020
       
  3602  * @SYMTestCaseDesc Cancel writing an entry to the ON store.
       
  3603  * @SYMTestPriority High
       
  3604  * @SYMTestActions 
       
  3605  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  3606  * @SYMTestType CIT
       
  3607  * @SYMTestCaseDependencies live/automatic
       
  3608  *
       
  3609  * Reason for test: Verify request is cancelled.
       
  3610  *
       
  3611  * @return - TVerdict code
       
  3612  */
       
  3613 	{
       
  3614 
       
  3615 	//
       
  3616 	// SET UP
       
  3617 	//
       
  3618 
       
  3619 	// Open the ADN store
       
  3620 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  3621 
       
  3622 	// Backup first Entry
       
  3623 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  3624 			KMainPhone, KMainONStore);
       
  3625 	TBackupAllEntries backup(*this,onStore);
       
  3626 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  3627 	CleanupStack::PushL (backup);
       
  3628 
       
  3629 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess
       
  3630 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  3631 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  3632 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  3633 	CleanupStack::PushL (onStoreInfoStatus);
       
  3634 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  3635 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  3636 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  3637 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  3638 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsWriteAccess,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  3639 
       
  3640 	// Ensure there is an empty slot in a known location. 
       
  3641 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  3642 	TInt clearSpace = iSimTestHelper.EnsureEmptyStoreSpaceL(onStore,KETelOwnNumberStore,onStoreInfo,phone);
       
  3643 	CHECK_TRUE_L(clearSpace>=0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL was unable to get an empty space"));
       
  3644 
       
  3645 
       
  3646 	//
       
  3647 	// SET UP END
       
  3648 	//
       
  3649 
       
  3650 	StartTest ();
       
  3651 
       
  3652 	//
       
  3653 	// TEST START
       
  3654 	//
       
  3655 
       
  3656 
       
  3657 	// Write an entry from the location of a known empty slot. 
       
  3658 	RMobileONStore::TMobileONEntryV1 entry;
       
  3659 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  3660 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  3661 	CleanupStack::PushL (writeStatus);
       
  3662 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  3663 	entry.iService=RMobilePhone::ETelephony;
       
  3664 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  3665 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  3666 	_LIT(KNumber, "01632960000");
       
  3667 	entry.iNumber.iTelNumber = KNumber;
       
  3668 	entry.iText = _L("An Entry 2");
       
  3669 	entry.iIndex=clearSpace;
       
  3670 	onStore.Write (writeStatus, writePckg);
       
  3671 
       
  3672 	// Cancel the read request immediately using RTelSubSessionBase::CancelAsyncRequest(EMobilePhoneStoreWrite) 
       
  3673 	onStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
       
  3674 
       
  3675 	// Check KErrCancel or KErrNone is returned.
       
  3676 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  3677 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  3678 	ASSERT_TRUE(((writeStatus.Int()== KErrNone) || ((writeStatus.Int()== KErrCancel))), _L("RMobileONStore::Write returned an error"));
       
  3679 
       
  3680 
       
  3681 	//
       
  3682 	// TEST END
       
  3683 	//
       
  3684 
       
  3685 	StartCleanup();
       
  3686 
       
  3687 	
       
  3688 	// Pop:
       
  3689 	//	writeStatus
       
  3690 	//	onStoreInfoStatus
       
  3691 	//	backup
       
  3692 	CleanupStack::PopAndDestroy(3,&backup);
       
  3693 
       
  3694 	return TestStepResult();
       
  3695 	}
       
  3696 
       
  3697 TPtrC CCTSYIntegrationTestONStore0020::GetTestStepName()
       
  3698 /**
       
  3699  * @return The test step name.
       
  3700  */
       
  3701 	{
       
  3702 	return _L("CCTSYIntegrationTestONStore0020");
       
  3703 	}
       
  3704 
       
  3705 CCTSYIntegrationTestONStore0021::CCTSYIntegrationTestONStore0021(
       
  3706 		CEtelSessionMgr& aEtelSessionMgr) :
       
  3707 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  3708 /**
       
  3709  * Constructor.
       
  3710  */
       
  3711 	{
       
  3712 	SetTestStepName(CCTSYIntegrationTestONStore0021::GetTestStepName());
       
  3713 	}
       
  3714 
       
  3715 CCTSYIntegrationTestONStore0021::~CCTSYIntegrationTestONStore0021()
       
  3716 /**
       
  3717  * Destructor.
       
  3718  */
       
  3719 	{
       
  3720 	}
       
  3721 
       
  3722 TVerdict CCTSYIntegrationTestONStore0021::doTestStepL()
       
  3723 /**
       
  3724  * @SYMTestCaseID BA-CTSY-INT-PBON-0021
       
  3725  * @SYMFssID BA/CTSY/PBON-0021
       
  3726  * @SYMTestCaseDesc Attempt to read own number into a wrongly sized buffer.
       
  3727  * @SYMTestPriority High
       
  3728  * @SYMTestActions 
       
  3729  * @SYMTestExpectedResults Pass - KErrArgument?
       
  3730  * @SYMTestType CIT
       
  3731  * @SYMTestCaseDependencies live/automatic
       
  3732  *
       
  3733  * Reason for test: Verify error is returned on attempt to write.
       
  3734  *
       
  3735  * @return - TVerdict code
       
  3736  */
       
  3737 	{
       
  3738 
       
  3739 	//
       
  3740 	// SET UP
       
  3741 	//
       
  3742 
       
  3743 	// Open the ADN store
       
  3744 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  3745 
       
  3746 	// Backup first Entry
       
  3747 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  3748 			KMainPhone, KMainONStore);
       
  3749 	TBackupAllEntries backup(*this,onStore);
       
  3750 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  3751 	CleanupStack::PushL (backup);
       
  3752 
       
  3753 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess 
       
  3754 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  3755 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  3756 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  3757 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  3758 	CleanupStack::PushL (onStoreInfoStatus);
       
  3759 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  3760 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  3761 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  3762 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  3763 	CHECK_BITS_SET_L(onStoreInfo.iCaps, (RMobilePhoneStore::KCapsReadAccess),KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  3764 
       
  3765 	// Write an entry to a known location in the phone book 
       
  3766 	RMobileONStore::TMobileONEntryV1 entry;
       
  3767 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  3768 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  3769 	CleanupStack::PushL (writeStatus);
       
  3770 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  3771 	entry.iService=RMobilePhone::ETelephony;
       
  3772 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  3773 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  3774 	_LIT(KNumber, "12345");
       
  3775 	entry.iNumber.iTelNumber = KNumber;
       
  3776 	entry.iText = _L("Entry 2");
       
  3777 	entry.iIndex=2;
       
  3778 	onStore.Write (writeStatus, writePckg);
       
  3779 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  3780 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  3781 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  3782 
       
  3783 
       
  3784 	//
       
  3785 	// SET UP END
       
  3786 	//
       
  3787 
       
  3788 	StartTest ();
       
  3789 
       
  3790 	//
       
  3791 	// TEST START
       
  3792 	//
       
  3793 
       
  3794 
       
  3795 	// Read an entry from the ON store using RMobilePhoneStore::Read and aEntry as a TBuf<1> 
       
  3796 	TBuf8<1> entryPckg;
       
  3797 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
  3798 	CleanupStack::PushL (readStatus);
       
  3799 	onStore.Read (readStatus, entryPckg);
       
  3800 
       
  3801 	// Check error is returned.
       
  3802 	ASSERT_TRUE((readStatus.Int() != KErrNone), _L("RMobileONStore::Read did not returned an error") );
       
  3803 
       
  3804 
       
  3805 	//
       
  3806 	// TEST END
       
  3807 	//
       
  3808 
       
  3809 	StartCleanup();
       
  3810 
       
  3811 	// Pop:
       
  3812 	//	readStatus
       
  3813 	//	writeStatus
       
  3814 	//	onStoreInfoStatus
       
  3815 	//	backup
       
  3816 	CleanupStack::PopAndDestroy(4,&backup);
       
  3817 
       
  3818 	return TestStepResult();
       
  3819 	}
       
  3820 
       
  3821 TPtrC CCTSYIntegrationTestONStore0021::GetTestStepName()
       
  3822 /**
       
  3823  * @return The test step name.
       
  3824  */
       
  3825 	{
       
  3826 	return _L("CCTSYIntegrationTestONStore0021");
       
  3827 	}
       
  3828 
       
  3829 CCTSYIntegrationTestONStore0022::CCTSYIntegrationTestONStore0022(
       
  3830 		CEtelSessionMgr& aEtelSessionMgr) :
       
  3831 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  3832 /**
       
  3833  * Constructor.
       
  3834  */
       
  3835 	{
       
  3836 	SetTestStepName(CCTSYIntegrationTestONStore0022::GetTestStepName());
       
  3837 	}
       
  3838 
       
  3839 CCTSYIntegrationTestONStore0022::~CCTSYIntegrationTestONStore0022()
       
  3840 /**
       
  3841  * Destructor.
       
  3842  */
       
  3843 	{
       
  3844 	}
       
  3845 
       
  3846 TVerdict CCTSYIntegrationTestONStore0022::doTestStepL()
       
  3847 /**
       
  3848  * @SYMTestCaseID BA-CTSY-INT-PBON-0022
       
  3849  * @SYMFssID BA/CTSY/PBON-0022
       
  3850  * @SYMTestCaseDesc Cancel reading an entry from the ON store.
       
  3851  * @SYMTestPriority High
       
  3852  * @SYMTestActions 
       
  3853  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  3854  * @SYMTestType CIT
       
  3855  * @SYMTestCaseDependencies live/automatic
       
  3856  *
       
  3857  * Reason for test: Verify request is cancelled.
       
  3858  *
       
  3859  * @return - TVerdict code
       
  3860  */
       
  3861 	{
       
  3862 
       
  3863 	//
       
  3864 	// SET UP
       
  3865 	//
       
  3866 
       
  3867 	// Open the ADN store
       
  3868 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  3869 
       
  3870 	// Backup first Entry
       
  3871 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  3872 			KMainPhone, KMainONStore);
       
  3873 	TBackupAllEntries backup(*this,onStore);
       
  3874 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  3875 	CleanupStack::PushL (backup);
       
  3876 
       
  3877 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess 
       
  3878 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  3879 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  3880 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  3881 	CleanupStack::PushL (onStoreInfoStatus);
       
  3882 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  3883 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  3884 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  3885 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  3886 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsReadAccess,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  3887 
       
  3888 	// Write an entry to a known location in the phone book 
       
  3889 	RMobileONStore::TMobileONEntryV1 entry;
       
  3890 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  3891 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  3892 	CleanupStack::PushL (writeStatus);
       
  3893 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  3894 	entry.iService=RMobilePhone::ETelephony;
       
  3895 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  3896 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  3897 	_LIT(KNumber, "12345");
       
  3898 	entry.iNumber.iTelNumber = KNumber;
       
  3899 	entry.iText = _L("Entry 2");
       
  3900 	entry.iIndex=2;
       
  3901 	onStore.Write (writeStatus, writePckg);
       
  3902 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  3903 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  3904 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  3905 
       
  3906 
       
  3907 	//
       
  3908 	// SET UP END
       
  3909 	//
       
  3910 
       
  3911 	StartTest ();
       
  3912 
       
  3913 	//
       
  3914 	// TEST START
       
  3915 	//
       
  3916 
       
  3917 
       
  3918 	// Read an entry from a known location from the ON store. 
       
  3919 	RMobileONStore::TMobileONEntryV1 readEntry;
       
  3920 	RMobileONStore::TMobileONEntryV1Pckg entryPckg(readEntry);
       
  3921 	TExtEtelRequestStatus readStatus(onStore, EMobilePhoneStoreRead);
       
  3922 	CleanupStack::PushL (readStatus);
       
  3923 	readEntry.iIndex=2;
       
  3924 	onStore.Read (readStatus, entryPckg);
       
  3925 
       
  3926 	// Cancel the read request immediately using RTelSubSessionBase::CancelAsyncRequest(EMobilePhoneStoreRead) 
       
  3927 	onStore.CancelAsyncRequest(EMobilePhoneStoreRead);
       
  3928 
       
  3929 	// Check KErrCancel or KErrNone is returned.
       
  3930 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),
       
  3931 			KErrNone, _L("RMobileONStore::Read timed out"));
       
  3932 	ASSERT_TRUE(((readStatus.Int()== KErrNone) || ((readStatus.Int()== KErrCancel))), _L("RMobileONStore::Read returned an error"));
       
  3933 
       
  3934 
       
  3935 	//
       
  3936 	// TEST END
       
  3937 	//
       
  3938 
       
  3939 	StartCleanup();
       
  3940 
       
  3941 	
       
  3942 	// Pop:
       
  3943 	//	readStatus
       
  3944 	//	writeStatus
       
  3945 	//	onStoreInfoStatus
       
  3946 	//	backup
       
  3947 	CleanupStack::PopAndDestroy(4,&backup);
       
  3948 
       
  3949 	return TestStepResult();
       
  3950 	}
       
  3951 
       
  3952 TPtrC CCTSYIntegrationTestONStore0022::GetTestStepName()
       
  3953 /**
       
  3954  * @return The test step name.
       
  3955  */
       
  3956 	{
       
  3957 	return _L("CCTSYIntegrationTestONStore0022");
       
  3958 	}
       
  3959 
       
  3960 CCTSYIntegrationTestONStore0023::CCTSYIntegrationTestONStore0023(
       
  3961 		CEtelSessionMgr& aEtelSessionMgr) :
       
  3962 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  3963 /**
       
  3964  * Constructor.
       
  3965  */
       
  3966 	{
       
  3967 	SetTestStepName(CCTSYIntegrationTestONStore0023::GetTestStepName());
       
  3968 	}
       
  3969 
       
  3970 CCTSYIntegrationTestONStore0023::~CCTSYIntegrationTestONStore0023()
       
  3971 /**
       
  3972  * Destructor.
       
  3973  */
       
  3974 	{
       
  3975 	}
       
  3976 
       
  3977 TVerdict CCTSYIntegrationTestONStore0023::doTestStepL()
       
  3978 /**
       
  3979  * @SYMTestCaseID BA-CTSY-INT-PBON-0023
       
  3980  * @SYMFssID BA/CTSY/PBON-0023
       
  3981  * @SYMTestCaseDesc Cancel delete one entry from ON store.
       
  3982  * @SYMTestPriority High
       
  3983  * @SYMTestActions 
       
  3984  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  3985  * @SYMTestType CIT
       
  3986  * @SYMTestCaseDependencies live/automatic
       
  3987  *
       
  3988  * Reason for test: Verify request is cancelled.
       
  3989  *
       
  3990  * @return - TVerdict code
       
  3991  */
       
  3992 	{
       
  3993 
       
  3994 	//
       
  3995 	// SET UP
       
  3996 	//
       
  3997 
       
  3998 	// Open the ADN store
       
  3999 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  4000 
       
  4001 	// Backup first Entry
       
  4002 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  4003 			KMainPhone, KMainONStore);
       
  4004 	TBackupAllEntries backup(*this,onStore);
       
  4005 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  4006 	CleanupStack::PushL (backup);
       
  4007 
       
  4008 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess 
       
  4009 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  4010 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  4011 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  4012 	CleanupStack::PushL (onStoreInfoStatus);
       
  4013 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  4014 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  4015 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  4016 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  4017 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsWriteAccess,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  4018 	
       
  4019 	// Write an entry to a known location in the phone book 
       
  4020 	RMobileONStore::TMobileONEntryV1 entry;
       
  4021 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  4022 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  4023 	CleanupStack::PushL (writeStatus);
       
  4024 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  4025 	entry.iService=RMobilePhone::ETelephony;
       
  4026 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  4027 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  4028 	_LIT(KNumber, "12345");
       
  4029 	entry.iNumber.iTelNumber = KNumber;
       
  4030 	entry.iText = _L("Entry 2");
       
  4031 	entry.iIndex=2;
       
  4032 	onStore.Write (writeStatus, writePckg);
       
  4033 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  4034 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  4035 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  4036 
       
  4037 
       
  4038 	//
       
  4039 	// SET UP END
       
  4040 	//
       
  4041 
       
  4042 	StartTest ();
       
  4043 
       
  4044 	//
       
  4045 	// TEST START
       
  4046 	//
       
  4047 
       
  4048 
       
  4049 	// Delete an entry at a known index from the ON store. 
       
  4050 	TExtEtelRequestStatus deleteStatus(onStore, EMobilePhoneStoreDelete);
       
  4051 	CleanupStack::PushL (deleteStatus);
       
  4052 	onStore.Delete (deleteStatus, 2);
       
  4053 
       
  4054 	// Cancel the request immediately with RTelSubSessionBase::.CancelAsyncRequest( EMobilePhoneStoreDelete ) 
       
  4055 	onStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
       
  4056 
       
  4057 	// Check KErrCancel or KErrNone is returned (if it was too late to cancel).
       
  4058 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileONStore::Delete timed out"));
       
  4059 	ASSERT_TRUE(((deleteStatus.Int()== KErrNone) || (deleteStatus.Int()== KErrCancel)), _L("RMobileONStore::Delete returned an error"));
       
  4060 
       
  4061 
       
  4062 	//
       
  4063 	// TEST END
       
  4064 	//
       
  4065 
       
  4066 	StartCleanup();
       
  4067 
       
  4068 	
       
  4069 	// Pop:
       
  4070 	//	deleteStatus
       
  4071 	//	writeStatus
       
  4072 	//	onStoreInfoStatus
       
  4073 	//	backup
       
  4074 	CleanupStack::PopAndDestroy(4,&backup);
       
  4075 
       
  4076 	return TestStepResult();
       
  4077 	}
       
  4078 
       
  4079 TPtrC CCTSYIntegrationTestONStore0023::GetTestStepName()
       
  4080 /**
       
  4081  * @return The test step name.
       
  4082  */
       
  4083 	{
       
  4084 	return _L("CCTSYIntegrationTestONStore0023");
       
  4085 	}
       
  4086 
       
  4087 CCTSYIntegrationTestONStore0024::CCTSYIntegrationTestONStore0024(
       
  4088 		CEtelSessionMgr& aEtelSessionMgr) :
       
  4089 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  4090 /**
       
  4091  * Constructor.
       
  4092  */
       
  4093 	{
       
  4094 	SetTestStepName(CCTSYIntegrationTestONStore0024::GetTestStepName());
       
  4095 	}
       
  4096 
       
  4097 CCTSYIntegrationTestONStore0024::~CCTSYIntegrationTestONStore0024()
       
  4098 /**
       
  4099  * Destructor.
       
  4100  */
       
  4101 	{
       
  4102 	}
       
  4103 
       
  4104 TVerdict CCTSYIntegrationTestONStore0024::doTestStepL()
       
  4105 /**
       
  4106  * @SYMTestCaseID BA-CTSY-INT-PBON-0024
       
  4107  * @SYMFssID BA/CTSY/PBON-0024
       
  4108  * @SYMTestCaseDesc Cancel notification of a store event on the ON store.
       
  4109  * @SYMTestPriority High
       
  4110  * @SYMTestActions RMobilePhoneStore::Write, RMobilePhoneStore::Delete, RMobileONStore::StoreAllL
       
  4111  * @SYMTestExpectedResults Pass - KErrCancel returned.
       
  4112  * @SYMTestType CIT
       
  4113  * @SYMTestCaseDependencies live/automatic
       
  4114  *
       
  4115  * Reason for test: Verify request is cancelled.
       
  4116  *
       
  4117  * @return - TVerdict code
       
  4118  */
       
  4119 	{
       
  4120 
       
  4121 	//
       
  4122 	// SET UP
       
  4123 	//
       
  4124 
       
  4125 	// Open the ADN store
       
  4126 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  4127 
       
  4128 	// Backup first Entry
       
  4129 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  4130 			KMainPhone, KMainONStore);
       
  4131 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  4132 	TBackupAllEntries backup(*this,onStore);
       
  4133 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  4134 	CleanupStack::PushL (backup);
       
  4135 
       
  4136 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsNotifyEvent 
       
  4137 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  4138 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  4139 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  4140 	CleanupStack::PushL (onStoreInfoStatus);
       
  4141 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  4142 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  4143 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  4144 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  4145 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsNotifyEvent,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  4146 
       
  4147 	// Write an entry to a known location in the phone book 
       
  4148 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
  4149 	CleanupStack::PushL (deleteAllStatus);
       
  4150 	onStore.DeleteAll (deleteAllStatus);
       
  4151 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  4152 	CHECK_EQUALS_L(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
  4153 	RMobileONStore::TMobileONEntryV1 entry;
       
  4154 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  4155 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  4156 	CleanupStack::PushL (writeStatus);
       
  4157 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  4158 	entry.iService=RMobilePhone::ETelephony;
       
  4159 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  4160 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  4161 	_LIT(KNumber, "12345");
       
  4162 	entry.iNumber.iTelNumber = KNumber;
       
  4163 	entry.iText = _L("Entry 2");
       
  4164 	entry.iIndex=2;
       
  4165 	onStore.Write (writeStatus, writePckg);
       
  4166 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  4167 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  4168 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  4169 
       
  4170 
       
  4171 	//
       
  4172 	// SET UP END
       
  4173 	//
       
  4174 
       
  4175 	StartTest ();
       
  4176 
       
  4177 	//
       
  4178 	// TEST START
       
  4179 	//
       
  4180 
       
  4181 
       
  4182 	// Request notification of a store event with RMobilePhoneStore::NotifyStoreEvent 
       
  4183 	TUint32 storeEvent;
       
  4184 	TInt index;
       
  4185 	TExtEtelRequestStatus notifyStoreEventStatus(onStore,
       
  4186 			EMobilePhoneStoreNotifyStoreEvent);
       
  4187 	CleanupStack::PushL (notifyStoreEventStatus);
       
  4188 	onStore.NotifyStoreEvent (notifyStoreEventStatus, storeEvent, index);
       
  4189 
       
  4190 	// Cancel the RMobilePhoneStore::NotifyStoreEvent with RTelSubSession::CancelAsyncRequest( EMobilePhoneStoreNotifyStoreEvent ) 
       
  4191 	onStore.CancelAsyncRequest(EMobilePhoneStoreNotifyStoreEvent);
       
  4192 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyStoreEventStatus, ETimeMedium), KErrNone, _L("RMobileONStore::NotifyStoreEvent timed out"));
       
  4193 
       
  4194 	// Delete an entry from the phone store 
       
  4195 	TExtEtelRequestStatus deleteStatus(onStore, EMobilePhoneStoreDelete);
       
  4196 	CleanupStack::PushL (deleteStatus);
       
  4197 	onStore.Delete (deleteStatus, 2);
       
  4198     ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium),
       
  4199 			KErrNone, _L("RMobileONStore::Delete timed out"));
       
  4200 	ASSERT_EQUALS(deleteStatus.Int(),KErrNone, _L("RMobileONStore::Delete did not returned as expected"));
       
  4201 
       
  4202 	// Write an entry to the phone store 
       
  4203 	entry.iNumber.iTelNumber = _L("4531231");
       
  4204 	entry.iIndex=1;
       
  4205 	onStore.Write (writeStatus, writePckg);
       
  4206     ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  4207 			KErrNone, _L("RMobileONStore::Write timed out"));
       
  4208 	ASSERT_EQUALS(writeStatus.Int(),KErrNone, _L("RMobileONStore::Write did not returned as expected"));
       
  4209 
       
  4210 	// Use RMobileONStore::StoreAllL to store entries to the ON store. 
       
  4211 	CMobilePhoneONList *list = CMobilePhoneONList::NewL ();
       
  4212 	CleanupStack::PushL (list);
       
  4213 	RMobileONStore::TMobileONEntryV1 entry2;
       
  4214 	entry2.iMode=RMobilePhone::ENetworkModeGsm;
       
  4215 	entry2.iService=RMobilePhone::ETelephony;
       
  4216 	entry2.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  4217 	entry2.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  4218 	entry2.iText = _L("Entry2");
       
  4219 	entry2.iNumber.iTelNumber = _L("12012032");
       
  4220 	for (TInt i=1; i < 2;++i)
       
  4221 		{
       
  4222 		entry2.iIndex=i;
       
  4223 		if ( entry2.iNumber.iTelNumber[0]=='9')
       
  4224 			{
       
  4225 			entry2.iNumber.iTelNumber[0]='0';
       
  4226 			}
       
  4227 		else
       
  4228 			{
       
  4229 			entry2.iNumber.iTelNumber[0]++;
       
  4230 			}
       
  4231 		list->AddEntryL (entry2);
       
  4232 		}
       
  4233 	// Bypass : The session manager can not be used, since a PANIC is created
       
  4234 	RMobileONStore byPassOnStore;
       
  4235 	User::LeaveIfError(byPassOnStore.Open(phone));
       
  4236 	CleanupClosePushL(byPassOnStore);
       
  4237 	// By pass end
       
  4238 	TExtEtelRequestStatus storeAllStatus(byPassOnStore, EMobileONStoreStoreAll);
       
  4239 	CleanupStack::PushL (storeAllStatus);
       
  4240 	byPassOnStore.StoreAllL (storeAllStatus, list);
       
  4241     ASSERT_EQUALS(WaitForRequestWithTimeOut(storeAllStatus, ETimeLong),
       
  4242 			KErrNone, _L("RMobileONStore::StoreAllL timed out"));
       
  4243 	ASSERT_EQUALS(storeAllStatus.Int(),KErrNone, _L("RMobileONStore::StoreAllL did not returned as expected"));
       
  4244 
       
  4245 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KErrCancel
       
  4246 	ASSERT_EQUALS(notifyStoreEventStatus.Int(),KErrCancel, _L("RMobileONStore::NotifyStoreEvent did not returned KErrCancel"));
       
  4247 
       
  4248 
       
  4249 
       
  4250 	//
       
  4251 	// TEST END
       
  4252 	//
       
  4253 
       
  4254 	StartCleanup();
       
  4255 
       
  4256 	
       
  4257 	// Pop:
       
  4258 	//	storeAllStatus
       
  4259 	//	byPassOnStore
       
  4260 	//	list
       
  4261 	//	deleteStatus
       
  4262 	//	notifyStoreEventStatus
       
  4263 	//	writeStatus
       
  4264     //  deleteAllStatus
       
  4265 	//	onStoreInfoStatus
       
  4266 	//	backup
       
  4267 	CleanupStack::PopAndDestroy(9,&backup);
       
  4268 
       
  4269 	return TestStepResult();
       
  4270 	}
       
  4271 
       
  4272 TPtrC CCTSYIntegrationTestONStore0024::GetTestStepName()
       
  4273 /**
       
  4274  * @return The test step name.
       
  4275  */
       
  4276 	{
       
  4277 	return _L("CCTSYIntegrationTestONStore0024");
       
  4278 	}
       
  4279 
       
  4280 CCTSYIntegrationTestONStore0025::CCTSYIntegrationTestONStore0025(
       
  4281 		CEtelSessionMgr& aEtelSessionMgr) :
       
  4282 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  4283 /**
       
  4284  * Constructor.
       
  4285  */
       
  4286 	{
       
  4287 	SetTestStepName(CCTSYIntegrationTestONStore0025::GetTestStepName());
       
  4288 	}
       
  4289 
       
  4290 CCTSYIntegrationTestONStore0025::~CCTSYIntegrationTestONStore0025()
       
  4291 /**
       
  4292  * Destructor.
       
  4293  */
       
  4294 	{
       
  4295 	}
       
  4296 
       
  4297 TVerdict CCTSYIntegrationTestONStore0025::doTestStepL()
       
  4298 /**
       
  4299  * @SYMTestCaseID BA-CTSY-INT-PBON-0025
       
  4300  * @SYMFssID BA/CTSY/PBON-0025
       
  4301  * @SYMTestCaseDesc Cancel get ON store info.
       
  4302  * @SYMTestPriority High
       
  4303  * @SYMTestActions 
       
  4304  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  4305  * @SYMTestType CIT
       
  4306  * @SYMTestCaseDependencies live/automatic
       
  4307  *
       
  4308  * Reason for test: Verify request is cancelled.
       
  4309  *
       
  4310  * @return - TVerdict code
       
  4311  */
       
  4312 	{
       
  4313 
       
  4314 	//
       
  4315 	// SET UP
       
  4316 	//
       
  4317 
       
  4318 	// Open the ADN store
       
  4319 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  4320 
       
  4321 
       
  4322 	//
       
  4323 	// SET UP END
       
  4324 	//
       
  4325 
       
  4326 	StartTest ();
       
  4327 
       
  4328 	//
       
  4329 	// TEST START
       
  4330 	//
       
  4331 
       
  4332 
       
  4333 	// Request to get phone store information by calling RMobilePhoneStore::GetInfo 
       
  4334 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  4335 			KMainPhone, KMainONStore);
       
  4336 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  4337 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  4338 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  4339 	CleanupStack::PushL (onStoreInfoStatus);
       
  4340 
       
  4341 	// $CTSYKnownFailure defect id=50009. CMmONStoreTsy::GetInfoL completes RMobileONStore::GetInfo() request to the test client with error KErrNotReady
       
  4342 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d </font>"), 50009);
       
  4343 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  4344 
       
  4345 	// Cancel get information by calling RTelSubSession::CancelAsyncRequest(EMobilePhoneStoreGetInfo) 
       
  4346 	onStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
       
  4347 
       
  4348 	// Check KErrCancel is returned or KErrNone if it was too late to cancel.
       
  4349 	ASSERT_EQUALS(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  4350 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  4351 	ASSERT_TRUE(((onStoreInfoStatus.Int()== KErrCancel)||(onStoreInfoStatus.Int()== KErrNone)), _L("RMobileONStore::GetInfo returned an error"));
       
  4352 
       
  4353 
       
  4354 	//
       
  4355 	// TEST END
       
  4356 	//
       
  4357 
       
  4358 	StartCleanup();
       
  4359 
       
  4360 	
       
  4361 	// Pop:
       
  4362 	//	onStoreInfoStatus
       
  4363 	CleanupStack::PopAndDestroy(&onStoreInfoStatus);
       
  4364 
       
  4365 	return TestStepResult();
       
  4366 	}
       
  4367 
       
  4368 TPtrC CCTSYIntegrationTestONStore0025::GetTestStepName()
       
  4369 /**
       
  4370  * @return The test step name.
       
  4371  */
       
  4372 	{
       
  4373 	return _L("CCTSYIntegrationTestONStore0025");
       
  4374 	}
       
  4375 
       
  4376 CCTSYIntegrationTestONStore0026::CCTSYIntegrationTestONStore0026(
       
  4377 		CEtelSessionMgr& aEtelSessionMgr) :
       
  4378 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  4379 /**
       
  4380  * Constructor.
       
  4381  */
       
  4382 	{
       
  4383 	SetTestStepName(CCTSYIntegrationTestONStore0026::GetTestStepName());
       
  4384 	}
       
  4385 
       
  4386 CCTSYIntegrationTestONStore0026::~CCTSYIntegrationTestONStore0026()
       
  4387 /**
       
  4388  * Destructor.
       
  4389  */
       
  4390 	{
       
  4391 	}
       
  4392 
       
  4393 TVerdict CCTSYIntegrationTestONStore0026::doTestStepL()
       
  4394 /**
       
  4395  * @SYMTestCaseID BA-CTSY-INT-PBON-0026
       
  4396  * @SYMFssID BA/CTSY/PBON-0026
       
  4397  * @SYMTestCaseDesc Read all ON store entries.
       
  4398  * @SYMTestPriority High
       
  4399  * @SYMTestActions CRetrieveMobilePhoneONList::RetrieveListL
       
  4400  * @SYMTestExpectedResults Pass - All entries read correctly.
       
  4401  * @SYMTestType CIT
       
  4402  * @SYMTestCaseDependencies live/automatic
       
  4403  *
       
  4404  * Reason for test: Verify all entries read correctly.
       
  4405  *
       
  4406  * @return - TVerdict code
       
  4407  */
       
  4408 	{
       
  4409 
       
  4410 	//
       
  4411 	// SET UP
       
  4412 	//
       
  4413 
       
  4414 	// Open the ADN store
       
  4415 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  4416 	// Backup first Entry
       
  4417 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  4418 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  4419 			KMainPhone, KMainONStore);
       
  4420 	TBackupAllEntries backup(*this,onStore);
       
  4421 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  4422 	CleanupStack::PushL (backup);
       
  4423 
       
  4424 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWholeStore 
       
  4425 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  4426 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  4427 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  4428 	CleanupStack::PushL (onStoreInfoStatus);
       
  4429 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  4430 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  4431 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  4432 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  4433 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsWholeStore,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  4434 
       
  4435 	// Ensure there are 2 entries in the ON store. 
       
  4436 	TExtEtelRequestStatus deleteAllStatus(onStore, EMobilePhoneStoreDeleteAll);
       
  4437 	CleanupStack::PushL (deleteAllStatus);
       
  4438 	onStore.DeleteAll (deleteAllStatus);
       
  4439 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::DeleteAll timed out"));
       
  4440 	CHECK_EQUALS_L(deleteAllStatus.Int(), KErrNone, _L("RMobileONStore::DeleteAll returned an error"));
       
  4441     TInt numberOfUsedEntries = 2 ;
       
  4442 	CHECK_TRUE_L((onStoreInfo.iTotalEntries>=numberOfUsedEntries), _L("The ON store dose not have 2 entries!"));
       
  4443 	CMobilePhoneONList *writeList = CMobilePhoneONList::NewL ();
       
  4444 	CleanupStack::PushL (writeList);
       
  4445 	RMobileONStore::TMobileONEntryV1 entry;
       
  4446 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  4447 	entry.iService=RMobilePhone::ETelephony;
       
  4448 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  4449 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  4450 	entry.iText = _L("Entry2");
       
  4451 	entry.iNumber.iTelNumber = _L("12012032");
       
  4452 	for (TInt i=1; i <= numberOfUsedEntries;++i)
       
  4453 		{
       
  4454 		entry.iIndex=i;
       
  4455 		if ( entry.iNumber.iTelNumber[0]=='9')
       
  4456 			{
       
  4457 			entry.iNumber.iTelNumber[0]='0';
       
  4458 			}
       
  4459 		else
       
  4460 			{
       
  4461 			entry.iNumber.iTelNumber[0]++;
       
  4462 			}
       
  4463 		writeList->AddEntryL (entry);
       
  4464 		}
       
  4465 	DEBUG_PRINTF1( _L("Store all has cause panic, using bypass"));
       
  4466 	// Bypass : The session manager can not be used, since a PANIC is created
       
  4467 	RMobileONStore byPassOnStore;
       
  4468 	User::LeaveIfError(byPassOnStore.Open(phone));
       
  4469 	CleanupClosePushL(byPassOnStore);
       
  4470 	// By pass end
       
  4471 	TExtEtelRequestStatus storeAllStatus(byPassOnStore, EMobileONStoreStoreAll);
       
  4472 	CleanupStack::PushL (storeAllStatus);
       
  4473 	byPassOnStore.StoreAllL (storeAllStatus, writeList);
       
  4474 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(storeAllStatus, ETimeMedium), KErrNone, _L("RMobileONStore::StoreAllL timed out"));
       
  4475 	CHECK_EQUALS_L(storeAllStatus.Int(), KErrNone, _L("RMobileONStore::StoreAllL returned an error"));
       
  4476 	
       
  4477 	
       
  4478 
       
  4479 	//
       
  4480 	// SET UP END
       
  4481 	//
       
  4482 
       
  4483 	StartTest ();
       
  4484 
       
  4485 	//
       
  4486 	// TEST START
       
  4487 	//
       
  4488 
       
  4489 
       
  4490 	// Use the helper class for CRetrieveMobilePhoneONList to read entries from the ON store. 
       
  4491 	TInt err;
       
  4492 	CRetrieveMobilePhoneONListExec *helper=CRetrieveMobilePhoneONListHelper::NewL(onStore);
       
  4493     CleanupStack::PushL(helper);
       
  4494 	CMobilePhoneONList *readList = helper->DoGetList(err);
       
  4495 	ASSERT_EQUALS(err, KErrNone, _L("CRetrieveMobilePhoneONListHelper::DoGetList is not able to get the list"));
       
  4496 	
       
  4497 
       
  4498 	// Check that all 2 entries have been read and are correct.
       
  4499 	ASSERT_EQUALS(readList->Enumerate(), writeList->Enumerate(), _L("CRetrieveMobilePhoneONListHelper::DoGetList entries list size is wrong"));
       
  4500 	for (TInt i=0; i<readList->Enumerate();++i)
       
  4501 		{
       
  4502 		ASSERT_TRUE(CompareEntries (readList->GetEntryL (i), writeList->GetEntryL (i)), _L("CRetrieveMobilePhoneONListHelper::DoGetListe entries are not the same"));
       
  4503 		}
       
  4504 
       
  4505 	//
       
  4506 	// TEST END
       
  4507 	//
       
  4508 
       
  4509 	StartCleanup();
       
  4510 
       
  4511 	// Pop:
       
  4512     // helper
       
  4513 	//	storeAllStatus
       
  4514 	//	byPassOnStore
       
  4515 	//	writeList
       
  4516     //  deleteAllStatus
       
  4517 	//	onStoreInfoStatus
       
  4518 	//	backup
       
  4519 	CleanupStack::PopAndDestroy(7,&backup);
       
  4520 
       
  4521 	return TestStepResult();
       
  4522 	}
       
  4523 
       
  4524 TPtrC CCTSYIntegrationTestONStore0026::GetTestStepName()
       
  4525 /**
       
  4526  * @return The test step name.
       
  4527  */
       
  4528 	{
       
  4529 	return _L("CCTSYIntegrationTestONStore0026");
       
  4530 	}
       
  4531 
       
  4532 CCTSYIntegrationTestONStore0027::CCTSYIntegrationTestONStore0027(
       
  4533 		CEtelSessionMgr& aEtelSessionMgr) :
       
  4534 	CCTSYIntegrationTestONStoreBase(aEtelSessionMgr)
       
  4535 /**
       
  4536  * Constructor.
       
  4537  */
       
  4538 	{
       
  4539 	SetTestStepName(CCTSYIntegrationTestONStore0027::GetTestStepName());
       
  4540 	}
       
  4541 
       
  4542 CCTSYIntegrationTestONStore0027::~CCTSYIntegrationTestONStore0027()
       
  4543 /**
       
  4544  * Destructor.
       
  4545  */
       
  4546 	{
       
  4547 	}
       
  4548 
       
  4549 TVerdict CCTSYIntegrationTestONStore0027::doTestStepL()
       
  4550 /**
       
  4551  * @SYMTestCaseID BA-CTSY-INT-PBON-0027
       
  4552  * @SYMFssID BA/CTSY/PBON-0027
       
  4553  * @SYMTestCaseDesc Cancel read all ON store entries.
       
  4554  * @SYMTestPriority High
       
  4555  * @SYMTestActions CAsyncRetrieveStoreList::CancelReq
       
  4556  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  4557  * @SYMTestType CIT
       
  4558  * @SYMTestCaseDependencies live/automatic
       
  4559  *
       
  4560  * Reason for test: Verify request is cancelled.
       
  4561  *
       
  4562  * @return - TVerdict code
       
  4563  */
       
  4564 	{
       
  4565 
       
  4566 	//
       
  4567 	// SET UP
       
  4568 	//
       
  4569 
       
  4570 	// Open the ADN store
       
  4571 	CHECK_TRUE_L(OpenADNStoreL(),_L("CCTSYIntegrationTestONStoreBase::OpenADNStoreL Failed"));
       
  4572 
       
  4573 	// Backup first Entry
       
  4574 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL (KMainServer, KMainPhone);
       
  4575 	RMobileONStore& onStore = iEtelSessionMgr.GetONStoreL (KMainServer,
       
  4576 			KMainPhone, KMainONStore);
       
  4577 	TBackupAllEntries backup(*this,onStore);
       
  4578 	CHECK_TRUE_L(backup.BackupL(), _L("TBackupAllEntries::Backup Could not backup"));
       
  4579 	CleanupStack::PushL (backup);
       
  4580 
       
  4581 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWholeStore 
       
  4582 	RMobileONStore::TMobileONStoreInfoV1 onStoreInfo;
       
  4583 	RMobileONStore::TMobileONStoreInfoV1Pckg onStoreInfoPckg(onStoreInfo);
       
  4584 	TExtEtelRequestStatus onStoreInfoStatus(onStore, EMobilePhoneStoreGetInfo);
       
  4585 	CleanupStack::PushL (onStoreInfoStatus);
       
  4586 	onStore.GetInfo (onStoreInfoStatus, onStoreInfoPckg);
       
  4587 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(onStoreInfoStatus, ETimeMedium),
       
  4588 			KErrNone, _L("RMobileONStore::GetInfo timed out"));
       
  4589 	CHECK_EQUALS_L(onStoreInfoStatus.Int(), KErrNone, _L("RMobileONStore::GetInfo returned an error"));
       
  4590 	CHECK_BITS_SET_L(onStoreInfo.iCaps, RMobilePhoneStore::KCapsWholeStore,KNoUnwantedBits, _L("RMobileONStore::GetInfo returned incorrect store caps"));
       
  4591 
       
  4592 	// Fill SIM phone book. 
       
  4593 	RMobileONStore::TMobileONEntryV1 entry;
       
  4594 	RMobileONStore::TMobileONEntryV1Pckg writePckg(entry);
       
  4595 	TExtEtelRequestStatus writeStatus(onStore, EMobilePhoneStoreWrite);
       
  4596 	CleanupStack::PushL (writeStatus);
       
  4597 	entry.iMode=RMobilePhone::ENetworkModeGsm;
       
  4598 	entry.iService=RMobilePhone::ETelephony;
       
  4599 	entry.iNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  4600 	entry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
  4601 	entry.iNumber.iTelNumber = _L("12012030");
       
  4602 	entry.iText = _L("Entry11");
       
  4603 	TInt usedEntries,totalEntries;
       
  4604 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  4605 	for (; usedEntries<totalEntries;++usedEntries)
       
  4606 		{
       
  4607 		entry.iIndex=-1;
       
  4608 		onStore.Write (writeStatus, writePckg);
       
  4609 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),
       
  4610 				KErrNone, _L("RMobileONStore::Write timed out"));
       
  4611 		CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileONStore::Write returned an error"));
       
  4612 		}
       
  4613 	CHECK_TRUE_L(GetUsedandTotalEntriesL(onStore,phone,usedEntries,totalEntries),_L("RMobileONStore::GetInfo can not get the number of used entries"));
       
  4614 	CHECK_EQUALS_L(usedEntries,totalEntries, _L("RMobileONStore::GetInfo Unexpected number of iUsedEntries returned" ));
       
  4615 
       
  4616 
       
  4617 	//
       
  4618 	// SET UP END
       
  4619 	//
       
  4620 
       
  4621 	StartTest ();
       
  4622 
       
  4623 	//
       
  4624 	// TEST START
       
  4625 	//
       
  4626 
       
  4627 
       
  4628 	// Use the helper class for CRetrieveMobilePhoneONList to read entries from the ON store. 
       
  4629 	TInt err;
       
  4630 	CRetrieveMobilePhoneONListExec *helper=CRetrieveMobilePhoneONListHelper::NewL(onStore);
       
  4631 	CleanupStack::PushL(helper);
       
  4632 	CMobilePhoneONList *readList = helper->DoGetList(err,ETrue);
       
  4633 
       
  4634 	// Wait one second. 
       
  4635 	User::After(KOneSecond);
       
  4636 
       
  4637 	// Cancel the request immediately. 
       
  4638 	
       
  4639 	// Check KErrCancel is returned or KErrNone if it was too late to cancel.
       
  4640 	ASSERT_TRUE(((err== KErrCancel) ||(err== KErrNone)), _L("CRetrieveMobilePhoneONListHelper::DoGetList is not able to get the list"));
       
  4641 
       
  4642 
       
  4643 	//
       
  4644 	// TEST END
       
  4645 	//
       
  4646 
       
  4647 	StartCleanup();
       
  4648 
       
  4649 	
       
  4650 	// Pop:
       
  4651 	//  helper
       
  4652 	//  writeStatus
       
  4653 	//	onStoreInfoStatus
       
  4654 	//	backup
       
  4655 	CleanupStack::PopAndDestroy(4,&backup);
       
  4656     
       
  4657 	return TestStepResult();
       
  4658 	}
       
  4659 
       
  4660 TPtrC CCTSYIntegrationTestONStore0027::GetTestStepName()
       
  4661 /**
       
  4662  * @return The test step name.
       
  4663  */
       
  4664 	{
       
  4665 	return _L("CCTSYIntegrationTestONStore0027");
       
  4666 	}
       
  4667 
       
  4668 
       
  4669 TBackupAllEntries::TBackupAllEntries(CCTSYIntegrationTestONStoreBase &aBase,
       
  4670 		RMobileONStore &aOnStore) : iValid(EFalse), iOnStore(aOnStore), iBase(aBase),
       
  4671                                      							iHelper(NULL), iList(NULL)
       
  4672 /*
       
  4673  * Constructor
       
  4674  * @param aBase pointer to the test.
       
  4675  * @param aOnStore reference to a store session
       
  4676  *
       
  4677  */
       
  4678 {
       
  4679 }
       
  4680 
       
  4681 TBool TBackupAllEntries::BackupL()
       
  4682 /*
       
  4683  * This function save the first entry in the storem and return false if its fails
       
  4684  *
       
  4685  * @return true if the backup was successful
       
  4686  *
       
  4687  */	
       
  4688 	{
       
  4689 	iValid=EFalse;
       
  4690     if(iList!=NULL)
       
  4691         return iValid;
       
  4692     if(iHelper!=NULL)
       
  4693         return iValid;
       
  4694 
       
  4695     // Read All the items from the store
       
  4696 	TInt err;
       
  4697 	iHelper=CRetrieveMobilePhoneONListHelper::NewL(iOnStore);
       
  4698     CleanupStack::PushL(iHelper);
       
  4699 	iList = iHelper->DoGetList(err);
       
  4700     if((err!=KErrNone)||(iList->Enumerate()==0))
       
  4701         {
       
  4702         iList=NULL;
       
  4703         CleanupStack::PopAndDestroy(iHelper);
       
  4704         iHelper=NULL;
       
  4705         return iValid;
       
  4706         }
       
  4707     iValid=ETrue;
       
  4708 	CleanupStack::Pop(1);
       
  4709     return iValid;
       
  4710 	}
       
  4711 
       
  4712 void TBackupAllEntries::DoCleanupL(TAny* aPtr)
       
  4713 /*
       
  4714  * This function is a static clean up function to be saved in the cleanup stack. Its restore the saved entry to the first entry in the phone
       
  4715  *
       
  4716  * @param aPtr a pointer to a TBackupAllEntries instance.
       
  4717  *
       
  4718  */	
       
  4719 	{
       
  4720 	TBackupAllEntries* me = static_cast<TBackupAllEntries*>(aPtr);
       
  4721 	me->CleanupL();
       
  4722 	}
       
  4723 
       
  4724 void TBackupAllEntries::CleanupL()
       
  4725 /*
       
  4726  * This function restore the saved entry to the first entry in the phone
       
  4727  *
       
  4728  */	
       
  4729 	{
       
  4730 	if(!iValid)
       
  4731 		return;
       
  4732     CleanupStack::PushL(iHelper);
       
  4733     TExtEtelRequestStatus deleteAllStatus(iOnStore, EMobilePhoneStoreDeleteAll);
       
  4734 	CleanupStack::PushL (deleteAllStatus);
       
  4735 	TExtEtelRequestStatus writeStatus(iOnStore, EMobilePhoneStoreWrite);
       
  4736 	CleanupStack::PushL (writeStatus);
       
  4737 
       
  4738 	iOnStore.DeleteAll (deleteAllStatus);
       
  4739     iBase.WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium);
       
  4740     for(TInt i=0;i<iList->Enumerate();++i)
       
  4741     	{
       
  4742     	RMobileONStore::TMobileONEntryV1Pckg writePckg(iList->GetEntryL (i));
       
  4743     	iOnStore.Write (writeStatus, writePckg);
       
  4744     	iBase.WaitForRequestWithTimeOut(writeStatus, ETimeMedium);
       
  4745     	}
       
  4746 
       
  4747 	CleanupStack::PopAndDestroy(3);
       
  4748     iHelper=NULL;
       
  4749     iList=NULL;
       
  4750     iValid=EFalse;
       
  4751 	}
       
  4752 
       
  4753 TBackupAllEntries::operator TCleanupItem()
       
  4754 /*
       
  4755  * This operator create a TCleanupItem to save a pointer to the DoCleanup static function and this in the cleanup stack
       
  4756  *
       
  4757  */	
       
  4758 	{
       
  4759 	return TCleanupItem(DoCleanupL,this);
       
  4760 	}