|
1 /** |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @publishedAll |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef __CONTACTVIEW_TESTS_H__ |
|
27 #define __CONTACTVIEW_TESTS_H__ |
|
28 |
|
29 #include <cntviewbase.h> |
|
30 #include "CntBaseStep.h" |
|
31 #include <coreappstest/testserver.h> |
|
32 #include "persistencelayer.h" |
|
33 |
|
34 enum FieldFullness |
|
35 { |
|
36 EBlank = 0, |
|
37 EMedium, |
|
38 EFull, |
|
39 }; |
|
40 |
|
41 enum PerformanceContacts |
|
42 { |
|
43 EFew = 10, |
|
44 EMid = 100, |
|
45 EMany = 500, |
|
46 EMax = 1000, |
|
47 EDone = -1, |
|
48 }; |
|
49 |
|
50 class CViewObserver; |
|
51 |
|
52 class CContactViewTest : public CCntBaseStep, public MContactUiCompactObserver |
|
53 { |
|
54 friend class CViewObserver; |
|
55 public: |
|
56 CContactViewTest(CCntPerfServer &aParent); |
|
57 virtual TVerdict doTestStepL(); |
|
58 virtual TVerdict CContactViewTest::doTestStepPostambleL(); |
|
59 virtual void PreTestL(); |
|
60 |
|
61 //testing methods |
|
62 private: |
|
63 void doAllEmptyTestL(const CContactViewBase &); |
|
64 void AllEmptyTestL(); |
|
65 void ViewEmptyTestL(); |
|
66 void doViewEmptyTestL(const CContactViewBase &aLView); |
|
67 void ContactEmptyTestL(); |
|
68 void doContactEmptyTestL(const CContactViewBase &aLView); |
|
69 void AllFullTestL(); |
|
70 void doAllFullTestL(const CContactViewBase &aLView); |
|
71 void EmptyFieldsetTestL(); |
|
72 void doEmptyFieldsetTestL(const CContactViewBase &aLView); |
|
73 void EmptyFieldsetSortTestL(); |
|
74 void doEmptyFieldsetSortTestL(const CContactViewBase &aLView); |
|
75 void MissingFieldTestL(); |
|
76 void doMissingFieldTestL(const CContactViewBase &aLView); |
|
77 void PerformanceTestL(); |
|
78 void doPerformanceTestL(const CContactViewBase &aLView); |
|
79 void RecoverCompressTestL(); |
|
80 void doRecoverCompressTestL(const CContactViewBase &aLView); |
|
81 void ConcurrentRecoverCompressTestL(); |
|
82 void doConcurrentRecoverCompressTestL(const CContactViewBase &aLView); |
|
83 void RecoverAndCompressThreadTestL(); |
|
84 |
|
85 //utility functions |
|
86 private: |
|
87 void CleanupL(); |
|
88 void InitializeL(); |
|
89 void ResetDatabaseL(const TInt aMany=0); |
|
90 TBool CheckViewContact(const CViewContact &aVContact, const TDesC &aVal); |
|
91 TBool CheckViewContactL(const CViewContact &aVContact); |
|
92 HBufC* FieldStringLC(const CContactItemField &aField); |
|
93 void ResetSortL(); |
|
94 void SetContactL(); |
|
95 TBool FindAndClearFieldL(const TContactItemId aCid, const TDesC &aField); |
|
96 TPtrC GetNextFieldL(); |
|
97 CContactViewBase* CreateViewL(); |
|
98 TPtrC GetFieldL(const TInt aIndex); |
|
99 void ClosePersistanceL(const TBool aReOpen); |
|
100 void OpenPersistanceL(); |
|
101 void SetMediumL(); |
|
102 void SetFullL(); |
|
103 void StartRecoverL(); |
|
104 void EndRecoverL(); |
|
105 void StartCompressL(); |
|
106 void EndCompressL(); |
|
107 static TInt ThreadRunL(TAny* aAny); |
|
108 |
|
109 //from MContactUiCompactObserver |
|
110 private: |
|
111 void Step(TInt ){} |
|
112 void HandleError(TInt aError); |
|
113 |
|
114 private: |
|
115 CViewObserver* iObserver; |
|
116 RContactViewSortOrder* iSortOrder; |
|
117 TBool iRemote; |
|
118 TTime iStartP; |
|
119 TTime iFinishP; |
|
120 TTime iStartC; |
|
121 FieldFullness iFullness; |
|
122 PerformanceContacts iPerformanceContacts; |
|
123 TBool iPLView;//run local view directly on top of the persistance layer, as used by view sub sessions within the server |
|
124 CPersistenceLayer* iPersistence; |
|
125 RPIMTestServer* iPimServ; |
|
126 CContactActiveRecover* iRecover; |
|
127 CContactActiveCompress* iCompress; |
|
128 CContactDatabase* iContactsDatabase2; |
|
129 TInt iError; |
|
130 TInt iIteration; |
|
131 TBool iRecoverFlag; |
|
132 RThread iThread; |
|
133 RSemaphore iSemaphore; |
|
134 RSemaphore iSemaphore2; |
|
135 TInt iDamageCounter; |
|
136 }; |
|
137 |
|
138 #endif |
|
139 |