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: Implementation of class CServicesDbApiTest |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SERVICESDBAPITEST_H |
|
21 #define SERVICESDBAPITEST_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <StifLogger.h> |
|
25 #include <TestScripterInternal.h> |
|
26 #include <StifTestModule.h> |
|
27 #include <TestclassAssert.h> |
|
28 #include <services_db.h> |
|
29 #include <ConeResLoader.h> |
|
30 #include <data_caging_path_literals.hrh> |
|
31 #include <StringLoader.h> |
|
32 #include <barsread.h> |
|
33 #include <eikenv.h> |
|
34 |
|
35 |
|
36 |
|
37 // MACROS |
|
38 #define TEST_CLASS_VERSION_MAJOR 0 |
|
39 #define TEST_CLASS_VERSION_MINOR 0 |
|
40 #define TEST_CLASS_VERSION_BUILD 0 |
|
41 |
|
42 // Logging path |
|
43 _LIT( KServicesDbApiTestLogPath, "\\logs\\testframework\\ServicesDbApiTest\\" ); |
|
44 // Log file |
|
45 _LIT( KServicesDbApiTestLogFile, "ServicesDbApiTest.txt" ); |
|
46 _LIT( KServicesDbApiTestLogFileWithTitle, "ServicesDbApiTest_[%S].txt" ); |
|
47 |
|
48 _LIT(KEmptyString,""); |
|
49 |
|
50 // FORWARD DECLARATIONS |
|
51 class CServicesDbApiTest; |
|
52 |
|
53 |
|
54 //Constants |
|
55 const TInt KNoOfServices = 3; // This is the number of services listed in resource file. |
|
56 const TInt KFirstOption = 0; |
|
57 const TInt KSecondOption = 1; |
|
58 const TInt KFirstServiceIndex = 0; |
|
59 const TInt KSecondServiceIndex = 1; |
|
60 const TInt KThirdServiceIndex=2; |
|
61 const TInt KFirstServiceUid = 257; |
|
62 const TInt KSecondServiceUid = 258; |
|
63 const TInt KThirdServiceUid = 259; |
|
64 const TInt KBufSize = 128; |
|
65 |
|
66 // CLASS DECLARATION |
|
67 |
|
68 /** |
|
69 * CServicesDbApiTest test class for STIF Test Framework TestScripter. |
|
70 * This class is written to test Services DB API. |
|
71 * |
|
72 * @lib ServicesDbApiTest.lib |
|
73 * @since ?Series60_version |
|
74 */ |
|
75 NONSHARABLE_CLASS(CServicesDbApiTest) : public CScriptBase |
|
76 { |
|
77 public: // Constructors and destructor |
|
78 |
|
79 /** |
|
80 * Two-phased constructor. |
|
81 */ |
|
82 static CServicesDbApiTest* NewL( CTestModuleIf& aTestModuleIf ); |
|
83 |
|
84 /** |
|
85 * Destructor. |
|
86 */ |
|
87 virtual ~CServicesDbApiTest(); |
|
88 |
|
89 |
|
90 public: // Functions from base classes |
|
91 |
|
92 /** |
|
93 * From CScriptBase Runs a script line. |
|
94 * @since ?Series60_version |
|
95 * @param aItem Script line containing method name and parameters |
|
96 * @return Symbian OS error code |
|
97 */ |
|
98 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
99 |
|
100 |
|
101 private: |
|
102 |
|
103 /** |
|
104 * C++ default constructor. |
|
105 */ |
|
106 CServicesDbApiTest( CTestModuleIf& aTestModuleIf ); |
|
107 |
|
108 /** |
|
109 * By default Symbian 2nd phase constructor is private. |
|
110 */ |
|
111 void ConstructL(); |
|
112 |
|
113 /** |
|
114 * Frees all resources allocated from test methods. |
|
115 * @since ?Series60_version |
|
116 */ |
|
117 void Delete(); |
|
118 |
|
119 /** |
|
120 * Test methods are listed below. |
|
121 */ |
|
122 |
|
123 /** |
|
124 * Method used to log version of test class |
|
125 */ |
|
126 void SendTestClassVersion(); |
|
127 |
|
128 //[TestMethods] |
|
129 |
|
130 /** |
|
131 * Creates CServicesDB object |
|
132 * @since ?Series60_version |
|
133 * @param aOption Option to create CServicesDB object using NewL or NewLC |
|
134 * @return Symbian OS error code. |
|
135 */ |
|
136 TInt CreateSeviceDBL(TInt aOption); |
|
137 |
|
138 /** |
|
139 * In this method NewLC is called. |
|
140 * @since ?Series60_version |
|
141 * @param aResReader Resource reader to get information from Resource file |
|
142 * @return Symbian OS error code. |
|
143 */ |
|
144 void CallNewlcL( TResourceReader aResReader ); |
|
145 |
|
146 /** |
|
147 * This method is used to test CServicesDB::NewL |
|
148 * @since ?Series60_version |
|
149 * @param No parameters required |
|
150 * @return Symbian OS error code. |
|
151 */ |
|
152 TInt InitializeSeviceDB( ); |
|
153 |
|
154 /** |
|
155 * This method is used to test CServicesDB::NewLC |
|
156 * @since ?Series60_version |
|
157 * @param No parameters required |
|
158 * @return Symbian OS error code. |
|
159 */ |
|
160 TInt InitializeonStackSeviceDB( ); |
|
161 |
|
162 /** |
|
163 * This method is used to test CServicesDB::Count |
|
164 * @since ?Series60_version |
|
165 * @param No parameters required |
|
166 * @return Symbian OS error code. |
|
167 */ |
|
168 TInt CountSeviceDB(); |
|
169 |
|
170 /** |
|
171 * This method is used to test CServicesDB::ServiceUidL |
|
172 * @since ?Series60_version |
|
173 * @param aItem Script line containing parameters. |
|
174 * @return Symbian OS error code. |
|
175 */ |
|
176 TInt ServiceUidLSeviceDB( CStifItemParser& aItem ); |
|
177 |
|
178 /** |
|
179 * This method is used to test CServicesDB::ServiceStringLC |
|
180 * with Index as parameter. |
|
181 * @since ?Series60_version |
|
182 * @param aItem Script line containing parameters. |
|
183 * @return Symbian OS error code. |
|
184 */ |
|
185 TInt ServiceStringLCSeviceDB( CStifItemParser& aItem ); |
|
186 |
|
187 /** |
|
188 * This method is used to test CServicesDB::ServiceStringLC |
|
189 * with UID as parameter |
|
190 * @since ?Series60_version |
|
191 * @param aItem Script line containing parameters. |
|
192 * @return Symbian OS error code. |
|
193 */ |
|
194 TInt ServiceStringLCuidSeviceDB( CStifItemParser& aItem ); |
|
195 |
|
196 /** |
|
197 * This method is used to test CServicesDB::ServiceNameLC |
|
198 * with Index as parameter |
|
199 * @since ?Series60_version |
|
200 * @param aItem Script line containing parameters. |
|
201 * @return Symbian OS error code. |
|
202 */ |
|
203 TInt ServiceNameLCSeviceDB( CStifItemParser& aItem ); |
|
204 |
|
205 /** |
|
206 * This method is used to test CServicesDB::ServiceNameLC |
|
207 * with UID as parameter |
|
208 * @since ?Series60_version |
|
209 * @param aItem Script line containing parameters. |
|
210 * @return Symbian OS error code. |
|
211 */ |
|
212 TInt ServiceNameLCuidSeviceDB( CStifItemParser& aItem ); |
|
213 |
|
214 /** |
|
215 * This is method encapsulates ServiceStringLC. |
|
216 * This method can be TRAPD and used to help in testing ServiceStringLC |
|
217 * @since ?Series60_version |
|
218 * @param aIndex the index of the service |
|
219 * @param aParam parameter for the localized string |
|
220 * @return Symbian OS error code. |
|
221 */ |
|
222 TInt CallServiceStringLCSeviceDBL(TInt aIndex,const TDes& aParam ); |
|
223 |
|
224 /** |
|
225 * This is method encapsulates ServiceStringLC. |
|
226 * This method can be TRAPD and used to help in testing ServiceStringLC |
|
227 * @since ?Series60_version |
|
228 * @param aServiceUid the Uid of the service |
|
229 * @param aParam parameter for the localized string |
|
230 * @return Symbian OS error code. |
|
231 */ |
|
232 TInt CallServiceStringLCuidSeviceDBL( TUid aServiceUid, const TDes& aParam); |
|
233 |
|
234 /** |
|
235 * This is method encapsulates ServiceNameLC. |
|
236 * This method can be TRAPD and used to help in testing ServiceNameLC |
|
237 * @since ?Series60_version |
|
238 * @param aIndex the index of the service |
|
239 * @return Symbian OS error code. |
|
240 */ |
|
241 TInt CallServiceNameLCSeviceDBL(TInt aIndex); |
|
242 |
|
243 /** |
|
244 * This is method encapsulates ServiceNameLC. |
|
245 * This method can be TRAPD and used to help in testing ServiceNameLC |
|
246 * @since ?Series60_version |
|
247 * @param aServiceUid the Uid of the service |
|
248 * @return Symbian OS error code. |
|
249 */ |
|
250 TInt CallServiceNameLCuidSeviceDBL( TUid aServiceUid ); |
|
251 |
|
252 |
|
253 private: // Data |
|
254 |
|
255 // This is the pointer to object of the class being tested |
|
256 // Through this pointer all the Exported methods are tested. |
|
257 CServicesDB *iServicesDB; |
|
258 |
|
259 |
|
260 }; |
|
261 |
|
262 #endif // SERVICESDBAPITEST_H |
|
263 |
|
264 // End of File |
|