|
1 // Copyright (c) 2001-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 <cntview.h> |
|
17 #include "t_utils2.h" |
|
18 #include "T_UTILS.H" |
|
19 |
|
20 |
|
21 // |
|
22 // Forward declarations. |
|
23 // |
|
24 |
|
25 class CViewTesterBase; |
|
26 |
|
27 |
|
28 // |
|
29 // CTestConductor. |
|
30 // |
|
31 |
|
32 class CTestConductor : public CBase |
|
33 { |
|
34 public: |
|
35 static CTestConductor* NewL(); |
|
36 ~CTestConductor(); |
|
37 void AddContactL(TInt aBitwiseFilterType); |
|
38 void SetTestError(TInt aTestError); |
|
39 private: |
|
40 CTestConductor(); |
|
41 void ConstructL(); |
|
42 void RunTestsL(); |
|
43 void AddContactsL(); |
|
44 private: |
|
45 RFs iFs; |
|
46 RTest iTest; |
|
47 CLog* iLog; |
|
48 CContactDatabase* iDb; |
|
49 CRandomContactGenerator* iRandomGenerator; |
|
50 TInt iTotalContacts; |
|
51 TInt iTestError; |
|
52 }; |
|
53 |
|
54 |
|
55 // |
|
56 // CViewTester. |
|
57 // |
|
58 |
|
59 class CViewTester : public CActive, public MContactViewObserver |
|
60 { |
|
61 public: |
|
62 static CViewTester* NewL(CLog& aLog,RTest& aTest,CContactDatabase& iDb,CTestConductor* aTestConductor); |
|
63 ~CViewTester(); |
|
64 private: |
|
65 CViewTester(CLog& aLog,RTest& aTest,CContactDatabase& iDb,CTestConductor* aTestConductor); |
|
66 void ConstructL(); |
|
67 void NextTest(); |
|
68 void ExceriseViewL(CContactViewBase& aView); |
|
69 private: // From CActive. |
|
70 void RunL(); |
|
71 TInt RunError(TInt aError); |
|
72 void DoCancel(); |
|
73 private: // From MContactViewObserver. |
|
74 virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent); |
|
75 private: |
|
76 void TestViewNotificationsL(CContactViewBase& aView); |
|
77 private: |
|
78 TBool ContactIdsEqualL(const CContactViewBase& aView, TInt aIndex); |
|
79 void TestViewIndiciesL(const CContactViewBase& aView); |
|
80 void PrintTimeTaken(TInt aProfile); |
|
81 void PrintTotalTimeTaken(); |
|
82 |
|
83 void ProfileContactMatchingPrefixL(TInt aNumberOfS, CContactFilteredView* aContactFilterView); |
|
84 void ProfileContactMatchingCriteriaL(TInt aNumberOfS, CContactFilteredView* aContactFilterView); |
|
85 |
|
86 private: |
|
87 enum TTest |
|
88 { |
|
89 ECreateLocalView, |
|
90 ECreateUnfilteredView, |
|
91 ECreateLandlineFilterView, |
|
92 ETestContactsMatchingPrefixL_LandLine, |
|
93 ETestContactsMatchingPrefixL_Unfiltered, |
|
94 ETestContactsMatchingCriteriaL_LandLine, |
|
95 ETestContactsMatchingCriteriaL_Unfiltered, |
|
96 ENumTests |
|
97 }; |
|
98 |
|
99 private: |
|
100 CLog& iLog; |
|
101 RTest& iTest; |
|
102 CContactDatabase& iDb; |
|
103 TInt iCurrentTest; |
|
104 RContactViewSortOrder iSortOrder_1; |
|
105 RContactViewSortOrder iSortOrder_2; |
|
106 CContactTextDef* iTextDef; |
|
107 TBuf<128> iScratchBuf; |
|
108 CContactNamedRemoteView* iNamedRemoteView; |
|
109 CContactFilteredView* iLandlineFilterView; |
|
110 CContactFilteredView* iUnfilteredView; |
|
111 TInt iFilter; |
|
112 TInt iNumNotificationExpected; |
|
113 CTestConductor* iTestConductor; |
|
114 TInt iItemEventsExpected; |
|
115 TInt iItemsEventsRecieved; |
|
116 TInt iTimeForTestsToComplete[ENumTests]; |
|
117 TCntProfile iProfile; |
|
118 }; |