phonebookengines/contactsmodel/tsrc/Integration/CntPerfTest/src/CntBaseStep.cpp
changeset 0 e686773b3f54
child 24 0ba2181d7c28
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 // Copyright (c) 2006-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  @file
       
    18  @publishedAll
       
    19  @released
       
    20 */
       
    21  
       
    22 #include <e32panic.h>
       
    23 #include <test/testexecutelog.h>
       
    24 #include <cntfldst.h>
       
    25 #include "CntBaseStep.h"
       
    26 #include "NbCntTestLib.h"
       
    27 
       
    28 _LIT(KServerUid, "*[10003a73]*" );
       
    29 
       
    30 
       
    31 CCntBaseStep::~CCntBaseStep()
       
    32 	{
       
    33 	_LIT(KBaseDestructor,"I am in base destructor");
       
    34 	INFO_PRINTF1(KBaseDestructor);
       
    35 	}
       
    36 
       
    37 TVerdict CCntBaseStep::doTestStepPreambleL()
       
    38 	{
       
    39 	if(!CActiveScheduler::Current())
       
    40 		{
       
    41 		CActiveScheduler* sched = NULL;
       
    42 		sched = new(ELeave) CActiveScheduler;
       
    43 		CActiveScheduler::Install(sched);
       
    44 		}
       
    45 
       
    46 		
       
    47 	iViewAll = CContactItemViewDef::NewL(CContactItemViewDef::EIncludeFields,CContactItemViewDef::EIncludeHiddenFields);
       
    48 	iViewAll->AddL(KUidContactFieldMatchAll);
       
    49 	/**
       
    50 	issue 3.
       
    51 	need use custom viewdef otherwise there is discrepency between number of fields between empty fields
       
    52 	and edited fields
       
    53 	*/
       
    54 	
       
    55 	iExistingUidsArray = new(ELeave) RArray<TInt32>();
       
    56 	iIterate = new(ELeave) RCntList();
       
    57 	
       
    58 	GetExistingUIDsL(*iExistingUidsArray);
       
    59 	
       
    60 	//call method in derived class
       
    61 	PreTestL();
       
    62 	
       
    63 	SetTestStepResult(EPass);
       
    64 	return TestStepResult();
       
    65 	}
       
    66 
       
    67 TVerdict CCntBaseStep::doTestStepPostambleL()
       
    68 	{
       
    69 	_LIT(KPostamblePrint,"I am in base doTestStepPostambleL");
       
    70 	INFO_PRINTF1(KPostamblePrint);
       
    71 	Close();
       
    72 	Cleanup();
       
    73 	delete iViewAll;
       
    74 
       
    75 	iExistingUidsArray->Close();
       
    76 	CLEAR(iExistingUidsArray);
       
    77 	CLEAR(iIterate);
       
    78 	
       
    79 	TRAPD( err, CContactDatabase::DeleteDefaultFileL() );
       
    80 	if( err )
       
    81 		{
       
    82 		_LIT(KDBDeleteError,"Default database couldn't be deleted, error: %d");
       
    83 		ERR_PRINTF2(KDBDeleteError, err);
       
    84 		}
       
    85 		
       
    86 	WaitForServerToExitL();//waits for server to close to allow for any memory leaks to be detected
       
    87 	return TestStepResult();
       
    88 	}
       
    89 
       
    90 /**initilize called within __UHEAP_MARK/__UHEAP_MARKEND of doTestStepL, 
       
    91 so that all relevant memmory de/allocation is in scope*/
       
    92 void CCntBaseStep::InitializeL()
       
    93 	{
       
    94 	iContactsDatabase = CContactDatabase::ReplaceL();//create  clean/fresh database for all tests		
       
    95 
       
    96 	iTemplate = STATIC_CAST( CContactTemplate*, 
       
    97 	iContactsDatabase->ReadContactL( iContactsDatabase->TemplateId(), *iViewAll ) );
       
    98 	
       
    99 	AddEmptyContactsL(iContacts);
       
   100 	}
       
   101 	
       
   102 /**cleans up called within __UHEAP_MARK/__UHEAP_MARKEND of doTestStepL, 
       
   103 so that all relevant memmory de/allocation is in scope*/	
       
   104 void CCntBaseStep::Cleanup()
       
   105 	{
       
   106 	delete iTemplate;
       
   107 	iTemplate = NULL;
       
   108 	delete iContactsDatabase;
       
   109 	iContactsDatabase = NULL;
       
   110 	iIterate->Close();
       
   111 	}
       
   112 /*
       
   113 adds a list of uids to all fields in aFields, uid is incremented from provided seed
       
   114 */	
       
   115 void CCntBaseStep::AddUIDsL(CContactItemFieldSet &aFields, const TInt32 aFieldType) const
       
   116 	{	
       
   117 	TInt length = aFields.Count();
       
   118 	for(TInt i = 0, uids=aFieldType; i<length; i++, uids++)
       
   119 		{	
       
   120 		aFields[i].AddFieldTypeL(TFieldType::Uid(uids));
       
   121 		}
       
   122 	}
       
   123 	
       
   124 /*
       
   125 check that an extra uid was added to all fields, uid is incremented from provided seed
       
   126 */	
       
   127 	
       
   128 TBool CCntBaseStep::CheckUIDsL(const CContactItemFieldSet &aFields, const TInt32 aFieldType) const
       
   129 	{
       
   130 	TBool ret = EFalse;
       
   131 	TInt length = aFields.Count();
       
   132 	const CContentType *ctype = NULL;
       
   133 	for(TInt i = 0, uids=aFieldType; i<length; i++, uids++)
       
   134 		{
       
   135 		ctype = &aFields[i].ContentType();
       
   136 		// SIP ID will always match the system template field, therefore the added uid will be lost
       
   137 		if(! ctype->ContainsFieldType(TFieldType::Uid(uids) ) && !ctype->ContainsFieldType(KUidContactFieldSIPID))
       
   138 			{
       
   139 			return ret;
       
   140 			}
       
   141 		}
       
   142 	ret=ETrue;
       
   143 	return ret;
       
   144 	}
       
   145 
       
   146 /*sets the label for  a field at position aPos, in aFields to aLabel*/	
       
   147 void CCntBaseStep::SetLabelL(CContactItemFieldSet &aFields, const TInt aPos, const TDesC& aLabel) const 
       
   148 	{
       
   149 	aFields[aPos].SetLabelL(aLabel);
       
   150 	}
       
   151 	
       
   152 
       
   153 /*checks that the label for  a field at position aPos, in aFields equals to aLabel*/	
       
   154 TBool CCntBaseStep::CompareLabels(const CContactItemFieldSet &aFields, const TInt aPos, const TDesC& aLabel) 
       
   155 	{
       
   156 	
       
   157 	return aFields[aPos].Label() == aLabel;
       
   158 		
       
   159 	}
       
   160 	
       
   161 /*add a new field empty or otherwise to afields, using the supplied label and uid*/
       
   162 void CCntBaseStep::AddNewFieldL(CContactItemFieldSet &aFields, const TDesC& aLabel, 
       
   163 const TFieldType aFieldType, const TBool aEmpty) const
       
   164 	{
       
   165 	CContactItemField *field = CContactItemField::NewLC(KStorageTypeText,aFieldType);
       
   166 	field->SetLabelL(aLabel);
       
   167 	if (!aEmpty)
       
   168 		{
       
   169 		field->TextStorage()->SetTextL(aLabel);//otherwise new field is not stored
       
   170 		}
       
   171 	aFields.AddL(*field);
       
   172 	CleanupStack::Pop(field);
       
   173 	}
       
   174 	
       
   175 /*checks if empty new field was added and uid of added field*/
       
   176 TBool CCntBaseStep::CheckNewFieldL(const CContactItemFieldSet &aFields, const TInt aPos, 
       
   177 const TFieldType aFieldType, const TBool aEmpty) const
       
   178 	{
       
   179 	TBool ret = EFalse;
       
   180 	if(aEmpty)
       
   181 		{
       
   182 		ret = aFields.Count() <= aPos;
       
   183 		}
       
   184 	else
       
   185 		{
       
   186 		const CContentType &ctype = aFields[aPos].ContentType();
       
   187 	 	ret = (ctype.FieldTypeCount() <= 2) && ( ctype.FieldType( 0 ) == aFieldType );//2 uids if other custom uid added
       
   188 		}
       
   189 	return ret;
       
   190 
       
   191 	}
       
   192 
       
   193 /*sets a specific contact field to a value as determined by its type.
       
   194 field at aPos in aFields is set to aText*/
       
   195 void CCntBaseStep::SetFieldL(CContactItemFieldSet &aFields, const TInt aPos, const TDesC& aText) const
       
   196 	{
       
   197 	CContactItemField &field = aFields[aPos];
       
   198 	if( field.IsTemplateLabelField() )
       
   199 		{
       
   200 		return;
       
   201 		}
       
   202 	switch(field.StorageType())
       
   203 		{
       
   204 		case KStorageTypeText:
       
   205 			field.TextStorage()->SetTextL(aText);
       
   206 		break;
       
   207 		case KStorageTypeStore:
       
   208 			{
       
   209 			HBufC8 *buf = HBufC8::NewLC(aText.Size());
       
   210 			TPtr8 tptr8 = buf->Des();
       
   211 			tptr8.Copy(aText);
       
   212 			field.StoreStorage()->SetThingL(*buf);
       
   213 			CleanupStack::PopAndDestroy(buf);
       
   214 			}
       
   215 		break;
       
   216 		case KStorageTypeContactItemId:
       
   217 			field.AgentStorage()->SetAgentId(TestConstants::KContactId);
       
   218 		break;
       
   219 		case KStorageTypeDateTime:
       
   220 			field.DateTimeStorage()->SetTime(TestConstants::KDateTime);
       
   221 		break;
       
   222 		default:
       
   223 			User::Panic(aText,EInvariantFalse);
       
   224 		break;
       
   225 		}
       
   226 	}
       
   227 
       
   228 /*checks the value of a specific field as determined by it type
       
   229 returns true if field at aPos in aFields equals aText*/
       
   230 TBool CCntBaseStep::CompareFieldsL(const CContactItemFieldSet &aFields, const TInt aPos, const TDesC& aText) const
       
   231 	{
       
   232 	TBool ret = EFalse;
       
   233 	const CContactItemField &field = aFields[aPos];
       
   234 	if(  field.IsTemplateLabelField() )
       
   235 		{
       
   236 		return ret;
       
   237 		}
       
   238 	switch( field.StorageType() )
       
   239 		{
       
   240 		case KStorageTypeText:
       
   241 			ret = field.TextStorage()->Text() == aText;
       
   242 		break;
       
   243 		case KStorageTypeStore:
       
   244 			{
       
   245 			HBufC8 *buf = HBufC8::NewLC(aText.Size());
       
   246 			TPtr8 tptr8 = buf->Des();
       
   247 			tptr8.Copy(aText);
       
   248 			ret = field.StoreStorage()->Thing()->Compare(*buf) == 0;
       
   249 			CleanupStack::PopAndDestroy(buf);
       
   250 			}
       
   251 		break;
       
   252 		case KStorageTypeContactItemId:
       
   253 			ret = field.AgentStorage()->Value() == TestConstants::KContactId;
       
   254 		break;
       
   255 		case KStorageTypeDateTime:
       
   256 			ret = field.DateTimeStorage()->Time() == TestConstants::KDateTime;
       
   257 		break;
       
   258 		default:
       
   259 			User::Panic(aText,EInvariantFalse);
       
   260 		break;
       
   261 		}
       
   262 	return ret;
       
   263 	
       
   264 	}
       
   265 	
       
   266 void CCntBaseStep::AddEmptyContactsL(const TInt aNumber)
       
   267 /**
       
   268 Add number of empty contacts to db, using the system template.
       
   269 @return None
       
   270 @param aNumber number of contacts to be added
       
   271 @pre None
       
   272 @post database now contains aNumber of empty contacts
       
   273 */
       
   274 	{
       
   275 	CContactCard* contact = CContactCard::NewLC(iTemplate);
       
   276 	for(TInt k = 0; k<aNumber; k++)
       
   277 		{		
       
   278 		iIterate->AddL( iContactsDatabase->AddNewContactL(*contact) );
       
   279 		}	
       
   280 	CleanupStack::PopAndDestroy(contact);
       
   281 	}
       
   282 
       
   283 //sets the value of all fields for a given contact, uses alternating string values
       
   284 void CCntBaseStep::SetContactFieldsL(CContactItem &aContact, const TInt aCount) const
       
   285 	{
       
   286 	CContactItemFieldSet &fields = aContact.CardFields();
       
   287 	
       
   288 	for(TInt i = 0; i < aCount; i++)
       
   289 		{
       
   290 		SetFieldL(fields, i, TestConstants::KLongString);
       
   291 		}
       
   292 	}
       
   293 
       
   294 void CCntBaseStep::SetContactFieldsL(CContactItem &aContact) const
       
   295 	{
       
   296 	SetContactFieldsL( aContact, aContact.CardFields().Count() );
       
   297 	}
       
   298 
       
   299 //checks the value of all fields for a given contact, uses alternating string values	
       
   300 TBool CCntBaseStep::CheckContactFieldsL(const CContactItem &aContact) const
       
   301 	{
       
   302 	TBool ret=EFalse;
       
   303 	const CContactItemFieldSet& fields = aContact.CardFields();
       
   304 	const TInt length = fields.Count();
       
   305 
       
   306 
       
   307 	// Numerous field combinations will result in non-valid combinations, therefore the following
       
   308     // three UIDs are excluded for brevity
       
   309 	for(TInt i = 0; i<length;i++)
       
   310 		{	
       
   311 		if (fields[i].ContentType().Mapping() == KUidContactFieldVCardMapUnusedN) 
       
   312 			{
       
   313 			continue;
       
   314 			}
       
   315 			
       
   316 		if (fields[i].ContentType().ContainsFieldType(TFieldType::Uid(KIntContactFieldVCardMapTEL)))
       
   317 			{
       
   318 			continue;
       
   319 			}
       
   320 			
       
   321 		if (fields[i].ContentType().ContainsFieldType(TFieldType::Uid(KIntContactFieldVCardMapSIPID)))
       
   322 			{
       
   323 			continue;
       
   324 			}
       
   325 			
       
   326 		ret = CompareFieldsL(fields, i, TestConstants::KLongString);
       
   327         if (!ret) 
       
   328 			{
       
   329 			break;	
       
   330 			}
       
   331 		}	
       
   332 	return ret;
       
   333 	}
       
   334 
       
   335 //set the value of all labels in a contact, uses semi-alternating string values
       
   336 void CCntBaseStep::SetContactLabelsL(CContactItem &aContact) const
       
   337 	{
       
   338 	CContactItemFieldSet &fields = aContact.CardFields();
       
   339 	TInt length = fields.Count();
       
   340 	for(TInt i = 0; i<length; i++)
       
   341 		{
       
   342 		SetLabelL(fields, i,   TestConstants::KLongString);
       
   343 		}
       
   344 	}
       
   345 
       
   346 //checks the value of all labels in a contact, uses semi-alternating fields	
       
   347 TBool CCntBaseStep::CheckContactLabelsL(const CContactItem &aContact)
       
   348 	{
       
   349 	TBool ret=EFalse;
       
   350 	CContactItemFieldSet &fields = aContact.CardFields();
       
   351 	TInt length = fields.Count();
       
   352 	
       
   353 	// Numerous field combinations will result in non-valid combinations, therefore the following
       
   354     // three UIDs are excluded for brevity	
       
   355 	for(TInt i = 0; i<length; i++)
       
   356 		{	
       
   357 		if (fields[i].ContentType().Mapping() == KUidContactFieldVCardMapUnusedN) 
       
   358 			{
       
   359 			continue;
       
   360 			}
       
   361 			
       
   362 		if (fields[i].ContentType().ContainsFieldType(KUidContactFieldVCardMapTEL))
       
   363 			{
       
   364 			continue;
       
   365 			}
       
   366 			
       
   367 		if (fields[i].ContentType().ContainsFieldType(KUidContactFieldVCardMapSIPID))
       
   368 			{
       
   369 			continue;
       
   370 			}	
       
   371 		
       
   372 		ret = CompareLabels(fields, i,   TestConstants::KLongString);
       
   373 	
       
   374 		if(!ret) 
       
   375 			{
       
   376 			break;
       
   377 			}
       
   378 		}
       
   379 	return ret;
       
   380 	}
       
   381 	
       
   382 /*returns the number of empty fields in aFields*/
       
   383 TInt CCntBaseStep::CountEmpty(const CContactItemFieldSet &aFields)
       
   384 	{
       
   385 	TInt count = 0;
       
   386 	TInt ecount = 0;
       
   387 	
       
   388 	count = aFields.Count();
       
   389 	for(TInt i = 0; i < count; ++i)
       
   390 		{
       
   391 		if( !( aFields[i].Storage()->IsFull() ) )
       
   392 			{
       
   393 			++ecount;
       
   394 			}
       
   395 		}
       
   396 	return ecount;
       
   397 	}
       
   398 	
       
   399 /*returns the number of hidden fields in aFields*/
       
   400 TInt CCntBaseStep::CountHiddenFields(const CContactItemFieldSet &aFields) const
       
   401 	{
       
   402 	const TInt count = aFields.Count();;
       
   403 	TInt hcount = 0;
       
   404 
       
   405 	for(TInt i = 0; i < count; ++i)
       
   406 		{
       
   407 		if( aFields[i].IsHidden() )
       
   408 			{
       
   409 			++hcount;
       
   410 			}
       
   411 		}	
       
   412 	return hcount;
       
   413 	}
       
   414 
       
   415 /*prints contents of aContact to an html file*/	
       
   416 void CCntBaseStep::PrintCurrentContactL(const CContactItem &aContact) const
       
   417 	{
       
   418 	static TInt counter = 0;
       
   419 	TFileName fileName;
       
   420 	
       
   421 	_LIT(KFileName,"c:\\cntperfviewdef\\%d\\%d.ViewDef.html");
       
   422 	fileName.Format(KFileName,counter/4,counter%4);
       
   423 	++counter;
       
   424 	PrintContactL(fileName, aContact);
       
   425 	}
       
   426 	
       
   427 /*prints contents of contactitem at aCid to an html file*/	
       
   428 void CCntBaseStep::PrintCurrentContactL(const TContactItemId aCid) const
       
   429 	{
       
   430 	CContactItem *citem = iContactsDatabase->ReadContactLC(aCid,*iViewAll);
       
   431 	PrintCurrentContactL(*citem);
       
   432 	CleanupStack::PopAndDestroy(citem);
       
   433 	}
       
   434 
       
   435 /*opens contact item at aCid using viewdef aView for editing, initilises iContactItem*/
       
   436 void CCntBaseStep::OpenL(	const TContactItemId aCid, 
       
   437 							const CContactItemViewDef &aView, 
       
   438 							const TBool aDefault)
       
   439 	{
       
   440 	if(aDefault)
       
   441 		{
       
   442 		iContactItem = iContactsDatabase->OpenContactL(aCid);
       
   443 		}
       
   444 	else
       
   445 		{
       
   446 		iContactItem = iContactsDatabase->OpenContactL(aCid,aView);
       
   447 		}
       
   448 	iFields = &(iContactItem->CardFields());
       
   449 	}
       
   450 /*commits open contact, must be called after openl*/
       
   451 void CCntBaseStep::CommitL()
       
   452 	{
       
   453 	if(iContactItem != NULL)
       
   454 		{		
       
   455 		iFields = NULL;
       
   456 		iContactsDatabase->CommitContactL(*iContactItem);
       
   457 		delete iContactItem;
       
   458 		iContactItem = NULL;
       
   459 		}
       
   460 	}
       
   461 /*reads (readonly) contact item at aCid using viewdef aView for viewing, initilises iContactItem*/	
       
   462 void CCntBaseStep::ReadL(	const TContactItemId aCid, 
       
   463 							const CContactItemViewDef &aView, 
       
   464 							const TBool aDefault)
       
   465 	{
       
   466 	if(aDefault)
       
   467 		{
       
   468 		iContactItem = iContactsDatabase->ReadContactL(aCid);
       
   469 		}
       
   470 	else
       
   471 		{
       
   472 		iContactItem = iContactsDatabase->ReadContactL(aCid,aView);
       
   473 		}
       
   474 	iFields = &(iContactItem->CardFields());
       
   475 	}
       
   476 /*reads non empty fields (readonly) for ocontact item at aCid using viewdef 
       
   477 aView for viewing, initilises iContactItem*/		
       
   478 void CCntBaseStep::ReadMinimalL(const TContactItemId aCid, 
       
   479 								const CContactItemViewDef &aView, 
       
   480 								const CContactItemViewDef &aDefView,
       
   481 								const TBool aDefault)
       
   482 	{
       
   483 	if(aDefault)
       
   484 		{
       
   485 		iContactItem = iContactsDatabase->ReadMinimalContactL(aCid);
       
   486 		}
       
   487 	else
       
   488 		{
       
   489 		iContactsDatabase->SetViewDefinitionL( CContactViewDef::NewL( CopyViewL(aView) ) );
       
   490 		iContactItem = iContactsDatabase->ReadMinimalContactL(aCid);
       
   491 		iContactsDatabase->SetViewDefinitionL( CContactViewDef::NewL( CopyViewL(aDefView) ) );
       
   492 		}
       
   493 	iFields = &(iContactItem->CardFields());
       
   494 	}
       
   495 	
       
   496 /*closes open contact, must be called after readl/openl*/	
       
   497 void CCntBaseStep::Close()
       
   498 	{
       
   499 	if(iContactItem != NULL)
       
   500 		{
       
   501 		iFields = NULL;
       
   502 		TRAPD( err, iContactsDatabase->CloseContactL( iContactItem->Id() ) );
       
   503 		if( err )
       
   504 			{
       
   505 			_LIT(KClosingError,"Default contact couldn't be closed, error: %d");
       
   506 			ERR_PRINTF2(KClosingError, err);
       
   507 			}
       
   508 		delete iContactItem;
       
   509 		iContactItem = NULL;
       
   510 		}
       
   511 	}
       
   512 
       
   513 /*returns a copy of aView*/	
       
   514 CContactItemViewDef *CCntBaseStep::CopyViewL(const CContactItemViewDef &aView)
       
   515 	{
       
   516 	CContactItemViewDef *ret=CContactItemViewDef::NewLC( aView.Use(), aView.Mode() );
       
   517 	TInt count = aView.Count();
       
   518 	for(TInt i=0; i < count; i++)
       
   519 		{
       
   520 		ret->AddL(aView[i]);
       
   521 		}
       
   522 	CleanupStack::Pop(ret);
       
   523 	return ret;
       
   524 	}
       
   525 
       
   526 //populates an array with all - vast majority of - contact uids
       
   527 void CCntBaseStep::GetExistingUIDsL(RArray<TInt32> &aArray) const
       
   528 	{
       
   529 	
       
   530 	aArray.AppendL(KUidContactFieldAddressValue);
       
   531 	aArray.AppendL(KUidContactFieldPostOfficeValue);
       
   532 	aArray.AppendL(KUidContactFieldExtendedAddressValue);
       
   533 	aArray.AppendL(KUidContactFieldLocalityValue);
       
   534 	aArray.AppendL(KUidContactFieldRegionValue);
       
   535 	aArray.AppendL(KUidContactFieldPostCodeValue);
       
   536 	aArray.AppendL(KUidContactFieldCountryValue);
       
   537 	aArray.AppendL(KUidContactFieldCompanyNameValue);
       
   538 	aArray.AppendL(KUidContactFieldCompanyNamePronunciationValue);
       
   539 	aArray.AppendL(KUidContactFieldPhoneNumberValue);
       
   540 	aArray.AppendL(KUidContactFieldGivenNameValue);
       
   541 	aArray.AppendL(KUidContactFieldFamilyNameValue);
       
   542 	aArray.AppendL(KUidContactFieldGivenNamePronunciationValue);
       
   543 	aArray.AppendL(KUidContactFieldFamilyNamePronunciationValue);
       
   544 	aArray.AppendL(KUidContactFieldAdditionalNameValue);
       
   545 	aArray.AppendL(KUidContactFieldSuffixNameValue);
       
   546 	aArray.AppendL(KUidContactFieldPrefixNameValue);
       
   547 	aArray.AppendL(KUidContactFieldHiddenValue);
       
   548 	aArray.AppendL(KUidContactFieldEMailValue);
       
   549 	aArray.AppendL(KUidContactFieldMsgValue);
       
   550 	aArray.AppendL(KUidContactFieldSmsValue);
       
   551 	aArray.AppendL(KUidContactFieldFaxValue);
       
   552 	aArray.AppendL(KUidContactFieldDefinedTextValue);
       
   553 	aArray.AppendL(KUidContactFieldNoteValue);
       
   554 	aArray.AppendL(KUidContactFieldBirthdayValue);
       
   555 	aArray.AppendL(KUidContactFieldUrlValue);
       
   556 	aArray.AppendL(KUidContactFieldStorageInlineValue);
       
   557 	aArray.AppendL(KUidContactFieldTemplateLabelValue);
       
   558 	aArray.AppendL(KUidContactFieldPictureValue);
       
   559 	aArray.AppendL(KUidContactFieldRingToneValue);
       
   560 	aArray.AppendL(KUidContactFieldDTMFValue);
       
   561 	aArray.AppendL(KUidContactsVoiceDialFieldValue);
       
   562 	aArray.AppendL(KUidContactFieldNoneValue);
       
   563 	aArray.AppendL(KUidContactFieldJobTitleValue);
       
   564 	aArray.AppendL(KUidContactFieldICCSlotValue);
       
   565 	aArray.AppendL(KUidContactFieldICCPhonebookValue);
       
   566 	aArray.AppendL(KUidContactFieldICCGroupValue);
       
   567 	aArray.AppendL(KUidContactFieldIMAddressValue);
       
   568 	aArray.AppendL(KUidContactFieldSecondNameValue);
       
   569 	aArray.AppendL(KUidContactFieldSIPIDValue);
       
   570 	aArray.AppendL(KIntContactFieldVCardMapWORK);
       
   571 	aArray.AppendL(KIntContactFieldVCardMapHOME);
       
   572 	aArray.AppendL(KIntContactFieldVCardMapMSG);
       
   573 	aArray.AppendL(KIntContactFieldVCardMapVOICE);
       
   574 	aArray.AppendL(KIntContactFieldVCardMapFAX);
       
   575 	aArray.AppendL(KIntContactFieldVCardMapPREF);
       
   576 	aArray.AppendL(KIntContactFieldVCardMapCELL);
       
   577 	aArray.AppendL(KIntContactFieldVCardMapPAGER);
       
   578 	aArray.AppendL(KIntContactFieldVCardMapBBS);
       
   579 	aArray.AppendL(KIntContactFieldVCardMapMODEM);
       
   580 	aArray.AppendL(KIntContactFieldVCardMapCAR);  
       
   581 	aArray.AppendL(KIntContactFieldVCardMapISDN);
       
   582 	aArray.AppendL(KIntContactFieldVCardMapVIDEO);
       
   583 	aArray.AppendL(KIntContactFieldVCardMapDOM);
       
   584 	aArray.AppendL(KIntContactFieldVCardMapADR);
       
   585 	aArray.AppendL(KIntContactFieldVCardMapPOSTOFFICE);
       
   586 	aArray.AppendL(KIntContactFieldVCardMapEXTENDEDADR);
       
   587 	aArray.AppendL(KIntContactFieldVCardMapLOCALITY);
       
   588 	aArray.AppendL(KIntContactFieldVCardMapREGION);
       
   589 	aArray.AppendL(KIntContactFieldVCardMapPOSTCODE);
       
   590 	aArray.AppendL(KIntContactFieldVCardMapCOUNTRY);
       
   591 	aArray.AppendL(KIntContactFieldVCardMapAGENT);
       
   592 	aArray.AppendL(KIntContactFieldVCardMapBDAY);
       
   593 	aArray.AppendL(KIntContactFieldVCardMapEMAILINTERNET);
       
   594 	aArray.AppendL(KIntContactFieldVCardMapGEO);
       
   595 	aArray.AppendL(KIntContactFieldVCardMapLABEL);
       
   596 	aArray.AppendL(KIntContactFieldVCardMapLOGO);
       
   597 	aArray.AppendL(KIntContactFieldVCardMapMAILER);
       
   598 	aArray.AppendL(KIntContactFieldVCardMapNOTE);
       
   599 	aArray.AppendL(KIntContactFieldVCardMapORG);
       
   600 	aArray.AppendL(KIntContactFieldVCardMapORGPronunciation);
       
   601 	aArray.AppendL(KIntContactFieldVCardMapPHOTO);
       
   602 	aArray.AppendL(KIntContactFieldVCardMapROLE);
       
   603 	aArray.AppendL(KIntContactFieldVCardMapSOUND);
       
   604 	aArray.AppendL(KIntContactFieldVCardMapTEL);
       
   605 	aArray.AppendL(KIntContactFieldVCardMapTELFAX);
       
   606 	aArray.AppendL(KIntContactFieldVCardMapTITLE);
       
   607 	aArray.AppendL(KIntContactFieldVCardMapURL);
       
   608 	aArray.AppendL(KIntContactFieldVCardMapUnusedN);
       
   609 	aArray.AppendL(KIntContactFieldVCardMapUnusedFN);
       
   610 	aArray.AppendL(KIntContactFieldVCardMapNotRequired);
       
   611 	aArray.AppendL(KIntContactFieldVCardMapUnknownXDash);
       
   612 	aArray.AppendL(KIntContactFieldVCardMapUnknown);
       
   613 	aArray.AppendL(KIntContactFieldVCardMapUID);
       
   614 	aArray.AppendL(KIntContactFieldVCardMapINTL);
       
   615 	aArray.AppendL(KIntContactFieldVCardMapPOSTAL);
       
   616 	aArray.AppendL(KIntContactFieldVCardMapPARCEL);
       
   617 	aArray.AppendL(KIntContactFieldVCardMapGIF);
       
   618 	aArray.AppendL(KIntContactFieldVCardMapCGM);
       
   619 	aArray.AppendL(KIntContactFieldVCardMapWMF);
       
   620 	aArray.AppendL(KIntContactFieldVCardMapBMP);
       
   621 	aArray.AppendL(KIntContactFieldVCardMapMET);
       
   622 	aArray.AppendL(KIntContactFieldVCardMapPMB);
       
   623 	aArray.AppendL(KIntContactFieldVCardMapDIB);
       
   624 	aArray.AppendL(KIntContactFieldVCardMapPICT);
       
   625 	aArray.AppendL(KIntContactFieldVCardMapTIFF);
       
   626 	aArray.AppendL(KIntContactFieldVCardMapPDF);
       
   627 	aArray.AppendL(KIntContactFieldVCardMapPS);
       
   628 	aArray.AppendL(KIntContactFieldVCardMapJPEG);
       
   629 	aArray.AppendL(KIntContactFieldVCardMapMPEG);
       
   630 	aArray.AppendL(KIntContactFieldVCardMapMPEG2);
       
   631 	aArray.AppendL(KIntContactFieldVCardMapAVI);
       
   632 	aArray.AppendL(KIntContactFieldVCardMapQTIME);
       
   633 	aArray.AppendL(KIntContactFieldVCardMapTZ);
       
   634 	aArray.AppendL(KIntContactFieldVCardMapKEY);
       
   635 	aArray.AppendL(KIntContactFieldVCardMapX509);
       
   636 	aArray.AppendL(KIntContactFieldVCardMapPGP);
       
   637 	aArray.AppendL(KIntContactFieldVCardMapSMIME);
       
   638 	aArray.AppendL(KIntContactFieldVCardMapWV);
       
   639 	aArray.AppendL(KIntContactFieldVCardMapSECONDNAME);
       
   640 	aArray.AppendL(KIntContactFieldVCardMapSIPID);
       
   641 	aArray.AppendL(KIntContactFieldVCardMapPOC);
       
   642 	aArray.AppendL(KIntContactFieldVCardMapSWIS);
       
   643 	aArray.AppendL(KIntContactFieldVCardMapVOIP);
       
   644 
       
   645 	
       
   646 	}
       
   647 	
       
   648 		
       
   649 void CCntBaseStep::MissngTestPanic() const
       
   650 	{
       
   651 	_LIT(KInvalidTest,"Invalid Test");
       
   652 	User::Panic(KInvalidTest, 444);
       
   653 	}
       
   654 
       
   655 void CCntBaseStep::WaitForServerToExitL()
       
   656 	{
       
   657 /**
       
   658 hardware testing is performed using techview, which always has a session open to cntsrv,
       
   659 hence cntsrv never shutsdown when performing HW testing.
       
   660 */
       
   661 #ifdef __WINSCW__
       
   662 
       
   663 	// The name of the CntSrv process includes its uid like this CNTSRV.EXE[10003a73]001
       
   664 	TInt findProcessResult = KErrNone;
       
   665 	TFindProcess findProcess( KServerUid );
       
   666 	TFullName  fullNameLastProcess;
       
   667 	TFullName  fullNameNextProcess;
       
   668 	//TFullName
       
   669 	findProcessResult = findProcess.Next(fullNameNextProcess);
       
   670 
       
   671 	
       
   672 	for ( TInt iteration = 1; findProcessResult == KErrNone; ++iteration )
       
   673 		{
       
   674 		fullNameLastProcess = fullNameNextProcess;
       
   675 		RProcess process;
       
   676 		const TInt OpenError = process.Open(fullNameLastProcess);
       
   677 		if ( OpenError == KErrNone)
       
   678 			{
       
   679 			TExitCategoryName category = process.ExitCategory();
       
   680 			//if this handle to server is still open, then wait for this handle to close
       
   681 			if( 0 == category.Length() )
       
   682 			    {
       
   683 			    CloseProcessL( fullNameLastProcess, iteration );
       
   684 			    }
       
   685 			}
       
   686 		findProcessResult = findProcess.Next(fullNameNextProcess);
       
   687 		}
       
   688 
       
   689 #else
       
   690 KServerUid();//removes unused variable warning			
       
   691 #endif
       
   692 	}
       
   693 
       
   694 void CCntBaseStep::CloseProcessL(const TDesC& aProcessName, const TInt aIteration)
       
   695     {
       
   696 	_LIT(KillString, "Kill");
       
   697 	if ( aProcessName != KNullDesC )
       
   698 		{
       
   699 		_LIT(KServerRunning,"*** The CntSrv process is running ***");
       
   700 		_LIT(KServerIteration, "Found server process on iteration: %d");
       
   701 		INFO_PRINTF1(KServerRunning);
       
   702 		INFO_PRINTF2(KServerIteration, aIteration);
       
   703 		
       
   704 		// the CntSrv process is running so wait 
       
   705 		RProcess process;
       
   706 		const TInt OpenError = process.Open(aProcessName);
       
   707 		if ( OpenError == KErrNone)
       
   708 			{
       
   709 			TRequestStatus status;
       
   710 			process.Logon(status); // ask for a callback when the process ends
       
   711 			User::WaitForRequest(status);
       
   712 			const TInt serverError = process.ExitReason();
       
   713 			TExitCategoryName category = process.ExitCategory();
       
   714 			_LIT(KServerClosed,"*** The CntSrv process has ended with error type: %S, and error value: %d ***");
       
   715 			INFO_PRINTF3(KServerClosed, &category, serverError);
       
   716 			process.Close();
       
   717 			if( ( category != KillString ) || ( serverError != KErrNone ) )
       
   718 				{
       
   719 				_LIT(KServerError,"*** The server caused an error while closing ***");
       
   720 				ERR_PRINTF1(KServerError);
       
   721 				TEST1( EFalse, ETrue);
       
   722 				}
       
   723 			}
       
   724 		else
       
   725 			{
       
   726 			_LIT(KProcessFailure,"*** Failed to open process, error: %d ***");
       
   727 			ERR_PRINTF2(KProcessFailure, OpenError);
       
   728 			TEST1(EFalse, ETrue);
       
   729 			}
       
   730 		}
       
   731 	else
       
   732 		{
       
   733 		_LIT(KNoProcess,"*** The CntSrv process is NOT running ***");
       
   734 		ERR_PRINTF1(KNoProcess);
       
   735 		TEST1(EFalse, ETrue);
       
   736 		}
       
   737     }
       
   738 
       
   739 TBool CCntBaseStep::StringComparisonTestPrint(	const TDesC &aCompareL,
       
   740 												const TText *aCompareOperator,  
       
   741 												const TDesC &aCompareR, 
       
   742 												const TBool aResult,
       
   743 												const TInt 	aIteration, 
       
   744 												const TInt 	aSubIteration,  
       
   745 												const TInt 	aLine, 
       
   746 												const TText *aFile)
       
   747 	{
       
   748 	_LIT(KComparePrint, "%s %s %s: failed on subiteration %d of iteration %d");
       
   749 	_LIT(KFilePrint, "In file: %s at line: %d");
       
   750 	if( !aResult )
       
   751 		{
       
   752 		ERR_PRINTF6( KComparePrint, (TText*)aCompareL.Ptr(), aCompareOperator, (TText*)aCompareR.Ptr(), aSubIteration, aIteration);
       
   753 		ERR_PRINTF3( KFilePrint, aFile, aLine );
       
   754 		TEST1( EFalse , ETrue );
       
   755 		
       
   756 		}
       
   757 	return aResult;
       
   758 	}
       
   759 
       
   760 
       
   761 TBool CCntBaseStep::IntegerComparisonTestPrint(	const TInt	aCompareL,
       
   762 												const TText *aCompareOperator,  
       
   763 												const TInt 	aCompareR, 
       
   764 												const TBool aResult,
       
   765 												const TInt 	aIteration, 
       
   766 												const TInt 	aSubIteration,  
       
   767 												const TInt 	aLine, 
       
   768 												const TText *aFile)
       
   769 	{
       
   770 	_LIT(KComparePrint, "%d %s %d: failed on subiteration %d of iteration %d");
       
   771 	_LIT(KFilePrint, "In file: %s at line: %d");
       
   772 	if( !aResult )
       
   773 		{
       
   774 		ERR_PRINTF6( KComparePrint, aCompareL, aCompareOperator, aCompareR, aSubIteration, aIteration);
       
   775 		ERR_PRINTF3( KFilePrint, aFile, aLine );
       
   776 		TEST1( EFalse , ETrue );
       
   777 		}
       
   778 	return aResult;
       
   779 	}
       
   780 
       
   781