|
1 // Copyright (c) 2002-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 class CDatabaseTesterBase; |
|
20 |
|
21 class CTestConductor : public CBase |
|
22 { |
|
23 public: |
|
24 static CTestConductor* NewL(TBool aKillFourTimes); |
|
25 ~CTestConductor(); |
|
26 void SetTestError(TInt aTestError); |
|
27 private: |
|
28 CTestConductor(TBool aKillFourTimes); |
|
29 void ConstructL(); |
|
30 void RunTestsL(); |
|
31 private: |
|
32 RFs iFs; |
|
33 CLog* iLog; |
|
34 CContactDatabase* iDb; |
|
35 TBool iKillFourTimes; |
|
36 CTestRegister* iTempFiles; |
|
37 TInt iTestError; |
|
38 }; |
|
39 |
|
40 class CDatabaseTester : public CActive |
|
41 { |
|
42 public: |
|
43 static CDatabaseTester* NewL(CLog& aLog,CContactDatabase& iDb,CTestConductor* aTestConductor, TBool aKillFourTimes); |
|
44 ~CDatabaseTester(); |
|
45 private: |
|
46 CDatabaseTester(CLog& aLog,CContactDatabase& iDb,CTestConductor* aTestConductor, TBool aKillFourTimes); |
|
47 void ConstructL(); |
|
48 void NextTest(); |
|
49 void AddContactsL(); |
|
50 private: // From CActive. |
|
51 void RunL(); |
|
52 TInt RunError(TInt aError); |
|
53 void DoCancel(); |
|
54 private: |
|
55 void FindServerAndKillItL(TInt aDelay); |
|
56 void SetupThreadL(); |
|
57 void SetupProcessL(); |
|
58 void DeleteThread(); |
|
59 void DeleteProcess(); |
|
60 void OpenAndKillProcess(); |
|
61 void OpenAndKillThread(); |
|
62 void WaitForServerToClose(); |
|
63 void AddContactL(TInt aBitwiseFilterType); |
|
64 |
|
65 private: |
|
66 enum TTest |
|
67 { |
|
68 EInitialisingTests, |
|
69 EAddContacts, |
|
70 EKillThreadFirstTime, |
|
71 ERemoveContacts, |
|
72 EKillThreadSecondTime, |
|
73 EAddMoreContacts, |
|
74 EKillThreadThirdTime, |
|
75 ERemoveMoreContacts, |
|
76 EKillThreadForthTime, |
|
77 ENumTests |
|
78 }; |
|
79 private: |
|
80 CLog& iLog; |
|
81 CContactDatabase& iDb; |
|
82 TTest iCurrentTest; |
|
83 TBuf<128> iScratchBuf; |
|
84 TInt iFilter; |
|
85 TInt iNumNotificationExpected; |
|
86 CTestConductor* iTestConductor; |
|
87 TInt iItemEventsExpected; |
|
88 TInt iItemsEventsRecieved; |
|
89 CRandomContactGenerator* iRandomGenerator; |
|
90 TInt iTotalContacts; |
|
91 TBool iKillFourTimes; |
|
92 private: |
|
93 union |
|
94 { |
|
95 struct |
|
96 { |
|
97 TFindThread* iFind; |
|
98 RThread* iExecution; |
|
99 } iThread; |
|
100 struct |
|
101 { |
|
102 TFindProcess* iFind; |
|
103 RProcess* iExecution; |
|
104 } iProcess; |
|
105 } iProcessOrThread; |
|
106 TFullName iProcessOrThreadFullName; |
|
107 |
|
108 }; |