|
1 /* |
|
2 * Copyright (c) 2002 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: The class handles the test case running. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TESTRUNNER_H |
|
20 #define TESTRUNNER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <f32file.h> |
|
24 #include <e32test.h> |
|
25 #include "IMApiMTHandlers.h" |
|
26 #include "StifTestModule.h" |
|
27 #include <StifLogger.h> |
|
28 #include <badesca.h> |
|
29 |
|
30 #include <cntdb.h> |
|
31 #include <cntfield.h> |
|
32 #include <cntfldst.h> |
|
33 #include <cntitem.h> |
|
34 #include <commdb.h> |
|
35 |
|
36 |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class CTestRunner; |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 class CErrorHandler; |
|
43 class CAccessHandler; |
|
44 class CTestIdleTimer; |
|
45 class CTestTimer; |
|
46 class CPureHandler; |
|
47 |
|
48 // ENUMS |
|
49 |
|
50 enum TWhichCase |
|
51 { |
|
52 InvalidLogin = 1, |
|
53 Login, |
|
54 SendMessageValidUserId, |
|
55 SendMessageValidTwoUserId, |
|
56 SendMessageValidContact, |
|
57 SendMessageValidTwoContact, |
|
58 SendPToPContactContentType, |
|
59 SendPToPUserIDContentType, |
|
60 Logout, |
|
61 CancelLogin, |
|
62 Finish |
|
63 }; |
|
64 |
|
65 |
|
66 // CONSTANTS |
|
67 const TInt KImpsMaxLen = 100; |
|
68 const TInt KImpsMaxSapLen = 100; |
|
69 const TInt KImpsMaxUserIdLen = 50; |
|
70 const TInt KImpsMaxClientIdLen = 64; // maximum Client ID, this is not sure! |
|
71 |
|
72 |
|
73 // CLASS DECLARATIONS |
|
74 |
|
75 |
|
76 class CTestRunner : public CActive |
|
77 { |
|
78 public: |
|
79 /** |
|
80 * Static factory method, |
|
81 * |
|
82 * Entry point into Symbian's 2 phase construction pattern. |
|
83 */ |
|
84 static CTestRunner* NewL(); |
|
85 |
|
86 /** |
|
87 * Destructor. |
|
88 */ |
|
89 virtual ~CTestRunner(); |
|
90 |
|
91 /** |
|
92 * Start the execution. |
|
93 */ |
|
94 void StartRunL( TWhichCase aCase ); |
|
95 |
|
96 CContactIdArray* GetWVContactIdsLC(); |
|
97 |
|
98 /** |
|
99 * Symbian's 2 phase construction pattern. |
|
100 */ |
|
101 void ConstructL( ); |
|
102 |
|
103 TInt CreateInstanceL(); |
|
104 TInt RegisterConnObserverL(); |
|
105 TInt LoadIMInterfaceL(); |
|
106 TInt IMRegisterL(); |
|
107 TInt LoginL( const TDesC& aUserID ); |
|
108 TInt SendPToPValidUserIDL(); |
|
109 TInt SendPToPValidTwoUserIDL(); |
|
110 TInt SendPToPValidContactL(); |
|
111 TInt SendPToPValidTwoContactL(); |
|
112 TInt SendPToPContactContentTypeL(); |
|
113 TInt SendPToPUserIDContentTypeL(); |
|
114 TInt QueryIMConnectionStatusL(); |
|
115 TInt CancelLoginL(); |
|
116 |
|
117 void GetDefaultAccessPoint(); |
|
118 |
|
119 void ReadIniFileL(); |
|
120 TBuf<KImpsMaxSapLen> iSapValue; |
|
121 TBuf<KImpsMaxUserIdLen> iUserIdValue; |
|
122 TBuf<KImpsMaxLen> iPassword; |
|
123 TBuf<KImpsMaxClientIdLen> iClientId; // 1.3 Client ID Implementation |
|
124 TBuf<KImpsMaxLen> iUserId1; |
|
125 TBuf<KImpsMaxLen> iUserId2; |
|
126 TInt iIAP; |
|
127 |
|
128 public: // Functions from base classes |
|
129 |
|
130 /** |
|
131 * Active object completion |
|
132 */ |
|
133 void RunL(); |
|
134 /** |
|
135 * Active object cancellation |
|
136 */ |
|
137 void DoCancel(); |
|
138 |
|
139 private: |
|
140 |
|
141 // By default, prohibit copy constructor |
|
142 CTestRunner( const CTestRunner& ); |
|
143 |
|
144 // Prohibit assigment operator |
|
145 CTestRunner& operator= ( const CTestRunner& ); |
|
146 |
|
147 /** |
|
148 * C-style constructor. |
|
149 */ |
|
150 CTestRunner(); |
|
151 |
|
152 // actual runner, that is leave trapped |
|
153 void DoRunL(); |
|
154 |
|
155 private: // Data |
|
156 |
|
157 TWhichCase iCase; |
|
158 CIMApiClientHandler* iImObserver; //earlier code |
|
159 //MImObserver* iImObserver; |
|
160 CConnectionObserver* iConnObserver; |
|
161 CImConnection* iOpenApi; |
|
162 MImClient* iImClient; |
|
163 CStifLogger* iLog; |
|
164 CContactDatabase* iDatabase; |
|
165 }; |
|
166 |
|
167 |
|
168 |
|
169 class CTestScheduler : public CActiveScheduler |
|
170 { |
|
171 public: |
|
172 void Error ( TInt aError ) const; |
|
173 }; |
|
174 |
|
175 class CTestLogger1 : public CBase |
|
176 { |
|
177 public: |
|
178 //IMPORT_C static void CTestLogger::Log(TRefByValue<const TDesC> aFmt,...); |
|
179 IMPORT_C static void Log( TRefByValue<const TDesC> aFmt, ... ); |
|
180 }; |
|
181 |
|
182 #endif |