summaryrefslogtreecommitdiffstats
path: root/plugins/contacts/symbian/contactsmodel/tsrc/integration/cntperftest/src/cntbasestep.cpp
blob: b42103a38bd90a4a8cf8240f0f4007d28dd93091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
/*
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/


/**
 @file
 @publishedAll
 @released
*/
 
#include <e32panic.h>
#include <test/testexecutelog.h>
#include <cntfldst.h>
#include "cntbasestep.h"
#include "nbcnttestlib.h"

_LIT(KServerUid, "*[10003a73]*" );


CCntBaseStep::~CCntBaseStep()
	{
	_LIT(KBaseDestructor,"I am in base destructor");
	INFO_PRINTF1(KBaseDestructor);
	}

TVerdict CCntBaseStep::doTestStepPreambleL()
	{
	if(!CActiveScheduler::Current())
		{
		CActiveScheduler* sched = NULL;
		sched = new(ELeave) CActiveScheduler;
		CActiveScheduler::Install(sched);
		}

		
	iViewAll = CContactItemViewDef::NewL(CContactItemViewDef::EIncludeFields,CContactItemViewDef::EIncludeHiddenFields);
	iViewAll->AddL(KUidContactFieldMatchAll);
	/**
	issue 3.
	need use custom viewdef otherwise there is discrepency between number of fields between empty fields
	and edited fields
	*/
	
	iExistingUidsArray = new(ELeave) RArray<TInt32>();
	iIterate = new(ELeave) RCntList();
	
	GetExistingUIDsL(*iExistingUidsArray);
	
	//call method in derived class
	PreTestL();
	
	SetTestStepResult(EPass);
	return TestStepResult();
	}

TVerdict CCntBaseStep::doTestStepPostambleL()
	{
	_LIT(KPostamblePrint,"I am in base doTestStepPostambleL");
	INFO_PRINTF1(KPostamblePrint);
	Close();
	Cleanup();
	delete iViewAll;

	iExistingUidsArray->Close();
	CLEAR(iExistingUidsArray);
	CLEAR(iIterate);
	
	TRAPD( err, CContactDatabase::DeleteDefaultFileL() );
	if( err )
		{
		_LIT(KDBDeleteError,"Default database couldn't be deleted, error: %d");
		ERR_PRINTF2(KDBDeleteError, err);
		}
		
	WaitForServerToExitL();//waits for server to close to allow for any memory leaks to be detected
	return TestStepResult();
	}

/**initilize called within __UHEAP_MARK/__UHEAP_MARKEND of doTestStepL, 
so that all relevant memmory de/allocation is in scope*/
void CCntBaseStep::InitializeL()
	{
	iContactsDatabase = CContactDatabase::ReplaceL();//create  clean/fresh database for all tests		

	iTemplate = STATIC_CAST( CContactTemplate*, 
	iContactsDatabase->ReadContactL( iContactsDatabase->TemplateId(), *iViewAll ) );
	
	AddEmptyContactsL(iContacts);
	}
	
/**cleans up called within __UHEAP_MARK/__UHEAP_MARKEND of doTestStepL, 
so that all relevant memmory de/allocation is in scope*/	
void CCntBaseStep::Cleanup()
	{
	delete iTemplate;
	iTemplate = NULL;
	delete iContactsDatabase;
	iContactsDatabase = NULL;
	iIterate->Close();
	}
/*
adds a list of uids to all fields in aFields, uid is incremented from provided seed
*/	
void CCntBaseStep::AddUIDsL(CContactItemFieldSet &aFields, const TInt32 aFieldType) const
	{	
	TInt length = aFields.Count();
	for(TInt i = 0, uids=aFieldType; i<length; i++, uids++)
		{	
		aFields[i].AddFieldTypeL(TFieldType::Uid(uids));
		}
	}
	
/*
check that an extra uid was added to all fields, uid is incremented from provided seed
*/	
	
TBool CCntBaseStep::CheckUIDsL(const CContactItemFieldSet &aFields, const TInt32 aFieldType) const
	{
	TBool ret = EFalse;
	TInt length = aFields.Count();
	const CContentType *ctype = NULL;
	for(TInt i = 0, uids=aFieldType; i<length; i++, uids++)
		{
		ctype = &aFields[i].ContentType();
		// SIP ID will always match the system template field, therefore the added uid will be lost
		if(! ctype->ContainsFieldType(TFieldType::Uid(uids) ) && !ctype->ContainsFieldType(KUidContactFieldSIPID))
			{
			return ret;
			}
		}
	ret=ETrue;
	return ret;
	}

/*sets the label for  a field at position aPos, in aFields to aLabel*/	
void CCntBaseStep::SetLabelL(CContactItemFieldSet &aFields, const TInt aPos, const TDesC& aLabel) const 
	{
	aFields[aPos].SetLabelL(aLabel);
	}
	

/*checks that the label for  a field at position aPos, in aFields equals to aLabel*/	
TBool CCntBaseStep::CompareLabels(const CContactItemFieldSet &aFields, const TInt aPos, const TDesC& aLabel) 
	{
	
	return aFields[aPos].Label() == aLabel;
		
	}
	
/*add a new field empty or otherwise to afields, using the supplied label and uid*/
void CCntBaseStep::AddNewFieldL(CContactItemFieldSet &aFields, const TDesC& aLabel, 
const TFieldType aFieldType, const TBool aEmpty) const
	{
	CContactItemField *field = CContactItemField::NewLC(KStorageTypeText,aFieldType);
	field->SetLabelL(aLabel);
	if (!aEmpty)
		{
		field->TextStorage()->SetTextL(aLabel);//otherwise new field is not stored
		}
	aFields.AddL(*field);
	CleanupStack::Pop(field);
	}
	
/*checks if empty new field was added and uid of added field*/
TBool CCntBaseStep::CheckNewFieldL(const CContactItemFieldSet &aFields, const TInt aPos, 
const TFieldType aFieldType, const TBool aEmpty) const
	{
	TBool ret = EFalse;
	if(aEmpty)
		{
		ret = aFields.Count() <= aPos;
		}
	else
		{
		const CContentType &ctype = aFields[aPos].ContentType();
	 	ret = (ctype.FieldTypeCount() <= 2) && ( ctype.FieldType( 0 ) == aFieldType );//2 uids if other custom uid added
		}
	return ret;

	}

/*sets a specific contact field to a value as determined by its type.
field at aPos in aFields is set to aText*/
void CCntBaseStep::SetFieldL(CContactItemFieldSet &aFields, const TInt aPos, const TDesC& aText) const
	{
	CContactItemField &field = aFields[aPos];
	if( field.IsTemplateLabelField() )
		{
		return;
		}
	switch(field.StorageType())
		{
		case KStorageTypeText:
			field.TextStorage()->SetTextL(aText);
		break;
		case KStorageTypeStore:
			{
			HBufC8 *buf = HBufC8::NewLC(aText.Size());
			TPtr8 tptr8 = buf->Des();
			tptr8.Copy(aText);
			field.StoreStorage()->SetThingL(*buf);
			CleanupStack::PopAndDestroy(buf);
			}
		break;
		case KStorageTypeContactItemId:
			field.AgentStorage()->SetAgentId(TestConstants::KContactId);
		break;
		case KStorageTypeDateTime:
			field.DateTimeStorage()->SetTime(TestConstants::KDateTime);
		break;
		default:
			User::Panic(aText,EInvariantFalse);
		break;
		}
	}

/*checks the value of a specific field as determined by it type
returns true if field at aPos in aFields equals aText*/
TBool CCntBaseStep::CompareFieldsL(const CContactItemFieldSet &aFields, const TInt aPos, const TDesC& aText) const
	{
	TBool ret = EFalse;
	const CContactItemField &field = aFields[aPos];
	if(  field.IsTemplateLabelField() )
		{
		return ret;
		}
	switch( field.StorageType() )
		{
		case KStorageTypeText:
			ret = field.TextStorage()->Text() == aText;
		break;
		case KStorageTypeStore:
			{
			HBufC8 *buf = HBufC8::NewLC(aText.Size());
			TPtr8 tptr8 = buf->Des();
			tptr8.Copy(aText);
			ret = field.StoreStorage()->Thing()->Compare(*buf) == 0;
			CleanupStack::PopAndDestroy(buf);
			}
		break;
		case KStorageTypeContactItemId:
			ret = field.AgentStorage()->Value() == TestConstants::KContactId;
		break;
		case KStorageTypeDateTime:
			ret = field.DateTimeStorage()->Time() == TestConstants::KDateTime;
		break;
		default:
			User::Panic(aText,EInvariantFalse);
		break;
		}
	return ret;
	
	}
	
void CCntBaseStep::AddEmptyContactsL(const TInt aNumber)
/**
Add number of empty contacts to db, using the system template.
@return None
@param aNumber number of contacts to be added
@pre None
@post database now contains aNumber of empty contacts
*/
	{
	CContactCard* contact = CContactCard::NewLC(iTemplate);
	for(TInt k = 0; k<aNumber; k++)
		{		
		iIterate->AddL( iContactsDatabase->AddNewContactL(*contact) );
		}	
	CleanupStack::PopAndDestroy(contact);
	}

//sets the value of all fields for a given contact, uses alternating string values
void CCntBaseStep::SetContactFieldsL(CContactItem &aContact, const TInt aCount) const
	{
	CContactItemFieldSet &fields = aContact.CardFields();
	
	for(TInt i = 0; i < aCount; i++)
		{
		SetFieldL(fields, i, TestConstants::KLongString);
		}
	}

void CCntBaseStep::SetContactFieldsL(CContactItem &aContact) const
	{
	SetContactFieldsL( aContact, aContact.CardFields().Count() );
	}

//checks the value of all fields for a given contact, uses alternating string values	
TBool CCntBaseStep::CheckContactFieldsL(const CContactItem &aContact) const
	{
	TBool ret=EFalse;
	const CContactItemFieldSet& fields = aContact.CardFields();
	const TInt length = fields.Count();


	// Numerous field combinations will result in non-valid combinations, therefore the following
    // three UIDs are excluded for brevity
	for(TInt i = 0; i<length;i++)
		{	
		if (fields[i].ContentType().Mapping() == KUidContactFieldVCardMapUnusedN) 
			{
			continue;
			}
			
		if (fields[i].ContentType().ContainsFieldType(TFieldType::Uid(KIntContactFieldVCardMapTEL)))
			{
			continue;
			}
			
		if (fields[i].ContentType().ContainsFieldType(TFieldType::Uid(KIntContactFieldVCardMapSIPID)))
			{
			continue;
			}
			
		ret = CompareFieldsL(fields, i, TestConstants::KLongString);
        if (!ret) 
			{
			break;	
			}
		}	
	return ret;
	}

//set the value of all labels in a contact, uses semi-alternating string values
void CCntBaseStep::SetContactLabelsL(CContactItem &aContact) const
	{
	CContactItemFieldSet &fields = aContact.CardFields();
	TInt length = fields.Count();
	for(TInt i = 0; i<length; i++)
		{
		SetLabelL(fields, i,   TestConstants::KLongString);
		}
	}

//checks the value of all labels in a contact, uses semi-alternating fields	
TBool CCntBaseStep::CheckContactLabelsL(const CContactItem &aContact)
	{
	TBool ret=EFalse;
	CContactItemFieldSet &fields = aContact.CardFields();
	TInt length = fields.Count();
	
	// Numerous field combinations will result in non-valid combinations, therefore the following
    // three UIDs are excluded for brevity	
	for(TInt i = 0; i<length; i++)
		{	
		if (fields[i].ContentType().Mapping() == KUidContactFieldVCardMapUnusedN) 
			{
			continue;
			}
			
		if (fields[i].ContentType().ContainsFieldType(KUidContactFieldVCardMapTEL))
			{
			continue;
			}
			
		if (fields[i].ContentType().ContainsFieldType(KUidContactFieldVCardMapSIPID))
			{
			continue;
			}	
		
		ret = CompareLabels(fields, i,   TestConstants::KLongString);
	
		if(!ret) 
			{
			break;
			}
		}
	return ret;
	}
	
/*returns the number of empty fields in aFields*/
TInt CCntBaseStep::CountEmpty(const CContactItemFieldSet &aFields)
	{
	TInt count = 0;
	TInt ecount = 0;
	
	count = aFields.Count();
	for(TInt i = 0; i < count; ++i)
		{
		if( !( aFields[i].Storage()->IsFull() ) )
			{
			++ecount;
			}
		}
	return ecount;
	}
	
/*returns the number of hidden fields in aFields*/
TInt CCntBaseStep::CountHiddenFields(const CContactItemFieldSet &aFields) const
	{
	const TInt count = aFields.Count();;
	TInt hcount = 0;

	for(TInt i = 0; i < count; ++i)
		{
		if( aFields[i].IsHidden() )
			{
			++hcount;
			}
		}	
	return hcount;
	}

/*prints contents of aContact to an html file*/	
void CCntBaseStep::PrintCurrentContactL(const CContactItem &aContact) const
	{
	static TInt counter = 0;
	TFileName fileName;
	
	_LIT(KFileName,"c:\\cntperfviewdef\\%d\\%d.ViewDef.html");
	fileName.Format(KFileName,counter/4,counter%4);
	++counter;
	PrintContactL(fileName, aContact);
	}
	
/*prints contents of contactitem at aCid to an html file*/	
void CCntBaseStep::PrintCurrentContactL(const TContactItemId aCid) const
	{
	CContactItem *citem = iContactsDatabase->ReadContactLC(aCid,*iViewAll);
	PrintCurrentContactL(*citem);
	CleanupStack::PopAndDestroy(citem);
	}

/*opens contact item at aCid using viewdef aView for editing, initilises iContactItem*/
void CCntBaseStep::OpenL(	const TContactItemId aCid, 
							const CContactItemViewDef &aView, 
							const TBool aDefault)
	{
	if(aDefault)
		{
		iContactItem = iContactsDatabase->OpenContactL(aCid);
		}
	else
		{
		iContactItem = iContactsDatabase->OpenContactL(aCid,aView);
		}
	iFields = &(iContactItem->CardFields());
	}
/*commits open contact, must be called after openl*/
void CCntBaseStep::CommitL()
	{
	if(iContactItem != NULL)
		{		
		iFields = NULL;
		iContactsDatabase->CommitContactL(*iContactItem);
		delete iContactItem;
		iContactItem = NULL;
		}
	}
/*reads (readonly) contact item at aCid using viewdef aView for viewing, initilises iContactItem*/	
void CCntBaseStep::ReadL(	const TContactItemId aCid, 
							const CContactItemViewDef &aView, 
							const TBool aDefault)
	{
	if(aDefault)
		{
		iContactItem = iContactsDatabase->ReadContactL(aCid);
		}
	else
		{
		iContactItem = iContactsDatabase->ReadContactL(aCid,aView);
		}
	iFields = &(iContactItem->CardFields());
	}
/*reads non empty fields (readonly) for ocontact item at aCid using viewdef 
aView for viewing, initilises iContactItem*/		
void CCntBaseStep::ReadMinimalL(const TContactItemId aCid, 
								const CContactItemViewDef &aView, 
								const CContactItemViewDef &aDefView,
								const TBool aDefault)
	{
	if(aDefault)
		{
		iContactItem = iContactsDatabase->ReadMinimalContactL(aCid);
		}
	else
		{
		iContactsDatabase->SetViewDefinitionL( CContactViewDef::NewL( CopyViewL(aView) ) );
		iContactItem = iContactsDatabase->ReadMinimalContactL(aCid);
		iContactsDatabase->SetViewDefinitionL( CContactViewDef::NewL( CopyViewL(aDefView) ) );
		}
	iFields = &(iContactItem->CardFields());
	}
	
/*closes open contact, must be called after readl/openl*/	
void CCntBaseStep::Close()
	{
	if(iContactItem != NULL)
		{
		iFields = NULL;
		TRAPD( err, iContactsDatabase->CloseContactL( iContactItem->Id() ) );
		if( err )
			{
			_LIT(KClosingError,"Default contact couldn't be closed, error: %d");
			ERR_PRINTF2(KClosingError, err);
			}
		delete iContactItem;
		iContactItem = NULL;
		}
	}

/*returns a copy of aView*/	
CContactItemViewDef *CCntBaseStep::CopyViewL(const CContactItemViewDef &aView)
	{
	CContactItemViewDef *ret=CContactItemViewDef::NewLC( aView.Use(), aView.Mode() );
	TInt count = aView.Count();
	for(TInt i=0; i < count; i++)
		{
		ret->AddL(aView[i]);
		}
	CleanupStack::Pop(ret);
	return ret;
	}

//populates an array with all - vast majority of - contact uids
void CCntBaseStep::GetExistingUIDsL(RArray<TInt32> &aArray) const
	{
	
	aArray.AppendL(KUidContactFieldAddressValue);
	aArray.AppendL(KUidContactFieldPostOfficeValue);
	aArray.AppendL(KUidContactFieldExtendedAddressValue);
	aArray.AppendL(KUidContactFieldLocalityValue);
	aArray.AppendL(KUidContactFieldRegionValue);
	aArray.AppendL(KUidContactFieldPostCodeValue);
	aArray.AppendL(KUidContactFieldCountryValue);
	aArray.AppendL(KUidContactFieldCompanyNameValue);
	aArray.AppendL(KUidContactFieldCompanyNamePronunciationValue);
	aArray.AppendL(KUidContactFieldPhoneNumberValue);
	aArray.AppendL(KUidContactFieldGivenNameValue);
	aArray.AppendL(KUidContactFieldFamilyNameValue);
	aArray.AppendL(KUidContactFieldGivenNamePronunciationValue);
	aArray.AppendL(KUidContactFieldFamilyNamePronunciationValue);
	aArray.AppendL(KUidContactFieldAdditionalNameValue);
	aArray.AppendL(KUidContactFieldSuffixNameValue);
	aArray.AppendL(KUidContactFieldPrefixNameValue);
	aArray.AppendL(KUidContactFieldHiddenValue);
	aArray.AppendL(KUidContactFieldEMailValue);
	aArray.AppendL(KUidContactFieldMsgValue);
	aArray.AppendL(KUidContactFieldSmsValue);
	aArray.AppendL(KUidContactFieldFaxValue);
	aArray.AppendL(KUidContactFieldDefinedTextValue);
	aArray.AppendL(KUidContactFieldNoteValue);
	aArray.AppendL(KUidContactFieldBirthdayValue);
	aArray.AppendL(KUidContactFieldUrlValue);
	aArray.AppendL(KUidContactFieldStorageInlineValue);
	aArray.AppendL(KUidContactFieldTemplateLabelValue);
	aArray.AppendL(KUidContactFieldPictureValue);
	aArray.AppendL(KUidContactFieldRingToneValue);
	aArray.AppendL(KUidContactFieldDTMFValue);
	aArray.AppendL(KUidContactsVoiceDialFieldValue);
	aArray.AppendL(KUidContactFieldNoneValue);
	aArray.AppendL(KUidContactFieldJobTitleValue);
	aArray.AppendL(KUidContactFieldICCSlotValue);
	aArray.AppendL(KUidContactFieldICCPhonebookValue);
	aArray.AppendL(KUidContactFieldICCGroupValue);
	aArray.AppendL(KUidContactFieldIMAddressValue);
	aArray.AppendL(KUidContactFieldSecondNameValue);
	aArray.AppendL(KUidContactFieldSIPIDValue);
	aArray.AppendL(KIntContactFieldVCardMapWORK);
	aArray.AppendL(KIntContactFieldVCardMapHOME);
	aArray.AppendL(KIntContactFieldVCardMapMSG);
	aArray.AppendL(KIntContactFieldVCardMapVOICE);
	aArray.AppendL(KIntContactFieldVCardMapFAX);
	aArray.AppendL(KIntContactFieldVCardMapPREF);
	aArray.AppendL(KIntContactFieldVCardMapCELL);
	aArray.AppendL(KIntContactFieldVCardMapPAGER);
	aArray.AppendL(KIntContactFieldVCardMapBBS);
	aArray.AppendL(KIntContactFieldVCardMapMODEM);
	aArray.AppendL(KIntContactFieldVCardMapCAR);  
	aArray.AppendL(KIntContactFieldVCardMapISDN);
	aArray.AppendL(KIntContactFieldVCardMapVIDEO);
	aArray.AppendL(KIntContactFieldVCardMapDOM);
	aArray.AppendL(KIntContactFieldVCardMapADR);
	aArray.AppendL(KIntContactFieldVCardMapPOSTOFFICE);
	aArray.AppendL(KIntContactFieldVCardMapEXTENDEDADR);
	aArray.AppendL(KIntContactFieldVCardMapLOCALITY);
	aArray.AppendL(KIntContactFieldVCardMapREGION);
	aArray.AppendL(KIntContactFieldVCardMapPOSTCODE);
	aArray.AppendL(KIntContactFieldVCardMapCOUNTRY);
	aArray.AppendL(KIntContactFieldVCardMapAGENT);
	aArray.AppendL(KIntContactFieldVCardMapBDAY);
	aArray.AppendL(KIntContactFieldVCardMapEMAILINTERNET);
	aArray.AppendL(KIntContactFieldVCardMapGEO);
	aArray.AppendL(KIntContactFieldVCardMapLABEL);
	aArray.AppendL(KIntContactFieldVCardMapLOGO);
	aArray.AppendL(KIntContactFieldVCardMapMAILER);
	aArray.AppendL(KIntContactFieldVCardMapNOTE);
	aArray.AppendL(KIntContactFieldVCardMapORG);
	aArray.AppendL(KIntContactFieldVCardMapORGPronunciation);
	aArray.AppendL(KIntContactFieldVCardMapPHOTO);
	aArray.AppendL(KIntContactFieldVCardMapROLE);
	aArray.AppendL(KIntContactFieldVCardMapSOUND);
	aArray.AppendL(KIntContactFieldVCardMapTEL);
	aArray.AppendL(KIntContactFieldVCardMapTELFAX);
	aArray.AppendL(KIntContactFieldVCardMapTITLE);
	aArray.AppendL(KIntContactFieldVCardMapURL);
	aArray.AppendL(KIntContactFieldVCardMapUnusedN);
	aArray.AppendL(KIntContactFieldVCardMapUnusedFN);
	aArray.AppendL(KIntContactFieldVCardMapNotRequired);
	aArray.AppendL(KIntContactFieldVCardMapUnknownXDash);
	aArray.AppendL(KIntContactFieldVCardMapUnknown);
	aArray.AppendL(KIntContactFieldVCardMapUID);
	aArray.AppendL(KIntContactFieldVCardMapINTL);
	aArray.AppendL(KIntContactFieldVCardMapPOSTAL);
	aArray.AppendL(KIntContactFieldVCardMapPARCEL);
	aArray.AppendL(KIntContactFieldVCardMapGIF);
	aArray.AppendL(KIntContactFieldVCardMapCGM);
	aArray.AppendL(KIntContactFieldVCardMapWMF);
	aArray.AppendL(KIntContactFieldVCardMapBMP);
	aArray.AppendL(KIntContactFieldVCardMapMET);
	aArray.AppendL(KIntContactFieldVCardMapPMB);
	aArray.AppendL(KIntContactFieldVCardMapDIB);
	aArray.AppendL(KIntContactFieldVCardMapPICT);
	aArray.AppendL(KIntContactFieldVCardMapTIFF);
	aArray.AppendL(KIntContactFieldVCardMapPDF);
	aArray.AppendL(KIntContactFieldVCardMapPS);
	aArray.AppendL(KIntContactFieldVCardMapJPEG);
	aArray.AppendL(KIntContactFieldVCardMapMPEG);
	aArray.AppendL(KIntContactFieldVCardMapMPEG2);
	aArray.AppendL(KIntContactFieldVCardMapAVI);
	aArray.AppendL(KIntContactFieldVCardMapQTIME);
	aArray.AppendL(KIntContactFieldVCardMapTZ);
	aArray.AppendL(KIntContactFieldVCardMapKEY);
	aArray.AppendL(KIntContactFieldVCardMapX509);
	aArray.AppendL(KIntContactFieldVCardMapPGP);
	aArray.AppendL(KIntContactFieldVCardMapSMIME);
	aArray.AppendL(KIntContactFieldVCardMapWV);
	aArray.AppendL(KIntContactFieldVCardMapSECONDNAME);
	aArray.AppendL(KIntContactFieldVCardMapSIPID);
	aArray.AppendL(KIntContactFieldVCardMapPOC);
	aArray.AppendL(KIntContactFieldVCardMapSWIS);
	aArray.AppendL(KIntContactFieldVCardMapVOIP);

	
	}
	
		
void CCntBaseStep::MissngTestPanic() const
	{
	_LIT(KInvalidTest,"Invalid Test");
	User::Panic(KInvalidTest, 444);
	}

void CCntBaseStep::WaitForServerToExitL()
	{
/**
hardware testing is performed using techview, which always has a session open to cntsrv,
hence cntsrv never shutsdown when performing HW testing.
*/
#ifdef __WINSCW__

	// The name of the CntSrv process includes its uid like this CNTSRV.EXE[10003a73]001
	TInt findProcessResult = KErrNone;
	TFindProcess findProcess( KServerUid );
	TFullName  fullNameLastProcess;
	TFullName  fullNameNextProcess;
	//TFullName
	findProcessResult = findProcess.Next(fullNameNextProcess);

	
	for ( TInt iteration = 1; findProcessResult == KErrNone; ++iteration )
		{
		fullNameLastProcess = fullNameNextProcess;
		RProcess process;
		const TInt OpenError = process.Open(fullNameLastProcess);
		if ( OpenError == KErrNone)
			{
			TExitCategoryName category = process.ExitCategory();
			//if this handle to server is still open, then wait for this handle to close
			if( 0 == category.Length() )
			    {
			    CloseProcessL( fullNameLastProcess, iteration );
			    }
			}
		findProcessResult = findProcess.Next(fullNameNextProcess);
		}

#else
KServerUid();//removes unused variable warning			
#endif
	}

void CCntBaseStep::CloseProcessL(const TDesC& aProcessName, const TInt aIteration)
    {
	_LIT(KillString, "Kill");
	if ( aProcessName != KNullDesC )
		{
		_LIT(KServerRunning,"*** The CntSrv process is running ***");
		_LIT(KServerIteration, "Found server process on iteration: %d");
		INFO_PRINTF1(KServerRunning);
		INFO_PRINTF2(KServerIteration, aIteration);
		
		// the CntSrv process is running so wait 
		RProcess process;
		const TInt OpenError = process.Open(aProcessName);
		if ( OpenError == KErrNone)
			{
			TRequestStatus status;
			process.Logon(status); // ask for a callback when the process ends
			User::WaitForRequest(status);
			const TInt serverError = process.ExitReason();
			TExitCategoryName category = process.ExitCategory();
			_LIT(KServerClosed,"*** The CntSrv process has ended with error type: %S, and error value: %d ***");
			INFO_PRINTF3(KServerClosed, &category, serverError);
			process.Close();
			if( ( category != KillString ) || ( serverError != KErrNone ) )
				{
				_LIT(KServerError,"*** The server caused an error while closing ***");
				ERR_PRINTF1(KServerError);
				TEST1( EFalse, ETrue);
				}
			}
		else
			{
			_LIT(KProcessFailure,"*** Failed to open process, error: %d ***");
			ERR_PRINTF2(KProcessFailure, OpenError);
			TEST1(EFalse, ETrue);
			}
		}
	else
		{
		_LIT(KNoProcess,"*** The CntSrv process is NOT running ***");
		ERR_PRINTF1(KNoProcess);
		TEST1(EFalse, ETrue);
		}
    }

TBool CCntBaseStep::StringComparisonTestPrint(	const TDesC &aCompareL,
												const TText *aCompareOperator,  
												const TDesC &aCompareR, 
												const TBool aResult,
												const TInt 	aIteration, 
												const TInt 	aSubIteration,  
												const TInt 	aLine, 
												const TText *aFile)
	{
	_LIT(KComparePrint, "%s %s %s: failed on subiteration %d of iteration %d");
	_LIT(KFilePrint, "In file: %s at line: %d");
	if( !aResult )
		{
		ERR_PRINTF6( KComparePrint, (TText*)aCompareL.Ptr(), aCompareOperator, (TText*)aCompareR.Ptr(), aSubIteration, aIteration);
		ERR_PRINTF3( KFilePrint, aFile, aLine );
		TEST1( EFalse , ETrue );
		
		}
	return aResult;
	}


TBool CCntBaseStep::IntegerComparisonTestPrint(	const TInt	aCompareL,
												const TText *aCompareOperator,  
												const TInt 	aCompareR, 
												const TBool aResult,
												const TInt 	aIteration, 
												const TInt 	aSubIteration,  
												const TInt 	aLine, 
												const TText *aFile)
	{
	_LIT(KComparePrint, "%d %s %d: failed on subiteration %d of iteration %d");
	_LIT(KFilePrint, "In file: %s at line: %d");
	if( !aResult )
		{
		ERR_PRINTF6( KComparePrint, aCompareL, aCompareOperator, aCompareR, aSubIteration, aIteration);
		ERR_PRINTF3( KFilePrint, aFile, aLine );
		TEST1( EFalse , ETrue );
		}
	return aResult;
	}