telephonyserverplugins/ctsydispatchlayer/test/dispatchertests/dispatchsrc/cctsyphonebookfunegative.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file The TEFUnit test suite for PhonebookEnControl in the Common TSY.
       
    20 */
       
    21 
       
    22 #include <etel.h>
       
    23 #include <etelmm.h>
       
    24 #include <et_clsvr.h>
       
    25 #include <ctsy/mmtsy_names.h>
       
    26 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    27 #include <test/tmockltsydata.h>
       
    28 #include <ctsy/serviceapi/gsmerror.h>
       
    29 #include <ctsy/ltsy/mltsydispatchphonebookinterface.h>
       
    30 #include "listretrieverao.h"
       
    31 #include "config.h"
       
    32 
       
    33 #include "cctsyphonebookfunegative.h"
       
    34 
       
    35 // Taken from cctsyphonebookfu.cpp
       
    36 const TInt KReadBufLength = 400;
       
    37 const TInt KMaxTextLength = 50;
       
    38 //const TInt KNewMaxTextLength = 55;
       
    39 const TInt KMaxNumberLength = 25;
       
    40 const TInt KNumberOfEnries = 100;
       
    41 
       
    42 void CCTsyPhonebookFUNegative::CreatePhonebookStoreDataL()
       
    43 	{
       
    44 	iPhonebookStoreData.iAdnTotalEntries 			= 4;
       
    45 	iPhonebookStoreData.iAdnMaximumNumberLength 	= KMaxNumberLength;
       
    46 	iPhonebookStoreData.iAdnMaximumTextLength 		= KMaxTextLength;
       
    47 
       
    48 	iPhonebookStoreData.iFdnTotalEntries 			= 4;
       
    49 	iPhonebookStoreData.iFdnMaximumNumberLength 	= KMaxNumberLength;
       
    50 	iPhonebookStoreData.iFdnMaximumTextLength 		= KMaxTextLength;
       
    51 
       
    52 	iPhonebookStoreData.iSdnTotalEntries			= KNumberOfEnries;
       
    53 	iPhonebookStoreData.iSdnMaximumTextLength		= KMaxTextLength;
       
    54 	iPhonebookStoreData.iSdnMaximumNumberLength		= KMaxNumberLength;
       
    55 
       
    56 	iPhonebookStoreData.iVmbTotalEntries			= KNumberOfEnries;
       
    57 	iPhonebookStoreData.iVmbMaximumTextLength		= KMaxTextLength;
       
    58 	iPhonebookStoreData.iVmbMaximumNumberLength		= KMaxNumberLength;
       
    59 	iPhonebookStoreData.iVmbCapabilities			= 0;
       
    60 
       
    61 	iPhonebookStoreData.iMbdnTotalEntries			= KNumberOfEnries;
       
    62 	iPhonebookStoreData.iMbdnMaximumTextLength		= KMaxTextLength;
       
    63 	iPhonebookStoreData.iMbdnMaximumNumberLength	= KMaxNumberLength;
       
    64 	iPhonebookStoreData.iMbdnCapabilities			= 0;
       
    65 	
       
    66 	iPhonebookStoreData.iEmailMaximumFieldsPerEntry				= 101;
       
    67 	iPhonebookStoreData.iEmailMaximumLength						= KMaxTextLength;
       
    68 		
       
    69 	iPhonebookStoreData.iAdditionalNumberMaximumFieldsPerEntry	= 102;
       
    70 	iPhonebookStoreData.iAdditionalNumberMaximumLength			= KMaxNumberLength;
       
    71 	
       
    72 	iPhonebookStoreData.iSecondNameMaximumFieldsPerEntry		= 103;
       
    73 	iPhonebookStoreData.iSecondNameMaximumLength				= KMaxTextLength;
       
    74 	}
       
    75 
       
    76 void CCTsyPhonebookFUNegative::OpenSmsStoreL(RMobileSmsMessaging& aSmsMessaging, RMobileSmsStore& aSmsStore, const TDesC& aSmsStoreName)
       
    77 	{
       
    78 	iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId);	
       
    79 		
       
    80 	User::LeaveIfError(aSmsMessaging.Open(iPhone));
       
    81 	User::LeaveIfError(aSmsStore.Open(aSmsMessaging, aSmsStoreName));
       
    82 	
       
    83 	RBuf8 data;
       
    84 	CleanupClosePushL(data);
       
    85 	
       
    86 	TInt totalEntries = 0;
       
    87 	TInt usedEntries = 0;
       
    88 	TMockLtsyData2<TInt,TInt> smsStoreGetInfoLtsyData(totalEntries, usedEntries);
       
    89 	data.Close();
       
    90 	smsStoreGetInfoLtsyData.SerialiseL(data);
       
    91 	iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrGeneral, data);
       
    92 	
       
    93 	WaitForMockLTSYTerminated();
       
    94 	AssertMockLtsyStatusL();
       
    95 	
       
    96 	CleanupStack::PopAndDestroy(&data);
       
    97 	}
       
    98 
       
    99 CTestSuite* CCTsyPhonebookFUNegative::CreateSuiteL(const TDesC& aName)
       
   100 	{
       
   101 	SUB_SUITE;
       
   102   	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0001L);
       
   103 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0002L);
       
   104 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0003L);
       
   105 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0004L);	
       
   106 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0005L);
       
   107 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0006L);
       
   108 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0007L);
       
   109 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0008L);
       
   110 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0009L);
       
   111 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0010L);
       
   112 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0011L);
       
   113 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0012L);
       
   114 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0013L);
       
   115 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0014L);
       
   116 	ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFUNegative, TestUnit0015L);
       
   117 	END_SUITE;
       
   118 	}
       
   119 
       
   120 //
       
   121 // 'Negative' unit tests
       
   122 //
       
   123 
       
   124 /**
       
   125 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0001
       
   126 @SYMComponent telephony_ctsy
       
   127 @SYMTestCaseDesc Test returned value if EMmTsyPhoneBookStoreReadIPC is not supported by LTSY
       
   128 @SYMTestPriority High
       
   129 @SYMTestActions Invokes RMobilePhoneBookStore::Read()
       
   130 @SYMTestExpectedResults Pass
       
   131 @SYMTestType UT
       
   132 */
       
   133 void CCTsyPhonebookFUNegative::TestUnit0001L()
       
   134 	{
       
   135 	TConfig config;
       
   136 	config.SetSupportedValue(MLtsyDispatchPhonebookStoreReadEntry::KLtsyDispatchPhonebookStoreReadEntryApiId, EFalse);
       
   137 
       
   138 	OpenEtelServerL(EUseExtendedError);
       
   139 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   140 	OpenPhoneL();
       
   141 	
       
   142 	RMobilePhoneBookStore phonebookStore;
       
   143 	CleanupClosePushL(phonebookStore);
       
   144 
       
   145 	//initialise IPC generated from phonebook store open
       
   146 	iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId);
       
   147 
       
   148 	TName phonebook(KETelIccBdnPhoneBook); //(Bdn - noncaching)
       
   149 	ASSERT_EQUALS(phonebookStore.Open(iPhone, phonebook), KErrNone);
       
   150 
       
   151     AssertMockLtsyStatusL();
       
   152 
       
   153     RBuf8 data;
       
   154     CleanupClosePushL(data);
       
   155 
       
   156     //complete initialise IPC
       
   157     TMockLtsyData1<DispatcherPhonebook::TPhonebookStoreInfoV1> phonebookCompLtsyData(iPhonebookStoreData);
       
   158     phonebookCompLtsyData.SerialiseL(data);
       
   159     iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId,KErrNone,data);
       
   160     data.Close();
       
   161 
       
   162     //fire up the initialise complete
       
   163     WaitForMockLTSYTerminated();
       
   164 
       
   165 	TRequestStatus requestStatus;
       
   166 	TBuf8<KReadBufLength> phonebookReadData;
       
   167 
       
   168 	phonebookStore.Read(requestStatus, 1, 1, phonebookReadData);
       
   169 	User::WaitForRequest(requestStatus);
       
   170 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);
       
   171 
       
   172 	AssertMockLtsyStatusL();
       
   173 	config.Reset();
       
   174 	CleanupStack::PopAndDestroy(3, this); // data, phonebookStore, this
       
   175 	}
       
   176 
       
   177 /**
       
   178 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0002
       
   179 @SYMComponent telephony_ctsy
       
   180 @SYMTestCaseDesc Test returned value if EMmTsyPhoneBookStoreDeleteIPC is not supported by LTSY
       
   181 @SYMTestPriority High
       
   182 @SYMTestActions Invokes RMobilePhoneBookStore::Delete()
       
   183 @SYMTestExpectedResults Pass
       
   184 @SYMTestType UT
       
   185 */
       
   186 void CCTsyPhonebookFUNegative::TestUnit0002L()
       
   187 	{
       
   188 	TConfig config;
       
   189 	config.SetSupportedValue(MLtsyDispatchPhonebookStoreDeleteEntry::KLtsyDispatchPhonebookStoreDeleteEntryApiId, EFalse);
       
   190 	
       
   191 	OpenEtelServerL(EUseExtendedError);
       
   192 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   193 	OpenPhoneL();
       
   194 	
       
   195 	RMobilePhoneBookStore phonebookStore;
       
   196 	CleanupClosePushL(phonebookStore);
       
   197 
       
   198     //initialise IPC generated from phonebook store open
       
   199     iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId);
       
   200 
       
   201 	TName phonebook(KETelIccBdnPhoneBook); //(Bdn - noncaching)
       
   202 	ASSERT_EQUALS(phonebookStore.Open(iPhone, phonebook), KErrNone);
       
   203 
       
   204     RBuf8 data;
       
   205     CleanupClosePushL(data);
       
   206 
       
   207     //complete initialise IPC
       
   208     TMockLtsyData1<DispatcherPhonebook::TPhonebookStoreInfoV1> phonebookCompLtsyData(iPhonebookStoreData);
       
   209     phonebookCompLtsyData.SerialiseL(data);
       
   210     iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId,KErrNone,data);
       
   211     data.Close();
       
   212 
       
   213     //fire up the initialise complete
       
   214     WaitForMockLTSYTerminated();
       
   215 
       
   216 	TRequestStatus requestStatus;
       
   217 	TInt indexToDelete = 0;
       
   218 	
       
   219 	phonebookStore.Delete(requestStatus, indexToDelete);
       
   220 	User::WaitForRequest(requestStatus);
       
   221 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);
       
   222 
       
   223 	AssertMockLtsyStatusL();
       
   224 	config.Reset();
       
   225 	CleanupStack::PopAndDestroy(3, this); // data, phonebookStore, this
       
   226 	}
       
   227 	
       
   228 /**
       
   229 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0003
       
   230 @SYMComponent telephony_ctsy
       
   231 @SYMTestCaseDesc Test returned value if EMmTsyPhoneBookStoreCacheIPC is not supported by LTSY
       
   232 @SYMTestPriority High
       
   233 @SYMTestActions Invokes RMobilePhoneBookStore::Open()
       
   234 @SYMTestExpectedResults Pass
       
   235 @SYMTestType UT
       
   236 */
       
   237 void CCTsyPhonebookFUNegative::TestUnit0003L() 
       
   238 	{
       
   239 	TConfig config;
       
   240 	config.SetSupportedValue(MLtsyDispatchPhonebookStoreCache::KLtsyDispatchPhonebookStoreCacheApiId, EFalse);
       
   241 	
       
   242 	OpenEtelServerL(EUseExtendedError);
       
   243 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   244 	OpenPhoneL();
       
   245 	
       
   246 	CreatePhonebookStoreDataL();
       
   247 	
       
   248 	RMobilePhoneBookStore phonebookStore;
       
   249 	CleanupClosePushL(phonebookStore);
       
   250 	TName phonebook(KETelIccFdnPhoneBook);
       
   251 	
       
   252 	//initialise IPC generated from phonebook store open
       
   253 	iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId);
       
   254 
       
   255 	ASSERT_EQUALS(phonebookStore.Open(iPhone, phonebook),KErrNone); 
       
   256 	
       
   257 	AssertMockLtsyStatusL();
       
   258     config.Reset();
       
   259 	CleanupStack::PopAndDestroy(2, this); // phonebookStore, this	
       
   260 	}	
       
   261 
       
   262 /**
       
   263 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0004
       
   264 @SYMComponent telephony_ctsy
       
   265 @SYMTestCaseDesc Test returned value if EMmTsyPhoneBookStoreGetInfoIPC is not supported by LTSY
       
   266 @SYMTestPriority High
       
   267 @SYMTestActions Invokes RMobilePhoneBookStore::GetInfo()
       
   268 @SYMTestExpectedResults Pass
       
   269 @SYMTestType UT
       
   270 */
       
   271 void CCTsyPhonebookFUNegative::TestUnit0004L()
       
   272 	{
       
   273 	TConfig config;
       
   274 	config.SetSupportedValue(MLtsyDispatchPhonebookStoreGetPhonebookInfo::KLtsyDispatchPhonebookStoreGetPhonebookInfoApiId, EFalse);
       
   275 	
       
   276 	OpenEtelServerL(EUseExtendedError);
       
   277 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   278 	OpenPhoneL();
       
   279 	
       
   280 	RMobilePhoneBookStore phonebookStore;
       
   281 	CleanupClosePushL(phonebookStore);
       
   282 
       
   283     //initialise IPC generated from phonebook store open
       
   284     iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId);
       
   285 
       
   286 	TName phonebook(KETelIccSdnPhoneBook); //(Sdn - noncaching)
       
   287 	ASSERT_EQUALS(phonebookStore.Open(iPhone, phonebook), KErrNone);
       
   288 	
       
   289 	AssertMockLtsyStatusL();
       
   290 
       
   291     RBuf8 data;
       
   292     CleanupClosePushL(data);
       
   293 
       
   294     //complete initialise IPC
       
   295     TMockLtsyData1<DispatcherPhonebook::TPhonebookStoreInfoV1> phonebookCompLtsyData(iPhonebookStoreData);
       
   296     phonebookCompLtsyData.SerialiseL(data);
       
   297     iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId,KErrNone,data);
       
   298     data.Close();
       
   299 
       
   300     //fire up the initialise complete
       
   301     WaitForMockLTSYTerminated();
       
   302 
       
   303 	RMmCustomAPI customApi;
       
   304 	OpenCustomApiLC(customApi);
       
   305 	
       
   306 	TRequestStatus cacheRequestStatus;
       
   307 	RMmCustomAPI::TPndCacheStatus cacheStatus;
       
   308 	customApi.GetPndCacheStatus(cacheRequestStatus, cacheStatus, phonebook);
       
   309 	User::WaitForRequest(cacheRequestStatus);
       
   310 	
       
   311 	TRequestStatus requestStatus;
       
   312 	RMobilePhoneBookStore::TMobilePhoneBookInfoV1 bookInfo;
       
   313 	RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg bookPckg(bookInfo);
       
   314 
       
   315 	phonebookStore.GetInfo(requestStatus, bookPckg);
       
   316 	User::WaitForRequest(requestStatus); 
       
   317 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);
       
   318 
       
   319 	AssertMockLtsyStatusL();
       
   320 	config.Reset();
       
   321 	CleanupStack::PopAndDestroy(4, this); // customApi, data, phonebookStore, this
       
   322 	}
       
   323 
       
   324 /**
       
   325 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0005
       
   326 @SYMComponent telephony_ctsy
       
   327 @SYMTestCaseDesc Test returned value if EMmTsyPhoneBookStoreInitIPC is not supported by LTSY
       
   328 @SYMTestPriority High
       
   329 @SYMTestActions Invokes RMobilePhoneBookStore::Open()
       
   330 @SYMTestExpectedResults Pass
       
   331 @SYMTestType UT
       
   332 */
       
   333 void CCTsyPhonebookFUNegative::TestUnit0005L()
       
   334 	{
       
   335 	TConfig config;
       
   336 	config.SetSupportedValue(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId, EFalse);
       
   337 	
       
   338 	OpenEtelServerL(EUseExtendedError);
       
   339 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   340 	OpenPhoneL();
       
   341 	
       
   342 	RMobilePhoneBookStore phonebookStore;
       
   343 	CleanupClosePushL(phonebookStore);
       
   344 	
       
   345 	TName phonebook(KETelIccAdnPhoneBook); //(Adn - caching, init required)
       
   346 	
       
   347 	// in CMmPhoneBookStoreTsy::ConstructL( TName aName )
       
   348 	// iMmPhoneBookStoreExtInterface->InitPhonebook(
       
   349 	// EMmTsyPhoneBookStoreInitIPC, iPhoneBookName );
       
   350 	// return code never checked, tests fails
       
   351 	TInt err = phonebookStore.Open(iPhone, phonebook); // still returns KErrNone
       
   352 	ASSERT_EQUALS(err, KErrNone);
       
   353 	
       
   354 	AssertMockLtsyStatusL();
       
   355 	config.Reset();
       
   356 	CleanupStack::PopAndDestroy(2, this); // phonebookStore, this
       
   357 	}
       
   358 
       
   359 /**
       
   360 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0006
       
   361 @SYMComponent telephony_ctsy
       
   362 @SYMTestCaseDesc Test returned value if EMmTsyPhoneBookStoreDeleteAllIPC is not supported by LTSY
       
   363 @SYMTestPriority High
       
   364 @SYMTestActions Invokes RMobilePhoneBookStore::DeleteAll()
       
   365 @SYMTestExpectedResults Pass
       
   366 @SYMTestType UT
       
   367 */
       
   368 void CCTsyPhonebookFUNegative::TestUnit0006L()
       
   369 	{
       
   370 	TConfig config;
       
   371 	config.SetSupportedValue(MLtsyDispatchPhonebookStoreDeleteAll::KLtsyDispatchPhonebookStoreDeleteAllApiId, EFalse);
       
   372 	
       
   373 	OpenEtelServerL(EUseExtendedError);
       
   374 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   375 	OpenPhoneL();
       
   376 	
       
   377 	RMobilePhoneBookStore phonebookStore;
       
   378 	CleanupClosePushL(phonebookStore);
       
   379 
       
   380 	//initialise IPC generated from phonebook store open
       
   381     iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId);
       
   382 
       
   383 	TName phonebook(KETelIccBdnPhoneBook); //(Bdn - noncaching)
       
   384 	ASSERT_EQUALS(phonebookStore.Open(iPhone, phonebook),KErrNone);
       
   385 
       
   386     RBuf8 data;
       
   387     CleanupClosePushL(data);
       
   388 
       
   389     //complete initialise IPC
       
   390     TMockLtsyData1<DispatcherPhonebook::TPhonebookStoreInfoV1> phonebookCompLtsyData(iPhonebookStoreData);
       
   391     phonebookCompLtsyData.SerialiseL(data);
       
   392     iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId,KErrNone,data);
       
   393     data.Close();
       
   394 
       
   395     //fire up the initialise complete
       
   396     WaitForMockLTSYTerminated();
       
   397 
       
   398 	TRequestStatus requestStatus;
       
   399 	
       
   400 	phonebookStore.DeleteAll(requestStatus);
       
   401 	User::WaitForRequest(requestStatus);
       
   402 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);	
       
   403 
       
   404 	AssertMockLtsyStatusL();
       
   405 	config.Reset();
       
   406 	CleanupStack::PopAndDestroy(3, this); // data, phonebookStore, this
       
   407 	}
       
   408 
       
   409 /**
       
   410 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0007
       
   411 @SYMComponent telephony_ctsy
       
   412 @SYMTestCaseDesc Test returned value if EMobilePhoneStoreReadAllPhase1 is not supported by LTSY
       
   413 @SYMTestPriority High
       
   414 @SYMTestActions Invokes CRetrieveMobilePhoneSmsList::Start()
       
   415 @SYMTestExpectedResults Pass
       
   416 @SYMTestType UT
       
   417 */
       
   418 void CCTsyPhonebookFUNegative::TestUnit0007L()
       
   419 	{
       
   420 	TConfig config;
       
   421 	config.SetSupportedValue(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, EFalse);
       
   422 	
       
   423 	OpenEtelServerL(EUseExtendedError);
       
   424 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   425 	OpenPhoneL();
       
   426 
       
   427 	RMobileSmsMessaging messaging;
       
   428 	CleanupClosePushL(messaging);
       
   429 
       
   430 	RMobileSmsStore smsStore;
       
   431 	CleanupClosePushL(smsStore);
       
   432 
       
   433 	OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore);
       
   434 
       
   435 	RBuf8 data;
       
   436 	CleanupClosePushL(data);
       
   437 	
       
   438 	TRequestStatus mockLtsyStatus;
       
   439 	TInt totalEntries = 1;
       
   440 	TInt usedEntries = 0;
       
   441 	TMockLtsyData2<TInt, TInt> dataGetInfo(totalEntries, usedEntries);
       
   442 	data.Close();
       
   443 	dataGetInfo.SerialiseL(data);
       
   444 
       
   445 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   446 	iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrNone, data);
       
   447 	User::WaitForRequest(mockLtsyStatus);
       
   448 	AssertMockLtsyStatusL();
       
   449 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
   450 
       
   451 	CGetSMSListAO* getSmsListAO = CGetSMSListAO::NewLC(smsStore);
       
   452 	getSmsListAO->TestRetrieveL();
       
   453     ASSERT_EQUALS(KErrNotSupported, getSmsListAO->RetrieveLastError());
       
   454 
       
   455 	AssertMockLtsyStatusL();
       
   456 	config.Reset();
       
   457 	CleanupStack::PopAndDestroy(5, this); // getSmsListAO, data, messaging, smsStore, this	
       
   458 	}
       
   459 
       
   460 /**
       
   461 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0004
       
   462 @SYMComponent telephony_ctsy
       
   463 @SYMTestCaseDesc Test returned value if EMmTsyPhoneBookStoreWriteIPC is not supported by LTSY
       
   464 @SYMTestPriority High
       
   465 @SYMTestActions Invokes RMobilePhoneBookStore::Write()
       
   466 @SYMTestExpectedResults Pass
       
   467 @SYMTestType UT
       
   468 */
       
   469 void CCTsyPhonebookFUNegative::TestUnit0008L()
       
   470 	{
       
   471 	TConfig config;
       
   472 	config.SetSupportedValue(MLtsyDispatchPhonebookStoreWriteEntry::KLtsyDispatchPhonebookStoreWriteEntryApiId, EFalse);
       
   473 	
       
   474 	OpenEtelServerL(EUseExtendedError);
       
   475 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   476 	OpenPhoneL();
       
   477 	
       
   478 	RMobilePhoneBookStore phonebookStore;
       
   479 	CleanupClosePushL(phonebookStore);
       
   480 
       
   481 	//initialise IPC generated from phonebook store open
       
   482     iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId);
       
   483 
       
   484 	TName phonebook(KETelIccBdnPhoneBook); //(Bdn - noncaching)
       
   485 	ASSERT_EQUALS(phonebookStore.Open(iPhone, phonebook), KErrNone);
       
   486 
       
   487     RBuf8 data;
       
   488     CleanupClosePushL(data);
       
   489 
       
   490     //complete initialise IPC
       
   491     TMockLtsyData1<DispatcherPhonebook::TPhonebookStoreInfoV1> phonebookCompLtsyData(iPhonebookStoreData);
       
   492     phonebookCompLtsyData.SerialiseL(data);
       
   493     iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId,KErrNone,data);
       
   494     data.Close();
       
   495 
       
   496     //fire up the initialise complete
       
   497     WaitForMockLTSYTerminated();
       
   498 
       
   499 	TRequestStatus requestStatus;
       
   500 	TInt index(-1); 
       
   501 	TBuf8<200> buf;	
       
   502     TUint16 location = 0;
       
   503     
       
   504     CPhoneBookBuffer* pbBuffer = new(ELeave) CPhoneBookBuffer();
       
   505     CleanupStack::PushL(pbBuffer);
       
   506 
       
   507     pbBuffer->Set(&buf);    
       
   508     TInt ret = pbBuffer->AddNewEntryTag();
       
   509     ret = pbBuffer->PutTagAndValue(RMobilePhoneBookStore::ETagPBAdnIndex, location);
       
   510 
       
   511 	phonebookStore.Write(requestStatus, buf, index);
       
   512 	User::WaitForRequest(requestStatus);
       
   513 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);	
       
   514 
       
   515 	AssertMockLtsyStatusL();
       
   516 	config.Reset();
       
   517 	CleanupStack::PopAndDestroy(4, this); // pbBuffer, data, phonebookStore, this
       
   518 	}
       
   519 
       
   520 /**
       
   521 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0009
       
   522 @SYMComponent telephony_ctsy
       
   523 @SYMTestCaseDesc Test returned value if EMobilePhoneGetPhoneStoreInfo is not supported by LTSY
       
   524 @SYMTestPriority High
       
   525 @SYMTestActions Invokes RMobilePhone::GetPhoneStoreInfo()
       
   526 @SYMTestExpectedResults Pass
       
   527 @SYMTestType UT
       
   528 */
       
   529 void CCTsyPhonebookFUNegative::TestUnit0009L()
       
   530 	{
       
   531 	TConfig config;
       
   532 	config.SetSupportedValue(MLtsyDispatchPhonebookGetPhoneStoreInfo::KLtsyDispatchPhonebookGetPhoneStoreInfoApiId, EFalse);
       
   533 	
       
   534 	OpenEtelServerL(EUseExtendedError);
       
   535 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   536 	OpenPhoneL();
       
   537 	
       
   538 	TRequestStatus requestStatus;
       
   539 	RMobilePhoneBookStore::TMobilePhoneStoreInfoV1 bookInfo;
       
   540 	RMobilePhoneBookStore::TMobilePhoneStoreInfoV1Pckg bookInfoPckg(bookInfo);
       
   541 	TName storeName(KETelIccBdnPhoneBook);
       
   542 	
       
   543 	iPhone.GetPhoneStoreInfo(requestStatus, bookInfoPckg, storeName);
       
   544 	User::WaitForRequest(requestStatus);
       
   545 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported)
       
   546 	
       
   547 	AssertMockLtsyStatusL();
       
   548 	config.Reset();
       
   549 	CleanupStack::PopAndDestroy(this);
       
   550 	}
       
   551 
       
   552 /**
       
   553 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0010
       
   554 @SYMComponent telephony_ctsy
       
   555 @SYMTestCaseDesc Test returned value if EMobilePhoneStoreDelete is not supported by LTSY
       
   556 @SYMTestPriority High
       
   557 @SYMTestActions Invokes RMobileSmsStore::Delete()
       
   558 @SYMTestExpectedResults Pass
       
   559 @SYMTestType UT
       
   560 */
       
   561 void CCTsyPhonebookFUNegative::TestUnit0010L()
       
   562 	{
       
   563 	TConfig config;
       
   564 	config.SetSupportedValue(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, EFalse);
       
   565 	
       
   566 	OpenEtelServerL(EUseExtendedError);
       
   567 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   568 	OpenPhoneL();
       
   569 	
       
   570 	RMobileSmsMessaging messaging;
       
   571 	CleanupClosePushL(messaging);
       
   572 
       
   573 	RMobileSmsStore smsStore;
       
   574 	CleanupClosePushL(smsStore);
       
   575 
       
   576 	OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore);
       
   577 
       
   578 	TRequestStatus requestStatus;
       
   579 	TInt index = 1;
       
   580 
       
   581 	smsStore.Delete(requestStatus, index);
       
   582     User::WaitForRequest(requestStatus);        
       
   583 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);	
       
   584 	
       
   585 	AssertMockLtsyStatusL();
       
   586 	config.Reset();
       
   587 	CleanupStack::PopAndDestroy(3, this); // messaging, smsStore, this
       
   588 	}
       
   589 
       
   590 /**
       
   591 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0011
       
   592 @SYMComponent telephony_ctsy
       
   593 @SYMTestCaseDesc Test returned value if EMobilePhoneStoreDeleteAll is not supported by LTSY
       
   594 @SYMTestPriority High
       
   595 @SYMTestActions Invokes RMobileSmsStore::DeleteAll()
       
   596 @SYMTestExpectedResults Pass
       
   597 @SYMTestType UT
       
   598 */
       
   599 void CCTsyPhonebookFUNegative::TestUnit0011L()
       
   600 	{
       
   601 	TConfig config;
       
   602 	config.SetSupportedValue(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId, EFalse);
       
   603 	
       
   604 	OpenEtelServerL(EUseExtendedError);
       
   605 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   606 	OpenPhoneL();
       
   607 	
       
   608 	RMobileSmsMessaging messaging;
       
   609 	CleanupClosePushL(messaging);
       
   610 
       
   611 	RMobileSmsStore smsStore;
       
   612 	CleanupClosePushL(smsStore);
       
   613 
       
   614 	OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore);
       
   615 	
       
   616 	TRequestStatus requestStatus;
       
   617 
       
   618 	smsStore.DeleteAll(requestStatus);
       
   619 	User::WaitForRequest(requestStatus);
       
   620 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);
       
   621 
       
   622 	AssertMockLtsyStatusL();
       
   623 	config.Reset();
       
   624 	CleanupStack::PopAndDestroy(3, this); // messaging, smsStore, this
       
   625 	}
       
   626 
       
   627 /**
       
   628 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0012
       
   629 @SYMComponent telephony_ctsy
       
   630 @SYMTestCaseDesc Test returned value if EMobilePhoneStoreGetInfo is not supported by LTSY
       
   631 @SYMTestPriority High
       
   632 @SYMTestActions Invokes RMobileSmsStore::GetInfo()
       
   633 @SYMTestExpectedResults Pass
       
   634 @SYMTestType UT
       
   635 */
       
   636 void CCTsyPhonebookFUNegative::TestUnit0012L()
       
   637 	{
       
   638 	TConfig config;
       
   639 	config.SetSupportedValue(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, EFalse);
       
   640 	
       
   641 	OpenEtelServerL(EUseExtendedError);
       
   642 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   643 	OpenPhoneL();
       
   644 
       
   645 	RMobileSmsMessaging messaging;
       
   646 	CleanupClosePushL(messaging);
       
   647 
       
   648 	RMobileSmsStore smsStore;
       
   649 	CleanupClosePushL(smsStore);
       
   650 
       
   651 	User::LeaveIfError(messaging.Open(iPhone));
       
   652 
       
   653 	// EMobilePhoneStoreGetInfo is called when opening smsStore,
       
   654 	// but fails to return KErrNotSupported
       
   655 	TInt err = smsStore.Open(messaging, KETelIccSmsStore);
       
   656 	ASSERT_EQUALS(err, KErrNone);
       
   657 		
       
   658 	TRequestStatus requestStatus;
       
   659 	RMobilePhoneBookStore::TMobilePhoneBookInfoV1 phoneBookInfoV1;
       
   660 	TPckg<RMobilePhoneBookStore::TMobilePhoneBookInfoV1> pckgInfoV1(phoneBookInfoV1);
       
   661 	
       
   662 	// and this call times out
       
   663 //	smsStore.GetInfo(requestStatus, pckgInfoV1);
       
   664 //	User::WaitForRequest(requestStatus);
       
   665 //	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);
       
   666 
       
   667 	AssertMockLtsyStatusL();
       
   668 	config.Reset();
       
   669 	CleanupStack::PopAndDestroy(3, this); // messaging, smsStore, this
       
   670 		
       
   671 	}
       
   672 
       
   673 /**
       
   674 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0013
       
   675 @SYMComponent telephony_ctsy
       
   676 @SYMTestCaseDesc Test returned value if EMobilePhoneStoreRead is not supported by LTSY
       
   677 @SYMTestPriority High
       
   678 @SYMTestActions Invokes RMobilePhoneBookStore::Read()
       
   679 @SYMTestExpectedResults Pass
       
   680 @SYMTestType UT
       
   681 */
       
   682 void CCTsyPhonebookFUNegative::TestUnit0013L()
       
   683 	{
       
   684 	TConfig config;
       
   685 	config.SetSupportedValue(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, EFalse);
       
   686 	
       
   687 	OpenEtelServerL(EUseExtendedError);
       
   688 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   689 	OpenPhoneL();
       
   690 
       
   691 	RMobileSmsMessaging messaging;
       
   692 	CleanupClosePushL(messaging);
       
   693 
       
   694 	RMobileSmsStore smsStore;
       
   695 	CleanupClosePushL(smsStore);
       
   696 
       
   697 	OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore);
       
   698 	
       
   699 	TRequestStatus requestStatus;
       
   700 	RMobilePhoneBookStore::TMobilePhoneBookInfoV1 phoneBookInfoV1;
       
   701 	TPckg<RMobilePhoneBookStore::TMobilePhoneBookInfoV1> pckgInfoV1(phoneBookInfoV1);
       
   702 	
       
   703 	smsStore.Read(requestStatus, pckgInfoV1);
       
   704 	User::WaitForRequest(requestStatus); // returns with KErrArgument error instead of KErrNotSupported
       
   705 	ASSERT_EQUALS(requestStatus.Int(), KErrArgument);
       
   706 
       
   707 	AssertMockLtsyStatusL();
       
   708 	config.Reset();
       
   709 	CleanupStack::PopAndDestroy(3, this); // messaging, smsStore, this
       
   710 	}
       
   711 
       
   712 /**
       
   713 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0014
       
   714 @SYMComponent telephony_ctsy
       
   715 @SYMTestCaseDesc Test returned value if EMobilePhoneStoreWrite is not supported by LTSY
       
   716 @SYMTestPriority High
       
   717 @SYMTestActions Invokes RMobileSmsStore::Write()
       
   718 @SYMTestExpectedResults Pass
       
   719 @SYMTestType UT
       
   720 */
       
   721 void CCTsyPhonebookFUNegative::TestUnit0014L()
       
   722 	{
       
   723 	TConfig config;
       
   724 	config.SetSupportedValue(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, EFalse);
       
   725 	
       
   726 	OpenEtelServerL(EUseExtendedError);
       
   727 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   728 	OpenPhoneL();
       
   729 
       
   730 	RMobileSmsMessaging messaging;
       
   731 	CleanupClosePushL(messaging);
       
   732 
       
   733 	RMobileSmsStore smsStore;
       
   734 	CleanupClosePushL(smsStore);
       
   735 
       
   736 	OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore);
       
   737 	
       
   738 	TRequestStatus requestStatus;
       
   739 	RMobileSmsStore::TMobileGsmSmsEntryV1 entryV1;
       
   740 	TPckg<RMobileSmsStore::TMobileGsmSmsEntryV1> pckgEntryV1(entryV1);
       
   741 		
       
   742 	entryV1.iServiceCentre.iNumberPlan   = RMobilePhone::ENationalNumberPlan;
       
   743 	entryV1.iServiceCentre.iTypeOfNumber = RMobilePhone::EAlphanumericNumber;
       
   744 	entryV1.iServiceCentre.iTelNumber    = _L("TelNumber1");
       
   745 	entryV1.iMsgData = _L8("Hello, World!");
       
   746 	entryV1.iMsgStatus = RMobileSmsStore::EStoredMessageUnread;
       
   747 	entryV1.iIndex = 1;
       
   748 	
       
   749 	smsStore.Write(requestStatus, pckgEntryV1);
       
   750 	User::WaitForRequest(requestStatus);
       
   751 	ASSERT_EQUALS(requestStatus.Int(), KErrNotSupported);
       
   752 
       
   753 	AssertMockLtsyStatusL();
       
   754 	config.Reset();
       
   755 	CleanupStack::PopAndDestroy(3, this); // messaging, smsStore, this
       
   756 	}
       
   757 
       
   758 /**
       
   759 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-NEGATIVE-UN0015
       
   760 @SYMComponent telephony_ctsy
       
   761 @SYMTestCaseDesc Test returned value if EMmTsyPhoneBookStoreCacheCancelIPC is not supported by LTSY
       
   762 @SYMTestPriority High
       
   763 @SYMTestActions Invokes RMobilePhoneBookStore::Open()
       
   764 @SYMTestExpectedResults Pass
       
   765 @SYMTestType UT
       
   766 */
       
   767 void CCTsyPhonebookFUNegative::TestUnit0015L()
       
   768 	{
       
   769 	TConfig config;
       
   770 	config.SetSupportedValue(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId, EFalse);
       
   771 	
       
   772 	OpenEtelServerL(EUseExtendedError);
       
   773 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   774 
       
   775 	OpenPhoneL();
       
   776 	
       
   777 	RBuf8 data;
       
   778 	CleanupClosePushL(data);
       
   779 	
       
   780 	RMmCustomAPI customApi;
       
   781 	OpenCustomApiLC(customApi);
       
   782 	
       
   783 	DispatcherPhonebook::TPhonebook phonebook = DispatcherPhonebook::EIccAdn;
       
   784 
       
   785 	RMobilePhoneBookStore phoneBookStore;
       
   786 	CleanupClosePushL(phoneBookStore);
       
   787 
       
   788 	//initialise IPC generated from phonebook store open
       
   789 	iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId);
       
   790 
       
   791 	ASSERT_EQUALS(phoneBookStore.Open(iPhone, KETelIccAdnPhoneBook),KErrNone);
       
   792 
       
   793 	AssertMockLtsyStatusL();
       
   794 		
       
   795 	//complete initialise IPC
       
   796     TMockLtsyData1<DispatcherPhonebook::TPhonebookStoreInfoV1> phonebookCompLtsyData(iPhonebookStoreData);
       
   797     phonebookCompLtsyData.SerialiseL(data);
       
   798 	iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId,KErrNone,data);
       
   799 	data.Close();
       
   800 	
       
   801 	//cache IPC generated from complete initialise IPC
       
   802 	TMockLtsyData1<DispatcherPhonebook::TPhonebook> cacheExpLtsyData(phonebook);
       
   803 	cacheExpLtsyData.SerialiseL(data);
       
   804 	iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCache::KLtsyDispatchPhonebookStoreCacheApiId,data);
       
   805 	data.Close();
       
   806 
       
   807 	//fire up the initialise complete
       
   808 	WaitForMockLTSYTerminated();
       
   809 
       
   810 	//close them without the cache yet completed
       
   811 	CleanupStack::PopAndDestroy(&phoneBookStore);
       
   812 
       
   813 	AssertMockLtsyStatusL();
       
   814 
       
   815 	CleanupStack::PopAndDestroy(&customApi);
       
   816 	CleanupStack::PopAndDestroy(&data);
       
   817 	CleanupStack::PopAndDestroy(this); 
       
   818 	config.Reset();
       
   819 	}