summaryrefslogtreecommitdiffstats
path: root/plugins/contacts/symbian/contactsmodel/tsrc/integration/cntperftest/inc/contactviewtest.h
blob: df80492204447859035a714bf657b9200c6b1663 (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
/*
* 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
*/

#ifndef __CONTACTVIEW_TESTS_H__
#define __CONTACTVIEW_TESTS_H__

#include <cntviewbase.h>
#include "cntbasestep.h"
#include <coreappstest/testserver.h>
#include "persistencelayer.h"

enum FieldFullness
	{
	EBlank = 0,
	EMedium,
	EFull,
	};
	
enum PerformanceContacts
	{
	EFew = 10,
	EMid = 100,
	EMany = 500,
	EMax = 1000,
	EDone = -1,
	};

class CViewObserver;

class CContactViewTest : public CCntBaseStep, public MContactUiCompactObserver
	{
friend class CViewObserver;
public:
	CContactViewTest(CCntPerfServer &aParent);
	virtual TVerdict doTestStepL();
	virtual TVerdict CContactViewTest::doTestStepPostambleL();
	virtual void PreTestL();

//testing methods
private:
	void doAllEmptyTestL(const CContactViewBase &);
	void AllEmptyTestL();
	void ViewEmptyTestL();
	void doViewEmptyTestL(const CContactViewBase &aLView);
	void ContactEmptyTestL();
	void doContactEmptyTestL(const CContactViewBase &aLView);
	void AllFullTestL();
	void doAllFullTestL(const CContactViewBase &aLView);
	void EmptyFieldsetTestL();
	void doEmptyFieldsetTestL(const CContactViewBase &aLView);
	void EmptyFieldsetSortTestL();
	void doEmptyFieldsetSortTestL(const CContactViewBase &aLView);
	void MissingFieldTestL();
	void doMissingFieldTestL(const CContactViewBase &aLView);
	void PerformanceTestL();
	void doPerformanceTestL(const CContactViewBase &aLView);
	void RecoverCompressTestL();
	void doRecoverCompressTestL(const CContactViewBase &aLView);
	void ConcurrentRecoverCompressTestL();
	void doConcurrentRecoverCompressTestL(const CContactViewBase &aLView);
	void RecoverAndCompressThreadTestL();

//utility functions
private:
	void CleanupL();
	void InitializeL();
	void ResetDatabaseL(const TInt aMany=0);
	TBool CheckViewContact(const CViewContact &aVContact, const TDesC &aVal);
	TBool CheckViewContactL(const CViewContact &aVContact);
	HBufC* FieldStringLC(const CContactItemField &aField);
	void ResetSortL();
	void SetContactL();
	TBool FindAndClearFieldL(const TContactItemId aCid, const TDesC &aField);
	TPtrC GetNextFieldL();
	CContactViewBase* CreateViewL();
	TPtrC GetFieldL(const TInt aIndex);
	void ClosePersistanceL(const TBool aReOpen);
	void OpenPersistanceL();
	void SetMediumL();
	void SetFullL();
	void StartRecoverL();
	void EndRecoverL();
	void StartCompressL();
	void EndCompressL();
	static TInt ThreadRunL(TAny* aAny);

//from MContactUiCompactObserver
private:
	void Step(TInt ){}
	void HandleError(TInt aError);
	
private:
	CViewObserver* 			iObserver;
	RContactViewSortOrder* 	iSortOrder;
	TBool 					iRemote;
	TTime 					iStartP;
	TTime 					iFinishP;
	TTime 					iStartC;
	FieldFullness 			iFullness;
	PerformanceContacts		iPerformanceContacts;
	TBool					iPLView;//run local view directly on top of the persistance layer, as used by view sub sessions within the server
	CPersistenceLayer* 		iPersistence;
	RPIMTestServer* 		iPimServ;
	CContactActiveRecover* 	iRecover;
	CContactActiveCompress* iCompress;
	CContactDatabase* 		iContactsDatabase2;
	TInt					iError;
	TInt					iIteration;
	TBool 					iRecoverFlag;
	RThread					iThread;
	RSemaphore				iSemaphore;
	RSemaphore				iSemaphore2;
	TInt                    iDamageCounter;
	};

#endif