|
1 /* |
|
2 * Copyright (c) 2002 - 2007 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: Header file for client test suite |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef PS_CLIENT_TEST_SUITE_H |
|
20 #define PS_CLIENT_TEST_SUITE_H |
|
21 |
|
22 // SYSTEM INCLUDES |
|
23 #include <StifLogger.h> |
|
24 #include <TestScripterInternal.h> |
|
25 #include <StifTestModule.h> |
|
26 #include <MPsResultsObserver.h> |
|
27 #include <CPcsDefs.h> |
|
28 |
|
29 // USER INCLUDES |
|
30 #include "TestSuiteInputData.h" |
|
31 #include "psclienttestsuitedefs.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CPcsTestContactsHandler; |
|
35 class CPsQuery; |
|
36 class CPSRequestHandler; |
|
37 class CPsSettings; |
|
38 |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 /** |
|
43 * CPsClientTestSuite test class for STIF Test Framework TestScripter. |
|
44 * @since S60 v3.2 |
|
45 */ |
|
46 |
|
47 NONSHARABLE_CLASS(CPsClientTestSuite) : public CScriptBase, public MPsResultsObserver |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * First phase constructor constructor. |
|
53 */ |
|
54 static CPsClientTestSuite* NewL( CTestModuleIf& aTestModuleIf ); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 virtual ~CPsClientTestSuite(); |
|
60 |
|
61 |
|
62 |
|
63 public: // Functions from base classes |
|
64 |
|
65 /** |
|
66 * From CScriptBase Runs a script line. |
|
67 * |
|
68 * @param aItem Script line containing method name and parameters |
|
69 * @return Symbian OS error code |
|
70 */ |
|
71 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
72 |
|
73 public: // Function from base class MPsResultsObserver |
|
74 /** |
|
75 * HandlePsResultsUpdateL. |
|
76 * Handle updates from the Ps server. |
|
77 * |
|
78 * @param searchResults Search results returned from the server. |
|
79 * @param searchSeqs List of matching character sequences. |
|
80 */ |
|
81 void HandlePsResultsUpdate(RPointerArray<CPsClientData>& searchResults, |
|
82 RPointerArray<CPsPattern>& searchSeqs); |
|
83 |
|
84 /** |
|
85 * HandlePsError. |
|
86 * Handle errors from the server. |
|
87 * |
|
88 * @param aErrorCode Search errors returned from the server. |
|
89 */ |
|
90 void HandlePsError(TInt aErrorCode); |
|
91 |
|
92 /** |
|
93 * CachingStatus |
|
94 * Gets called when caching is completed. |
|
95 * Observers need to implement this function accordingly |
|
96 * to take action after cache completion |
|
97 * |
|
98 * @param aStatus - caching status, |
|
99 * 20 - Caching completes succesfully, |
|
100 * 30 - Caching completed with errors |
|
101 * @param aError - Any error that occurred while caching. KErrNone if no error else the error code |
|
102 */ |
|
103 void CachingStatus(TCachingStatus& aStatus, TInt& aError); |
|
104 |
|
105 |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * C++ default constructor. |
|
111 */ |
|
112 CPsClientTestSuite( CTestModuleIf& aTestModuleIf ); |
|
113 |
|
114 /** |
|
115 * Symbian 2nd phase constructor. |
|
116 */ |
|
117 void ConstructL(); |
|
118 |
|
119 /** |
|
120 * Frees all resources allocated from test methods. |
|
121 * |
|
122 */ |
|
123 void Delete(); |
|
124 |
|
125 |
|
126 |
|
127 private: //Test cases |
|
128 |
|
129 /** |
|
130 * This method writes the test case title to the log file |
|
131 */ |
|
132 TInt WriteTitleToLog( ); |
|
133 |
|
134 /** |
|
135 * This test case creates contacts in the phonebook |
|
136 * |
|
137 * @param aItem Script line containing parameters. |
|
138 */ |
|
139 TInt CreateContactsL( CStifItemParser& aItem ); |
|
140 |
|
141 /** |
|
142 * This test case creates groups in the phonebook. It creats only |
|
143 * empty groups, i.e the groups do not have any members. |
|
144 * |
|
145 * @param aItem Script line containing parameters. |
|
146 */ |
|
147 TInt CreateGroupsInPhoneL( CStifItemParser& aItem ); |
|
148 |
|
149 /** |
|
150 * This test case fires a search query to the psengine |
|
151 * |
|
152 * @param aItem Script line containing parameters. |
|
153 * @return - error status - KErrNone if test case is successful |
|
154 */ |
|
155 TInt SearchCacheL( CStifItemParser& aItem ); |
|
156 |
|
157 /** |
|
158 * This test case cancels a search query to the psengine |
|
159 * |
|
160 * |
|
161 * @param aItem Script line containing parameters. |
|
162 * @return - error status - KErrNone if test case is successful |
|
163 */ |
|
164 TInt CancelSearchL( CStifItemParser& aItem ); |
|
165 |
|
166 /** |
|
167 * This test case searches for a query in the given input string |
|
168 * |
|
169 * @param aItem Script line containing parameters. |
|
170 * @return - error status - KErrNone if test case is successful |
|
171 */ |
|
172 TInt SearchOnInputStringL(CStifItemParser& aItem); |
|
173 |
|
174 /** |
|
175 * This test case searches for a query with LookupMatch |
|
176 * and ensures the result string is correct |
|
177 * |
|
178 * @param aItem Script line containing parameters. |
|
179 * @return - error status - KErrNone if test case is successful |
|
180 */ |
|
181 TInt SearchLookupMatchStringL(CStifItemParser& aItem); |
|
182 |
|
183 /** |
|
184 * This method deletes all the contacts in the phonebook |
|
185 * |
|
186 * @param aItem Script line containing parameters. |
|
187 * @return - error status - KErrNone if test case is successful |
|
188 */ |
|
189 TInt DeleteAllContactsInPhonebookL(CStifItemParser& aItem); |
|
190 |
|
191 /** |
|
192 * This method checks the caching status |
|
193 * |
|
194 * @return - error status - KErrNone if test case is successful |
|
195 */ |
|
196 TInt CheckCachingStatusL(); |
|
197 |
|
198 |
|
199 /** |
|
200 * This method checks the version of the ps server |
|
201 * |
|
202 * @return - error status - KErrNone if test case is successful |
|
203 */ |
|
204 TInt CheckVersion(); |
|
205 |
|
206 /** |
|
207 * This method checks if a particular language is supported by the ps server |
|
208 * |
|
209 * @return - error status - KErrNone if test case is successful |
|
210 */ |
|
211 TInt TestIsLanguageSupportedL(CStifItemParser& aItem); |
|
212 |
|
213 /** |
|
214 * This method waits for time equal to the input parameter |
|
215 * @param aInterval The wait interval |
|
216 */ |
|
217 void RTimerWait(TTimeIntervalMicroSeconds32 aInterval); |
|
218 |
|
219 /** |
|
220 * This method checks gets all the contents from a particular URI (as specified in the configuration) |
|
221 * |
|
222 * @return - error status - KErrNone if test case is successful |
|
223 */ |
|
224 TInt GetAllContentsL( CStifItemParser& aItem ); |
|
225 |
|
226 /** |
|
227 * This method searches in a particular group. The group name is given as a |
|
228 * configuration parameter. |
|
229 * |
|
230 * @return - error status - KErrNone if test case is successful |
|
231 */ |
|
232 TInt SearchWithInGroupL(CStifItemParser& aItem ); |
|
233 |
|
234 |
|
235 /** |
|
236 * This method tests the sort order |
|
237 * |
|
238 * @return - error status - KErrNone if test case is successful |
|
239 */ |
|
240 TInt TestSortOrderL( CStifItemParser& aItem ); |
|
241 |
|
242 /** |
|
243 * This method tests the sort order for error case |
|
244 * |
|
245 * @return - error status - KErrNone if test case is successful |
|
246 */ |
|
247 TInt TestSortOrderErrCaseL( CStifItemParser& aItem ); |
|
248 /** |
|
249 * This method removes the observer from ps searchengine |
|
250 * |
|
251 * @return - error status - KErrNone if test case is successful |
|
252 */ |
|
253 TInt RemoveObserverL(CStifItemParser& aItem); |
|
254 |
|
255 /** |
|
256 * Tests if contact Id returns correct vpbklink |
|
257 * |
|
258 * @return - - error status - KErrNone if test case is successful |
|
259 */ |
|
260 TInt ConvertToVpbkLinkL(CStifItemParser& aItem); |
|
261 |
|
262 /** |
|
263 * Tests for bookmarked contacts |
|
264 * |
|
265 * @return error status - KErrNone if test case is successful |
|
266 */ |
|
267 TInt AddMarkedContactsTestL(CStifItemParser& aItem); |
|
268 |
|
269 /** |
|
270 * Tests for data order |
|
271 * |
|
272 * @return error status - KErrNone if test case is successful |
|
273 */ |
|
274 TInt TestDataOrderL(CStifItemParser& aItem); |
|
275 |
|
276 /** |
|
277 * Tests for data order |
|
278 * |
|
279 * @return error status - KErrNone if test case is successful |
|
280 */ |
|
281 TInt TestDataOrderForErrL(CStifItemParser& aItem); |
|
282 |
|
283 |
|
284 /** |
|
285 * This method shuts the server down |
|
286 * |
|
287 * @return - error status - KErrNone if test case is successful |
|
288 */ |
|
289 TInt ShutDownL(); |
|
290 |
|
291 private: // Data |
|
292 |
|
293 /** |
|
294 * The input data parser |
|
295 * own |
|
296 */ |
|
297 CTestSuiteInputData* iInputParsedData; |
|
298 |
|
299 /** |
|
300 * The search query |
|
301 */ |
|
302 CPsQuery *iPsQuery; |
|
303 |
|
304 /** |
|
305 * The CPSRequestHandler instance |
|
306 */ |
|
307 CPSRequestHandler* iPsClientHandler; |
|
308 |
|
309 /** |
|
310 * The search settings |
|
311 */ |
|
312 CPsSettings* iSettings ; |
|
313 |
|
314 /** |
|
315 * The error return status |
|
316 */ |
|
317 TInt iReturnStatus; |
|
318 |
|
319 /** |
|
320 * The group Id of the group name entered in the configuration file |
|
321 */ |
|
322 TInt iGroupToBeSearchedId; |
|
323 |
|
324 /** |
|
325 * The current operation being performed |
|
326 */ |
|
327 TTestCase iCurrentOperation; |
|
328 |
|
329 /** |
|
330 * RTimer variable to set the timer before RunL calls any function. |
|
331 * This is required to allow other threads to run since contact fetch |
|
332 * is CPU intensive task. |
|
333 */ |
|
334 RTimer iTimer; |
|
335 |
|
336 /** |
|
337 * The caching status of the psengine |
|
338 */ |
|
339 TCachingStatus iCachingStatus; |
|
340 |
|
341 /** |
|
342 * The marked contacts |
|
343 */ |
|
344 RPointerArray<CPsClientData> iMarkedContacts; |
|
345 |
|
346 }; |
|
347 |
|
348 #endif // PS_CLIENT_TEST_SUITE_H |
|
349 |
|
350 // End of File |