telephonyserverplugins/common_tsy/test/integration/src/cctsyintegrationtestsmsstore.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 SMSStore functional unit.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @internalTechnology
       
    20 */
       
    21 
       
    22 #include "cctsyintegrationtestsmsstore.h"
       
    23 #include "cctsyinidata.h"
       
    24 #include "cetelsessionmgr.h"
       
    25 
       
    26 
       
    27 
       
    28 /*
       
    29 PDU LENGTH IS 140 BYTES
       
    30 NO SMSC ADDRESS PRESENT
       
    31 MESSAGE HEADER FLAGS
       
    32 	MESSAGE TYPE :	SMS DELIVER
       
    33 	MSGS WAITING IN SC :	NO
       
    34 	SEND STATUS REPORT :	YES
       
    35 	USER DATA HEADER :	NO UDH
       
    36 	REPLY PATH :	NO
       
    37 
       
    38 ORIGINATING ADDRESS
       
    39 	NUMBER IS :	+441632960000
       
    40 	TYPE OF NR. :	International
       
    41 	NPI :	ISDN/Telephone (E.164/163)
       
    42 
       
    43 PROTOCOL IDENTIFIER	(0x00)
       
    44 	MESSAGE ENTITIES :	SME-to-SME
       
    45 	PROTOCOL USED :	Implicit / SC-specific
       
    46 
       
    47 DATA CODING SCHEME	(0x00)
       
    48 	AUTO-DELETION :	OFF
       
    49 	COMPRESSION :	OFF
       
    50 	MESSAGE CLASS :	NONE
       
    51 	ALPHABET USED :	7bit default
       
    52 
       
    53 SMSC TIMESTAMP :	09/07/07 08:15 GMT+1.00
       
    54 
       
    55 USER DATA PART OF SM
       
    56 	USER DATA LENGTH : 	138 septets
       
    57 	USER DATA (TEXT) :	TravelAlert 08:15: Nrthrn: Severe
       
    58 		delays on the H Barnet Branch with
       
    59 		minor delays on the rest of the line
       
    60 		due to signal failure at Camden.
       
    61 */
       
    62 _LIT8(KValidSmsPdu2, "\x24\x0c\x91\x44\x77\x79\x08\x80\x25\x00\x00\x70\x70\x90\x80\x51\x81\x40\x8a\x54\x79\xd8\x5e\x66\x07\xd9\x65\x39\x1d\x04\xc3\xe9\x62\x35\x1d\xc8\x29\xa7\xa3\xe5\x6e\x1d\x68\x5a\xb6\x97\xe5\x65\x10\xb9\xcc\x0e\xe7\xe7\xa0\xb7\x1b\x44\x47\x97\x41\x48\x90\x30\x2c\x77\x97\xe9\x20\xa1\x3c\xec\x1e\xa3\x41\xf7\x34\x1d\x0d\x6a\xa7\xdd\x6f\x39\x88\x5c\x66\x87\xf3\x73\xd0\xdb\x0d\xa2\xa3\xcb\x20\x79\x79\x4e\x07\xbd\xcd\x20\x3a\xba\x0c\x62\xa7\xdd\x65\x10\xb9\x5e\x06\xd1\xdf\xa0\x79\xfa\xec\x0e\xb3\x41\xe6\x70\x9a\x5d\x97\x97\x41\x61\x3a\x68\x18\x6e\x93\xcb\x6e\x17");
       
    63 
       
    64 /**
       
    65 PDU LENGTH IS 19 BYTES
       
    66 NO SMSC ADDRESS PRESENT
       
    67 MESSAGE HEADER FLAGS
       
    68 	MESSAGE TYPE :	SMS DELIVER
       
    69 	MSGS WAITING IN SC :	NO
       
    70 	SEND STATUS REPORT :	NO
       
    71 	USER DATA HEADER :	NO UDH
       
    72 	REPLY PATH :	NO
       
    73 
       
    74 ORIGINATING ADDRESS
       
    75 	NUMBER IS :	+441632960000
       
    76 	TYPE OF NR. :	International
       
    77 	NPI :	ISDN/Telephone (E.164/163)
       
    78 
       
    79 PROTOCOL IDENTIFIER	(0x00)
       
    80 	MESSAGE ENTITIES :	SME-to-SME
       
    81 	PROTOCOL USED :	Implicit / SC-specific
       
    82 
       
    83 DATA CODING SCHEME	(0x00)
       
    84 	AUTO-DELETION :	OFF
       
    85 	COMPRESSION :	OFF
       
    86 	MESSAGE CLASS :	NONE
       
    87 	ALPHABET USED :	7bit default
       
    88 
       
    89 SMSC TIMESTAMP :	13/09/07 17:16 GMT+1.00
       
    90 
       
    91 USER DATA PART OF SM
       
    92 	USER DATA LENGTH : 	0 septets
       
    93 	USER DATA (TEXT) :	<no data>
       
    94 */
       
    95 _LIT8(KValidEmptyPdu, "\x04\x0c\x91\x44\x97\x71\x57\x30\x12\x00\x00\x70\x90\x31\x71\x61\x05\x40\x00");
       
    96 
       
    97 
       
    98 _LIT8(KCorruptSmsPdu, "\x01\x02\x03\x04\x05\x06");
       
    99 
       
   100 CCTSYIntegrationTestSMSStoreBase::CCTSYIntegrationTestSMSStoreBase(CEtelSessionMgr& aEtelSessionMgr)
       
   101 	: CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr), iSmsStoreTestHelper(*this), iSimTsyTestHelper(*this)
       
   102 /**
       
   103  * Constructor
       
   104  */
       
   105 	{
       
   106 	}
       
   107 
       
   108 CCTSYIntegrationTestSMSStoreBase::~CCTSYIntegrationTestSMSStoreBase()
       
   109 /*
       
   110  * Destructor
       
   111  */
       
   112 	{
       
   113 	}
       
   114 	
       
   115 
       
   116 void CCTSYIntegrationTestSMSStoreBase::CreateGsmSmsEntry(
       
   117 		RMobileSmsStore::TMobileGsmSmsEntryV1& aEntry, 
       
   118 		TInt aIndex,
       
   119 		const TDesC8& aMsgData,
       
   120 		RMobileSmsStore::TMobileSmsStoreStatus aStoreStatus,
       
   121 		RMobilePhone::TMobileTON aServiceCentreTON,
       
   122 		RMobilePhone::TMobileNPI aServiceCentreNumberingPlan,
       
   123 		const TDesC& aServiceCentreNum)
       
   124 /**
       
   125  * Populates aEntry with parameters to create a valid SMS entry which
       
   126  * can be written to the store. Note that aEntry.iMsgData is not populated.
       
   127  * 
       
   128  * @param aEntry Entry to be populated
       
   129  * @param aIndex Slot number of the entry
       
   130  * @param aServiceCentreTON Service centre type of number
       
   131  * @param aServiceCentreNumberingPlan Service centre numbering plan
       
   132  * @param aServiceCentreNum Service centre number
       
   133  */
       
   134 	{
       
   135 	aEntry.iMsgStatus = aStoreStatus;
       
   136 	aEntry.iIndex = aIndex;
       
   137 	aEntry.iMsgData = aMsgData;
       
   138 	aEntry.iServiceCentre.iTypeOfNumber =  aServiceCentreTON; 
       
   139 	aEntry.iServiceCentre.iNumberPlan = aServiceCentreNumberingPlan; 
       
   140 	aEntry.iServiceCentre.iTelNumber = aServiceCentreNum;
       
   141 	}
       
   142 
       
   143 
       
   144 
       
   145 void CCTSYIntegrationTestSMSStoreBase::WaitForPhoneBookCachingToFinish()
       
   146 	{
       
   147 	User::After(KOneSecond * 20);
       
   148 	}
       
   149 
       
   150 CCTSYIntegrationTestSMSStore0001::CCTSYIntegrationTestSMSStore0001(CEtelSessionMgr& aEtelSessionMgr)
       
   151 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
   152 /**
       
   153  * Constructor.
       
   154  */
       
   155 	{
       
   156 	SetTestStepName(CCTSYIntegrationTestSMSStore0001::GetTestStepName());
       
   157 	}
       
   158 
       
   159 CCTSYIntegrationTestSMSStore0001::~CCTSYIntegrationTestSMSStore0001()
       
   160 /**
       
   161  * Destructor.
       
   162  */
       
   163 	{
       
   164 	}
       
   165 
       
   166 TVerdict CCTSYIntegrationTestSMSStore0001::doTestStepL()
       
   167 /**
       
   168  * @SYMTestCaseID BA-CTSY-INT-SMSS-0001
       
   169  * @SYMFssID BA/CTSY/SMSS-0001
       
   170  * @SYMTestCaseDesc Get phone store information.
       
   171  * @SYMTestPriority High
       
   172  * @SYMTestActions RMobilePhone::GetPhoneStoreInfo
       
   173  * @SYMTestExpectedResults Pass - Phone store information returned correctly.
       
   174  * @SYMTestType CIT
       
   175  * @SYMTestCaseDependencies live/automatic
       
   176  *
       
   177  * Reason for test: Verify phone store information returned is correct.
       
   178  *
       
   179  * @return - TVerdict code
       
   180  */
       
   181 	{
       
   182 
       
   183 	//
       
   184 	// SET UP
       
   185 	//
       
   186 
       
   187 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);	
       
   188 	
       
   189 	//
       
   190 	// SET UP END
       
   191 	//
       
   192 	
       
   193 	StartTest();
       
   194 	
       
   195 	//
       
   196 	// TEST START
       
   197 	//	
       
   198 	
       
   199 	// Get SMS store info. using RMobilePhoneStore::GetInfo with RMobilePhoneStore::TMobilePhoneStoreInfoV1 
       
   200 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
   201 	CleanupStack::PushL(getInfoStatus);
       
   202 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
   203 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
   204 
       
   205 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
   206 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::GetInfo timed out"));
       
   207 	ASSERT_EQUALS(getInfoStatus.Int(), KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));				
       
   208 
       
   209 	// Check: 
       
   210 	// iName == KETelIccSmsStore 
       
   211 	ASSERT_TRUE(storeInfo.iName == KETelIccSmsStore, _L("RMobilePhoneStore::GetInfo returned wrong store name"));
       
   212 	
       
   213 	// iType == RMobilePhoneStore::EShortMessageStore 
       
   214 	ASSERT_EQUALS(storeInfo.iType, RMobilePhoneStore::EShortMessageStore, _L("RMobilePhoneStore::GetInfo returned wrong Type"));
       
   215 	
       
   216 	// iTotalEntries >= -1 
       
   217 	ASSERT_TRUE(storeInfo.iTotalEntries >= -1, _L("RMobilePhoneStore::GetInfo returned wrong Total Entries"));
       
   218 	
       
   219 	// iUsedEntries >= -1 
       
   220 	ASSERT_TRUE(storeInfo.iUsedEntries >= -1, _L("RMobilePhoneStore::GetInfo returned wrong Used Entries"));
       
   221 	
       
   222 	// iCaps == RMobilePhoneStore::KCapsIndividualEntry  
       
   223 	//     | RMobilePhoneStore::KCapsDeleteAll 
       
   224 	//     | RMobilePhoneStore::KCapsReadAccess 
       
   225 	//     | RMobilePhoneStore::KCapsWriteAccess 
       
   226 	//     | RMobilePhoneStore::KCapsNotifyEvent 
       
   227 	//     | RMobilePhoneStore::KCapsWholeStore 				   
       
   228 	TUint wantedBits = RMobilePhoneStore::KCapsIndividualEntry  
       
   229 	    			 | RMobilePhoneStore::KCapsDeleteAll 
       
   230 	    			 | RMobilePhoneStore::KCapsReadAccess 
       
   231 	    			 | RMobilePhoneStore::KCapsWriteAccess 
       
   232 	    			 | RMobilePhoneStore::KCapsNotifyEvent 
       
   233 	    			 | RMobilePhoneStore::KCapsWholeStore; 
       
   234 	    			 
       
   235 	ASSERT_BITS_SET(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned unexpected iCaps"));			
       
   236 
       
   237 	//
       
   238     // TEST END
       
   239     //
       
   240 
       
   241     StartCleanup();
       
   242 	
       
   243 	// Pop
       
   244 	// getInfoStatus
       
   245 	CleanupStack::PopAndDestroy(&getInfoStatus);
       
   246 	
       
   247 	return TestStepResult();
       
   248 	}
       
   249 
       
   250 TPtrC CCTSYIntegrationTestSMSStore0001::GetTestStepName()
       
   251 /**
       
   252  * @return The test step name.
       
   253  */
       
   254 	{
       
   255 	return _L("CCTSYIntegrationTestSMSStore0001");
       
   256 	}
       
   257 
       
   258 
       
   259 
       
   260 CCTSYIntegrationTestSMSStore0002::CCTSYIntegrationTestSMSStore0002(CEtelSessionMgr& aEtelSessionMgr)
       
   261 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
   262 /**
       
   263  * Constructor.
       
   264  */
       
   265 	{
       
   266 	SetTestStepName(CCTSYIntegrationTestSMSStore0002::GetTestStepName());
       
   267 	}
       
   268 
       
   269 CCTSYIntegrationTestSMSStore0002::~CCTSYIntegrationTestSMSStore0002()
       
   270 /**
       
   271  * Destructor.
       
   272  */
       
   273 	{
       
   274 	}
       
   275 
       
   276 TVerdict CCTSYIntegrationTestSMSStore0002::doTestStepL()
       
   277 /**
       
   278  * @SYMTestCaseID BA-CTSY-INT-SMSS-0002
       
   279  * @SYMFssID BA/CTSY/SMSS-0002
       
   280  * @SYMTestCaseDesc Read SMS message from the SMS store.
       
   281  * @SYMTestPriority High
       
   282  * @SYMTestActions RMobilePhoneStore::Read
       
   283  * @SYMTestExpectedResults Pass - Entry read successfully.
       
   284  * @SYMTestType CIT
       
   285  * @SYMTestCaseDependencies live/automatic
       
   286  *
       
   287  * Reason for test: Verify entries are read correctly.
       
   288  *
       
   289  * @return - TVerdict code
       
   290  */
       
   291 	{
       
   292 
       
   293 	//
       
   294 	// SET UP
       
   295 	//
       
   296 	
       
   297 	
       
   298 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
   299 
       
   300 	WaitForPhoneBookCachingToFinish();
       
   301 	
       
   302 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess
       
   303 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
   304 	CleanupStack::PushL(getInfoStatus);
       
   305 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
   306 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
   307 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
   308 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
   309 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
   310 	CHECK_BITS_SET_L(storeInfo.iCaps, RMobilePhoneStore::KCapsReadAccess,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect store caps"));
       
   311 				   
       
   312 	// Write entries to the first slot, slot 4 and the maximum slot in the phone book. PDU in the entry should be coded with valid  
       
   313 	// * TP-Message parameters 
       
   314 	// * Type of number 
       
   315 	// * Type of number plan 
       
   316 	// * TP Originator address 
       
   317 	// * TP Protocol Identifier 
       
   318 	// * TP Data Coding Scheme 
       
   319 	// * TP Service Center Time Stamp 
       
   320 	// * TP User data length 
       
   321 
       
   322 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
   323 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry); 
       
   324 
       
   325 	// Create and write entry for 1st slot
       
   326 	CreateGsmSmsEntry(entry, 1, KValidSmsPdu1(), RMobileSmsStore::EStoredMessageRead);
       
   327 
       
   328 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
   329 	CleanupStack::PushL(writeStatus);
       
   330 	smsStore.Write(writeStatus,pckgEntry);
       
   331 	CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));
       
   332 	CHECK_TRUE_L(writeStatus.Int() == KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
   333 	
       
   334 	// Create and write entry for ninth slot
       
   335 	CreateGsmSmsEntry(	entry, 9, KValidSmsPdu2(), RMobileSmsStore::EStoredMessageUnread, 
       
   336 						RMobilePhone::EInternationalNumber, 
       
   337 						RMobilePhone::EIsdnNumberPlan);
       
   338 	smsStore.Write(writeStatus,pckgEntry);
       
   339 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Write timed out"));
       
   340 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileSmsStore::Write returned an error"));	
       
   341 
       
   342 	// Create and write entry for last slot
       
   343 	CreateGsmSmsEntry(	entry, storeInfo.iTotalEntries, KValidSmsPdu1(), 
       
   344 						RMobileSmsStore::EStoredMessageUnread, 
       
   345 						RMobilePhone::EAbbreviatedNumber, 
       
   346 						RMobilePhone::EIsdnNumberPlan);
       
   347 	smsStore.Write(writeStatus,pckgEntry);
       
   348 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Write timed out"));	
       
   349 	CHECK_EQUALS_L(writeStatus.Int(), KErrNone, _L("RMobileSmsStore::Write returned an error"));	
       
   350 
       
   351 	//
       
   352 	// SET UP END
       
   353 	//
       
   354 	
       
   355 	StartTest();
       
   356 	
       
   357 	//
       
   358 	// TEST START
       
   359 	//
       
   360 	
       
   361 	
       
   362 	// Read entry from the first slot, slot 9 and the maximum slot from the phone book in turn passing an RMobileSmsStore::TMobileGsmSmsEntryV1 as aEntry. 
       
   363 
       
   364 	// Set up and read from slot1
       
   365 	RMobileSmsStore::TMobileGsmSmsEntryV1 readFirstEntry;
       
   366 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg readFirstEntryPckg(readFirstEntry);
       
   367 	readFirstEntry.iIndex = 1;
       
   368 	readFirstEntry.iMsgData.Zero();
       
   369 	readFirstEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
       
   370 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
   371 	CleanupStack::PushL(readStatus);	
       
   372 	smsStore.Read(readStatus,readFirstEntryPckg);	
       
   373 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),KErrNone,_L("RMobileSmsStore::Read timed out"));
       
   374 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileSmsStore::Read returned an error"));
       
   375 	
       
   376 	// Set up and read from slot 9	
       
   377 	RMobileSmsStore::TMobileGsmSmsEntryV1 readNinthEntry;
       
   378 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg readNinthEntryPckg(readNinthEntry);
       
   379 	readNinthEntry.iIndex = 9;
       
   380 	readNinthEntry.iMsgData.Zero();
       
   381 	readNinthEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;	
       
   382 	smsStore.Read(readStatus,readNinthEntryPckg);	
       
   383 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),KErrNone, _L("RMobileSmsStore::Read Could not read SMS store"));
       
   384 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileSmsStore::Read returned an error"));
       
   385 
       
   386 	// Set up and read from last slot
       
   387 	RMobileSmsStore::TMobileGsmSmsEntryV1 readLastEntry;
       
   388 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg readLastEntryPckg(readLastEntry);
       
   389 	readLastEntry.iIndex = storeInfo.iTotalEntries;
       
   390 	readLastEntry.iMsgData.Zero();
       
   391 	readLastEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;	
       
   392 	smsStore.Read(readStatus,readLastEntryPckg);	
       
   393 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium),KErrNone, _L("RMobileSmsStore::Read Could not read SMS store"));
       
   394 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileSmsStore::Read returned an error"));
       
   395 	
       
   396 	// For each one: 
       
   397 
       
   398 	// Check iMsgStatus is the same as that written to the phone book in set up.
       
   399 	ASSERT_EQUALS(readFirstEntry.iMsgStatus, RMobileSmsStore::EStoredMessageRead, _L("RMobileSmsStore::Read First Read Entry has the wrong iMsgStatus"));
       
   400 	ASSERT_EQUALS(readNinthEntry.iMsgStatus, RMobileSmsStore::EStoredMessageUnread, _L("RMobileSmsStore::Read Fourth Read Entry has the wrong iMsgStatus"));
       
   401 	ASSERT_EQUALS(readLastEntry.iMsgStatus, RMobileSmsStore::EStoredMessageUnread, 	_L("RMobileSmsStore::Read Last Read Entry has the wrong iMsgStatus"));	        																
       
   402 
       
   403 	// Check iMsgData is the same as that written to the phone book in set up.
       
   404 	ASSERT_EQUALS_DES8(readFirstEntry.iMsgData, KValidSmsPdu1,_L("RMobileSmsStore::Read First Read Entry has the wrong iMsgData"));
       
   405 	ASSERT_EQUALS_DES8(readNinthEntry.iMsgData, KValidSmsPdu2,_L("RMobileSmsStore::Read Fourth Read Entry has the wrong iMsgData"));
       
   406 	ASSERT_EQUALS_DES8(readLastEntry.iMsgData, KValidSmsPdu1,_L("RMobileSmsStore::Read Last Read Entry has the wrong iMsgData"));	
       
   407 							                                                                                                                            		
       
   408 	// Check iServiceCentre is the same as that written to the phone book in set up.
       
   409 	ASSERT_EQUALS(readFirstEntry.iServiceCentre.iTypeOfNumber, RMobilePhone::ENationalNumber,_L("RMobileSmsStore::Read First Read Entry has the wrong iServiceCentre.iTypeOfNumber"));
       
   410 	ASSERT_EQUALS(readFirstEntry.iServiceCentre.iNumberPlan, RMobilePhone::EIsdnNumberPlan,	_L("RMobileSmsStore::Read First Read Entry has the wrong iServiceCentre.iNumberPlan"));
       
   411 	ASSERT_EQUALS_DES16(readFirstEntry.iServiceCentre.iTelNumber, KNumber,_L("RMobileSmsStore::Read First Read Entry has the wrong iServiceCentre.iTelNumber"));
       
   412 		
       
   413 	ASSERT_EQUALS(readNinthEntry.iServiceCentre.iTypeOfNumber, RMobilePhone::EInternationalNumber, _L("RMobileSmsStore::Read Ninth Read Entry has the wrong iServiceCentre.iTypeOfNumber"));
       
   414 	ASSERT_EQUALS(readNinthEntry.iServiceCentre.iNumberPlan, RMobilePhone::EIsdnNumberPlan,_L("RMobileSmsStore::Read Ninth Read Entry has the wrong iServiceCentre.iNumberPlan"));
       
   415 	ASSERT_EQUALS_DES16(readNinthEntry.iServiceCentre.iTelNumber, KNumberInternational, _L("RMobileSmsStore::Read Ninth Read Entry has the wrong iServiceCentre.iTelNumber"));
       
   416 		
       
   417 	ASSERT_EQUALS(readLastEntry.iServiceCentre.iTypeOfNumber, RMobilePhone::EAbbreviatedNumber, _L("RMobileSmsStore::Read Last Read Entry has the wrong iServiceCentre.iTypeOfNumber"))	;
       
   418 	ASSERT_EQUALS(readLastEntry.iServiceCentre.iNumberPlan, RMobilePhone::EIsdnNumberPlan,_L("RMobileSmsStore::Read Last Read Entry has the wrong iServiceCentre.iNumberPlan"))	;
       
   419 	ASSERT_EQUALS_DES16(readLastEntry.iServiceCentre.iTelNumber, KNumber,_L("RMobileSmsStore::Read Last Read Entry has the wrong iServiceCentre.iTelNumber"));
       
   420 
       
   421 	//
       
   422 	// TEST END
       
   423 	//
       
   424 
       
   425     StartCleanup();	
       
   426 	
       
   427 	// Pop:
       
   428 	// getInfoStatus
       
   429 	// writeStatus
       
   430 	// readStatus	
       
   431 	CleanupStack::PopAndDestroy(3,&getInfoStatus);
       
   432 	
       
   433 	return TestStepResult();
       
   434 	}
       
   435 
       
   436 TPtrC CCTSYIntegrationTestSMSStore0002::GetTestStepName()
       
   437 /**
       
   438  * @return The test step name.
       
   439  */
       
   440 	{
       
   441 	return _L("CCTSYIntegrationTestSMSStore0002");
       
   442 	}
       
   443 
       
   444 
       
   445 
       
   446 CCTSYIntegrationTestSMSStore0003::CCTSYIntegrationTestSMSStore0003(CEtelSessionMgr& aEtelSessionMgr)
       
   447 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
   448 /**
       
   449  * Constructor.
       
   450  */
       
   451 	{
       
   452 	SetTestStepName(CCTSYIntegrationTestSMSStore0003::GetTestStepName());
       
   453 	}
       
   454 
       
   455 CCTSYIntegrationTestSMSStore0003::~CCTSYIntegrationTestSMSStore0003()
       
   456 /**
       
   457  * Destructor.
       
   458  */
       
   459 	{
       
   460 	}
       
   461 
       
   462 TVerdict CCTSYIntegrationTestSMSStore0003::doTestStepL()
       
   463 /**
       
   464  * @SYMTestCaseID BA-CTSY-INT-SMSS-0003
       
   465  * @SYMFssID BA/CTSY/SMSS-0003
       
   466  * @SYMTestCaseDesc Read entry that is not present in the SMS store.
       
   467  * @SYMTestPriority High
       
   468  * @SYMTestActions RMobilePhoneStore::Read, RMobilePhoneStore::Read
       
   469  * @SYMTestExpectedResults Pass - KErrNotFound returned when reading a non-existent entry.
       
   470  * @SYMTestType CIT
       
   471  * @SYMTestCaseDependencies live/automatic
       
   472  *
       
   473  * Reason for test: Verify KErrNotFound is returned.
       
   474  *
       
   475  * @return - TVerdict code
       
   476  */
       
   477 	{
       
   478 
       
   479 	//
       
   480 	// SET UP
       
   481 	//
       
   482 
       
   483 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess 
       
   484 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
   485 
       
   486 	WaitForPhoneBookCachingToFinish();
       
   487 	
       
   488 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
   489 	CleanupStack::PushL(getInfoStatus);
       
   490 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
   491 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
   492 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
   493 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out")); 
       
   494 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
   495 	CHECK_BITS_SET_L(storeInfo.iCaps, RMobilePhoneStore::KCapsReadAccess,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect store caps"));
       
   496 				   
       
   497 	// Delete an entry from a known slot. 
       
   498 	// check if it is empty
       
   499 	RMobileSmsStore::TMobileGsmSmsEntryV1 readEntry;
       
   500 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgReadEntry(readEntry);
       
   501 	TInt knownSlotIndex = 1;
       
   502 	readEntry.iIndex = knownSlotIndex;
       
   503 	readEntry.iMsgData.Zero();
       
   504 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
       
   505 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
   506 	CleanupStack::PushL(readStatus);
       
   507 		
       
   508 	smsStore.Read(readStatus,pckgReadEntry);
       
   509 	CHECK_TRUE_L(WaitForRequestWithTimeOut(readStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::Read timed out")) ;
       
   510 	CHECK_EQUALS_L(readStatus.Int(), KErrNone, _L("RMobileSmsStore::Read returned an error"));
       
   511 
       
   512 	// If the entry exists, delete it				
       
   513 	if(readStatus.Int() == KErrNone)
       
   514 		{		
       
   515 		TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDelete);
       
   516 		CleanupStack::PushL(deleteStatus);		
       
   517 		smsStore.Delete(deleteStatus,knownSlotIndex);
       
   518 		CHECK_TRUE_L(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium) == KErrNone, _L("RMobileSmsStore::Delete timed out"));
       
   519 		CHECK_TRUE_L(deleteStatus.Int() == KErrNone,_L("RMobileSmsStore::Delete returned an error"));
       
   520 		CleanupStack::PopAndDestroy(&deleteStatus);
       
   521 		}
       
   522 
       
   523 	//
       
   524 	// SET UP END
       
   525 	//
       
   526 	
       
   527 	StartTest();
       
   528 	
       
   529 	//
       
   530 	// TEST START
       
   531 	//
       
   532 	
       
   533 	
       
   534 	// Read an entry from a known empty slot. 
       
   535 	readEntry.iIndex = knownSlotIndex;
       
   536 	readEntry.iMsgData.Zero();
       
   537 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;	
       
   538 	smsStore.Read(readStatus,pckgReadEntry);
       
   539 	
       
   540 	// Check KErrNotFound is returned.
       
   541 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Read timed out"));
       
   542 	ASSERT_EQUALS(readStatus.Int(), KErrNotFound, _L("RMobileSmsStore::Read did not return KErrNotFound"));	
       
   543 
       
   544 	//
       
   545     // TEST END
       
   546     //
       
   547 
       
   548     StartCleanup();
       
   549 	// Pop:
       
   550 	// getInfoStatus
       
   551 	// readStatus
       
   552 	CleanupStack::PopAndDestroy(2,&getInfoStatus);		
       
   553 	return TestStepResult();
       
   554 	}
       
   555 
       
   556 TPtrC CCTSYIntegrationTestSMSStore0003::GetTestStepName()
       
   557 /**
       
   558  * @return The test step name.
       
   559  */
       
   560 	{
       
   561 	return _L("CCTSYIntegrationTestSMSStore0003");
       
   562 	}
       
   563 
       
   564 
       
   565 
       
   566 CCTSYIntegrationTestSMSStore0004::CCTSYIntegrationTestSMSStore0004(CEtelSessionMgr& aEtelSessionMgr)
       
   567 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
   568 /**
       
   569  * Constructor.
       
   570  */
       
   571 	{
       
   572 	SetTestStepName(CCTSYIntegrationTestSMSStore0004::GetTestStepName());
       
   573 	}
       
   574 
       
   575 CCTSYIntegrationTestSMSStore0004::~CCTSYIntegrationTestSMSStore0004()
       
   576 /**
       
   577  * Destructor.
       
   578  */
       
   579 	{
       
   580 	}
       
   581 
       
   582 TVerdict CCTSYIntegrationTestSMSStore0004::doTestStepL()
       
   583 /**
       
   584  * @SYMTestCaseID BA-CTSY-INT-SMSS-0004
       
   585  * @SYMFssID BA/CTSY/SMSS-0004
       
   586  * @SYMTestCaseDesc Read SMS message from the SMS store using invalid slot numbers.
       
   587  * @SYMTestPriority High
       
   588  * @SYMTestActions RMobilePhoneStore::Read
       
   589  * @SYMTestExpectedResults Pass - Error returned on read.
       
   590  * @SYMTestType CIT
       
   591  * @SYMTestCaseDependencies live/automatic
       
   592  *
       
   593  * Reason for test: Verify KErrArgument or KErrGsmSMSInvalidMemoryIndex or KErrNotFound is returned.
       
   594  *
       
   595  * @return - TVerdict code
       
   596  */
       
   597 	{
       
   598 
       
   599 	//
       
   600 	// SET UP
       
   601 	//
       
   602 
       
   603 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess 
       
   604 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
   605 
       
   606 	WaitForPhoneBookCachingToFinish();
       
   607 	
       
   608 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
   609 	CleanupStack::PushL(getInfoStatus);
       
   610 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
   611 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
   612 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
   613 CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
   614 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
   615 	CHECK_BITS_SET_L(storeInfo.iCaps, RMobilePhoneStore::KCapsReadAccess,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect store caps"));
       
   616 				   
       
   617 	//
       
   618 	// SET UP END
       
   619 	//
       
   620 	
       
   621 	StartTest();
       
   622 	
       
   623 	//
       
   624 	// TEST START
       
   625 	//
       
   626 	
       
   627 	
       
   628 	// ===  Read an entry with an invalid slot number ===
       
   629 
       
   630 	// Read a single entry from the phone book using aIndex = -1 
       
   631 	RMobileSmsStore::TMobileGsmSmsEntryV1 readEntry;
       
   632 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgReadEntry(readEntry);
       
   633 	readEntry.iIndex = -1;
       
   634 	readEntry.iMsgData.Zero();
       
   635 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
       
   636 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
   637 	CleanupStack::PushL(readStatus);	
       
   638 	smsStore.Read(readStatus,pckgReadEntry);
       
   639 	// Check KErrArgument or KErrGsmSMSInvalidMemoryIndex or KErrNotFound is returned.
       
   640 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Read timed out"));
       
   641 	ASSERT_TRUE((readStatus.Int() == KErrArgument) || 
       
   642 				(readStatus.Int() == KErrGsmSMSInvalidMemoryIndex) || 
       
   643 				(readStatus.Int() == KErrNotFound),
       
   644 				_L("RMobileSmsStore::Read Did not get the expected KErrArgument || KErrGsmSMSInvalidMemoryIndex || KErrNotFound when reading from -1 index"));
       
   645 	
       
   646 
       
   647 	// Read a single entry from the phone book using aIndex = -10 
       
   648 	readEntry.iIndex = -10;
       
   649 	smsStore.Read(readStatus,pckgReadEntry);	
       
   650 	// Check KErrArgument or KErrGsmSMSInvalidMemoryIndex or KErrNotFound is returned.
       
   651 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Read timed out"));
       
   652 	ASSERT_TRUE((readStatus.Int() == KErrArgument) || 
       
   653 				(readStatus.Int() == KErrGsmSMSInvalidMemoryIndex) || 
       
   654 				(readStatus.Int() == KErrNotFound),
       
   655 				_L("RMobileSmsStore::Read Did not get the expected KErrArgument || KErrGsmSMSInvalidMemoryIndex || KErrNotFound when reading from -10 index"));
       
   656 	
       
   657 
       
   658 	// Read a single entry from the phone book using aIndex = -50 
       
   659 	readEntry.iIndex = -50;
       
   660 	smsStore.Read(readStatus,pckgReadEntry);	
       
   661 	// Check KErrArgument or KErrGsmSMSInvalidMemoryIndex or KErrNotFound is returned.
       
   662 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Read timed out"));
       
   663 	ASSERT_TRUE((readStatus.Int() == KErrArgument) || 
       
   664 				(readStatus.Int() == KErrGsmSMSInvalidMemoryIndex) || 
       
   665 				(readStatus.Int() == KErrNotFound),
       
   666 				_L("RMobileSmsStore::Read Did not get the expected KErrArgument || KErrGsmSMSInvalidMemoryIndex || KErrNotFound when reading from -50 index"));
       
   667 
       
   668 	//
       
   669     // TEST END
       
   670     //
       
   671 
       
   672     StartCleanup();
       
   673 	
       
   674 	// Pop:
       
   675 	// getInfoStatus
       
   676 	// readStatus
       
   677 	CleanupStack::PopAndDestroy(2,&getInfoStatus);		
       
   678 	return TestStepResult();
       
   679 	}
       
   680 
       
   681 TPtrC CCTSYIntegrationTestSMSStore0004::GetTestStepName()
       
   682 /**
       
   683  * @return The test step name.
       
   684  */
       
   685 	{
       
   686 	return _L("CCTSYIntegrationTestSMSStore0004");
       
   687 	}
       
   688 
       
   689 
       
   690 
       
   691 CCTSYIntegrationTestSMSStore0005::CCTSYIntegrationTestSMSStore0005(CEtelSessionMgr& aEtelSessionMgr)
       
   692 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
   693 /**
       
   694  * Constructor.
       
   695  */
       
   696 	{
       
   697 	SetTestStepName(CCTSYIntegrationTestSMSStore0005::GetTestStepName());
       
   698 	}
       
   699 
       
   700 CCTSYIntegrationTestSMSStore0005::~CCTSYIntegrationTestSMSStore0005()
       
   701 /**
       
   702  * Destructor.
       
   703  */
       
   704 	{
       
   705 	}
       
   706 
       
   707 TVerdict CCTSYIntegrationTestSMSStore0005::doTestStepL()
       
   708 /**
       
   709  * @SYMTestCaseID BA-CTSY-INT-SMSS-0005
       
   710  * @SYMFssID BA/CTSY/SMSS-0005
       
   711  * @SYMTestCaseDesc Write SMS message to the SMS store.
       
   712  * @SYMTestPriority High
       
   713  * @SYMTestActions RMobilePhoneStore::Write, RMobilePhoneStore::Read, RMobilePhoneStore::NotifyStoreEvent
       
   714  * @SYMTestExpectedResults Pass - Write successful. 
       
   715  * @SYMTestType CIT
       
   716  * @SYMTestCaseDependencies live/automatic
       
   717  *
       
   718  * Reason for test: Verify entries are written correctly and can be read.
       
   719  *
       
   720  * @return - TVerdict code
       
   721  */
       
   722 	{
       
   723 
       
   724 	//
       
   725 	// SET UP
       
   726 	//
       
   727 
       
   728 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
   729 	
       
   730 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess | KCapsWriteAccess | KCapsNotifyEvent 
       
   731 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
   732 
       
   733 	WaitForPhoneBookCachingToFinish();
       
   734 	
       
   735 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
   736 	CleanupStack::PushL(getInfoStatus);
       
   737 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
   738 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
   739 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
   740 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
   741 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
   742 					
       
   743 	TUint wantedBits = RMobilePhoneStore::KCapsReadAccess | 
       
   744 					   RMobilePhoneStore::KCapsWriteAccess | 
       
   745 					   RMobilePhoneStore::KCapsNotifyEvent;
       
   746 	CHECK_BITS_SET_L(storeInfo.iCaps, wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
   747 
       
   748 	// Ensure phone store is not full. 	
       
   749 	TInt clearSpace = iSimTsyTestHelper.EnsureEmptyStoreSpaceL(smsStore,KETelIccSmsStore,storeInfo,phone);
       
   750 	CHECK_TRUE_L(clearSpace>0,_L("TSimTsyTestHelper::EnsureEmptyStoreSpaceL returned an error"));
       
   751 
       
   752 	//
       
   753 	// SET UP END
       
   754 	//
       
   755 	
       
   756 	StartTest();
       
   757 	
       
   758 	//
       
   759 	// TEST START
       
   760 	//
       
   761 	
       
   762 	
       
   763 	// ===  Find out how many entries are used in the phone store ===
       
   764 	
       
   765 	// Get phone store information using RMobilePhone::GetPhoneStoreInfo and KETelIccSmsStore 
       
   766 	// Store the iUsedEntries returned.
       
   767 	// Get phone book store information using RMobilePhoneStore::GetInfo 
       
   768 	// Store the iUsedEntries returned.
       
   769 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
   770 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
   771 	TInt usedEntries = -1;
       
   772 	TInt usedEntries2 = -1;
       
   773 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
   774 			phoneStoreInfoPckg,
       
   775 			phone, 
       
   776 			usedEntries, 
       
   777 			usedEntries2), 
       
   778 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
   779 
       
   780 	// ===  Write a valid entry (RMobileSmsStore::TMobileGsmSmsEntryV1) ===
       
   781 
       
   782 	// post notifier for RMobilePhoneStore::NotifyStoreEvent
       
   783 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
   784 	CleanupStack::PushL(notifyStoreEventStatus);
       
   785 	TUint32 storeEvent;
       
   786 	TInt index;
       
   787 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);
       
   788 	
       
   789 	// Write a valid entry with a entry into the phone store specifying a specific index to store the entry which does not contain an entry. 
       
   790 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
   791 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry); 
       
   792 	CreateGsmSmsEntry(entry, clearSpace, KValidSmsPdu1(),
       
   793 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
   794 			RMobilePhone::EIsdnNumberPlan);
       
   795 	
       
   796 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
   797 	CleanupStack::PushL(writeStatus);	
       
   798 	smsStore.Write(writeStatus,pckgEntry);
       
   799 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Write Timed out"));
       
   800 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
   801 
       
   802 	TEST_CHECK_POINT_L(_L("RMobileSmsStore::Write returned an error, not proceeding with test"));
       
   803 		
       
   804 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreEntryAdded
       
   805 	RMobilePhoneStore::TMobileStoreEvent expectedEvent = RMobilePhoneStore::KStoreEntryAdded ;
       
   806 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
   807 													notifyStoreEventStatus,
       
   808 													storeEvent,
       
   809 													expectedEvent,
       
   810 													index);
       
   811 
       
   812 	// ===  Read the written entry ===
       
   813 
       
   814 	// Read the entry from the phone store. 
       
   815 	RMobileSmsStore::TMobileGsmSmsEntryV1 readEntry;
       
   816 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgReadEntry(readEntry);
       
   817 	readEntry.iIndex = index;
       
   818 	readEntry.iMsgData.Zero();
       
   819 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
       
   820 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
   821 	CleanupStack::PushL(readStatus);
       
   822 		
       
   823 	smsStore.Read(readStatus,pckgReadEntry);
       
   824 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Read, Timed out"));
       
   825 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileSmsStore::Read returned an error"));			
       
   826 	
       
   827 	// Check that the entry information is the same as that written.
       
   828 	ASSERT_EQUALS(readEntry.iMsgStatus, RMobileSmsStore::EStoredMessageUnread, 	_L("RMobileSmsStore::Read Read Entry has the wrong iMsgStatus"));
       
   829 	ASSERT_EQUALS_DES8(readEntry.iMsgData, KValidSmsPdu1, _L("RMobileSmsStore::Read Read Entry has the wrong iMsgData"));
       
   830 									
       
   831 	// Check iServiceCentre is the same as that written to the phone book in set up.
       
   832 	ASSERT_EQUALS(readEntry.iServiceCentre.iTypeOfNumber,  RMobilePhone::ENationalNumber, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iTypeOfNumber"));
       
   833 	ASSERT_EQUALS(readEntry.iServiceCentre.iNumberPlan, RMobilePhone::EIsdnNumberPlan, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iNumberPlan"));
       
   834 	ASSERT_EQUALS_DES16(readEntry.iServiceCentre.iTelNumber, KNumber, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iTelNumber"));
       
   835 
       
   836 	// ===  Get the number of used entries and check it is 1 higher than before writing the new entry ===
       
   837 
       
   838 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 higher than that stored if this API is supported
       
   839 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 higher than that stored.
       
   840 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg,  
       
   841 				phone, usedEntries +1, usedEntries2 +1), 
       
   842 				KErrNone, 
       
   843 				_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
   844 
       
   845 	// ===  Write an entry to the same slot number as before ===
       
   846 
       
   847 	// post notifier for RMobilePhoneStore::NotifyStoreEvent
       
   848 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);
       
   849 	
       
   850 	// Write a valid entry with a entry into the phone store specifying a specific index to 
       
   851 	// store the entry which is the same as the index used in the first write. 
       
   852 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry2;
       
   853 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry2(entry2);
       
   854 	CreateGsmSmsEntry(entry2, clearSpace, KValidSmsPdu1(), 
       
   855 			RMobileSmsStore::EStoredMessageRead, RMobilePhone::EInternationalNumber,
       
   856 			RMobilePhone::EIsdnNumberPlan);
       
   857 	smsStore.Write(writeStatus,pckgEntry2);
       
   858 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Write timed out"));
       
   859 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
   860 	
       
   861 	TEST_CHECK_POINT_L(_L("RMobileSmsStore::Write returned an error"));
       
   862 	
       
   863 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreEntryChanged
       
   864 	expectedEvent = RMobilePhoneStore::KStoreEntryChanged;
       
   865 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
   866 													notifyStoreEventStatus,
       
   867 													storeEvent,
       
   868 													expectedEvent,
       
   869 													entry2.iIndex);
       
   870 	
       
   871 	// DEFECT HERE!
       
   872 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10003);
       
   873 
       
   874 	// ===  Read the written entry ===
       
   875 
       
   876 	// Read the entry from the phone store. 
       
   877 	readEntry.iIndex = entry2.iIndex; 
       
   878 	smsStore.Read(readStatus,pckgReadEntry);
       
   879 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Read, Timed out"));
       
   880 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileSmsStore::Read returned an error"));
       
   881 	
       
   882 	// Check that the entry information is the same as that written.
       
   883 	ASSERT_EQUALS(readEntry.iMsgStatus, RMobileSmsStore::EStoredMessageRead, _L("RMobileSmsStore::Read Read Entry has the wrong iMsgStatus"));
       
   884 	ASSERT_EQUALS_DES8(readEntry.iMsgData, KValidSmsPdu1, _L("RMobileSmsStore::Read Read Entry has the wrong iMsgData"));	
       
   885 	ASSERT_EQUALS(readEntry.iServiceCentre.iTypeOfNumber,  RMobilePhone::EInternationalNumber, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iTypeOfNumber"));
       
   886 	ASSERT_EQUALS(readEntry.iServiceCentre.iNumberPlan, RMobilePhone::EIsdnNumberPlan,	_L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iNumberPlan"));
       
   887 	ASSERT_EQUALS_DES16(readEntry.iServiceCentre.iTelNumber, KNumberInternational, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iTelNumber"));
       
   888 
       
   889 	// ===  Get the number of used entries and check it is the same as the previous call to get number of used entries ===
       
   890 	
       
   891 	// Check RMobilePhone::GetPhoneStoreInfo returns correct iUsedEntries
       
   892 	// Check RMobilePhoneStore::GetInfo returns correct iUsedEntries 
       
   893 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore,  phoneStoreInfoPckg, phone, usedEntries +1, usedEntries2 +1), 
       
   894 		KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
   895 
       
   896 	//
       
   897     // TEST END
       
   898     //
       
   899 
       
   900     StartCleanup();
       
   901 
       
   902 	// Pop
       
   903 	// getInfoStatus
       
   904 	// notifyStoreEventStatus
       
   905 	// writeStatus
       
   906 	// readStatus
       
   907 	CleanupStack::PopAndDestroy(4,&getInfoStatus);
       
   908 	return TestStepResult();
       
   909 	}
       
   910 
       
   911 TPtrC CCTSYIntegrationTestSMSStore0005::GetTestStepName()
       
   912 /**
       
   913  * @return The test step name.
       
   914  */
       
   915 	{
       
   916 	return _L("CCTSYIntegrationTestSMSStore0005");
       
   917 	}
       
   918 
       
   919 
       
   920 
       
   921 CCTSYIntegrationTestSMSStore0006::CCTSYIntegrationTestSMSStore0006(CEtelSessionMgr& aEtelSessionMgr)
       
   922 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
   923 /**
       
   924  * Constructor.
       
   925  */
       
   926 	{
       
   927 	SetTestStepName(CCTSYIntegrationTestSMSStore0006::GetTestStepName());
       
   928 	}
       
   929 
       
   930 CCTSYIntegrationTestSMSStore0006::~CCTSYIntegrationTestSMSStore0006()
       
   931 /**
       
   932  * Destructor.
       
   933  */
       
   934 	{
       
   935 	}
       
   936 
       
   937 TVerdict CCTSYIntegrationTestSMSStore0006::doTestStepL()
       
   938 /**
       
   939  * @SYMTestCaseID BA-CTSY-INT-SMSS-0006
       
   940  * @SYMFssID BA/CTSY/SMSS-0006
       
   941  * @SYMTestCaseDesc Write an entry to SMS store at index of -1 (first free slot).
       
   942  * @SYMTestPriority High
       
   943  * @SYMTestActions RMobilePhoneStore::Write, RMobilePhoneStore::GetInfo, RMobilePhoneStore::Read, RMobilePhoneStore::NotifyStoreEvent, RMobilePhone::GetPhoneStoreInfo
       
   944  * @SYMTestExpectedResults Pass - Entry written.
       
   945  * @SYMTestType CIT
       
   946  * @SYMTestCaseDependencies live/automatic
       
   947  *
       
   948  * Reason for test: Verify entry is written correctly and correct slot number is returned.
       
   949  *
       
   950  * @return - TVerdict code
       
   951  */
       
   952 	{
       
   953 
       
   954 	//
       
   955 	// SET UP
       
   956 	//
       
   957 
       
   958 	WaitForPhoneBookCachingToFinish();
       
   959 	
       
   960 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
   961 	
       
   962 	// Ensure SIM phone book is not full. 
       
   963 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
   964 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
   965 	TInt nextFreeSpace = iSimTsyTestHelper.EnsureEmptyStoreSpaceL(smsStore,KETelIccSmsStore,storeInfo,phone);
       
   966 	CHECK_TRUE_L(nextFreeSpace>=0,_L("TSimTsyTestHelper::GetSmsMessagingL returned an error"));
       
   967 	
       
   968 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsReadAccess | KCapsNotifyEvent 
       
   969 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
   970 	CleanupStack::PushL(getInfoStatus);
       
   971 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
   972 
       
   973 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
   974 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
   975 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));				
       
   976 	TUint wantedBits = RMobilePhoneStore::KCapsReadAccess | 
       
   977 					   RMobilePhoneStore::KCapsWriteAccess | 
       
   978 					   RMobilePhoneStore::KCapsNotifyEvent;
       
   979 	CHECK_BITS_SET_L(storeInfo.iCaps, wantedBits, KNoUnwantedBits, 
       
   980 					_L("RMobileSmsStore::GetInfo, wrong bits set"));
       
   981 
       
   982 
       
   983 	//
       
   984 	// SET UP END
       
   985 	//
       
   986 	
       
   987 	StartTest();
       
   988 	
       
   989 	//
       
   990 	// TEST START
       
   991 	//
       
   992 	
       
   993 	
       
   994 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1 	
       
   995 	TInt storedUsedEntries = -1;
       
   996 	TInt storedPhoneUsedEntries = -1;
       
   997 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
   998 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
   999 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  1000 			phoneStoreInfoPckg,
       
  1001 			phone,
       
  1002 			storedUsedEntries,
       
  1003 			storedPhoneUsedEntries),
       
  1004 			KErrNone,  
       
  1005 			_L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1006 
       
  1007 	// post notifier for RMobilePhoneStore::NotifyStoreEvent
       
  1008 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
  1009 	CleanupStack::PushL(notifyStoreEventStatus);
       
  1010 	TUint32 storeEvent;
       
  1011 	TInt index;
       
  1012 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);
       
  1013 	
       
  1014 		
       
  1015 	// ===  Write an entry to the first free slot (RMobileSmsStore::TMobileGsmSmsEntryV1) ===
       
  1016 
       
  1017 	// Write a valid entry to the phone store using RMobilePhoneStore::Write supplying aEntry.index = -1 
       
  1018 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  1019 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry); 
       
  1020 	CreateGsmSmsEntry(entry, -1, KValidSmsPdu1(),
       
  1021 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  1022 			RMobilePhone::EIsdnNumberPlan);
       
  1023 	
       
  1024 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  1025 	CleanupStack::PushL(writeStatus);
       
  1026 	smsStore.Write(writeStatus,pckgEntry);
       
  1027 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  1028 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  1029 
       
  1030 										
       
  1031 	// Store the aEntry.iIndex returned for future use 
       
  1032 	TInt storedIndex = entry.iIndex;
       
  1033 	
       
  1034 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreEntryAdded
       
  1035 	RMobilePhoneStore::TMobileStoreEvent expectedEvent = RMobilePhoneStore::KStoreEntryAdded ;
       
  1036 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
  1037 													notifyStoreEventStatus,
       
  1038 													storeEvent,
       
  1039 													expectedEvent,
       
  1040 													index);
       
  1041 													
       
  1042 	// ===  Get the number of used entries and check it is 1 higher than before writing the new entry ===
       
  1043 
       
  1044 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 higher than that stored if this API is supported
       
  1045 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 higher than that stored.
       
  1046 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, 
       
  1047 			 phoneStoreInfoPckg, phone, storedUsedEntries +1, storedPhoneUsedEntries +1),
       
  1048 			KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1049 	
       
  1050 	// ===  Read the written entry ===
       
  1051 
       
  1052 	// Read the written entry at index aEntry.iIndex returned from the write 
       
  1053 	RMobileSmsStore::TMobileGsmSmsEntryV1 readEntry;
       
  1054 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgReadEntry(readEntry);
       
  1055 	readEntry.iIndex = storedIndex;
       
  1056 	readEntry.iMsgData.Zero();
       
  1057 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
       
  1058 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
  1059 	CleanupStack::PushL(readStatus);	
       
  1060 	smsStore.Read(readStatus,pckgReadEntry);
       
  1061 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone,	_L("RMobileSmsStore::Read, timed out"));
       
  1062 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileSmsStore::Read returned an error"));
       
  1063 
       
  1064 	// Check RMobilePhoneStore::Read returns correct entry information 
       
  1065 	ASSERT_EQUALS(readEntry.iMsgStatus, RMobileSmsStore::EStoredMessageUnread, _L("RMobileSmsStore::Read Read Entry has the wrong iMsgStatus"));
       
  1066 	ASSERT_EQUALS_DES8(readEntry.iMsgData, KValidSmsPdu1, _L("RMobileSmsStore::Read Read Entry has the wrong iMsgData"));			
       
  1067 	ASSERT_EQUALS(readEntry.iServiceCentre.iTypeOfNumber,  RMobilePhone::ENationalNumber, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iTypeOfNumber"));
       
  1068 	ASSERT_EQUALS(readEntry.iServiceCentre.iNumberPlan, RMobilePhone::EIsdnNumberPlan, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iNumberPlan"));
       
  1069 	ASSERT_EQUALS_DES16(readEntry.iServiceCentre.iTelNumber, KNumber, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iTelNumber"));
       
  1070 	
       
  1071 	//
       
  1072     // TEST END
       
  1073     //
       
  1074 
       
  1075     StartCleanup();
       
  1076 	// Pop:
       
  1077 	// getInfoStatus
       
  1078 	// writeStatus
       
  1079 	// notifyStoreEventStatus
       
  1080 	// readStatus
       
  1081 	CleanupStack::PopAndDestroy(4, &getInfoStatus);
       
  1082 	
       
  1083 	return TestStepResult();
       
  1084 	}
       
  1085 
       
  1086 TPtrC CCTSYIntegrationTestSMSStore0006::GetTestStepName()
       
  1087 /**
       
  1088  * @return The test step name.
       
  1089  */
       
  1090 	{
       
  1091 	return _L("CCTSYIntegrationTestSMSStore0006");
       
  1092 	}
       
  1093 
       
  1094 
       
  1095 
       
  1096 CCTSYIntegrationTestSMSStore0007::CCTSYIntegrationTestSMSStore0007(CEtelSessionMgr& aEtelSessionMgr)
       
  1097 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  1098 /**
       
  1099  * Constructor.
       
  1100  */
       
  1101 	{
       
  1102 	SetTestStepName(CCTSYIntegrationTestSMSStore0007::GetTestStepName());
       
  1103 	}
       
  1104 
       
  1105 CCTSYIntegrationTestSMSStore0007::~CCTSYIntegrationTestSMSStore0007()
       
  1106 /**
       
  1107  * Destructor.
       
  1108  */
       
  1109 	{
       
  1110 	}
       
  1111 
       
  1112 TVerdict CCTSYIntegrationTestSMSStore0007::doTestStepL()
       
  1113 /**
       
  1114  * @SYMTestCaseID BA-CTSY-INT-SMSS-0007
       
  1115  * @SYMFssID BA/CTSY/SMSS-0007
       
  1116  * @SYMTestCaseDesc Write SMS message to the SMS store using invalid slot numbers.
       
  1117  * @SYMTestPriority High
       
  1118  * @SYMTestActions RMobilePhoneStore::Write, RMobilePhoneStore::Read
       
  1119  * @SYMTestExpectedResults Pass - Error returned on write.
       
  1120  * @SYMTestType CIT
       
  1121  * @SYMTestCaseDependencies live/automatic
       
  1122  *
       
  1123  * Reason for test: Verify error is returned on attempt to write to an invalid index and number of used entries in the store is unchanged.
       
  1124  *
       
  1125  * @return - TVerdict code
       
  1126  */
       
  1127 	{
       
  1128 
       
  1129 	//
       
  1130 	// SET UP
       
  1131 	//
       
  1132 
       
  1133 	
       
  1134 	// Ensure phone book is not full. 
       
  1135 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  1136 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  1137 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  1138 	TInt nextFreeSpace = iSimTsyTestHelper.EnsureEmptyStoreSpaceL(smsStore,KETelIccSmsStore,storeInfo,phone);
       
  1139 	CHECK_TRUE_L(nextFreeSpace>=0,_L("TSimTsyTestHelper::GetSmsMessagingL returned an error"));
       
  1140 	
       
  1141 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsReadAccess 
       
  1142 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  1143 	CleanupStack::PushL(getInfoStatus);
       
  1144 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1145 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  1146 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  1147 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  1148 	TUint wantedBits = RMobilePhoneStore::KCapsReadAccess | RMobilePhoneStore::KCapsWriteAccess;
       
  1149 	CHECK_BITS_SET_L(storeInfo.iCaps, wantedBits,KNoUnwantedBits, _L("RMobileSmsStore::GetInfo, wrong bits set"));
       
  1150 
       
  1151 
       
  1152 	//
       
  1153 	// SET UP END
       
  1154 	//
       
  1155 	
       
  1156 	StartTest();
       
  1157 	
       
  1158 	//
       
  1159 	// TEST START
       
  1160 	//
       
  1161 
       
  1162 	// ===  1. Find out how many entries are used in the phone book ===
       
  1163 	// ===  2. Attempt to write an entry to invalid index ===
       
  1164 	// ===  3. Get the number of used entries and check it is same as before the attempted write ===
       
  1165 	// Repeat steps 1 to 3 for aEntry.index = 0, -2, -10 	
       
  1166 
       
  1167 	TInt indexArray[3] = {0,-2,-10};	
       
  1168 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  1169 	CleanupStack::PushL(writeStatus);	
       
  1170 	TInt storedUsedEntries, storedPhoneUsedEntries;
       
  1171 	
       
  1172 	// create the entry, the only thing that will change in each iteration is the iIndex
       
  1173 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  1174 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg entryPckg(entry);
       
  1175  	CreateGsmSmsEntry(entry, 1, KValidSmsPdu1(),
       
  1176 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  1177 			RMobilePhone::EIsdnNumberPlan);
       
  1178  	
       
  1179 	for (TInt i = 0; i< 3; i++)
       
  1180 		{
       
  1181 		// ===  1. Find out how many entries are used in the phone book ===
       
  1182 		
       
  1183 		// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1 
       
  1184 		// Store iUsedEntries returned for future use
       
  1185 		// Get the phone book information using RMobilePhone::GetPhoneStoreInfo
       
  1186 		// Store iUsedEntries returned for future use
       
  1187 		RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  1188 		RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  1189 		ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  1190 				phoneStoreInfoPckg,
       
  1191 				phone,
       
  1192 				storedUsedEntries,
       
  1193 				storedPhoneUsedEntries),
       
  1194 				KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1195 				
       
  1196 		// ===  2. Attempt to write an entry to invalid index ===
       
  1197 		
       
  1198 		// Write an entry using RMobilePhoneStore::Write and aEntry.index = 0, -2, -10 
       
  1199 		entry.iIndex = indexArray[i];			
       
  1200 		smsStore.Write(writeStatus,entryPckg);
       
  1201 										
       
  1202 		// Check KErrArgument or KErrGsmSMSInvalidMemoryIndex is returned
       
  1203 		DEBUG_PRINTF2(_L("just wrote to index = %d"), entry.iIndex);
       
  1204 		ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),KErrNone, _L("RMobileSmsStore::Write, timed out"));
       
  1205 		ASSERT_TRUE((writeStatus.Int() == KErrArgument) || (writeStatus.Int() == KErrGsmSMSInvalidMemoryIndex), _L("RMobileSmsStore::Write did not return KErrArgument | KErrGsmSMSInvalidMemoryIndex"));
       
  1206 		DEBUG_PRINTF2(_L("write status = %d"), writeStatus.Int());
       
  1207 										
       
  1208 		// ===  3. Get the number of used entries and check it is same as before the attempted write ===
       
  1209 		
       
  1210 		// Check RMobilePhoneStore::GetInfo returns same iUsedEntries as before	
       
  1211 		// Check RMobilePhone::GetPhoneStoreInfo returns same iUsedEntries as before
       
  1212 		ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg, phone, 
       
  1213 				storedUsedEntries, storedPhoneUsedEntries),
       
  1214 				KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1215 		} // end for (TInt i = 0; i< 3; i++)
       
  1216 		
       
  1217 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10004);
       
  1218 	
       
  1219 	// ===  Attempt to write an entry to an index that is higher than the max slot number ===
       
  1220 
       
  1221 	// Write an entry using RMobilePhoneStore::Write and aEntry.index = 10000 
       
  1222 	entry.iIndex = 10000;
       
  1223 	smsStore.Write(writeStatus,entryPckg);
       
  1224 	// Check error returned is not KErrNone
       
  1225 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Write, timed out"));
       
  1226 	ASSERT_TRUE(writeStatus.Int() != KErrNone, _L("RMobileSmsStore::Write should have returned an error but didnt"));
       
  1227 
       
  1228 	
       
  1229 	//
       
  1230     // TEST END
       
  1231     //
       
  1232 
       
  1233     StartCleanup();
       
  1234 	// Pop
       
  1235 	// getInfoStatus
       
  1236 	// writeStatus
       
  1237 	CleanupStack::PopAndDestroy(2, &getInfoStatus);	
       
  1238 	return TestStepResult();
       
  1239 	}
       
  1240 
       
  1241 TPtrC CCTSYIntegrationTestSMSStore0007::GetTestStepName()
       
  1242 /**
       
  1243  * @return The test step name.
       
  1244  */
       
  1245 	{
       
  1246 	return _L("CCTSYIntegrationTestSMSStore0007");
       
  1247 	}
       
  1248 
       
  1249 
       
  1250 
       
  1251 CCTSYIntegrationTestSMSStore0008::CCTSYIntegrationTestSMSStore0008(CEtelSessionMgr& aEtelSessionMgr)
       
  1252 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  1253 /**
       
  1254  * Constructor.
       
  1255  */
       
  1256 	{
       
  1257 	SetTestStepName(CCTSYIntegrationTestSMSStore0008::GetTestStepName());
       
  1258 	}
       
  1259 
       
  1260 CCTSYIntegrationTestSMSStore0008::~CCTSYIntegrationTestSMSStore0008()
       
  1261 /**
       
  1262  * Destructor.
       
  1263  */
       
  1264 	{
       
  1265 	}
       
  1266 
       
  1267 TVerdict CCTSYIntegrationTestSMSStore0008::doTestStepL()
       
  1268 /**
       
  1269  * @SYMTestCaseID BA-CTSY-INT-SMSS-0008
       
  1270  * @SYMFssID BA/CTSY/SMSS-0008
       
  1271  * @SYMTestCaseDesc Write SMS message to the SMS store when SIM is full.
       
  1272  * @SYMTestPriority High
       
  1273  * @SYMTestActions RMobilePhoneStore::Write, RMobilePhoneStore::Read
       
  1274  * @SYMTestExpectedResults Pass - Error on attempt to write.
       
  1275  * @SYMTestType CIT
       
  1276  * @SYMTestCaseDependencies live/automatic
       
  1277  *
       
  1278  * Reason for test: Verify error is returned and number of used entries is unchanged.
       
  1279  *
       
  1280  * @return - TVerdict code
       
  1281  */
       
  1282 	{
       
  1283 
       
  1284 	//
       
  1285 	// SET UP
       
  1286 	//
       
  1287 
       
  1288 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  1289 	
       
  1290 	// Fill SIM phone book. 
       
  1291 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  1292     CHECK_TRUE_L(iSmsStoreTestHelper.EnsureStoreFullL(smsStore),_L("TSmsStoreTsyTestHelper::EnsureStoreFullL returned an error"));
       
  1293     
       
  1294 
       
  1295 	//
       
  1296 	// SET UP END
       
  1297 	//
       
  1298 	
       
  1299 	StartTest();
       
  1300 	
       
  1301 	//
       
  1302 	// TEST START
       
  1303 	//
       
  1304 	
       
  1305 	
       
  1306 	// ===  Find out how many entries are used in the phone book ===
       
  1307 
       
  1308 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1 
       
  1309 	// Store iUsedEntries returned for future use 
       
  1310 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  1311 	// Store iUsedEntries returned for future use 
       
  1312 	TInt storeUsedEntries = -1;
       
  1313 	TInt phoneUsedEntries = -1;
       
  1314 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  1315 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  1316 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  1317 			phoneStoreInfoPckg,
       
  1318 			phone,
       
  1319 			storeUsedEntries,
       
  1320 			phoneUsedEntries),
       
  1321 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1322 	
       
  1323 
       
  1324 	// ===  Attempt to write an entry to the phone book ===
       
  1325 
       
  1326 	// Write an entry using RMobilePhoneStore::Write and aEntry.index = -1 
       
  1327 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  1328 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);
       
  1329 	CreateGsmSmsEntry(entry, -1, KValidSmsPdu1,
       
  1330 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::EUnknownNumber,
       
  1331 			RMobilePhone::EIsdnNumberPlan);
       
  1332 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  1333 	CleanupStack::PushL(writeStatus);	
       
  1334 	smsStore.Write(writeStatus,pckgEntry);
       
  1335 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  1336 
       
  1337 	// Check KErrDiskFull is returned.
       
  1338 	ASSERT_EQUALS(writeStatus.Int(), KErrDiskFull, _L("RMobileSmsStore::Write did not return the expected status != KErrNone"));
       
  1339 
       
  1340 	// ===  Get the number of used entries and check it is the same as before attempted write ===
       
  1341 
       
  1342 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is same as before
       
  1343 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is same as before
       
  1344 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore,  phoneStoreInfoPckg, phone, 
       
  1345 		storeUsedEntries, phoneUsedEntries),
       
  1346 		KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1347 	
       
  1348 	//
       
  1349 	// TEST END
       
  1350 	//
       
  1351 
       
  1352     StartCleanup();
       
  1353 	
       
  1354 	// Pop
       
  1355 	// writeStatus
       
  1356 	CleanupStack::PopAndDestroy(&writeStatus);
       
  1357 	
       
  1358 	return TestStepResult();
       
  1359 	}
       
  1360 
       
  1361 TPtrC CCTSYIntegrationTestSMSStore0008::GetTestStepName()
       
  1362 /**
       
  1363  * @return The test step name.
       
  1364  */
       
  1365 	{
       
  1366 	return _L("CCTSYIntegrationTestSMSStore0008");
       
  1367 	}
       
  1368 
       
  1369 
       
  1370 
       
  1371 CCTSYIntegrationTestSMSStore0009::CCTSYIntegrationTestSMSStore0009(CEtelSessionMgr& aEtelSessionMgr)
       
  1372 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  1373 /**
       
  1374  * Constructor.
       
  1375  */
       
  1376 	{
       
  1377 	SetTestStepName(CCTSYIntegrationTestSMSStore0009::GetTestStepName());
       
  1378 	}
       
  1379 
       
  1380 CCTSYIntegrationTestSMSStore0009::~CCTSYIntegrationTestSMSStore0009()
       
  1381 /**
       
  1382  * Destructor.
       
  1383  */
       
  1384 	{
       
  1385 	}
       
  1386 
       
  1387 TVerdict CCTSYIntegrationTestSMSStore0009::doTestStepL()
       
  1388 /**
       
  1389  * @SYMTestCaseID BA-CTSY-INT-SMSS-0009
       
  1390  * @SYMFssID BA/CTSY/SMSS-0009
       
  1391  * @SYMTestCaseDesc Write SMS message to the SMS store making the store full.
       
  1392  * @SYMTestPriority High
       
  1393  * @SYMTestActions RMobilePhoneStore::Write, RMobilePhoneStore::Read, RMobilePhoneStore::NotifyStoreEvent
       
  1394  * @SYMTestExpectedResults Pass - Entry written correctly.  Store event is retrieved indicating entry has been written and store is full.
       
  1395  * @SYMTestType CIT
       
  1396  * @SYMTestCaseDependencies live/automatic
       
  1397  *
       
  1398  * Reason for test: Verify entry written and KStoreFull event occurs.
       
  1399  *
       
  1400  * @return - TVerdict code
       
  1401  */
       
  1402 	{
       
  1403 
       
  1404 	//
       
  1405 	// SET UP
       
  1406 	//
       
  1407 
       
  1408 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  1409 	
       
  1410 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsReadAccess | KCapsNotifyEvent 
       
  1411 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  1412 
       
  1413 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  1414 	CleanupStack::PushL(getInfoStatus);
       
  1415 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  1416 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1417 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  1418 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  1419 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  1420 					
       
  1421 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess | 
       
  1422 						RMobilePhoneStore::KCapsReadAccess | 
       
  1423 						RMobilePhoneStore::KCapsNotifyEvent;
       
  1424 	CHECK_BITS_SET_L(storeInfo.iCaps, wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  1425 
       
  1426 	
       
  1427 	// Fill phone book until there is only one slot free. 
       
  1428 	// Create an entry
       
  1429 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  1430 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);
       
  1431 	CreateGsmSmsEntry(entry, -1, KValidSmsPdu2(),
       
  1432 			RMobileSmsStore::EStoredMessageUnread, 
       
  1433 			RMobilePhone::ENetworkSpecificNumber,
       
  1434 			RMobilePhone::ETelexNumberPlan);
       
  1435 
       
  1436 	TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDelete);
       
  1437 	CleanupStack::PushL(deleteStatus);
       
  1438 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  1439 	CleanupStack::PushL(writeStatus);
       
  1440 	
       
  1441 	if (storeInfo.iUsedEntries == storeInfo.iTotalEntries) // if already full, delete one entry
       
  1442 		{
       
  1443 		smsStore.Delete(deleteStatus,storeInfo.iUsedEntries);			
       
  1444 		CHECK_TRUE_L(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium) == KErrNone, _L("RMobileSmsStore::Delete timed out"));
       
  1445 		CHECK_TRUE_L(deleteStatus.Int() == KErrNone, _L("RMobileSmsStore::Delete returned an error"));
       
  1446 		}
       
  1447 	else
       
  1448 		{
       
  1449 		while (storeInfo.iUsedEntries != (storeInfo.iTotalEntries))
       
  1450 			{
       
  1451 			entry.iIndex = -1; // need to reset this every time
       
  1452 
       
  1453 			smsStore.Write(writeStatus,pckgEntry);
       
  1454 			CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  1455 			CHECK_TRUE_L(writeStatus.Int() == KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  1456 		
       
  1457 			smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  1458 			CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  1459 			CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  1460 			}
       
  1461 		}
       
  1462 
       
  1463 
       
  1464 	//
       
  1465 	// SET UP END
       
  1466 	//
       
  1467 	
       
  1468 	StartTest();
       
  1469 	
       
  1470 	//
       
  1471 	// TEST START
       
  1472 	//
       
  1473 	
       
  1474 	
       
  1475 	// ===  Find out how many entries are used in the phone book ===
       
  1476 
       
  1477 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1  
       
  1478 	// Store iUsedEntries returned for future use 
       
  1479 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  1480 	// Store iUsedEntries returned for future use 
       
  1481 	TInt storeUsedEntries = -1;
       
  1482 	TInt phoneUsedEntries = -1;
       
  1483 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  1484 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  1485 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  1486 			phoneStoreInfoPckg,
       
  1487 			phone,
       
  1488 			storeUsedEntries,
       
  1489 			phoneUsedEntries),
       
  1490 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1491 	
       
  1492 	// ===  Write an entry into the last free slot in the phone book ===
       
  1493 
       
  1494 	// Post a notifier
       
  1495 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
  1496 	CleanupStack::PushL(notifyStoreEventStatus);
       
  1497 	TUint32 storeEvent;
       
  1498 	TInt index;
       
  1499 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);	
       
  1500 	
       
  1501 	// Write an entry using RMobilePhoneStore::Write and aEntry.index = -1 
       
  1502 	entry.iIndex = -1; 
       
  1503 	smsStore.Write(writeStatus,pckgEntry);
       
  1504 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  1505 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  1506 
       
  1507 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreFull | KStoreEntryAdded
       
  1508 	TUint32 expectedEvent = RMobilePhoneStore::KStoreEntryAdded | RMobilePhoneStore::KStoreFull;
       
  1509 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
  1510 													notifyStoreEventStatus,
       
  1511 													storeEvent,
       
  1512 													expectedEvent,
       
  1513 													index);
       
  1514 
       
  1515 	// ===  Get the number of used entries and check it is 1 higher than before writing the new entry ===
       
  1516 
       
  1517 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 higher than that stored.
       
  1518 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 higher than that stored.
       
  1519 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg, phone,
       
  1520 		storeUsedEntries+1, phoneUsedEntries+1),
       
  1521 		KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1522 	
       
  1523 	// ===  Read the written entry ===
       
  1524 
       
  1525 	// Read the written entry with RMobilePhoneStore::Read 
       
  1526 	RMobileSmsStore::TMobileGsmSmsEntryV1 readEntry;
       
  1527 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgReadEntry(readEntry);
       
  1528 	readEntry.iIndex = index;
       
  1529 	readEntry.iMsgData.Zero();
       
  1530 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
       
  1531 
       
  1532 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
  1533 	CleanupStack::PushL(readStatus);
       
  1534 		
       
  1535 	smsStore.Read(readStatus,pckgReadEntry);
       
  1536 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone, _L("RMobilePhoneStore::Read timed out"));
       
  1537 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobilePhoneStore::Read returned an error"));
       
  1538 	
       
  1539 	// Check entry details are correct
       
  1540 	ASSERT_EQUALS(readEntry.iMsgStatus, RMobileSmsStore::EStoredMessageUnread,_L("RMobilePhoneStore::Read Read Entry has the wrong iMsgStatus"));
       
  1541 	ASSERT_EQUALS_DES8(readEntry.iMsgData, KValidSmsPdu2, _L("RMobilePhoneStore::Read Read Entry has the wrong iMsgData"));
       
  1542 	ASSERT_EQUALS(readEntry.iServiceCentre.iTypeOfNumber,  RMobilePhone::ENetworkSpecificNumber,_L("RMobilePhoneStore::Read Read Entry has the wrong iServiceCentre.iTypeOfNumber"));
       
  1543 	ASSERT_EQUALS(readEntry.iServiceCentre.iNumberPlan, RMobilePhone::ETelexNumberPlan,_L("RMobilePhoneStore::Read Read Entry has the wrong iServiceCentre.iNumberPlan"));
       
  1544 	ASSERT_EQUALS_DES16(readEntry.iServiceCentre.iTelNumber, KNumber, _L("RMobilePhoneStore::Read Read Entry has the wrong iServiceCentre.iTelNumber"));
       
  1545 	
       
  1546 	//
       
  1547 	// TEST END
       
  1548 	//
       
  1549 
       
  1550     StartCleanup();
       
  1551 	
       
  1552 	// Pop
       
  1553 	// getInfoStatus
       
  1554 	// deleteStatus
       
  1555 	// writeStatus
       
  1556 	// notifyStoreEventStatus
       
  1557 	// readStatus
       
  1558 	CleanupStack::PopAndDestroy(5, &getInfoStatus);
       
  1559 	
       
  1560 	
       
  1561 	return TestStepResult();
       
  1562 	}
       
  1563 
       
  1564 TPtrC CCTSYIntegrationTestSMSStore0009::GetTestStepName()
       
  1565 /**
       
  1566  * @return The test step name.
       
  1567  */
       
  1568 	{
       
  1569 	return _L("CCTSYIntegrationTestSMSStore0009");
       
  1570 	}
       
  1571 
       
  1572 
       
  1573 
       
  1574 CCTSYIntegrationTestSMSStore0010::CCTSYIntegrationTestSMSStore0010(CEtelSessionMgr& aEtelSessionMgr)
       
  1575 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  1576 /**
       
  1577  * Constructor.
       
  1578  */
       
  1579 	{
       
  1580 	SetTestStepName(CCTSYIntegrationTestSMSStore0010::GetTestStepName());
       
  1581 	}
       
  1582 
       
  1583 CCTSYIntegrationTestSMSStore0010::~CCTSYIntegrationTestSMSStore0010()
       
  1584 /**
       
  1585  * Destructor.
       
  1586  */
       
  1587 	{
       
  1588 	}
       
  1589 
       
  1590 TVerdict CCTSYIntegrationTestSMSStore0010::doTestStepL()
       
  1591 /**
       
  1592  * @SYMTestCaseID BA-CTSY-INT-SMSS-0010
       
  1593  * @SYMFssID BA/CTSY/SMSS-0010
       
  1594  * @SYMTestCaseDesc Delete entry from the SMS store.
       
  1595  * @SYMTestPriority High
       
  1596  * @SYMTestActions RMobilePhoneStore::Delete, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  1597  * @SYMTestExpectedResults Pass - Entry deleted.
       
  1598  * @SYMTestType CIT
       
  1599  * @SYMTestCaseDependencies live/automatic
       
  1600  *
       
  1601  * Reason for test: Verify deletion is successful and deleted entry cannot be read.
       
  1602  *
       
  1603  * @return - TVerdict code
       
  1604  */
       
  1605 	{
       
  1606 
       
  1607 	//
       
  1608 	// SET UP
       
  1609 	//
       
  1610 
       
  1611 	
       
  1612 	// Ensure phone has KCapsReadAccess | KCapsWriteAccess | KCapsNotifyEvent capabilities. 
       
  1613 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  1614 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  1615 	
       
  1616 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  1617 	CleanupStack::PushL(getInfoStatus);
       
  1618 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  1619 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1620 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  1621 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  1622 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  1623 					
       
  1624 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess | 
       
  1625 						RMobilePhoneStore::KCapsReadAccess | 
       
  1626 						RMobilePhoneStore::KCapsNotifyEvent;
       
  1627 	CHECK_BITS_SET_L(storeInfo.iCaps, wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  1628 
       
  1629 
       
  1630 	// Ensure there is an entry in slot 4 of the phone book. 
       
  1631     // Create an entry 
       
  1632 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  1633 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);
       
  1634 	CreateGsmSmsEntry(entry, 4, KValidSmsPdu1(),
       
  1635 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENetworkSpecificNumber,
       
  1636 			RMobilePhone::ETelexNumberPlan);    
       
  1637  	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  1638 	CleanupStack::PushL(writeStatus);   
       
  1639 
       
  1640 	smsStore.Write(writeStatus,pckgEntry);
       
  1641 	CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  1642 	// This may return a value other than KErrNone, if the space was already full
       
  1643 	CHECK_TRUE_L((writeStatus.Int() == KErrNone ||
       
  1644 				  writeStatus.Int() == KErrGsmSMSSimSMSStorageFull), _L("RMobileSmsStore::Write status was not set to KErrNone or KErrGsmSMSSimSMSStorageFull as expected"));
       
  1645 	
       
  1646 
       
  1647 	//
       
  1648 	// SET UP END
       
  1649 	//
       
  1650 	
       
  1651 	StartTest();
       
  1652 	
       
  1653 	//
       
  1654 	// TEST START
       
  1655 	//
       
  1656 	
       
  1657 	// === Delete entry from the phone store specifying aIndex = 4 ===
       
  1658 
       
  1659 	// used for RMobilePhoneStore::NotifyStoreEvent
       
  1660 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
  1661 	CleanupStack::PushL(notifyStoreEventStatus);
       
  1662 	TUint32 storeEvent;
       
  1663 	
       
  1664 	// used for RMobileSmsStore::Delete
       
  1665 	TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDelete);
       
  1666 	CleanupStack::PushL(deleteStatus);
       
  1667 
       
  1668 	// used to check RMobilePhoneStore::NotifyStoreEvent
       
  1669 	TUint32 expectedEvent;		
       
  1670 	
       
  1671 	// used for RMobilePhoneStore::Read 
       
  1672 	RMobileSmsStore::TMobileGsmSmsEntryV1 readEntry;
       
  1673 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgReadEntry(readEntry);	
       
  1674 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
  1675 	CleanupStack::PushL(readStatus);
       
  1676 	
       
  1677 	// ===  Find out how many entries are used in the phone book ===
       
  1678 
       
  1679 	// Get the phone store information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1 
       
  1680 	// Store iUsedEntries returned for future use 
       
  1681 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  1682 	// Store iUsedEntries returned for future use 
       
  1683 	TInt storeUsedEntries = -1;
       
  1684 	TInt phoneUsedEntries = -1;
       
  1685 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  1686 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  1687 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  1688 			phoneStoreInfoPckg,
       
  1689 			phone,
       
  1690 			storeUsedEntries,
       
  1691 			phoneUsedEntries),
       
  1692 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1693 	
       
  1694 	// ===  Delete an entry ===
       
  1695 	// Post a notifier
       
  1696 	TInt storeEventIndex;
       
  1697 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, storeEventIndex);	
       
  1698 
       
  1699 	// Delete entry from the phone store specifying aIndex = 4
       
  1700 	smsStore.Delete(deleteStatus,4);			
       
  1701 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Delete timed out"));
       
  1702 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileSmsStore::Delete returned an error"));
       
  1703 	
       
  1704 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreEntryDeleted
       
  1705 	expectedEvent = RMobilePhoneStore::KStoreEntryDeleted;
       
  1706 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
  1707 													notifyStoreEventStatus,
       
  1708 													storeEvent,
       
  1709 													expectedEvent,
       
  1710 													4);
       
  1711 													
       
  1712 	// ===  Get the number of used entries and check it is 1 lower than before deleting the new entry ===
       
  1713 
       
  1714 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 lower  than that stored.
       
  1715 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 lower than that stored.
       
  1716 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore,  phoneStoreInfoPckg, phone,
       
  1717 			storeUsedEntries-1, phoneUsedEntries-1),
       
  1718 			KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1719 	
       
  1720 	
       
  1721 	// ===  Attempt to read the deleted entry.  ===
       
  1722 
       
  1723 	// Read a single entry stored in the slot used in delete 
       
  1724 	readEntry.iIndex = 4;
       
  1725 	readEntry.iMsgData.Zero();
       
  1726 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;		
       
  1727 	smsStore.Read(readStatus,pckgReadEntry);
       
  1728 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone, _L("RMobilePhoneStore::Read timed out"));
       
  1729 
       
  1730 	// Check KErrNotFound is returned.
       
  1731 	ASSERT_EQUALS(readStatus.Int(), KErrNotFound, _L("RMobilePhoneStore::Read did not return KErrNotFound as expected"));
       
  1732 
       
  1733 	// ===  Attempt to delete the already deleted entry again. ===
       
  1734 	
       
  1735 	// Delete the already deleted entry 
       
  1736 	smsStore.Delete(deleteStatus,4);			
       
  1737 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Delete timed out"));
       
  1738 
       
  1739 	// $CTSYProblem The LTSY returns KErrNone to CTSY when an entry is deleted from a slot which is already empty
       
  1740 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
  1741 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
  1742 	// should be expected in this case.
       
  1743 	
       
  1744 	// Check KErrNone is returned
       
  1745 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileSmsStore::Delete did not return KErrNone as expected"));	
       
  1746 		
       
  1747 
       
  1748 	
       
  1749 	//
       
  1750 	// TEST END
       
  1751 	//
       
  1752 
       
  1753     StartCleanup();
       
  1754 	
       
  1755 	// Pop
       
  1756 	// getInfoStatus
       
  1757 	// writeStatus
       
  1758     // notifyStatus
       
  1759 	// deleteStatus
       
  1760 	// readStatus
       
  1761 	CleanupStack::PopAndDestroy(5, &getInfoStatus);
       
  1762 	
       
  1763 	return TestStepResult();
       
  1764 	}
       
  1765 
       
  1766 TPtrC CCTSYIntegrationTestSMSStore0010::GetTestStepName()
       
  1767 /**
       
  1768  * @return The test step name.
       
  1769  */
       
  1770 	{
       
  1771 	return _L("CCTSYIntegrationTestSMSStore0010");
       
  1772 	}
       
  1773 
       
  1774 
       
  1775 
       
  1776 CCTSYIntegrationTestSMSStore0011::CCTSYIntegrationTestSMSStore0011(CEtelSessionMgr& aEtelSessionMgr)
       
  1777 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  1778 /**
       
  1779  * Constructor.
       
  1780  */
       
  1781 	{
       
  1782 	SetTestStepName(CCTSYIntegrationTestSMSStore0011::GetTestStepName());
       
  1783 	}
       
  1784 
       
  1785 CCTSYIntegrationTestSMSStore0011::~CCTSYIntegrationTestSMSStore0011()
       
  1786 /**
       
  1787  * Destructor.
       
  1788  */
       
  1789 	{
       
  1790 	}
       
  1791 
       
  1792 TVerdict CCTSYIntegrationTestSMSStore0011::doTestStepL()
       
  1793 /**
       
  1794  * @SYMTestCaseID BA-CTSY-INT-SMSS-0011
       
  1795  * @SYMFssID BA/CTSY/SMSS-0011
       
  1796  * @SYMTestCaseDesc Delete entry from the SMS store which does not exist.
       
  1797  * @SYMTestPriority High
       
  1798  * @SYMTestActions RMobilePhoneStore::Delete, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo
       
  1799  * @SYMTestExpectedResults Pass - Error returned on delete.
       
  1800  * @SYMTestType CIT
       
  1801  * @SYMTestCaseDependencies live/automatic
       
  1802  *
       
  1803  * Reason for test: Verify KErrNotFound or KErrNone is returned.
       
  1804  *
       
  1805  * @return - TVerdict code
       
  1806  */
       
  1807 	{
       
  1808 
       
  1809 	//
       
  1810 	// SET UP
       
  1811 	//
       
  1812 
       
  1813 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  1814 	
       
  1815 	// Ensure phone has KCapsReadAccess and KCapsWriteAccess capabilities. 
       
  1816 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  1817 
       
  1818 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  1819 	CleanupStack::PushL(getInfoStatus);
       
  1820 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  1821 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1822 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  1823 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  1824 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  1825 					
       
  1826 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess | 
       
  1827 						RMobilePhoneStore::KCapsReadAccess ;
       
  1828 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  1829 
       
  1830 	// Ensure slot 1 is empty. 
       
  1831 	TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDelete);
       
  1832 	CleanupStack::PushL(deleteStatus);
       
  1833 	smsStore.Delete(deleteStatus,1);			
       
  1834 	CHECK_TRUE_L(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium) == KErrNone, _L("RMobileSmsStore::Delete timed out"));
       
  1835 	CHECK_TRUE_L(deleteStatus.Int() == KErrNone || deleteStatus.Int() == KErrGsmSMSInvalidMemoryIndex,_L("RMobileSmsStore::Delete returned an error"));
       
  1836 
       
  1837 	//
       
  1838 	// SET UP END
       
  1839 	//
       
  1840 	
       
  1841 	StartTest();
       
  1842 	
       
  1843 	//
       
  1844 	// TEST START
       
  1845 	//
       
  1846 	
       
  1847 	
       
  1848 	// ===  Find out how many entries are used in the phone book ===
       
  1849 
       
  1850 	// Get phone store information using RMobilePhone::GetPhoneStoreInfo and KETelIccSmsStore
       
  1851 	// Store the iUsedEntries for future use.
       
  1852 	// Get phone book store information using RMobilePhoneStore::GetInfo
       
  1853 	// Store the iUsedEntries for future use.
       
  1854 	TInt storeUsedEntries = -1;
       
  1855 	TInt phoneUsedEntries = -1;
       
  1856 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  1857 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  1858 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  1859 			phoneStoreInfoPckg,
       
  1860 			phone,
       
  1861 			storeUsedEntries,
       
  1862 			phoneUsedEntries),
       
  1863 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  1864 
       
  1865 	// Delete an entry using RMobilePhoneStore::Delete where aIndex is the index of slot 1 
       
  1866 	smsStore.Delete(deleteStatus,1);			
       
  1867 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Delete timed out"));
       
  1868 	// Check KErrNotFound or KErrGsmSMSInvalidMemoryIndex or KErrNone is returned.
       
  1869 	ASSERT_TRUE((deleteStatus.Int()== KErrNotFound) || (deleteStatus.Int() == KErrNone) || (deleteStatus.Int() == KErrGsmSMSInvalidMemoryIndex),_L("RMobileSmsStore::Delete did not return KErrNotFound or KErrGsmSMSInvalidMemoryIndex"));
       
  1870 
       
  1871 	// $CTSYProblem The LTSY returns KErrNone to CTSY when an entry is deleted from a slot which is already empty
       
  1872 	// CTSY correctly propagates whatever error is returned by LTSY back to the client.
       
  1873 	// Therefore the test has been coded to expect KErrNone.  If the LTSY behaviour is fixed, KErrNotFound or similar
       
  1874 	// should be expected in this case.
       
  1875 	
       
  1876 	// ===  Get the number of used entries and check it is the same as before attempted delete ===
       
  1877 
       
  1878 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is same as before
       
  1879 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is same as before
       
  1880 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg, phone,
       
  1881 			storeUsedEntries, phoneUsedEntries),
       
  1882 			KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  1883 	
       
  1884 
       
  1885 	
       
  1886 	//
       
  1887 	// TEST END
       
  1888 	//
       
  1889 
       
  1890     StartCleanup();
       
  1891 	
       
  1892 	// Pop
       
  1893 	// getInfoStatus,
       
  1894 	// deleteStatus,
       
  1895 	CleanupStack::PopAndDestroy(2,&getInfoStatus);
       
  1896 	return TestStepResult();
       
  1897 	}
       
  1898 
       
  1899 TPtrC CCTSYIntegrationTestSMSStore0011::GetTestStepName()
       
  1900 /**
       
  1901  * @return The test step name.
       
  1902  */
       
  1903 	{
       
  1904 	return _L("CCTSYIntegrationTestSMSStore0011");
       
  1905 	}
       
  1906 
       
  1907 
       
  1908 
       
  1909 CCTSYIntegrationTestSMSStore0012::CCTSYIntegrationTestSMSStore0012(CEtelSessionMgr& aEtelSessionMgr)
       
  1910 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  1911 /**
       
  1912  * Constructor.
       
  1913  */
       
  1914 	{
       
  1915 	SetTestStepName(CCTSYIntegrationTestSMSStore0012::GetTestStepName());
       
  1916 	}
       
  1917 
       
  1918 CCTSYIntegrationTestSMSStore0012::~CCTSYIntegrationTestSMSStore0012()
       
  1919 /**
       
  1920  * Destructor.
       
  1921  */
       
  1922 	{
       
  1923 	}
       
  1924 
       
  1925 TVerdict CCTSYIntegrationTestSMSStore0012::doTestStepL()
       
  1926 /**
       
  1927  * @SYMTestCaseID BA-CTSY-INT-SMSS-0012
       
  1928  * @SYMFssID BA/CTSY/SMSS-0012
       
  1929  * @SYMTestCaseDesc Delete entry from the SMS store which makes the store empty.
       
  1930  * @SYMTestPriority High
       
  1931  * @SYMTestActions RMobilePhoneStore::Delete, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  1932  * @SYMTestExpectedResults Pass - Entry deleted, RMobilePhoneStore::KStoreEmpty event occurs.
       
  1933  * @SYMTestType CIT
       
  1934  * @SYMTestCaseDependencies live/automatic
       
  1935  *
       
  1936  * Reason for test: Verify entry deleted and KStoreEmpty event occurs.
       
  1937  *
       
  1938  * @return - TVerdict code
       
  1939  */
       
  1940 	{
       
  1941 
       
  1942 	//
       
  1943 	// SET UP
       
  1944 	//
       
  1945 
       
  1946 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  1947 
       
  1948 	// Ensure phone has KCapsReadAccess | KCapsWriteAccess | KCapsNotifyEvent capabilities. 
       
  1949 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  1950 
       
  1951 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  1952 	CleanupStack::PushL(getInfoStatus);
       
  1953 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  1954 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  1955 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  1956 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone, _L("RMobileSmsStore::GetInfo, timed out"));
       
  1957 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  1958 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess | 
       
  1959 						RMobilePhoneStore::KCapsReadAccess | 
       
  1960 						RMobilePhoneStore::KCapsNotifyEvent;
       
  1961 	
       
  1962 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  1963 	
       
  1964 	// Delete all the entries from the phone book then write one entry to a known location. 
       
  1965 	TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDeleteAll);
       
  1966 	CleanupStack::PushL(deleteStatus);
       
  1967 	smsStore.DeleteAll(deleteStatus);
       
  1968 	CHECK_TRUE_L(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::DeleteAll timed out"));
       
  1969 	CHECK_TRUE_L(deleteStatus.Int() == KErrNone, _L("RMobileSmsStore::DeleteAll returned an error"));
       
  1970 	
       
  1971 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  1972 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone, _L("RMobileSmsStore::GetInfo, timed out"));
       
  1973 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  1974 	CHECK_TRUE_L(storeInfo.iUsedEntries == 0, _L("RMobilePhoneStore::GetInfo SET UP error, iUsedEntries should be 0 at this point"));
       
  1975 
       
  1976 	// Create an entry 
       
  1977 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  1978 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);
       
  1979 	CreateGsmSmsEntry(entry, -1, KValidSmsPdu1(),
       
  1980 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENetworkSpecificNumber,
       
  1981 			RMobilePhone::ETelexNumberPlan);
       
  1982 
       
  1983 	// Write entry
       
  1984 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  1985 	CleanupStack::PushL(writeStatus);
       
  1986 	smsStore.Write(writeStatus,pckgEntry);
       
  1987 	CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));		
       
  1988 	CHECK_TRUE_L(writeStatus.Int() == KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  1989 	TInt entryNum = entry.iIndex;	
       
  1990 
       
  1991 	//
       
  1992 	// SET UP END
       
  1993 	//
       
  1994 	
       
  1995 	StartTest();
       
  1996 	
       
  1997 	//
       
  1998 	// TEST START
       
  1999 	//
       
  2000 	
       
  2001 	
       
  2002 	// Post a notifier
       
  2003 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
  2004 	CleanupStack::PushL(notifyStoreEventStatus);
       
  2005 	TUint32 storeEvent;
       
  2006 	TInt index;
       
  2007 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);	
       
  2008 
       
  2009 	// Delete the entry from the SMS store 
       
  2010 	smsStore.Delete(deleteStatus, entryNum);
       
  2011 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Delete timed out"));
       
  2012 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileSmsStore::Delete returned an error"));
       
  2013 
       
  2014 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KStoreEntryDeleted | KStoreEmpty
       
  2015 	TUint32 expectedEvent = RMobilePhoneStore::KStoreEntryDeleted | RMobilePhoneStore::KStoreEmpty;
       
  2016 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
  2017 													notifyStoreEventStatus,
       
  2018 													storeEvent,
       
  2019 													expectedEvent,
       
  2020 													index);
       
  2021 
       
  2022 	// ===  Get the number of used entries and check it is the same as before attempted delete ===
       
  2023 
       
  2024 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries of 0
       
  2025 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries of 0
       
  2026 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  2027 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  2028 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg, phone, 0, 0),
       
  2029 			KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2030 	
       
  2031 	//
       
  2032 	// TEST END
       
  2033 	//
       
  2034 
       
  2035     StartCleanup();
       
  2036 	
       
  2037 	// Pop
       
  2038 	// getInfoStatus
       
  2039     // deleteStatus
       
  2040 	// writeStatus
       
  2041 	// notifyStoreEventStatus
       
  2042 	CleanupStack::PopAndDestroy(4,&getInfoStatus);
       
  2043 	return TestStepResult();
       
  2044 	}
       
  2045 
       
  2046 TPtrC CCTSYIntegrationTestSMSStore0012::GetTestStepName()
       
  2047 /**
       
  2048  * @return The test step name.
       
  2049  */
       
  2050 	{
       
  2051 	return _L("CCTSYIntegrationTestSMSStore0012");
       
  2052 	}
       
  2053 
       
  2054 
       
  2055 
       
  2056 CCTSYIntegrationTestSMSStore0013::CCTSYIntegrationTestSMSStore0013(CEtelSessionMgr& aEtelSessionMgr)
       
  2057 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  2058 /**
       
  2059  * Constructor.
       
  2060  */
       
  2061 	{
       
  2062 	SetTestStepName(CCTSYIntegrationTestSMSStore0013::GetTestStepName());
       
  2063 	}
       
  2064 
       
  2065 CCTSYIntegrationTestSMSStore0013::~CCTSYIntegrationTestSMSStore0013()
       
  2066 /**
       
  2067  * Destructor.
       
  2068  */
       
  2069 	{
       
  2070 	}
       
  2071 
       
  2072 TVerdict CCTSYIntegrationTestSMSStore0013::doTestStepL()
       
  2073 /**
       
  2074  * @SYMTestCaseID BA-CTSY-INT-SMSS-0013
       
  2075  * @SYMFssID BA/CTSY/SMSS-0013
       
  2076  * @SYMTestCaseDesc Delete an entry from a full SMS store.
       
  2077  * @SYMTestPriority High
       
  2078  * @SYMTestActions RMobilePhoneStore::Delete, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  2079  * @SYMTestExpectedResults Pass - Entries deleted, RMobilePhoneStore::KStoreHasSpace event occurs.
       
  2080  * @SYMTestType CIT
       
  2081  * @SYMTestCaseDependencies live/automatic
       
  2082  *
       
  2083  * Reason for test: Verify entry deleted and KStoreHasSpace event occurs.
       
  2084  *
       
  2085  * @return - TVerdict code
       
  2086  */
       
  2087 	{
       
  2088 
       
  2089 	//
       
  2090 	// SET UP
       
  2091 	//
       
  2092 
       
  2093 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  2094 	
       
  2095 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsNotifyEvent 
       
  2096 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  2097 
       
  2098 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  2099 	CleanupStack::PushL(getInfoStatus);
       
  2100 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  2101 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2102 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2103 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  2104 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  2105 					
       
  2106 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess | 
       
  2107 						RMobilePhoneStore::KCapsNotifyEvent;
       
  2108 	CHECK_BITS_SET_L(storeInfo.iCaps, wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  2109 
       
  2110 	// Ensure phone book is full
       
  2111     CHECK_TRUE_L(iSmsStoreTestHelper.EnsureStoreFullL(smsStore),_L("TSmsStoreTsyTestHelper::EnsureStoreFullL returned an error"));
       
  2112 		
       
  2113 		
       
  2114 	//
       
  2115 	// SET UP END
       
  2116 	//
       
  2117 	
       
  2118 	StartTest();
       
  2119 	
       
  2120 	//
       
  2121 	// TEST START
       
  2122 	//
       
  2123 	
       
  2124 	
       
  2125 	// ===  Find out how many entries are used in the phone book ===
       
  2126 
       
  2127 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1 
       
  2128 	// Store iUsedEntries returned for future use 
       
  2129 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo				
       
  2130 	// Store iUsedEntries returned for future use 
       
  2131 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  2132 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  2133 	TInt usedEntries = -1;
       
  2134 	TInt phoneUsedEntries = -1;
       
  2135 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg, phone,
       
  2136 			usedEntries,
       
  2137 			phoneUsedEntries),
       
  2138 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2139 
       
  2140 	// Post a notifier
       
  2141 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
  2142 	CleanupStack::PushL(notifyStoreEventStatus);
       
  2143 	TUint32 storeEvent;
       
  2144 	TInt index;
       
  2145 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);	
       
  2146 	
       
  2147 	// Delete an entry from the phone book. 
       
  2148 	TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDelete);
       
  2149 	CleanupStack::PushL(deleteStatus);
       
  2150 
       
  2151 	smsStore.Delete(deleteStatus, 1);
       
  2152 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Delete timed out"));
       
  2153 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileSmsStore::Delete returned an error"));
       
  2154 
       
  2155 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreHasSpace | RMobilePhoneStore::KStoreEntryDeleted
       
  2156 	TUint32 expectedEvent = RMobilePhoneStore::KStoreHasSpace | RMobilePhoneStore::KStoreEntryDeleted;
       
  2157 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
  2158 													notifyStoreEventStatus,
       
  2159 													storeEvent,
       
  2160 													expectedEvent,
       
  2161 													index);
       
  2162 
       
  2163 	// ===  Get the number of used entries and check it is one lower than before ===
       
  2164 
       
  2165 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries is one lower than before
       
  2166 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries is one lower than before
       
  2167 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg, phone,
       
  2168 			usedEntries-1, phoneUsedEntries-1),
       
  2169 			KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2170 		
       
  2171 	//
       
  2172 	// TEST END
       
  2173 	//
       
  2174 
       
  2175     StartCleanup();
       
  2176 	
       
  2177 	// Pop
       
  2178 	// getInfoStatus
       
  2179 	// notifyStoreEventStatus
       
  2180 	// deleteStatus
       
  2181 	CleanupStack::PopAndDestroy(3, &getInfoStatus);
       
  2182 	
       
  2183 	return TestStepResult();
       
  2184 	}
       
  2185 
       
  2186 TPtrC CCTSYIntegrationTestSMSStore0013::GetTestStepName()
       
  2187 /**
       
  2188  * @return The test step name.
       
  2189  */
       
  2190 	{
       
  2191 	return _L("CCTSYIntegrationTestSMSStore0013");
       
  2192 	}
       
  2193 
       
  2194 
       
  2195 
       
  2196 CCTSYIntegrationTestSMSStore0014::CCTSYIntegrationTestSMSStore0014(CEtelSessionMgr& aEtelSessionMgr)
       
  2197 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  2198 /**
       
  2199  * Constructor.
       
  2200  */
       
  2201 	{
       
  2202 	SetTestStepName(CCTSYIntegrationTestSMSStore0014::GetTestStepName());
       
  2203 	}
       
  2204 
       
  2205 CCTSYIntegrationTestSMSStore0014::~CCTSYIntegrationTestSMSStore0014()
       
  2206 /**
       
  2207  * Destructor.
       
  2208  */
       
  2209 	{
       
  2210 	}
       
  2211 
       
  2212 TVerdict CCTSYIntegrationTestSMSStore0014::doTestStepL()
       
  2213 /**
       
  2214  * @SYMTestCaseID BA-CTSY-INT-SMSS-0014
       
  2215  * @SYMFssID BA/CTSY/SMSS-0014
       
  2216  * @SYMTestCaseDesc Delete all entries from the SMS store.
       
  2217  * @SYMTestPriority High
       
  2218  * @SYMTestActions RMobilePhoneStore::DeleteAll, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  2219  * @SYMTestExpectedResults Pass - Entries deleted, RMobilePhoneStore::KStoreEmpty event occurs.
       
  2220  * @SYMTestType CIT
       
  2221  * @SYMTestCaseDependencies live/automatic
       
  2222  *
       
  2223  * Reason for test: All entries deleted.
       
  2224  *
       
  2225  * @return - TVerdict code
       
  2226  */
       
  2227 	{
       
  2228 
       
  2229 	//
       
  2230 	// SET UP
       
  2231 	//
       
  2232 
       
  2233 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  2234 	
       
  2235 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess | KCapsNotifyEvent 
       
  2236 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  2237 
       
  2238 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  2239 	CleanupStack::PushL(getInfoStatus);
       
  2240 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  2241 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2242 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2243 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  2244 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  2245 
       
  2246 	// Ensure phone book is not empty 
       
  2247 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  2248 	CleanupStack::PushL(writeStatus);	
       
  2249 
       
  2250 	if (storeInfo.iUsedEntries == 0)
       
  2251 	{
       
  2252 		RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  2253 		RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);
       
  2254 
       
  2255 	    // Create an entry 
       
  2256 		CreateGsmSmsEntry(entry, -1, KValidSmsPdu1(),
       
  2257 				RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENetworkSpecificNumber,
       
  2258 				RMobilePhone::ETelexNumberPlan);
       
  2259 		
       
  2260 		smsStore.Write(writeStatus,pckgEntry);
       
  2261 		CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  2262 		CHECK_TRUE_L(writeStatus.Int() == KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  2263 
       
  2264 		smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2265 		CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  2266 		CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  2267 	}
       
  2268 	
       
  2269 	CHECK_TRUE_L(storeInfo.iUsedEntries != 0, _L("SETUP: There should be at least one entry at this point"));
       
  2270 
       
  2271 	//
       
  2272 	// SET UP END
       
  2273 	//
       
  2274 	
       
  2275 	StartTest();
       
  2276 	
       
  2277 	//
       
  2278 	// TEST START
       
  2279 	//
       
  2280 	
       
  2281 	
       
  2282 	// ===  Delete all entries from the phone book ===
       
  2283 
       
  2284 	// post notifier for RMobilePhoneStore::NotifyStoreEvent
       
  2285 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
  2286 	CleanupStack::PushL(notifyStoreEventStatus);
       
  2287 	TUint32 storeEvent;
       
  2288 	TInt index;
       
  2289 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);
       
  2290 	
       
  2291 	// Delete all entries from the full phone book 
       
  2292 	TExtEtelRequestStatus deleteAllStatus (smsStore,EMobilePhoneStoreDeleteAll);
       
  2293 	CleanupStack::PushL(deleteAllStatus);
       
  2294 	smsStore.DeleteAll(deleteAllStatus);
       
  2295 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteAllStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::DeleteAll timed out"));
       
  2296 	ASSERT_EQUALS(deleteAllStatus.Int(), KErrNone, _L("RMobileSmsStore::DeleteAll returned an error"));
       
  2297  	TEST_CHECK_POINT_L(_L("RMobileSmsStore::DeleteAll returned an error"));
       
  2298 			
       
  2299 	// Check RMobilePhoneStore::NotifyStoreEvent complete with KStoreEmpty
       
  2300 	RMobilePhoneStore::TMobileStoreEvent expectedEvent = RMobilePhoneStore::KStoreEmpty ;
       
  2301 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
  2302 													notifyStoreEventStatus,
       
  2303 													storeEvent,
       
  2304 													expectedEvent,
       
  2305 													index);	
       
  2306 	
       
  2307 	// ===  Check phone book is empty ===
       
  2308 
       
  2309 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1  
       
  2310 	// Check iUsedEntries == 0
       
  2311 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2312 	// Check iUsedEntries == 0
       
  2313 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, storeInfoPckg, phone, 0, 0),
       
  2314 		KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2315 	
       
  2316 	//
       
  2317 	// TEST END
       
  2318 	//
       
  2319 
       
  2320     StartCleanup();
       
  2321 	
       
  2322 	// Pop
       
  2323 	// getInfoStatus
       
  2324 	// writeStatus
       
  2325 	// notifyStoreEventStatus
       
  2326 	// deleteStatus
       
  2327 	CleanupStack::PopAndDestroy(4,&getInfoStatus);
       
  2328 	
       
  2329 	return TestStepResult();
       
  2330 	}
       
  2331 
       
  2332 TPtrC CCTSYIntegrationTestSMSStore0014::GetTestStepName()
       
  2333 /**
       
  2334  * @return The test step name.
       
  2335  */
       
  2336 	{
       
  2337 	return _L("CCTSYIntegrationTestSMSStore0014");
       
  2338 	}
       
  2339 
       
  2340 
       
  2341 
       
  2342 CCTSYIntegrationTestSMSStore0015::CCTSYIntegrationTestSMSStore0015(CEtelSessionMgr& aEtelSessionMgr)
       
  2343 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  2344 /**
       
  2345  * Constructor.
       
  2346  */
       
  2347 	{
       
  2348 	SetTestStepName(CCTSYIntegrationTestSMSStore0015::GetTestStepName());
       
  2349 	}
       
  2350 
       
  2351 CCTSYIntegrationTestSMSStore0015::~CCTSYIntegrationTestSMSStore0015()
       
  2352 /**
       
  2353  * Destructor.
       
  2354  */
       
  2355 	{
       
  2356 	}
       
  2357 
       
  2358 TVerdict CCTSYIntegrationTestSMSStore0015::doTestStepL()
       
  2359 /**
       
  2360  * @SYMTestCaseID BA-CTSY-INT-SMSS-0015
       
  2361  * @SYMFssID BA/CTSY/SMSS-0015
       
  2362  * @SYMTestCaseDesc Cancel delete of all entries from the SMS store.
       
  2363  * @SYMTestPriority High
       
  2364  * @SYMTestActions RMobilePhoneStore::DeleteAll, RMobilePhoneStore::GetInfo, RMobilePhone::GetPhoneStoreInfo, RMobilePhoneStore::NotifyStoreEvent
       
  2365  * @SYMTestExpectedResults Pass - Some entries deleted, request cancelled successfully. Store not empty.
       
  2366  * @SYMTestType CIT
       
  2367  * @SYMTestCaseDependencies live/automatic
       
  2368  *
       
  2369  * Reason for test: Verify some entries deleted before cancellation but cancellation occurs.
       
  2370  *
       
  2371  * @return - TVerdict code
       
  2372  */
       
  2373 	{
       
  2374 
       
  2375 	//
       
  2376 	// SET UP
       
  2377 	//
       
  2378 
       
  2379 	
       
  2380 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess 
       
  2381 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  2382 
       
  2383 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  2384 	CleanupStack::PushL(getInfoStatus);
       
  2385 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  2386 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2387 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2388 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  2389 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  2390 
       
  2391 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess ;
       
  2392 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  2393 
       
  2394 	// Ensure phone store is full
       
  2395     CHECK_TRUE_L(iSmsStoreTestHelper.EnsureStoreFullL(smsStore),_L("TSmsStoreTsyTestHelper::EnsureStoreFullL returned an error"));
       
  2396 
       
  2397 	//
       
  2398 	// SET UP END
       
  2399 	//
       
  2400 	
       
  2401 	StartTest();
       
  2402 	
       
  2403 	//
       
  2404 	// TEST START
       
  2405 	//
       
  2406 	
       
  2407 	
       
  2408 	// ===  Find out how many entries are used in the phone book ===
       
  2409 
       
  2410 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1   
       
  2411 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2412 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  2413 	ASSERT_EQUALS(getInfoStatus.Int(), KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));	
       
  2414 
       
  2415 	// Store iUsedEntries returned for future use 
       
  2416 	TInt storeUsedEntries = storeInfo.iUsedEntries;
       
  2417 
       
  2418 	// ===  Delete all entries from the phone book ===
       
  2419 
       
  2420 	// Delete all entries from the full phone book 
       
  2421 	TExtEtelRequestStatus deleteAllStatus (smsStore,EMobilePhoneStoreDeleteAll);
       
  2422 	CleanupStack::PushL(deleteAllStatus);	
       
  2423 	smsStore.DeleteAll(deleteAllStatus);
       
  2424 	// Do not wait for the request to complete. 
       
  2425 
       
  2426 	// Wait for 2 seconds. 
       
  2427 	User::After(KOneSecond*2); 
       
  2428 		
       
  2429 	// Cancel the DeleteAll operation. Check KErrCancel returned on status of DeleteAll 
       
  2430 	smsStore.CancelAsyncRequest(EMobilePhoneStoreDeleteAllCancel);
       
  2431 
       
  2432 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::GetInfo, timed out"));
       
  2433 	ASSERT_TRUE(	deleteAllStatus.Int()==KErrNone ||
       
  2434 					deleteAllStatus.Int()==KErrCancel, 
       
  2435 					_L("RMobileSmsStore::GetInfo returned an error"));
       
  2436 	
       
  2437 	// ===  Check phone book is not empty but some entries have been deleted. ===
       
  2438 
       
  2439 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1   
       
  2440 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2441 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::GetInfo, timed out"));
       
  2442 	ASSERT_EQUALS(getInfoStatus.Int(), KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  2443 
       
  2444 	// Check iUsedEntries < before deletion.
       
  2445 	ASSERT_TRUE(storeInfo.iUsedEntries < storeUsedEntries, _L("RMobilePhoneStore::GetInfo returned an unexpected number of iUsedEntries"));
       
  2446 	
       
  2447 	//
       
  2448 	// TEST END
       
  2449 	//
       
  2450 
       
  2451     StartCleanup();
       
  2452 	
       
  2453 	// Pop
       
  2454 	// getInfoStatus
       
  2455 	// deleteStatus
       
  2456 	CleanupStack::PopAndDestroy(2, &getInfoStatus);
       
  2457 	
       
  2458 	return TestStepResult();
       
  2459 	}
       
  2460 
       
  2461 TPtrC CCTSYIntegrationTestSMSStore0015::GetTestStepName()
       
  2462 /**
       
  2463  * @return The test step name.
       
  2464  */
       
  2465 	{
       
  2466 	return _L("CCTSYIntegrationTestSMSStore0015");
       
  2467 	}
       
  2468 
       
  2469 
       
  2470 
       
  2471 CCTSYIntegrationTestSMSStore0016::CCTSYIntegrationTestSMSStore0016(CEtelSessionMgr& aEtelSessionMgr)
       
  2472 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  2473 /**
       
  2474  * Constructor.
       
  2475  */
       
  2476 	{
       
  2477 	SetTestStepName(CCTSYIntegrationTestSMSStore0016::GetTestStepName());
       
  2478 	}
       
  2479 
       
  2480 CCTSYIntegrationTestSMSStore0016::~CCTSYIntegrationTestSMSStore0016()
       
  2481 /**
       
  2482  * Destructor.
       
  2483  */
       
  2484 	{
       
  2485 	}
       
  2486 
       
  2487 TVerdict CCTSYIntegrationTestSMSStore0016::doTestStepL()
       
  2488 /**
       
  2489  * @SYMTestCaseID BA-CTSY-INT-SMSS-0016
       
  2490  * @SYMFssID BA/CTSY/SMSS-0016
       
  2491  * @SYMTestCaseDesc Write corrupt SMS message to the SMS store.
       
  2492  * @SYMTestPriority High
       
  2493  * @SYMTestActions RMobilePhoneStore::Write, RMobilePhoneStore::GetInfo
       
  2494  * @SYMTestExpectedResults Pass - Error returned on write.
       
  2495  * @SYMTestType CIT
       
  2496  * @SYMTestCaseDependencies live/automatic
       
  2497  *
       
  2498  * Reason for test: Verify error returned.
       
  2499  *
       
  2500  * @return - TVerdict code
       
  2501  */
       
  2502 	{
       
  2503 
       
  2504 	//
       
  2505 	// SET UP
       
  2506 	//
       
  2507 	
       
  2508 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  2509 	
       
  2510 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess 
       
  2511 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  2512 
       
  2513 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  2514 	CleanupStack::PushL(getInfoStatus);
       
  2515 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  2516 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2517 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2518 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  2519 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  2520 
       
  2521 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess ;
       
  2522 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  2523 
       
  2524 	TInt nextFreeSpace = iSimTsyTestHelper.EnsureEmptyStoreSpaceL(smsStore,KETelIccSmsStore,storeInfo,phone);
       
  2525 	CHECK_TRUE_L(nextFreeSpace>=0,_L("TSimTsyTestHelper::GetSmsMessagingL returned an error"));
       
  2526 	
       
  2527 	//
       
  2528 	// SET UP END
       
  2529 	//
       
  2530 	
       
  2531 	StartTest();
       
  2532 	
       
  2533 	//
       
  2534 	// TEST START
       
  2535 	//
       
  2536 	
       
  2537 	// ===  Find out how many entries are used in the phone book ===
       
  2538 
       
  2539 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1   
       
  2540 	// Store iUsedEntries returned for future use 
       
  2541 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2542 	// Store iUsedEntries returned for future use 
       
  2543 	TInt storeUsedEntries = -1;
       
  2544 	TInt phoneUsedEntries = -1;
       
  2545 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  2546 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  2547 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  2548 			phoneStoreInfoPckg,
       
  2549 			phone,
       
  2550 			storeUsedEntries,
       
  2551 			phoneUsedEntries),
       
  2552 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2553 	
       
  2554 	// ===  Construct a corrupt SMS message ===
       
  2555 
       
  2556 	// Create a  RMobileSmsStore::TMobileGsmSmsEntryV1 with a corrupt iMsgData. 
       
  2557 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  2558 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);
       
  2559        
       
  2560     // Create an entry 
       
  2561 	CreateGsmSmsEntry(entry, -1, KCorruptSmsPdu(),
       
  2562 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  2563 			RMobilePhone::EIsdnNumberPlan);
       
  2564 	
       
  2565 	// Write the entry to the SMS store. 
       
  2566 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  2567 	CleanupStack::PushL(writeStatus);	
       
  2568 
       
  2569 	// $CTSYProblem When the LTSY does not
       
  2570 	// panic when a corrupt SMS is passed to it for writing to the SMS
       
  2571 	// Store.
       
  2572 /*	smsStore.Write(writeStatus,pckgEntry);
       
  2573 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium),KErrNone, _L("RMobileSmsStore::Write timed out"))		
       
  2574 
       
  2575 	// Check error != KErrNone is returned on attempt to write.
       
  2576 	ASSERT_TRUE(writeStatus.Int() != KErrNone, _L("RMobileSmsStore::Write did not return the expected error != KErrNone"))					
       
  2577 
       
  2578 	// ===  Get the number of used entries and check it is the same as before attempted write ===
       
  2579 
       
  2580 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is same as before
       
  2581 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is same as before
       
  2582 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg, phone,
       
  2583 			storeUsedEntries, phoneUsedEntries),
       
  2584 			KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2585 */
       
  2586 	//
       
  2587 	// TEST END
       
  2588 	//
       
  2589 
       
  2590     StartCleanup();
       
  2591 	
       
  2592 	// Pop
       
  2593 	// getInfoStatus
       
  2594 	// writeStatus
       
  2595 	CleanupStack::PopAndDestroy(2, &getInfoStatus);
       
  2596 	
       
  2597 	return TestStepResult();
       
  2598 	}
       
  2599 
       
  2600 TPtrC CCTSYIntegrationTestSMSStore0016::GetTestStepName()
       
  2601 /**
       
  2602  * @return The test step name.
       
  2603  */
       
  2604 	{
       
  2605 	return _L("CCTSYIntegrationTestSMSStore0016");
       
  2606 	}
       
  2607 
       
  2608 
       
  2609 
       
  2610 CCTSYIntegrationTestSMSStore0017::CCTSYIntegrationTestSMSStore0017(CEtelSessionMgr& aEtelSessionMgr)
       
  2611 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  2612 /**
       
  2613  * Constructor.
       
  2614  */
       
  2615 	{
       
  2616 	SetTestStepName(CCTSYIntegrationTestSMSStore0017::GetTestStepName());
       
  2617 	}
       
  2618 
       
  2619 CCTSYIntegrationTestSMSStore0017::~CCTSYIntegrationTestSMSStore0017()
       
  2620 /**
       
  2621  * Destructor.
       
  2622  */
       
  2623 	{
       
  2624 	}
       
  2625 
       
  2626 TVerdict CCTSYIntegrationTestSMSStore0017::doTestStepL()
       
  2627 /**
       
  2628  * @SYMTestCaseID BA-CTSY-INT-SMSS-0017
       
  2629  * @SYMFssID BA/CTSY/SMSS-0017
       
  2630  * @SYMTestCaseDesc Store an empty SMS 
       
  2631  * @SYMTestPriority High
       
  2632  * @SYMTestActions 
       
  2633  * @SYMTestExpectedResults Pass - SMS message stored
       
  2634  * @SYMTestType CIT
       
  2635  * @SYMTestCaseDependencies live/automatic
       
  2636  *
       
  2637  * Reason for test: Verify SMS message are written and can be read.
       
  2638  *
       
  2639  * @return - TVerdict code
       
  2640  */
       
  2641 	{
       
  2642 
       
  2643 	//
       
  2644 	// SET UP
       
  2645 	//
       
  2646 
       
  2647 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  2648 	
       
  2649 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess | KCapsWriteAccess
       
  2650 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  2651 
       
  2652 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  2653 	CleanupStack::PushL(getInfoStatus);
       
  2654 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  2655 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2656 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2657 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  2658 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  2659 
       
  2660 	TUint wantedBits =  RMobilePhoneStore::KCapsReadAccess |
       
  2661 						RMobilePhoneStore::KCapsWriteAccess;
       
  2662 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  2663 				
       
  2664 
       
  2665 	//
       
  2666 	// SET UP END
       
  2667 	//
       
  2668 	
       
  2669 	StartTest();
       
  2670 	
       
  2671 	//
       
  2672 	// TEST START
       
  2673 	//
       
  2674 
       
  2675 	// ===  Find out how many entries are used in the phone store ===
       
  2676 	
       
  2677 	// Get phone store information using RMobilePhone::GetPhoneStoreInfo and KETelIccSmsStore 
       
  2678 	// Store the iUsedEntries returned.
       
  2679 	// Get phone book store information using RMobilePhoneStore::GetInfo 
       
  2680 	// Store the iUsedEntries returned.
       
  2681 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  2682 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  2683 	TInt usedEntries = -1;
       
  2684 	TInt usedEntries2 = -1;
       
  2685 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  2686 			phoneStoreInfoPckg,
       
  2687 			phone, 
       
  2688 			usedEntries, 
       
  2689 			usedEntries2), 
       
  2690 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2691 
       
  2692 	// ===  Write a valid entry (RMobileSmsStore::TMobileGsmSmsEntryV1) ===
       
  2693 
       
  2694 	// post notifier for RMobilePhoneStore::NotifyStoreEvent
       
  2695 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
  2696 	CleanupStack::PushL(notifyStoreEventStatus);
       
  2697 	TUint32 storeEvent;
       
  2698 	TInt index;
       
  2699 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);
       
  2700 	
       
  2701 	// Write a valid empty entry with a entry into the phone store specifying a specific index to store the entry which does not contain an entry. 
       
  2702 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  2703 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry); 
       
  2704 	CreateGsmSmsEntry(entry, -1, KValidEmptyPdu(),
       
  2705 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  2706 			RMobilePhone::EIsdnNumberPlan);
       
  2707 	
       
  2708 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  2709 	CleanupStack::PushL(writeStatus);	
       
  2710 	smsStore.Write(writeStatus,pckgEntry);
       
  2711 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Write Timed out"));
       
  2712 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  2713 
       
  2714 	TEST_CHECK_POINT_L(_L("RMobileSmsStore::Write returned an error, not proceeding with test"));
       
  2715 		
       
  2716 	// Check RMobilePhoneStore::NotifyStoreEvent completes with RMobilePhoneStore::KStoreEntryAdded
       
  2717 	RMobilePhoneStore::TMobileStoreEvent expectedEvent = RMobilePhoneStore::KStoreEntryAdded ;
       
  2718 	iSmsStoreTestHelper.WaitForSmsStoreNotifyStoreEvent( smsStore,
       
  2719 													notifyStoreEventStatus,
       
  2720 													storeEvent,
       
  2721 													expectedEvent,
       
  2722 													index);
       
  2723 
       
  2724 	// ===  Read the written entry ===
       
  2725 
       
  2726 	// Read the entry from the phone store. 
       
  2727 	RMobileSmsStore::TMobileGsmSmsEntryV1 readEntry;
       
  2728 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgReadEntry(readEntry);
       
  2729 	readEntry.iIndex = index;
       
  2730 	readEntry.iMsgData.Zero();
       
  2731 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
       
  2732 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
  2733 	CleanupStack::PushL(readStatus);
       
  2734 		
       
  2735 	smsStore.Read(readStatus,pckgReadEntry);
       
  2736 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Read, Timed out"));
       
  2737 	ASSERT_EQUALS(readStatus.Int(), KErrNone, _L("RMobileSmsStore::Read returned an error"));			
       
  2738 	
       
  2739 	// Check that the entry information is the same as that written.
       
  2740 	ASSERT_EQUALS(readEntry.iMsgStatus, RMobileSmsStore::EStoredMessageUnread, 	_L("RMobileSmsStore::Read Read Entry has the wrong iMsgStatus"));
       
  2741 	ASSERT_EQUALS_DES8(readEntry.iMsgData, KValidEmptyPdu, _L("RMobileSmsStore::Read Read Entry has the wrong iMsgData"));
       
  2742 									
       
  2743 	// Check iServiceCentre is the same as that written to the phone book in set up.
       
  2744 	ASSERT_EQUALS(readEntry.iServiceCentre.iTypeOfNumber,  RMobilePhone::ENationalNumber, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iTypeOfNumber"));
       
  2745 	ASSERT_EQUALS(readEntry.iServiceCentre.iNumberPlan, RMobilePhone::EIsdnNumberPlan, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iNumberPlan"));
       
  2746 	ASSERT_EQUALS_DES16(readEntry.iServiceCentre.iTelNumber, KNumber, _L("RMobileSmsStore::Read Read Entry has the wrong iServiceCentre.iTelNumber"));
       
  2747 
       
  2748 	// ===  Get the number of used entries and check it is 1 higher than before writing the new entry ===
       
  2749 
       
  2750 	// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is 1 higher than that stored if this API is supported
       
  2751 	// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is 1 higher than that stored.
       
  2752 	ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, 
       
  2753 				phoneStoreInfoPckg, phone, usedEntries +1, usedEntries2 +1), 
       
  2754 				KErrNone, 
       
  2755 				_L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2756 	
       
  2757 	//
       
  2758 	// TEST END
       
  2759 	//
       
  2760 
       
  2761     StartCleanup();
       
  2762 	
       
  2763 	// Pop
       
  2764 	// getInfoStatus
       
  2765     // notifyStoreEventStatus
       
  2766 	// writeStatus
       
  2767 	// readStatus
       
  2768 	CleanupStack::PopAndDestroy(4, &getInfoStatus);
       
  2769 	
       
  2770 	return TestStepResult();
       
  2771 	}
       
  2772 
       
  2773 TPtrC CCTSYIntegrationTestSMSStore0017::GetTestStepName()
       
  2774 /**
       
  2775  * @return The test step name.
       
  2776  */
       
  2777 	{
       
  2778 	return _L("CCTSYIntegrationTestSMSStore0017");
       
  2779 	}
       
  2780 
       
  2781 
       
  2782 
       
  2783 CCTSYIntegrationTestSMSStore0018::CCTSYIntegrationTestSMSStore0018(CEtelSessionMgr& aEtelSessionMgr)
       
  2784 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  2785 /**
       
  2786  * Constructor.
       
  2787  */
       
  2788 	{
       
  2789 	SetTestStepName(CCTSYIntegrationTestSMSStore0018::GetTestStepName());
       
  2790 	}
       
  2791 
       
  2792 CCTSYIntegrationTestSMSStore0018::~CCTSYIntegrationTestSMSStore0018()
       
  2793 /**
       
  2794  * Destructor.
       
  2795  */
       
  2796 	{
       
  2797 	}
       
  2798 
       
  2799 TVerdict CCTSYIntegrationTestSMSStore0018::doTestStepL()
       
  2800 /**
       
  2801  * @SYMTestCaseID BA-CTSY-INT-SMSS-0018
       
  2802  * @SYMFssID BA/CTSY/SMSS-0018
       
  2803  * @SYMTestCaseDesc Delete an SMS message from an invalid slot.
       
  2804  * @SYMTestPriority High
       
  2805  * @SYMTestActions RMobilePhoneStore::Delete, RMobilePhone::GetPhoneStoreInfo
       
  2806  * @SYMTestExpectedResults Pass - KErrPathNotFound returned.
       
  2807  * @SYMTestType CIT
       
  2808  * @SYMTestCaseDependencies live/automatic
       
  2809  *
       
  2810  * Reason for test: Verify KErrPathNotFound is returned and number of phone store entries is unaffected.
       
  2811  *
       
  2812  * @return - TVerdict code
       
  2813  */
       
  2814 	{
       
  2815 
       
  2816 	//
       
  2817 	// SET UP
       
  2818 	//
       
  2819 
       
  2820 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  2821 	
       
  2822 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess  
       
  2823 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  2824 
       
  2825 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  2826 	CleanupStack::PushL(getInfoStatus);
       
  2827 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  2828 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2829 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2830 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  2831 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  2832 
       
  2833 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess;
       
  2834 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  2835 
       
  2836 	//
       
  2837 	// SET UP END
       
  2838 	//
       
  2839 	
       
  2840 	StartTest();
       
  2841 	
       
  2842 	//
       
  2843 	// TEST START
       
  2844 	//
       
  2845 	
       
  2846 	
       
  2847 	// ===  Find out how many entries are used in the phone book ===
       
  2848 
       
  2849 	// Get the phone book information using RMobilePhoneStore::GetInfo using a RMobilePhoneStore::TMobilePhoneStoreInfoV1   
       
  2850 	// Store iUsedEntries returned for future use 
       
  2851 	// Get the phone book information using RMobilePhone::GetPhoneStoreInfo 
       
  2852 	// Store iUsedEntries returned for future use
       
  2853 	TInt storeUsedEntries = -1;
       
  2854 	TInt phoneUsedEntries = -1;
       
  2855 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  2856 	RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  2857 	ASSERT_EQUALS(iSimTsyTestHelper.GetNumberOfUsedEntriesInStoreL(smsStore, KETelIccSmsStore, 
       
  2858 			phoneStoreInfoPckg,
       
  2859 			phone,
       
  2860 			storeUsedEntries,
       
  2861 			phoneUsedEntries),
       
  2862 			KErrNone,  _L("RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo both returned an error."));
       
  2863 	
       
  2864 	// ===  Delete an entry from an invalid slot number ===
       
  2865 
       
  2866 	// Delete an entry from slot -1 
       
  2867 	// Repeat test deleting from slot 0 and -10 
       
  2868 	TInt indexArray[] = {-1,0,-10};
       
  2869 	
       
  2870 	TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDelete);
       
  2871 	CleanupStack::PushL(deleteStatus);
       
  2872 	
       
  2873 	for (TInt i = 0; i< 3; i++)
       
  2874 		{
       
  2875 		
       
  2876 		if (indexArray[i] == 0)
       
  2877 			{
       
  2878 			ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10011);
       
  2879 			}
       
  2880 		
       
  2881 		smsStore.Delete(deleteStatus, indexArray[i]);
       
  2882 		ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Delete timed out"));
       
  2883 		ASSERT_TRUE(deleteStatus.Int() != KErrNone, _L("RMobileSmsStore::Delete returned KErrNone when we were expecting an error"));
       
  2884 
       
  2885 		// ===  Get the number of used entries and check it is the same as before attempted delete ===
       
  2886 
       
  2887 		// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is same as before
       
  2888 		// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is same as before
       
  2889 		ASSERT_EQUALS(iSimTsyTestHelper.AssertNumberOfUsedEntriesCorrectL(smsStore, KETelIccSmsStore, phoneStoreInfoPckg, phone,
       
  2890 			storeUsedEntries, phoneUsedEntries),
       
  2891 			KErrNone, _L("RMobilePhoneStore::GetInfo and RMobilePhone::GetPhoneStoreInfo both returned an error"));
       
  2892 		}
       
  2893 	
       
  2894 	//
       
  2895 	// TEST END
       
  2896 	//
       
  2897 
       
  2898     StartCleanup();
       
  2899 	
       
  2900 	// Pop
       
  2901 	// getInfoStatus
       
  2902 	// deleteStatus
       
  2903 	CleanupStack::PopAndDestroy(2,&getInfoStatus);
       
  2904 	
       
  2905 	return TestStepResult();
       
  2906 	}
       
  2907 
       
  2908 TPtrC CCTSYIntegrationTestSMSStore0018::GetTestStepName()
       
  2909 /**
       
  2910  * @return The test step name.
       
  2911  */
       
  2912 	{
       
  2913 	return _L("CCTSYIntegrationTestSMSStore0018");
       
  2914 	}
       
  2915 
       
  2916 
       
  2917 
       
  2918 CCTSYIntegrationTestSMSStore0019::CCTSYIntegrationTestSMSStore0019(CEtelSessionMgr& aEtelSessionMgr)
       
  2919 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  2920 /**
       
  2921  * Constructor.
       
  2922  */
       
  2923 	{
       
  2924 	SetTestStepName(CCTSYIntegrationTestSMSStore0019::GetTestStepName());
       
  2925 	}
       
  2926 
       
  2927 CCTSYIntegrationTestSMSStore0019::~CCTSYIntegrationTestSMSStore0019()
       
  2928 /**
       
  2929  * Destructor.
       
  2930  */
       
  2931 	{
       
  2932 	}
       
  2933 
       
  2934 TVerdict CCTSYIntegrationTestSMSStore0019::doTestStepL()
       
  2935 /**
       
  2936  * @SYMTestCaseID BA-CTSY-INT-SMSS-0019
       
  2937  * @SYMFssID BA/CTSY/SMSS-0019
       
  2938  * @SYMTestCaseDesc Cancel get SMS store info.
       
  2939  * @SYMTestPriority High
       
  2940  * @SYMTestActions 
       
  2941  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  2942  * @SYMTestType CIT
       
  2943  * @SYMTestCaseDependencies live/automatic
       
  2944  *
       
  2945  * Reason for test: Verify request is cancelled.
       
  2946  *
       
  2947  * @return - TVerdict code
       
  2948  */
       
  2949 	{
       
  2950 
       
  2951 	//
       
  2952 	// SET UP
       
  2953 	//
       
  2954 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  2955 
       
  2956 	//
       
  2957 	// SET UP END
       
  2958 	//
       
  2959 	
       
  2960 	StartTest();
       
  2961 	
       
  2962 	//
       
  2963 	// TEST START
       
  2964 	//
       
  2965 	
       
  2966 	
       
  2967 	// Request to get phone store information by calling RMobilePhoneStore::GetInfo 
       
  2968 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  2969 	CleanupStack::PushL(getInfoStatus);
       
  2970 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  2971 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  2972 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  2973 
       
  2974 	// Cancel get information by calling RTelSubSession::CancelAsyncRequest(EMobilePhoneStoreGetInfo) 
       
  2975 	smsStore.CancelAsyncRequest(EMobilePhoneStoreGetInfoCancel);
       
  2976 	
       
  2977 	// Check request completes with KErrCancel | KErrNone
       
  2978 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::GetInfo, timed out"));
       
  2979 	ASSERT_TRUE((getInfoStatus.Int() == KErrCancel) || (getInfoStatus.Int() == KErrNone), _L("RMobileSmsStore::GetInfo did not return KErrCancel or KErrNone"));
       
  2980 
       
  2981 	// Call RMobilePhone::GetPhoneStoreInfo with aStoreName=KETelIccSmsStore 
       
  2982 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 phoneStoreInfo;
       
  2983 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg phoneStoreInfoPckg(phoneStoreInfo);
       
  2984 	RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer,KMainPhone);
       
  2985 	TExtEtelRequestStatus phoneGetInfoStatus (phone,EMobilePhoneStoreGetInfo);	
       
  2986 	CleanupStack::PushL(phoneGetInfoStatus);
       
  2987 	phone.GetPhoneStoreInfo(phoneGetInfoStatus,phoneStoreInfoPckg, KETelIccSmsStore);
       
  2988 
       
  2989 	// Cancel request with RTelSubSession::CancelAsyncRequest(EMobilePhoneGetPhoneStoreInfo) 
       
  2990 	phone.CancelAsyncRequest(EMobilePhoneGetPhoneStoreInfo);
       
  2991 
       
  2992 	// Check request completes with KErrCancel | KErrNone | KErrNotSupported
       
  2993 	ASSERT_EQUALS(WaitForRequestWithTimeOut(phoneGetInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhone::GetPhoneStoreInfo, timed out"));
       
  2994 	ASSERT_TRUE((phoneGetInfoStatus.Int() == KErrCancel) || 
       
  2995 				(phoneGetInfoStatus.Int() == KErrNone) || 
       
  2996 				(phoneGetInfoStatus.Int() == KErrNotSupported), _L("RMobilePhone::GetPhoneStoreInfo did not return KErrCancel or KErrNone or KErrNotSupported"));
       
  2997 
       
  2998 	
       
  2999 	//
       
  3000 	// TEST END
       
  3001 	//
       
  3002 
       
  3003     StartCleanup();
       
  3004 	
       
  3005 	// Pop
       
  3006 	// getInfoStatus
       
  3007 	// phoneGetInfoStatus
       
  3008 	CleanupStack::PopAndDestroy(2, &getInfoStatus);
       
  3009 	
       
  3010 	return TestStepResult();
       
  3011 	}
       
  3012 
       
  3013 TPtrC CCTSYIntegrationTestSMSStore0019::GetTestStepName()
       
  3014 /**
       
  3015  * @return The test step name.
       
  3016  */
       
  3017 	{
       
  3018 	return _L("CCTSYIntegrationTestSMSStore0019");
       
  3019 	}
       
  3020 
       
  3021 
       
  3022 
       
  3023 CCTSYIntegrationTestSMSStore0020::CCTSYIntegrationTestSMSStore0020(CEtelSessionMgr& aEtelSessionMgr)
       
  3024 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  3025 /**
       
  3026  * Constructor.
       
  3027  */
       
  3028 	{
       
  3029 	SetTestStepName(CCTSYIntegrationTestSMSStore0020::GetTestStepName());
       
  3030 	}
       
  3031 
       
  3032 CCTSYIntegrationTestSMSStore0020::~CCTSYIntegrationTestSMSStore0020()
       
  3033 /**
       
  3034  * Destructor.
       
  3035  */
       
  3036 	{
       
  3037 	}
       
  3038 
       
  3039 TVerdict CCTSYIntegrationTestSMSStore0020::doTestStepL()
       
  3040 /**
       
  3041  * @SYMTestCaseID BA-CTSY-INT-SMSS-0020
       
  3042  * @SYMFssID BA/CTSY/SMSS-0020
       
  3043  * @SYMTestCaseDesc Cancel read SMS message from SMS store.
       
  3044  * @SYMTestPriority High
       
  3045  * @SYMTestActions 
       
  3046  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  3047  * @SYMTestType CIT
       
  3048  * @SYMTestCaseDependencies live/automatic
       
  3049  *
       
  3050  * Reason for test: Verify request is cancelled.
       
  3051  *
       
  3052  * @return - TVerdict code
       
  3053  */
       
  3054 	{
       
  3055 
       
  3056 	//
       
  3057 	// SET UP
       
  3058 	//
       
  3059 
       
  3060 	
       
  3061 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsReadAccess 
       
  3062 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  3063 
       
  3064 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  3065 	CleanupStack::PushL(getInfoStatus);
       
  3066 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  3067 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  3068 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  3069 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  3070 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  3071 
       
  3072 	TUint wantedBits =  RMobilePhoneStore::KCapsReadAccess;
       
  3073 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  3074 
       
  3075 	// Write an entry to a known location in the phone book 
       
  3076 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  3077 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);
       
  3078 	CreateGsmSmsEntry(entry, 1, KValidSmsPdu1(),
       
  3079 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  3080 			RMobilePhone::EIsdnNumberPlan);
       
  3081  		
       
  3082 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  3083 	CleanupStack::PushL(writeStatus);	
       
  3084 	smsStore.Write(writeStatus,pckgEntry);
       
  3085 	CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  3086 	CHECK_TRUE_L(writeStatus.Int() == KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  3087 
       
  3088 	//
       
  3089 	// SET UP END
       
  3090 	//
       
  3091 	
       
  3092 	StartTest();
       
  3093 	
       
  3094 	//
       
  3095 	// TEST START
       
  3096 	//
       
  3097 	
       
  3098 	
       
  3099 	// Read an entry from a known location from the SMS store. 
       
  3100 	RMobileSmsStore::TMobileGsmSmsEntryV1 readEntry;
       
  3101 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgReadEntry(readEntry);
       
  3102 	readEntry.iIndex = 1; 
       
  3103 	readEntry.iMsgData.Zero();
       
  3104 	readEntry.iMsgStatus = RMobileSmsStore::EStoredMessageUnknownStatus;
       
  3105 
       
  3106 	TExtEtelRequestStatus readStatus (smsStore,EMobilePhoneStoreRead);	
       
  3107 	CleanupStack::PushL(readStatus);	
       
  3108 	smsStore.Read(readStatus,pckgReadEntry);
       
  3109 
       
  3110 	// Cancel the read request immediately using RTelSubSessionBase::CancelAsyncRequest(EMobilePhoneStoreRead) 
       
  3111 	smsStore.CancelAsyncRequest(EMobilePhoneStoreReadCancel);
       
  3112 	
       
  3113 	// Check KErrCancel or KErrNone is returned.
       
  3114 	ASSERT_EQUALS(WaitForRequestWithTimeOut(readStatus, ETimeMedium), KErrNone,	_L("RMobileSmsStore::Read, timed out"));
       
  3115 	ASSERT_TRUE(readStatus.Int() == KErrNone || readStatus.Int() ==  KErrCancel, _L("RMobileSmsStore::Read returned an error"));
       
  3116 	
       
  3117 	//
       
  3118 	// TEST END
       
  3119 	//
       
  3120 
       
  3121     StartCleanup();
       
  3122 	
       
  3123 	// Pop
       
  3124 	// getInfoStatus
       
  3125 	// writeStatus
       
  3126 	// readStatus
       
  3127 	CleanupStack::PopAndDestroy(3, &getInfoStatus);
       
  3128 	
       
  3129 	return TestStepResult();
       
  3130 	}
       
  3131 
       
  3132 TPtrC CCTSYIntegrationTestSMSStore0020::GetTestStepName()
       
  3133 /**
       
  3134  * @return The test step name.
       
  3135  */
       
  3136 	{
       
  3137 	return _L("CCTSYIntegrationTestSMSStore0020");
       
  3138 	}
       
  3139 
       
  3140 
       
  3141 
       
  3142 CCTSYIntegrationTestSMSStore0021::CCTSYIntegrationTestSMSStore0021(CEtelSessionMgr& aEtelSessionMgr)
       
  3143 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  3144 /**
       
  3145  * Constructor.
       
  3146  */
       
  3147 	{
       
  3148 	SetTestStepName(CCTSYIntegrationTestSMSStore0021::GetTestStepName());
       
  3149 	}
       
  3150 
       
  3151 CCTSYIntegrationTestSMSStore0021::~CCTSYIntegrationTestSMSStore0021()
       
  3152 /**
       
  3153  * Destructor.
       
  3154  */
       
  3155 	{
       
  3156 	}
       
  3157 
       
  3158 TVerdict CCTSYIntegrationTestSMSStore0021::doTestStepL()
       
  3159 /**
       
  3160  * @SYMTestCaseID BA-CTSY-INT-SMSS-0021
       
  3161  * @SYMFssID BA/CTSY/SMSS-0021
       
  3162  * @SYMTestCaseDesc Cancel delete message from SMS store.
       
  3163  * @SYMTestPriority High
       
  3164  * @SYMTestActions 
       
  3165  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  3166  * @SYMTestType CIT
       
  3167  * @SYMTestCaseDependencies live/automatic
       
  3168  *
       
  3169  * Reason for test: Verify request is cancelled.
       
  3170  *
       
  3171  * @return - TVerdict code
       
  3172  */
       
  3173 	{
       
  3174 
       
  3175 	//
       
  3176 	// SET UP
       
  3177 	//
       
  3178 
       
  3179 	
       
  3180 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess 
       
  3181 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  3182 
       
  3183 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  3184 	CleanupStack::PushL(getInfoStatus);
       
  3185 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  3186 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  3187 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  3188 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  3189 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  3190 
       
  3191 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess;
       
  3192 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  3193 
       
  3194 	// Write an entry to a known location in the phone book 
       
  3195  	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  3196 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);
       
  3197     
       
  3198     // Create an entry 
       
  3199 	CreateGsmSmsEntry(entry, 5, KValidSmsPdu1(),
       
  3200 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  3201 			RMobilePhone::EIsdnNumberPlan);
       
  3202 	
       
  3203 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  3204 	CleanupStack::PushL(writeStatus);
       
  3205 	smsStore.Write(writeStatus,pckgEntry);
       
  3206 	CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  3207 	CHECK_TRUE_L(writeStatus.Int() == KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  3208 
       
  3209 	//
       
  3210 	// SET UP END
       
  3211 	//
       
  3212 	
       
  3213 	StartTest();
       
  3214 	
       
  3215 	//
       
  3216 	// TEST START
       
  3217 	//
       
  3218 	
       
  3219 	
       
  3220 	// Delete an entry at a known index from the SMS store. 
       
  3221 	TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDelete);
       
  3222 	CleanupStack::PushL(deleteStatus);
       
  3223 	smsStore.Delete(deleteStatus,entry.iIndex);			
       
  3224 	
       
  3225 	// Cancel the request immediately with RTelSubSessionBase::.CancelAsyncRequest( EMobilePhoneStoreDelete ) 
       
  3226 	smsStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
       
  3227 	
       
  3228 	// Check KErrCancel or KErrNone is returned (if it was too late to cancel).
       
  3229 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::Delete timed out"));
       
  3230 	ASSERT_TRUE(deleteStatus.Int() == KErrNone ||  deleteStatus.Int() == KErrCancel, _L("RMobileSmsStore::Delete returned an error"));
       
  3231 
       
  3232 	
       
  3233 	//
       
  3234 	// TEST END
       
  3235 	//
       
  3236 
       
  3237     StartCleanup();
       
  3238 	
       
  3239 	// Pop 
       
  3240 	// getInfoStatus
       
  3241 	// writeStatus
       
  3242 	// deleteStatus
       
  3243 	CleanupStack::PopAndDestroy(3, &getInfoStatus);
       
  3244 	
       
  3245 	
       
  3246 	return TestStepResult();
       
  3247 	}
       
  3248 
       
  3249 TPtrC CCTSYIntegrationTestSMSStore0021::GetTestStepName()
       
  3250 /**
       
  3251  * @return The test step name.
       
  3252  */
       
  3253 	{
       
  3254 	return _L("CCTSYIntegrationTestSMSStore0021");
       
  3255 	}
       
  3256 
       
  3257 
       
  3258 
       
  3259 CCTSYIntegrationTestSMSStore0022::CCTSYIntegrationTestSMSStore0022(CEtelSessionMgr& aEtelSessionMgr)
       
  3260 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  3261 /**
       
  3262  * Constructor.
       
  3263  */
       
  3264 	{
       
  3265 	SetTestStepName(CCTSYIntegrationTestSMSStore0022::GetTestStepName());
       
  3266 	}
       
  3267 
       
  3268 CCTSYIntegrationTestSMSStore0022::~CCTSYIntegrationTestSMSStore0022()
       
  3269 /**
       
  3270  * Destructor.
       
  3271  */
       
  3272 	{
       
  3273 	}
       
  3274 
       
  3275 TVerdict CCTSYIntegrationTestSMSStore0022::doTestStepL()
       
  3276 /**
       
  3277  * @SYMTestCaseID BA-CTSY-INT-SMSS-0022
       
  3278  * @SYMFssID BA/CTSY/SMSS-0022
       
  3279  * @SYMTestCaseDesc Cancel write message to SMS store.
       
  3280  * @SYMTestPriority High
       
  3281  * @SYMTestActions 
       
  3282  * @SYMTestExpectedResults Pass - KErrCancel or KErrNone if it was too late to cancel.
       
  3283  * @SYMTestType CIT
       
  3284  * @SYMTestCaseDependencies live/automatic
       
  3285  *
       
  3286  * Reason for test: Verify request is cancelled.
       
  3287  *
       
  3288  * @return - TVerdict code
       
  3289  */
       
  3290 	{
       
  3291 
       
  3292 	//
       
  3293 	// SET UP
       
  3294 	//
       
  3295 
       
  3296 	
       
  3297 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsWriteAccess 
       
  3298 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  3299 
       
  3300 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  3301 	CleanupStack::PushL(getInfoStatus);
       
  3302 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  3303 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  3304 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  3305 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  3306 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  3307 
       
  3308 	TUint wantedBits =  RMobilePhoneStore::KCapsWriteAccess;
       
  3309 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  3310 
       
  3311 	// Ensure phone store is not empty. 
       
  3312 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  3313 	CleanupStack::PushL(writeStatus);
       
  3314 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  3315 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);	    
       
  3316 	
       
  3317 	if(storeInfo.iUsedEntries < 1)
       
  3318 		{
       
  3319 	    // Create an entry 
       
  3320 	    CreateGsmSmsEntry(entry, -1, KValidSmsPdu1(),
       
  3321 				RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  3322 				RMobilePhone::EIsdnNumberPlan);
       
  3323 
       
  3324 		smsStore.Write(writeStatus,pckgEntry);
       
  3325 		CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  3326 		CHECK_TRUE_L(writeStatus.Int() == KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  3327 
       
  3328 		smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  3329 		CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  3330 		CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  3331 		}
       
  3332 	
       
  3333 	CHECK_TRUE_L(storeInfo.iUsedEntries > 0, _L("RMobileSmsStore.GetInfo returned storeInfo.iUserEntries >0"));
       
  3334 
       
  3335 	//
       
  3336 	// SET UP END
       
  3337 	//
       
  3338 	
       
  3339 	StartTest();
       
  3340 	
       
  3341 	//
       
  3342 	// TEST START
       
  3343 	//
       
  3344 	
       
  3345 	
       
  3346 	// Write an entry at a known index from the SMS store. 
       
  3347 	CreateGsmSmsEntry(entry, 3, KValidSmsPdu1(),
       
  3348 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  3349 			RMobilePhone::EIsdnNumberPlan);
       
  3350 	smsStore.Write(writeStatus,pckgEntry);	
       
  3351 
       
  3352 	// Cancel the request immediately with RTelSubSessionBase::.CancelAsyncRequest( EMobilePhoneStoreWrite ) 
       
  3353 	smsStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
       
  3354 	
       
  3355 	// Check KErrCancel or KErrNone is returned (if it was too late to cancel).
       
  3356 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  3357 	ASSERT_TRUE((writeStatus.Int() == KErrCancel) || (writeStatus.Int() == KErrNone) , _L("RMobileSmsStore::Write returned an unexpected error of KErrNone or KErrCancel"));
       
  3358 
       
  3359 	
       
  3360 	//
       
  3361 	// TEST END
       
  3362 	//
       
  3363 
       
  3364     StartCleanup();
       
  3365 	
       
  3366 	// Pop
       
  3367 	// getInfoStatus
       
  3368 	// writeStatus
       
  3369 	CleanupStack::PopAndDestroy(2, &getInfoStatus);
       
  3370 	
       
  3371 	return TestStepResult();
       
  3372 	}
       
  3373 
       
  3374 TPtrC CCTSYIntegrationTestSMSStore0022::GetTestStepName()
       
  3375 /**
       
  3376  * @return The test step name.
       
  3377  */
       
  3378 	{
       
  3379 	return _L("CCTSYIntegrationTestSMSStore0022");
       
  3380 	}
       
  3381 
       
  3382 
       
  3383 
       
  3384 CCTSYIntegrationTestSMSStore0023::CCTSYIntegrationTestSMSStore0023(CEtelSessionMgr& aEtelSessionMgr)
       
  3385 	: CCTSYIntegrationTestSMSStoreBase(aEtelSessionMgr)
       
  3386 /**
       
  3387  * Constructor.
       
  3388  */
       
  3389 	{
       
  3390 	SetTestStepName(CCTSYIntegrationTestSMSStore0023::GetTestStepName());
       
  3391 	}
       
  3392 
       
  3393 CCTSYIntegrationTestSMSStore0023::~CCTSYIntegrationTestSMSStore0023()
       
  3394 /**
       
  3395  * Destructor.
       
  3396  */
       
  3397 	{
       
  3398 	}
       
  3399 
       
  3400 TVerdict CCTSYIntegrationTestSMSStore0023::doTestStepL()
       
  3401 /**
       
  3402  * @SYMTestCaseID BA-CTSY-INT-SMSS-0023
       
  3403  * @SYMFssID BA/CTSY/SMSS-0023
       
  3404  * @SYMTestCaseDesc Cancel notify store event on SMS store.
       
  3405  * @SYMTestPriority High
       
  3406  * @SYMTestActions 
       
  3407  * @SYMTestExpectedResults Pass - KErrCancel returned.
       
  3408  * @SYMTestType CIT
       
  3409  * @SYMTestCaseDependencies live/automatic
       
  3410  *
       
  3411  * Reason for test: Verify request is cancelled.
       
  3412  *
       
  3413  * @return - TVerdict code
       
  3414  */
       
  3415 	{
       
  3416 
       
  3417 	//
       
  3418 	// SET UP
       
  3419 	//
       
  3420 
       
  3421 	
       
  3422 	// Ensure RMobilePhoneStore::GetInfo returns iCaps in set of KCapsNotifyEvent 
       
  3423 	RMobileSmsStore& smsStore = iEtelSessionMgr.GetSmsStoreL(KMainServer,KMainPhone,KMainSmsMessaging,KIccSmsStore);
       
  3424 
       
  3425 	TExtEtelRequestStatus getInfoStatus (smsStore,EMobilePhoneStoreGetInfo);	
       
  3426 	CleanupStack::PushL(getInfoStatus);
       
  3427 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 storeInfo;
       
  3428 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg storeInfoPckg (storeInfo);
       
  3429 	smsStore.GetInfo(getInfoStatus,storeInfoPckg);
       
  3430 	CHECK_TRUE_L(WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium) == KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
       
  3431 	CHECK_TRUE_L(getInfoStatus.Int() == KErrNone, _L("RMobileSmsStore::GetInfo returned an error"));
       
  3432 
       
  3433 	TUint wantedBits =  RMobilePhoneStore::KCapsNotifyEvent;
       
  3434 	CHECK_BITS_SET_L(storeInfo.iCaps,wantedBits,KNoUnwantedBits, _L("RMobilePhoneStore::GetInfo returned incorrect Store Info Caps"));
       
  3435 
       
  3436 	// Write an entry to a known location in the phone book 
       
  3437 
       
  3438     // Create an entry 
       
  3439 	RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
       
  3440 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg pckgEntry(entry);	      
       
  3441 	CreateGsmSmsEntry(entry, -1, KValidSmsPdu1(),
       
  3442 			RMobileSmsStore::EStoredMessageUnread, RMobilePhone::ENationalNumber,
       
  3443 			RMobilePhone::EIsdnNumberPlan);
       
  3444 
       
  3445 	TExtEtelRequestStatus writeStatus (smsStore,EMobilePhoneStoreWrite);	
       
  3446 	CleanupStack::PushL(writeStatus);
       
  3447 	smsStore.Write(writeStatus,pckgEntry);
       
  3448 	CHECK_TRUE_L(WaitForRequestWithTimeOut(writeStatus, ETimeMedium)==KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  3449 	CHECK_TRUE_L(writeStatus.Int() == KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  3450 
       
  3451 
       
  3452 	//
       
  3453 	// SET UP END
       
  3454 	//
       
  3455 	
       
  3456 	StartTest();
       
  3457 	
       
  3458 	//
       
  3459 	// TEST START
       
  3460 	//
       
  3461 	
       
  3462 	
       
  3463 	// Request notification of a store event with RMobilePhoneStore::NotifyStoreEvent 
       
  3464 	
       
  3465 	TExtEtelRequestStatus notifyStoreEventStatus (smsStore,EMobilePhoneStoreNotifyStoreEvent);	
       
  3466 	CleanupStack::PushL(notifyStoreEventStatus);
       
  3467 	TUint32 storeEvent;
       
  3468 	TInt index;
       
  3469 	smsStore.NotifyStoreEvent(notifyStoreEventStatus, storeEvent, index);
       
  3470 	
       
  3471 	// Cancel the RMobilePhoneStore::NotifyStoreEvent with RTelSubSession::CancelAsyncRequest( EMobilePhoneStoreNotifyStoreEvent ) 
       
  3472 	smsStore.CancelAsyncRequest (EMobilePhoneStoreNotifyStoreEvent);
       
  3473 	
       
  3474 	// Do some operations which would trigger a store event if it hadn't been cancelled. 
       
  3475 
       
  3476 	// Delete an entry from the phone store 
       
  3477 	TExtEtelRequestStatus deleteStatus (smsStore,EMobilePhoneStoreDelete);
       
  3478 	CleanupStack::PushL(deleteStatus);
       
  3479 	smsStore.Delete(deleteStatus,5);	
       
  3480 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Delete timed out"));
       
  3481 	ASSERT_EQUALS(deleteStatus.Int(), KErrNone, _L("RMobileSmsStore::Delete returned an error"));
       
  3482 
       
  3483 	// Write an entry to the phone store 
       
  3484 	entry.iIndex = -1;
       
  3485 	smsStore.Write(writeStatus,pckgEntry);
       
  3486 	ASSERT_EQUALS(WaitForRequestWithTimeOut(writeStatus, ETimeMedium), KErrNone, _L("RMobileSmsStore::Write timed out"));
       
  3487 	ASSERT_EQUALS(writeStatus.Int(), KErrNone, _L("RMobileSmsStore::Write returned an error"));
       
  3488 
       
  3489 	// Check RMobilePhoneStore::NotifyStoreEvent completes with KErrCancel
       
  3490 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyStoreEventStatus, ETimeMedium), KErrNone, _L("RMobilePhoneStore::NotifyStoreEvent timed out"));
       
  3491 	ASSERT_EQUALS(notifyStoreEventStatus.Int(), KErrCancel, _L("RMobilePhoneStore::NotifyStoreEvent did not complete with KErrCancel"));
       
  3492 	
       
  3493 	//
       
  3494 	// TEST END
       
  3495 	//
       
  3496 
       
  3497     StartCleanup();
       
  3498 	
       
  3499 	// Pop
       
  3500 	// getInfoStatus
       
  3501 	// writeStatus
       
  3502 	// notifyStoreEventStatus
       
  3503 	// deleteStatus
       
  3504 	CleanupStack::PopAndDestroy(4,&getInfoStatus);
       
  3505 	
       
  3506 	return TestStepResult();
       
  3507 	}
       
  3508 
       
  3509 TPtrC CCTSYIntegrationTestSMSStore0023::GetTestStepName()
       
  3510 /**
       
  3511  * @return The test step name.
       
  3512  */
       
  3513 	{
       
  3514 	return _L("CCTSYIntegrationTestSMSStore0023");
       
  3515 	}
       
  3516 
       
  3517 
       
  3518