|
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 |
|
19 |
|
20 // |
|
21 // Forward declarations. |
|
22 // |
|
23 |
|
24 class CViewTesterBase; |
|
25 |
|
26 |
|
27 // |
|
28 // CTestConductor. |
|
29 // |
|
30 |
|
31 class CTestConductor : public CBase |
|
32 { |
|
33 public: |
|
34 static CTestConductor* NewL(RTest& aTest); |
|
35 ~CTestConductor(); |
|
36 void AddContactL(TInt aBitwiseFilterType); |
|
37 void SetTestError(TInt aTestError); |
|
38 private: |
|
39 CTestConductor(RTest& aTest); |
|
40 void ConstructL(); |
|
41 void RunTestsL(); |
|
42 void AddContactsL(); |
|
43 void AddContactsThatMatchFilterL(TInt aNumberOfContacts, TInt aFilter); |
|
44 private: |
|
45 RTest& iTest; |
|
46 CContactDatabase* iDb; |
|
47 CRandomContactGenerator* iRandomGenerator; |
|
48 TInt iTestError; |
|
49 }; |
|
50 |
|
51 |
|
52 // |
|
53 // CViewTester. |
|
54 // |
|
55 |
|
56 class CViewTester : public CActive, public MContactViewObserver |
|
57 { |
|
58 |
|
59 public: // Construction |
|
60 static CViewTester* NewL(RTest& aTest, CContactDatabase& iDb, CTestConductor& aTestConductor); |
|
61 ~CViewTester(); |
|
62 private: |
|
63 CViewTester(RTest& aTest, CContactDatabase& iDb, CTestConductor& aTestConductor); |
|
64 void ConstructL(); |
|
65 |
|
66 public: |
|
67 void StartTest(); |
|
68 |
|
69 private: // Functionality. |
|
70 virtual void RunL(); |
|
71 TInt RunError(TInt aError); |
|
72 virtual void DoCancel(); |
|
73 virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent); |
|
74 |
|
75 private: // utility |
|
76 void NextState(); |
|
77 void CallRunLAgain(); |
|
78 |
|
79 private: // data type definitions |
|
80 enum TState |
|
81 { |
|
82 ECreate_RemoteView, |
|
83 EWait_RemoteView, |
|
84 ECreate_FilteredView, |
|
85 EWait_FilteredView, |
|
86 EChangeSortOrder, |
|
87 EWait_SortViewEvents, |
|
88 EFinished |
|
89 }; |
|
90 |
|
91 private: // member data |
|
92 RTest& iTest; |
|
93 CContactDatabase& iDb; |
|
94 CTestConductor& iTestConductor; |
|
95 TState iState; |
|
96 RTimer iTimer; |
|
97 |
|
98 RContactViewSortOrder iSortOrder[2]; |
|
99 |
|
100 CContactNamedRemoteView* iNamedRemoteView; |
|
101 CContactFilteredView* iFilteredView; |
|
102 TContactViewEvent::TEventType iRemoteViewEvent; |
|
103 TContactViewEvent::TEventType iFilteredViewEvent; |
|
104 }; |