messagingappbase/smsmtm/test/src/T_SmsSc.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "T_SmsSc.h"
       
    17 #include <smutsimparam.h>
       
    18 #include <smsclnt.h>
       
    19 #include <smsuaddr.h>
       
    20 
       
    21 #include <testconfigfileparser.h>
       
    22 #include <e32std.h>
       
    23 
       
    24 // Autotest library header file
       
    25 #include <autotest.h>
       
    26 
       
    27 #include <simtsy.h>
       
    28 
       
    29 // Global pointer for use by the autogTest.h macro's
       
    30 CAutoTest* gAutoTest;
       
    31 
       
    32 
       
    33 RTest gTest(_L("T_SmsSc Testrig"));
       
    34 CTrapCleanup* theCleanup;
       
    35 
       
    36 
       
    37 #define LOCAL_CHECKPOINT_CODE(a,b) a.TestCheckPointCodeL((b), (__FILE__), (__LINE__))
       
    38 #define LOCAL_CHECKPOINT(a,b) a.TestCheckPointL((b), (__FILE__), (__LINE__))
       
    39 #define LOCAL_CHECKPOINT_COMPARE(a,b,c,d) a.TestCheckPointCompareL((b),(c),(d),(__FILE__),(__LINE__))
       
    40 
       
    41 _LIT(KTestScriptFile, "SimParameter.script");
       
    42 _LIT(KTestScriptComponent, "sms");
       
    43 
       
    44 _LIT8(KListSectionStart, "list");
       
    45 _LIT8(KSmsParamEntry, "SmsParamEntry");
       
    46 _LIT8(KSmsParamMaxEntries, "SmsParamMaxEntries");
       
    47 
       
    48 const TInt KSmsParamEntryDel = ',';
       
    49 
       
    50 enum TSmsParamEntry
       
    51 /**	@enum	TSmsParamEntry
       
    52  *	Enum defining the SMS parameters
       
    53  */
       
    54 	{
       
    55 	ESmsParamIndex,
       
    56 	ESmsParamName,
       
    57 	ESmsParamPID,
       
    58 	ESmsParamDCS,
       
    59 	ESmsParamVP,
       
    60 	ESmsParamDA,
       
    61 	ESmsParamSCA
       
    62 	};
       
    63 
       
    64 /*
       
    65 void SetTestNumberL(TInt aTestNumber)
       
    66   	{
       
    67   	gTest.Printf(_L("Changing the Test Number to %d\n"), aTestNumber);
       
    68 	RSAVarChangeNotify notify;
       
    69 	GLOBAL_CHECKPOINT_COMPARE(notify.Connect(), KErrNone, _L("Failed to connect to System Agent Notifier"));
       
    70 	CleanupClosePushL(notify);
       
    71   	TRAPD(ret, notify.NotifySaVarChangeL(KUidSASimTsyTestNumber,aTestNumber));
       
    72 	GLOBAL_CHECKPOINT_COMPARE(ret, KErrNone, _L("Failed to set test number"));
       
    73 	CleanupStack::PopAndDestroy(&notify);
       
    74   	}
       
    75 */
       
    76 CSmsScTest* NewScTestLCC(TInt aTestNumber)
       
    77 /**
       
    78 	Constructs and returns CSmsScTest object. 
       
    79 	Notifies the system agent that the phone is on.
       
    80 
       
    81 	@return		CSmsScTest*		A pointer to SmsSc test.  
       
    82  */
       
    83 	{
       
    84 	CSmsTestUtils* testUtils = CSmsTestUtils::NewL(gTest);
       
    85 	CleanupStack::PushL(testUtils);
       
    86 
       
    87 	testUtils->SetSimTsyTestNumberL(aTestNumber);
       
    88 
       
    89 	TInt nextTest = 0;
       
    90 
       
    91 	testUtils->NotifySaPhoneOnL();
       
    92 	testUtils->WaitForInitializeL();
       
    93 	return CSmsScTest::NewLC(*gAutoTest, *testUtils, KNullDesC, nextTest);
       
    94 	}
       
    95 
       
    96 RMobileSmsMessaging::TMobileSmspEntryV1 CreateEntry()
       
    97 /**
       
    98 	Creates and returns an entry. 
       
    99 
       
   100 	@return		TMobileSmspEntryV1		A SIM parameter entry. 
       
   101  */
       
   102 	{
       
   103 	RMobileSmsMessaging::TMobileSmspEntryV1 entry;
       
   104 	
       
   105 	_LIT(KSmsServiceCenterNumber, "+44778501000000");
       
   106 	entry.iServiceCentre.iTelNumber = KSmsServiceCenterNumber();
       
   107 
       
   108 //	_LIT(KSmsNumber, "123456");
       
   109 //	entry.iDestination.iTelNumber = KSmsNumber();
       
   110 
       
   111 	_LIT(KSmsText, "Vodafone");
       
   112 	entry.iText = KSmsText();
       
   113 
       
   114 	entry.iValidParams = RMobileSmsMessaging::KSCAIncluded;
       
   115 
       
   116 //	TUint8 reservedFiller = 'a';
       
   117 //	entry.iReservedFiller = reservedFiller;
       
   118 
       
   119 //	TUint8 validityPeriod = 'b';
       
   120 //	entry.iValidityPeriod = validityPeriod;
       
   121 
       
   122 //	TUint8 dcs = 'c';
       
   123 //	entry.iDcs = dcs;
       
   124 
       
   125 //	TUint8 protocolID = 'd';
       
   126 //	entry.iProtocolId = protocolID;
       
   127 
       
   128 	return entry;
       
   129 	}
       
   130 
       
   131 CMobilePhoneSmspList* NewListLC(const RMobileSmsMessaging::TMobileSmspEntryV1& aEntry, TInt aCount)
       
   132 /**
       
   133 	Return a new list with aCount entries of aEntry
       
   134 
       
   135 	@param		aEntry						A SIM parameter entry.
       
   136 	@param		aCount						An integer.
       
   137 	@return		CMobilePhoneSmspList*		A list containing the SIM Parameters.
       
   138  */
       
   139 	{
       
   140 	CMobilePhoneSmspList* list = CMobilePhoneSmspList::NewL();
       
   141 	CleanupStack::PushL(list);
       
   142 	RMobileSmsMessaging::TMobileSmspEntryV1 entry(aEntry);
       
   143 
       
   144 	for (TInt i = 0; i < aCount; ++i)
       
   145 		{
       
   146 		entry.iIndex = i;
       
   147 		list->AddEntryL(entry);
       
   148 		}
       
   149 
       
   150 	return list;
       
   151 	}
       
   152 
       
   153 void DoTest1L(CSmsScTest& aTest)
       
   154 /**
       
   155 	Reads and stores the initial SIM parameters
       
   156 
       
   157 	@param		aTest		A reference to the SmsSc test
       
   158  */
       
   159 	{
       
   160 	CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
       
   161 	
       
   162 	aTest.ReadInitialParamsL(waiter->iStatus);
       
   163 	waiter->Start();
       
   164 	CActiveScheduler::Start();
       
   165 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("ReadInitialParamsL completed with error"));
       
   166 
       
   167 	CleanupStack::PopAndDestroy(waiter);
       
   168 	}
       
   169 
       
   170 void Test1L()
       
   171 /**
       
   172 	Tests Reading SMS parameters from SIM
       
   173  */
       
   174 	{
       
   175 	CSmsScTest* scTest = NewScTestLCC(0);
       
   176 
       
   177 	DoTest1L(*scTest);
       
   178 
       
   179 	CleanupStack::PopAndDestroy(scTest);
       
   180 	CleanupStack::PopAndDestroy();
       
   181 	}
       
   182 
       
   183 void Test2L()
       
   184 /**
       
   185 	Tests Reading error
       
   186  */
       
   187 	{
       
   188 	// todo Request the tester on screen to remove the phone from serial/IR link
       
   189 
       
   190 	CSmsScTest* scTest = NewScTestLCC(0);
       
   191 	CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
       
   192 	
       
   193 	scTest->ReadInitialParamsL(waiter->iStatus);
       
   194 	waiter->Start();
       
   195 	CActiveScheduler::Start();
       
   196 	//GLOBAL_CHECKPOINT(waiter->iStatus != KErrNone);
       
   197 	//GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus != KErrNone, ETrue, _L("ReadInitialParamsL completed with error"));
       
   198 
       
   199 	CleanupStack::PopAndDestroy(3); //waiter, scTest*2
       
   200 	}
       
   201 
       
   202 void DoTest3L(CSmsScTest& aTest, CMsvOperationWait& aWaiter, TInt aMaxNumber)
       
   203 /**
       
   204 	Performs round trip tests
       
   205 
       
   206 	@param		aTest		A reference to SmsSc test
       
   207 	@param		aWaiter		A reference to MsvOperationWait
       
   208  */
       
   209 	{
       
   210 	//const TInt maxNumber = aTest.OriginalOperation().SmspList().MaxNumberEntries();
       
   211 	const RMobileSmsMessaging::TMobileSmspEntryV1 entry(CreateEntry());
       
   212 	
       
   213 	for (TInt i = 1; i <= aMaxNumber; ++i)
       
   214 		{
       
   215 		CMobilePhoneSmspList* list = NewListLC(entry, i);
       
   216 		list->SetMaxNumberEntries(aMaxNumber);
       
   217 		aTest.RoundTripTestL(*list, aWaiter.iStatus);
       
   218 		aWaiter.Start();
       
   219 		CActiveScheduler::Start();
       
   220 		CleanupStack::PopAndDestroy(list);
       
   221 		User::LeaveIfError(aWaiter.iStatus.Int());
       
   222 		}
       
   223 	}
       
   224 
       
   225 void Test3L()
       
   226 /**
       
   227 	Tests Reading and Writing parameters (Round Trip Test)
       
   228  */
       
   229 	{	
       
   230 	CSmsScTest* scTest = NewScTestLCC(1);
       
   231 	CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
       
   232 	scTest->ReadInitialParamsL(waiter->iStatus);
       
   233 	waiter->Start();
       
   234 	CActiveScheduler::Start();
       
   235 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("ReadInitialParamsL completed with error"));
       
   236 	
       
   237 	const TInt maxNumber = scTest->OriginalOperation().SmspList().MaxNumberEntries();
       
   238 	TRAPD(err, DoTest3L(*scTest, *waiter, maxNumber));
       
   239 
       
   240 	scTest->WriteOriginalParamsL(waiter->iStatus);
       
   241 	waiter->Start();
       
   242 	CActiveScheduler::Start();
       
   243 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("WriteOriginalParamsL completed with error"));
       
   244 	User::LeaveIfError(err);
       
   245 
       
   246 	CleanupStack::PopAndDestroy(3); //scTest*2, waiter
       
   247 	}
       
   248 
       
   249 void DoTest4L(CSmsScTest& aTest, CMsvOperationWait& aWaiter, TInt aMaxNumber)
       
   250 	{
       
   251 	const RMobileSmsMessaging::TMobileSmspEntryV1 entry(CreateEntry());
       
   252 
       
   253 	CMobilePhoneSmspList* list = NewListLC(entry, aMaxNumber);
       
   254 	list->SetMaxNumberEntries(aMaxNumber);
       
   255 	aTest.RoundTripTestL(*list, aWaiter.iStatus);
       
   256 	aWaiter.Start();
       
   257 	CActiveScheduler::Start();
       
   258 	CleanupStack::PopAndDestroy(list);
       
   259 	GLOBAL_CHECKPOINT(aWaiter.iStatus != KErrNone);
       
   260 	}
       
   261 
       
   262 void Test4L()
       
   263 /**
       
   264 	Tests Writing error
       
   265  */
       
   266 	{
       
   267 	CSmsScTest* scTest = NewScTestLCC(0);
       
   268 	CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
       
   269 	
       
   270 	scTest->ReadInitialParamsL(waiter->iStatus);
       
   271 	waiter->Start();
       
   272 	CActiveScheduler::Start();
       
   273 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("ReadInitialParamsL completed with error"));
       
   274 
       
   275 	// Write too many parameters
       
   276 	const TInt maxNumber = scTest->OriginalOperation().SmspList().MaxNumberEntries() + 1;
       
   277 
       
   278 	TRAPD(err, DoTest4L(*scTest, *waiter, maxNumber));
       
   279 
       
   280 	scTest->WriteOriginalParamsL(waiter->iStatus);
       
   281 	waiter->Start();
       
   282 	CActiveScheduler::Start();
       
   283 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("WriteOriginalParamsL completed with error"));
       
   284 	User::LeaveIfError(err);
       
   285 
       
   286 	CleanupStack::PopAndDestroy(3); //waiter, scTest*2
       
   287 	}
       
   288 
       
   289 TInt CountListsInScriptL(RFs& aFs, const TDesC& aComponent, const TDesC& aScriptFile)
       
   290 /**
       
   291 	Returns the number of lists in the script file. 
       
   292 
       
   293 	@param		aFs							Handle to file server session 
       
   294 	@param		aComponent					A descriptor
       
   295 	@param		aScriptFile					Script file
       
   296 	@return		TInt						Number of lists in the script file
       
   297  */
       
   298 	{
       
   299 	CTestConfig* file = CTestConfig::NewLC(aFs, aComponent, aScriptFile);
       
   300 
       
   301 	TInt count = 0;
       
   302 
       
   303 	FOREVER
       
   304 		{
       
   305 		TBuf8<32> sectionName(KListSectionStart);
       
   306 		sectionName.AppendNum(count+1);
       
   307 		const CTestConfigSection* section = file->Section(sectionName);
       
   308 
       
   309 		if (section != NULL)
       
   310 			count++;
       
   311 		else
       
   312 			break;
       
   313 		}
       
   314 
       
   315 	CleanupStack::PopAndDestroy(file);
       
   316 	return count;
       
   317 	}
       
   318 	
       
   319 
       
   320 CMobilePhoneSmspList* ReadFromScriptLC(RFs& aFs, const TDesC& aComponent, const TDesC& aScriptFile, TInt aListNumber, TInt aDefaultMaxNumber)
       
   321 /**
       
   322 	Reads and returns a list of parameters from the script file. 
       
   323 
       
   324 	@param		aFs							Handle to file server session 
       
   325 	@param		aComponent					A descriptor
       
   326 	@param		aScriptFile					Script file
       
   327 	@param		aListNumber					The list number in the script file 
       
   328 	@param		aDefaultMaxNumber			Maximum number of entries supported by the SIM 
       
   329 	@return		CMobilePhoneSmspList*		A list containing the parameters
       
   330  */
       
   331 	{
       
   332 	gTest.Printf(_L("ReadFromScriptLC [aComponent=%S aScript=%S aListNumber=%d"), &aComponent, &aScriptFile, aListNumber);
       
   333 
       
   334 	CMobilePhoneSmspList* list = CMobilePhoneSmspList::NewL();
       
   335 	CleanupStack::PushL(list);
       
   336 
       
   337 	CTestConfig* file = CTestConfig::NewLC(aFs, aComponent, aScriptFile);
       
   338 
       
   339 	TBuf8<32> sectionName(KListSectionStart);
       
   340 	sectionName.AppendNum(aListNumber);
       
   341 
       
   342 	const CTestConfigSection* section = file->Section(sectionName);
       
   343 
       
   344 	if (section == NULL)
       
   345 		{
       
   346 		gTest.Printf(_L("\tSection %d Not Found"), aListNumber);
       
   347 		User::Leave(KErrNotFound);
       
   348 		}
       
   349 
       
   350 	const CTestConfigItem* item = section->Item(KSmsParamMaxEntries);
       
   351 
       
   352 	TInt maxNumber = aDefaultMaxNumber;
       
   353 
       
   354 	if (item == NULL)
       
   355 		{
       
   356 		gTest.Printf(_L("\tFailed to find KSmsParamMaxEntries in script section. Setting to %d\n"), aDefaultMaxNumber);
       
   357 		}
       
   358 	else
       
   359 		{
       
   360 		maxNumber = section->ItemValue(KSmsParamMaxEntries, aDefaultMaxNumber);
       
   361 		}
       
   362 
       
   363 	if (maxNumber > aDefaultMaxNumber)
       
   364 		maxNumber = aDefaultMaxNumber;
       
   365 
       
   366 	list->SetMaxNumberEntries(maxNumber);
       
   367 
       
   368 	const TInt count = section->ItemCount(KSmsParamEntry);
       
   369 
       
   370 	if (count == 0)
       
   371 		{
       
   372 		gTest.Printf(_L("\tFailed to find KSmsParamEntry in script section\n"));
       
   373 		User::Leave(KErrNotFound);
       
   374 		}
       
   375 	
       
   376 	for (TInt i = 0; i < count && i < aDefaultMaxNumber; ++i)
       
   377 		{
       
   378 		item = section->Item(KSmsParamEntry, i);
       
   379 		__ASSERT_ALWAYS(item != NULL, User::Invariant());
       
   380 
       
   381 		const TDesC8& value = item->Value();
       
   382 
       
   383 		RMobileSmsMessaging::TMobileSmspEntryV1 entry = RMobileSmsMessaging::TMobileSmspEntryV1();
       
   384 		TPtrC8 ptrOutput(KNullDesC8);
       
   385 		TInt intOutput;
       
   386 	
       
   387 		if (CTestConfig::GetElement(value, KSmsParamEntryDel, ESmsParamIndex, intOutput) == KErrNone)
       
   388 			entry.iIndex = intOutput;
       
   389 		else
       
   390 			entry.iIndex = i;
       
   391 
       
   392 		if (CTestConfig::GetElement(value, KSmsParamEntryDel, ESmsParamName, ptrOutput) == KErrNone)
       
   393 			{
       
   394 			entry.iText.Copy(ptrOutput);
       
   395 			}
       
   396 
       
   397 		if (CTestConfig::GetElement(value, KSmsParamEntryDel, ESmsParamPID, intOutput) == KErrNone)
       
   398 			{
       
   399 			entry.iProtocolId = (TUint8)intOutput;
       
   400 			entry.iValidParams |= RMobileSmsMessaging::KProtocolIdIncluded;
       
   401 			}
       
   402 
       
   403 		if (CTestConfig::GetElement(value, KSmsParamEntryDel, ESmsParamDCS, intOutput) == KErrNone)
       
   404 			{
       
   405 			entry.iDcs = (TUint8)intOutput;
       
   406 			entry.iValidParams |= RMobileSmsMessaging::KDcsIncluded;
       
   407 			}
       
   408 
       
   409 		if (CTestConfig::GetElement(value, KSmsParamEntryDel, ESmsParamVP, intOutput) == KErrNone)
       
   410 			{
       
   411 			entry.iValidityPeriod = (TUint8)intOutput;
       
   412 			entry.iValidParams |= RMobileSmsMessaging::KValidityPeriodIncluded;
       
   413 			}
       
   414 
       
   415 		if (CTestConfig::GetElement(value, KSmsParamEntryDel, ESmsParamDA, ptrOutput) == KErrNone)
       
   416 			{
       
   417 			entry.iDestination.iTelNumber.Copy(ptrOutput);
       
   418 			entry.iValidParams |= RMobileSmsMessaging::KDestinationIncluded;
       
   419 			}
       
   420 
       
   421 		if (CTestConfig::GetElement(value, KSmsParamEntryDel, ESmsParamSCA, ptrOutput) == KErrNone)
       
   422 			{
       
   423 			entry.iServiceCentre.iTelNumber.Copy(ptrOutput);
       
   424 			entry.iValidParams |= RMobileSmsMessaging::KSCAIncluded;
       
   425 			}
       
   426 
       
   427 		list->AddEntryL(entry);
       
   428 		}
       
   429 	
       
   430 	CleanupStack::PopAndDestroy(file);
       
   431 
       
   432 	return list;
       
   433 	}
       
   434 
       
   435 void Test5L()
       
   436 /**
       
   437 	Data test (Round Trip Test using script)
       
   438  */
       
   439 	{
       
   440 	CSmsScTest* scTest = NewScTestLCC(0);
       
   441 	CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
       
   442 
       
   443 	scTest->ReadInitialParamsL(waiter->iStatus);
       
   444 	waiter->Start();
       
   445 	CActiveScheduler::Start();
       
   446 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("ReadInitialParamsL completed with error"));
       
   447 
       
   448 	RFs fs;
       
   449 	User::LeaveIfError(fs.Connect());
       
   450 	CleanupClosePushL(fs);
       
   451 
       
   452 	const TInt maxNumber = scTest->OriginalOperation().SmspList().MaxNumberEntries();
       
   453 	const TInt count = CountListsInScriptL(fs, KTestScriptComponent, KTestScriptFile);
       
   454 
       
   455 	TBool roundTripTests = ETrue;
       
   456 	for (TInt i = 1; i <= count; ++i)
       
   457 		{
       
   458 		CMobilePhoneSmspList* list = ReadFromScriptLC(fs, KTestScriptComponent, KTestScriptFile, i, maxNumber);
       
   459 
       
   460 		GLOBAL_CHECKPOINT(list->MaxNumberEntries() <= maxNumber);
       
   461 
       
   462 		scTest->RoundTripTestL(*list, waiter->iStatus);
       
   463 		waiter->Start();
       
   464 		CActiveScheduler::Start();
       
   465 
       
   466 		if(waiter->iStatus != KErrNone)
       
   467 			{
       
   468 			roundTripTests = EFalse;
       
   469 			break;
       
   470 			}
       
   471 
       
   472 		CleanupStack::PopAndDestroy(list);
       
   473 		}
       
   474 
       
   475 	scTest->WriteOriginalParamsL(waiter->iStatus);
       
   476 	waiter->Start();
       
   477 	CActiveScheduler::Start();
       
   478 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("WriteOriginalParamsL completed with error"));
       
   479 
       
   480 	//GLOBAL_CHECKPOINT(roundTripTests);
       
   481 	GLOBAL_CHECKPOINT_COMPARE(roundTripTests, ETrue, _L("RoundTripTestL failled"));
       
   482 
       
   483 	CleanupStack::PopAndDestroy(4); //waiter, scTest*2, fs
       
   484 	}
       
   485 
       
   486 void Test6L()
       
   487 /**
       
   488 	OOM Test of CSmsClientMtm::ReadSimParamsL
       
   489  */
       
   490 	{
       
   491 	CSmsScTest* scTest = NewScTestLCC(0);
       
   492 
       
   493 	TInt failCount = 0;
       
   494 	TInt error = KErrNone;
       
   495 	_LIT(KFailCountDesc, "DoTest1L still failing, count = %d\n");
       
   496 
       
   497 	do
       
   498 		{
       
   499 		__UHEAP_FAILNEXT(failCount++);
       
   500 
       
   501 		TRAP(error, DoTest1L(*scTest));
       
   502 
       
   503 		__UHEAP_RESET;
       
   504 
       
   505 		if (error != KErrNone)
       
   506 			{
       
   507 			if (error != KErrNoMemory)
       
   508 				gTest.Printf(KFailCountDesc, failCount);
       
   509 
       
   510 			GLOBAL_CHECKPOINT_COMPARE(error, KErrNoMemory, _L("Error not KErrNoMemory"));
       
   511 
       
   512 			if (failCount % 100 == 0)
       
   513 				gTest.Printf(KFailCountDesc, failCount);
       
   514 			}
       
   515 		}
       
   516 	while (error != KErrNone);
       
   517 	
       
   518 	gTest.Printf(KFailCountDesc, failCount);
       
   519 
       
   520 	CleanupStack::PopAndDestroy(2); //scTest*2
       
   521 	}
       
   522 
       
   523 void Test7L()
       
   524 /**
       
   525 	OOM Test of CSmsClientMtm::WriteSimParamsL
       
   526  */
       
   527 	{
       
   528 	CSmsScTest* scTest = NewScTestLCC(1);
       
   529 	CMsvOperationWait* waiter = CMsvOperationWait::NewLC();
       
   530 	scTest->ReadInitialParamsL(waiter->iStatus);
       
   531 	waiter->Start();
       
   532 	CActiveScheduler::Start();
       
   533 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("ReadInitialParamsL completed with error"));
       
   534 
       
   535 	TInt failCount = 0;
       
   536 	TInt error = KErrNone;
       
   537 
       
   538 	do
       
   539 		{
       
   540 		__UHEAP_FAILNEXT(failCount++);
       
   541 
       
   542 		const TInt maxNumber = 1;
       
   543 		TRAP(error, DoTest3L(*scTest, *waiter, maxNumber));
       
   544 
       
   545 		__UHEAP_RESET;
       
   546 
       
   547 		if (error != KErrNone)
       
   548 			{
       
   549 			gTest.Printf(_L("DoTest3L still failing, count = %d\n"), failCount);
       
   550 			GLOBAL_CHECKPOINT_COMPARE(error, KErrNoMemory, _L("Error not KErrNoMemory"));
       
   551 			}
       
   552 		}
       
   553 	while (error != KErrNone);
       
   554 	
       
   555 	gTest.Printf(_L("DoTest3L Fail Count %d\n"), failCount);
       
   556 
       
   557 	scTest->WriteOriginalParamsL(waiter->iStatus);
       
   558 	waiter->Start();
       
   559 	CActiveScheduler::Start();
       
   560 	GLOBAL_CHECKPOINT_COMPARE(waiter->iStatus.Int(), KErrNone, _L("WriteOriginalParamsL completed with error"));
       
   561 
       
   562 	CleanupStack::PopAndDestroy(3); //scTest*2, waiter
       
   563 	}
       
   564 
       
   565 LOCAL_C const TAutoTestCase SmsScTestCases[] =
       
   566 /**
       
   567 	Sets up an array of test functions
       
   568  */
       
   569 	{
       
   570 	{Test1L,_S("GT83-T_MESSS-001 Test Reading")},
       
   571 	//{Test2L,_S("GT83-T_MESSS-002 Test Reading Error")},
       
   572 	{Test3L,_S("GT83-T_MESSS-003 Test Reading and Writing (Round Trip Test)")},
       
   573 	{Test4L,_S("GT83-T_MESSS-004 Test Writing Error")},
       
   574 	{Test5L,_S("GT83-T_MESSS-005 Data test (Round Trip Test using script)")},
       
   575 	{Test6L,_S("GT83-T_MESSS-006 OOM test of CSmsClientMtm::ReadSimParamsL")},
       
   576 	{Test7L,_S("GT83-T_MESSS-007 OOM test of CSmsClientMtm::WriteSimParamsL")}
       
   577 	};
       
   578 
       
   579 LOCAL_C void doMainL()
       
   580 /**
       
   581 	Constructs sctive scheduler and starts off the tests
       
   582  */
       
   583 	{
       
   584 	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
   585 	CleanupStack::PushL(scheduler);
       
   586 	CActiveScheduler::Install( scheduler );
       
   587 
       
   588 	// Copying the config file to the root directory
       
   589 
       
   590 	RFs fs;
       
   591 	User::LeaveIfError(fs.Connect());
       
   592 	CleanupClosePushL(fs);
       
   593 	_LIT(KFileName2,"\\sms\\smssc_config.txt");
       
   594 	
       
   595 	CSmsTestUtils::CopyToSimTsyConfigFileL(fs, KFileName2);
       
   596 
       
   597 	CleanupStack::PopAndDestroy(&fs);
       
   598 
       
   599 	// Open the socket server
       
   600 
       
   601 	RSocketServ serv;
       
   602 	RSocket socket;
       
   603 
       
   604 	User::LeaveIfError(serv.Connect());
       
   605 	CleanupClosePushL(serv);
       
   606 	
       
   607 	TProtocolDesc protoinfo;
       
   608 	TProtocolName protocolname(KSmsDatagram);
       
   609 	User::LeaveIfError(serv.FindProtocol(protocolname,protoinfo));
       
   610 	User::LeaveIfError(socket.Open(serv,protoinfo.iAddrFamily,protoinfo.iSockType,protoinfo.iProtocol));
       
   611 
       
   612 	TSmsAddr smsaddr;
       
   613 	smsaddr.SetSmsAddrFamily(ESmsAddrSendOnly);
       
   614 	User::LeaveIfError(socket.Bind(smsaddr));
       
   615 
       
   616 	CleanupClosePushL(socket);
       
   617 
       
   618 	_LIT(KTestOutput,"smssc_testreport.txt");
       
   619 	_LIT8(KComponentInfo,"smcm and smss");
       
   620 	// Library defined macro
       
   621 	// Uses a global pointer instance of CAutoTest
       
   622 	GLOBAL_AUTOTEST_EXECUTE(SmsScTestCases, KTestOutput, KComponentInfo, gTest);
       
   623 
       
   624 	CleanupStack::PopAndDestroy(&socket);
       
   625 	CleanupStack::PopAndDestroy(&serv);
       
   626 	CleanupStack::PopAndDestroy(scheduler);
       
   627 	}
       
   628 
       
   629 GLDEF_C TInt E32Main()
       
   630 /**
       
   631 	Calls doMainL and checks for error
       
   632  */
       
   633 	{
       
   634 	__UHEAP_MARK;
       
   635 
       
   636 	gTest.Start(_L("Setup"));
       
   637 	theCleanup = CTrapCleanup::New();
       
   638 
       
   639 
       
   640 	TRAPD(ret,doMainL());
       
   641 
       
   642 	if (ret != KErrNone)
       
   643 		gTest.Printf(_L("Test completed with %d"), ret);
       
   644 
       
   645 	delete theCleanup;	
       
   646 	gTest.Console()->SetPos(0, 13);
       
   647 	gTest.End();
       
   648 	gTest.Close();
       
   649 	__UHEAP_MARKEND;
       
   650 	return(KErrNone);
       
   651 	}
       
   652 
       
   653 CSmsScTest::~CSmsScTest()
       
   654 /**
       
   655 	destructor
       
   656  */
       
   657 	{
       
   658 	Cancel();
       
   659 	delete iOriginalParams;
       
   660 	}
       
   661 
       
   662 void CSmsScTest::ReadInitialParamsL(TRequestStatus& aStatus)
       
   663 /**
       
   664 	Starts off the read async operation.
       
   665 
       
   666 	@param		aStatus		A request status.
       
   667  */
       
   668 	{
       
   669 	iState = EStateReadInitialParams;
       
   670 
       
   671 	delete iOperation;
       
   672 	iOperation = NULL;
       
   673 
       
   674 	iOperation = Client().ReadSimParamsL(iStatus);
       
   675 	SetActive();
       
   676 	Queue(aStatus);
       
   677 	}
       
   678 
       
   679 void CSmsScTest::RoundTripTestL(const CMobilePhoneSmspList& aListToWrite, TRequestStatus& aStatus)
       
   680 /**
       
   681 	Starts off the round trip test.
       
   682 
       
   683 	@param		aListToWrite	A list to write to the SIM.
       
   684 	@param		aStatus			Indicates the status of the operations.
       
   685  */
       
   686 	{
       
   687 	iListToWrite = &aListToWrite;
       
   688 
       
   689 //	iSmsTest.Test().Printf(_L("Starting Round Trip Test\n"));
       
   690 
       
   691 	WriteSimParamsL();
       
   692 	Queue(aStatus);
       
   693 	}
       
   694 
       
   695 void CSmsScTest::WriteSimParamsL()
       
   696 /**
       
   697 	Starts off the write async operation.
       
   698 
       
   699 	@param		aList		A list to write to the SIM.
       
   700  */
       
   701 	{
       
   702 	iState = EStateWriteSimParams;
       
   703 
       
   704 //	PrintList(iSmsTest.Test(), *iListToWrite);
       
   705 
       
   706 	delete iOperation;
       
   707 	iOperation = NULL;
       
   708 
       
   709 	iOperation = Client().WriteSimParamsL(*iListToWrite, iStatus);
       
   710 	SetActive();
       
   711 	}
       
   712 
       
   713 void CSmsScTest::ReadAfterWriteL()
       
   714 /**
       
   715 	Reading after writing to the SIM
       
   716  */
       
   717 	{
       
   718 	iSmsTest.Test().Printf(_L("Reading after writing\n"));
       
   719 	iState = EStateReadAfterWrite;
       
   720 
       
   721 	delete iOperation;
       
   722 	iOperation = NULL;
       
   723 
       
   724 	iOperation = Client().ReadSimParamsL(iStatus);
       
   725 	SetActive();
       
   726 	}
       
   727 
       
   728 void CSmsScTest::WriteOriginalParamsL(TRequestStatus& aStatus)
       
   729 /**
       
   730 	Writes the default parameters back to the SIM
       
   731 
       
   732 	@param		aStatus		Indicates the status of the write operation.
       
   733  */
       
   734 	{
       
   735 	Queue(aStatus);
       
   736 
       
   737 	iSmsTest.Test().Printf(_L("Writing original parameters back to Sim"));
       
   738 	iState = EStateWriteOriginalParams;
       
   739 
       
   740 	delete iOperation;
       
   741 	iOperation = NULL;
       
   742 
       
   743 	iOperation = Client().WriteSimParamsL(iOriginalParams->SmspList(), iStatus);
       
   744 	SetActive();
       
   745 	}
       
   746 
       
   747 CSmsScTest* CSmsScTest::NewLC(CAutoTest& aAutoTest, CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aNextTest)
       
   748 	{
       
   749 	CSmsScTest* self = new (ELeave) CSmsScTest(aAutoTest, aSmsTest, aScriptFile, aNextTest);
       
   750 	CleanupStack::PushL(self);
       
   751 
       
   752 	self->ConstructL();
       
   753 	return self;
       
   754 	}
       
   755 
       
   756 CSmsScTest::CSmsScTest(CAutoTest& aAutoTest, CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aNextTest)
       
   757 : CSmsTestBase(aSmsTest, aScriptFile, aNextTest), iState(EStateWaiting), iAutoTest(aAutoTest)
       
   758 	{
       
   759 	CActiveScheduler::Add(this);
       
   760 	}
       
   761 
       
   762 void CSmsScTest::RunAutoL()
       
   763 /**
       
   764 	Required by CSmsTestBase.
       
   765  */
       
   766 	{
       
   767 
       
   768 	}
       
   769 
       
   770 void CSmsScTest::ConstructL()
       
   771 	{
       
   772 	SetTestNameL(KSmsScTestName);
       
   773 	iSmsTest.InstantiateClientMtmsL();
       
   774 
       
   775 	iSmsTest.SetLogToFile();
       
   776 	}
       
   777 
       
   778 void CSmsScTest::ShowMenuL()
       
   779 /**
       
   780 	Required by CSmsTestBase.
       
   781  */
       
   782 	{
       
   783 	}
       
   784 
       
   785 void CSmsScTest::RunL()
       
   786 /**
       
   787 	Handles completed async operations
       
   788  */
       
   789 	{
       
   790 	iSmsTest.Test().Printf(_L("CSmsScTest::RunL [State=%d Status=%d]\n"), iState, iStatus.Int());
       
   791 
       
   792 	switch (iState)
       
   793 		{
       
   794 		case EStateReadInitialParams:
       
   795 			{
       
   796 			DoRunReadInitialParamsL();
       
   797 			break;
       
   798 			}
       
   799 		case EStateWriteSimParams:
       
   800 			{
       
   801 			DoRunWriteSimParamsL();
       
   802 			break;
       
   803 			}
       
   804 		case EStateReadAfterWrite:
       
   805 			{
       
   806 			DoRunReadAfterWriteL();
       
   807 			break;
       
   808 			}
       
   809 		case EStateWriteOriginalParams:
       
   810 			{
       
   811 			DoRunWriteOriginalParamsL();
       
   812 			break;
       
   813 			}
       
   814 		default:
       
   815 			{
       
   816 			break;
       
   817 			}
       
   818 		}
       
   819 
       
   820 	if (!IsActive())
       
   821 		Complete(iStatus.Int());
       
   822 	}
       
   823 
       
   824 void CSmsScTest::Complete(TInt aError)
       
   825 /**
       
   826 	Indicates that the operation is complete with aError.
       
   827 
       
   828 	@param		aError		error returned by the operation
       
   829  */
       
   830 	{
       
   831 	iSmsTest.Test().Printf(_L("CSmsScTest::Complete [aError=%d]\n"), aError);
       
   832 
       
   833 	if (iReport != NULL)
       
   834 		User::RequestComplete(iReport, aError);
       
   835 	}
       
   836 
       
   837 TInt CSmsScTest::RunError(TInt aError)
       
   838 /**
       
   839 
       
   840 	@param		aError		error returned by the operation
       
   841 	@return		TInt		Returns the KErrNone. 
       
   842  */
       
   843 	{
       
   844 	Complete(aError);
       
   845 	return KErrNone;
       
   846 	}
       
   847 
       
   848 void CSmsScTest::Queue(TRequestStatus& aStatus)
       
   849 /**
       
   850 
       
   851 	@param		aStatus		Indicates the status of the operation.
       
   852  */
       
   853 	{
       
   854 	__ASSERT_DEBUG(iReport==NULL, User::Invariant());
       
   855 
       
   856 	aStatus=KRequestPending;
       
   857 	iReport=&aStatus;
       
   858 	}
       
   859 
       
   860 void CSmsScTest::PrintListL(RTest& aTest, const CMobilePhoneSmspList& aList)
       
   861 /**
       
   862 	Prints aList 
       
   863 
       
   864 	@param		aTest		
       
   865 	@param		aList		A list of SIM parameters	
       
   866  */
       
   867 	{
       
   868 	//Print MaxNumber
       
   869 	aTest.Printf(_L("========= CMobilePhoneSmspList ========= \n"));
       
   870 
       
   871 	aTest.Printf(_L("MaxNumber=%d\n"), aList.MaxNumberEntries());
       
   872 
       
   873 	//Pirnt Num Entries
       
   874 	TInt count = aList.Enumerate();
       
   875 	aTest.Printf(_L("Number of entries: %d\n"), count);
       
   876 
       
   877 	//Print each entry in aList
       
   878 	for(TInt i = 0; i < count; ++i)
       
   879 		{
       
   880 		const RMobileSmsMessaging::TMobileSmspEntryV1& entry = aList.GetEntryL(i);
       
   881 		PrintEntry(aTest, entry);
       
   882 		}
       
   883 
       
   884 	aTest.Printf(_L("======= End CMobilePhoneSmspList ======= \n"));
       
   885 	}
       
   886 
       
   887 void CSmsScTest::PrintEntry(RTest& aTest, const RMobileSmsMessaging::TMobileSmspEntryV1& aEntry)
       
   888 /**
       
   889 	Prints aEntry 
       
   890 
       
   891 	@param		aTest		
       
   892 	@param		aEntry		A parameter entry.	
       
   893  */
       
   894 	{
       
   895 	aTest.Printf(_L("\t========= TMobileSmspEntryV1 =========\n"));
       
   896 
       
   897 	aTest.Printf(_L("\tIndex= %d\n\tValid= 0x%X\n"), aEntry.iIndex, aEntry.iValidParams);
       
   898 
       
   899 	if (aEntry.iValidParams & RMobileSmsMessaging::KProtocolIdIncluded)
       
   900 		aTest.Printf(_L("\tProtocolId = %d\n"), aEntry.iProtocolId);
       
   901 
       
   902 	if (aEntry.iValidParams & RMobileSmsMessaging::KDcsIncluded)
       
   903 		aTest.Printf(_L("\tDcs = %d\n"), aEntry.iDcs);
       
   904 	
       
   905 	if (aEntry.iValidParams & RMobileSmsMessaging::KValidityPeriodIncluded)
       
   906 		aTest.Printf(_L("\tValidityPeriod= %d\n"), aEntry.iValidityPeriod);
       
   907 	
       
   908 	if (aEntry.iValidParams & RMobileSmsMessaging::KDestinationIncluded)
       
   909 		aTest.Printf(_L("\tDestination = %S\n"), &aEntry.iDestination.iTelNumber);
       
   910 	
       
   911 	if (aEntry.iValidParams & RMobileSmsMessaging::KSCAIncluded)
       
   912 		aTest.Printf(_L("\tSC = %S\n"), &aEntry.iServiceCentre.iTelNumber);
       
   913 	
       
   914 	if (aEntry.iValidParams & RMobileSmsMessaging::KSCAIncluded)
       
   915 		aTest.Printf(_L("\tText = %S\n"), &aEntry.iText);
       
   916 		
       
   917 	aTest.Printf(_L("\t======= End TMobileSmspEntryV1 =======\n"));
       
   918 	}
       
   919 
       
   920 void CSmsScTest::DoRunReadInitialParamsL()
       
   921 /**
       
   922 	Checks the status, saves the operation and prints the list read.
       
   923  */
       
   924 	{
       
   925 	if (iStatus == KErrNone)
       
   926 		{
       
   927 		TIntBuf progressBuf;
       
   928 		progressBuf.Copy(iOperation->ProgressL());
       
   929 		iStatus = progressBuf();
       
   930 		}
       
   931 
       
   932 	if (iStatus == KErrNone)
       
   933 		{
       
   934 		delete iOriginalParams;
       
   935 		iOriginalParams = (CSmsSimParamOperation*) iOperation;
       
   936 		iOperation = NULL;
       
   937 
       
   938 	    PrintListL(iSmsTest.Test(), iOriginalParams->SmspList());
       
   939 		}
       
   940 
       
   941 	delete iOperation;
       
   942 	iOperation = NULL;
       
   943 	}
       
   944 
       
   945 void CSmsScTest::DoRunWriteSimParamsL()
       
   946 /**
       
   947 	Checks the status, saves the operation and calls ReadAfterWriteL.
       
   948  */
       
   949 	{
       
   950 	if (iStatus == KErrNone)
       
   951 		{
       
   952 		TIntBuf progressBuf;
       
   953 		progressBuf.Copy(iOperation->ProgressL());
       
   954 		iStatus = progressBuf();
       
   955 		}
       
   956 
       
   957 	iSmsTest.Test().Printf(_L("WriteSimParams completed with error %d\n"), iStatus);
       
   958 
       
   959 	delete iOperation;
       
   960 	iOperation = NULL;
       
   961 
       
   962 	if (iStatus == KErrNone)
       
   963 		{
       
   964 		// Reading the new parameters from Sim
       
   965 		ReadAfterWriteL();
       
   966 		}
       
   967 	}
       
   968 
       
   969 void CSmsScTest::DoRunReadAfterWriteL()
       
   970 /**
       
   971 	Checks the status, parameter list and service center list.
       
   972  */
       
   973 	{
       
   974 	if (iStatus == KErrNone)
       
   975 		{
       
   976 		TIntBuf progressBuf;
       
   977 		progressBuf.Copy(iOperation->ProgressL());
       
   978 		iStatus = progressBuf();
       
   979 		}
       
   980 
       
   981 	iSmsTest.Test().Printf(_L("ReadSimParams completed with error %d\n"), iStatus);
       
   982 	
       
   983 	if (iStatus == KErrNone)
       
   984 		{
       
   985 		CSmsSimParamOperation* op = (CSmsSimParamOperation*) iOperation;
       
   986 		
       
   987 		const CMobilePhoneSmspList& list = op->SmspList();
       
   988 		TInt count = list.Enumerate();
       
   989 
       
   990 		iSmsTest.Test().Printf(_L("ReadSimParams found:\n\t%d SMS params on SIM\n"), count);
       
   991 
       
   992 //		PrintList(iSmsTest.Test(), list);
       
   993 		LOCAL_CHECKPOINT(iAutoTest, CompareListsL(*iListToWrite, list));
       
   994 		}
       
   995 
       
   996 	delete iOperation;
       
   997 	iOperation = NULL;
       
   998 	}
       
   999 
       
  1000 TBool CSmsScTest::CompareListsL(const CMobilePhoneSmspList& aWritten, const CMobilePhoneSmspList& aRead)
       
  1001 /**
       
  1002 	Compares two parameter lists 
       
  1003 
       
  1004 	@param		aWritten	A list of SIM parameters
       
  1005 	@param		aRead		A list of SIM parameters	
       
  1006 	@return		TBool		A boolean. 
       
  1007  */
       
  1008 	{
       
  1009 	const TInt count = aWritten.Enumerate();
       
  1010 
       
  1011 	TInt ret = ETrue;
       
  1012 
       
  1013 	if (count < aRead.Enumerate())
       
  1014 		ret = EFalse;
       
  1015 
       
  1016 	for (TInt i=0; i<count && ret; ++i) 
       
  1017 		{   
       
  1018 		const RMobileSmsMessaging::TMobileSmspEntryV1& entry1 = aWritten.GetEntryL(i);
       
  1019 		const RMobileSmsMessaging::TMobileSmspEntryV1& entry2 = aRead.GetEntryL(i);
       
  1020 
       
  1021 		ret = CompareEntries(entry1, entry2);
       
  1022 		}
       
  1023 	
       
  1024 	return ret;
       
  1025 	}
       
  1026 
       
  1027 TBool CSmsScTest::CompareEntries(const RMobileSmsMessaging::TMobileSmspEntryV1& aWritten, const RMobileSmsMessaging::TMobileSmspEntryV1& aRead)
       
  1028 /**
       
  1029 	Compares two parameter entries 
       
  1030 
       
  1031 	@param		aWritten	A parameter entry
       
  1032 	@param		aRead		A parameter entry	
       
  1033 	@return		TBool		A boolean. 
       
  1034  */
       
  1035 	{
       
  1036 	TBool ret = ETrue;
       
  1037 
       
  1038 	if ((aWritten.iValidParams & RMobileSmsMessaging::KProtocolIdIncluded) && (aRead.iValidParams & RMobileSmsMessaging::KProtocolIdIncluded) && aRead.iProtocolId != aWritten.iProtocolId)
       
  1039 		ret = EFalse;
       
  1040 	else if ((aWritten.iValidParams & RMobileSmsMessaging::KDcsIncluded) && (aRead.iValidParams & RMobileSmsMessaging::KDcsIncluded) && aWritten.iDcs != aRead.iDcs)
       
  1041 		ret = EFalse;
       
  1042 	else if ((aWritten.iValidParams & RMobileSmsMessaging::KValidityPeriodIncluded) && (aRead.iValidParams & RMobileSmsMessaging::KValidityPeriodIncluded) && aWritten.iValidityPeriod != aRead.iValidityPeriod)
       
  1043 		ret = EFalse;
       
  1044 	else if ((aWritten.iValidParams & RMobileSmsMessaging::KDestinationIncluded) && (aRead.iValidParams & RMobileSmsMessaging::KDestinationIncluded) && aWritten.iDestination.iTelNumber.CompareF(aRead.iDestination.iTelNumber) != 0)
       
  1045 		ret = EFalse;
       
  1046 	else if ((aWritten.iValidParams & RMobileSmsMessaging::KSCAIncluded) && (aRead.iValidParams & RMobileSmsMessaging::KSCAIncluded) && aWritten.iServiceCentre.iTelNumber.CompareF(aRead.iServiceCentre.iTelNumber) != 0)
       
  1047 		ret = EFalse;
       
  1048 	else if ((aWritten.iValidParams & RMobileSmsMessaging::KSCAIncluded) && (aRead.iValidParams & RMobileSmsMessaging::KSCAIncluded) && aWritten.iText.CompareF(aRead.iText) != 0)
       
  1049 		ret = EFalse;
       
  1050 
       
  1051 	return ret;
       
  1052 	}
       
  1053 
       
  1054 void CSmsScTest::DoRunWriteOriginalParamsL()
       
  1055 /**
       
  1056 	Checks the status
       
  1057  */	
       
  1058 	{
       
  1059 	if (iStatus == KErrNone)
       
  1060 		{
       
  1061 		TIntBuf progressBuf;
       
  1062 		progressBuf.Copy(iOperation->ProgressL());
       
  1063 		iStatus = progressBuf();
       
  1064 		}
       
  1065 
       
  1066 	iSmsTest.Test().Printf(_L("WriteSimParams completed with error %d\n"), iStatus);
       
  1067 
       
  1068 	delete iOperation;
       
  1069 	iOperation = NULL;
       
  1070 	}
       
  1071 
       
  1072 void CSmsScTest::DoCancel()
       
  1073 /**
       
  1074 	Cancels the async operation
       
  1075  */
       
  1076 	{
       
  1077 	if (iOperation)
       
  1078 		{
       
  1079 		iOperation->Cancel();
       
  1080 		iSmsTest.Test().Printf(_L("Operation Cancelled!\n"));
       
  1081 		}
       
  1082 
       
  1083 	delete iOperation;
       
  1084 	iOperation = NULL;
       
  1085 	}