|
1 /* |
|
2 * Copyright (c) 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 the License "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: Widget Registry test module. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef WIDGETREGISTRYSTIF_H |
|
21 #define WIDGETREGISTRYSTIF_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <WidgetRegistryClient.h> |
|
25 #include <StifTestModule.h> |
|
26 #include <StifLogger.h> |
|
27 #include <f32file.h> |
|
28 |
|
29 |
|
30 // CONSTANTS |
|
31 _LIT( KTestDbName, "Test" ); |
|
32 |
|
33 // MACROS |
|
34 |
|
35 // Logging path |
|
36 _LIT( KWidgetRegistrySTIFLogPath, "\\logs\\testframework\\" ); |
|
37 // Log file |
|
38 _LIT( KWidgetRegistrySTIFLogFile, "WidgetRegistrySTIF.txt" ); |
|
39 |
|
40 // DATA TYPES |
|
41 |
|
42 // FUNCTION PROTOTYPES |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 class CWidgetRegistrySTIF; |
|
46 |
|
47 // A typedef for function that does the actual testing, |
|
48 // function is a type |
|
49 // TInt CDemoModule::<NameOfFunction> ( TTestResult& aResult ) |
|
50 typedef TInt (CWidgetRegistrySTIF::* TestFunction)(TTestResult&); |
|
51 |
|
52 // CLASS DECLARATION |
|
53 |
|
54 /** |
|
55 * An internal structure containing a test case name and |
|
56 * the pointer to function doing the test |
|
57 * |
|
58 * @since 5.0 |
|
59 */ |
|
60 class TCaseInfoInternal |
|
61 { |
|
62 public: |
|
63 const TText* iCaseName; |
|
64 TestFunction iMethod; |
|
65 TBool iIsOOMTest; |
|
66 TInt iFirstMemoryAllocation; |
|
67 TInt iLastMemoryAllocation; |
|
68 }; |
|
69 |
|
70 // CLASS DECLARATION |
|
71 |
|
72 /** |
|
73 * A structure containing a test case name and |
|
74 * the pointer to function doing the test |
|
75 * |
|
76 * @since 5.0 |
|
77 */ |
|
78 class TCaseInfo |
|
79 { |
|
80 public: |
|
81 TPtrC iCaseName; |
|
82 TestFunction iMethod; |
|
83 TBool iIsOOMTest; |
|
84 TInt iFirstMemoryAllocation; |
|
85 TInt iLastMemoryAllocation; |
|
86 |
|
87 TCaseInfo( const TText* a ) : iCaseName( (TText*) a ) |
|
88 { |
|
89 }; |
|
90 }; |
|
91 |
|
92 // CLASS DECLARATION |
|
93 |
|
94 /** |
|
95 * This a WidgetRegistrySTIF class. |
|
96 * |
|
97 * @since 5.0 |
|
98 */ |
|
99 NONSHARABLE_CLASS(CWidgetRegistrySTIF) : public CTestModuleBase |
|
100 { |
|
101 public: // Constructors and destructor |
|
102 |
|
103 /** |
|
104 * Two-phased constructor. |
|
105 */ |
|
106 static CWidgetRegistrySTIF* NewL(); |
|
107 |
|
108 /** |
|
109 * Destructor. |
|
110 */ |
|
111 virtual ~CWidgetRegistrySTIF(); |
|
112 |
|
113 public: // Functions from base classes |
|
114 |
|
115 /** |
|
116 * From CTestModuleBase InitL is used to initialize the WidgetRegistrySTIF. |
|
117 * It is called once for every instance of WidgetRegistrySTIF after |
|
118 * its creation. |
|
119 * @since 5.0 |
|
120 * @param aIniFile Initialization file for the test module (optional) |
|
121 * @param aFirstTime Flag is true when InitL is executed for first |
|
122 * created instance of WidgetRegistrySTIF. |
|
123 * @return Symbian OS error code |
|
124 */ |
|
125 TInt InitL( TFileName& aIniFile, TBool aFirstTime ); |
|
126 |
|
127 /** |
|
128 * From CTestModuleBase GetTestCasesL is used to inquiry test cases |
|
129 * from WidgetRegistrySTIF. |
|
130 * @since 5.0 |
|
131 * @param aTestCaseFile Test case file (optional) |
|
132 * @param aTestCases Array of TestCases returned to test framework |
|
133 * @return Symbian OS error code |
|
134 */ |
|
135 TInt GetTestCasesL( const TFileName& aTestCaseFile, |
|
136 RPointerArray<TTestCaseInfo>& aTestCases ); |
|
137 |
|
138 /** |
|
139 * From CTestModuleBase RunTestCaseL is used to run an individual |
|
140 * test case. |
|
141 * @since 5.0 |
|
142 * @param aCaseNumber Test case number |
|
143 * @param aTestCaseFile Test case file (optional) |
|
144 * @param aResult Test case result returned to test framework (PASS/FAIL) |
|
145 * @return Symbian OS error code (test case execution error, which is |
|
146 * not reported in aResult parameter as test case failure). |
|
147 */ |
|
148 TInt RunTestCaseL( const TInt aCaseNumber, |
|
149 const TFileName& aTestCaseFile, |
|
150 TTestResult& aResult ); |
|
151 |
|
152 /** |
|
153 * From CTestModuleBase; OOMTestQueryL is used to specify is particular |
|
154 * test case going to be executed using OOM conditions |
|
155 * @param aTestCaseFile Test case file (optional) |
|
156 * @param aCaseNumber Test case number (optional) |
|
157 * @param aFailureType OOM failure type (optional) |
|
158 * @param aFirstMemFailure The first heap memory allocation failure value (optional) |
|
159 * @param aLastMemFailure The last heap memory allocation failure value (optional) |
|
160 * @return TBool |
|
161 */ |
|
162 virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, |
|
163 const TInt /* aCaseNumber */, |
|
164 TOOMFailureType& /* aFailureType */, |
|
165 TInt& /* aFirstMemFailure */, |
|
166 TInt& /* aLastMemFailure */ ); |
|
167 |
|
168 /** |
|
169 * From CTestModuleBase; User may add implementation for OOM test |
|
170 * environment initialization. Usually no implementation is required. |
|
171 * @param aTestCaseFile Test case file (optional) |
|
172 * @param aCaseNumber Test case number (optional) |
|
173 * @return None |
|
174 */ |
|
175 virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, |
|
176 const TInt /* aCaseNumber */ ); |
|
177 |
|
178 /** |
|
179 * From CTestModuleBase; OOMHandleWarningL. User may add implementation |
|
180 * for OOM test warning handling. Usually no implementation is required. |
|
181 * @param aTestCaseFile Test case file (optional) |
|
182 * @param aCaseNumber Test case number (optional) |
|
183 * @param aFailNextValue FailNextValue for OOM test execution (optional) |
|
184 * @return None |
|
185 */ |
|
186 virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */, |
|
187 const TInt /* aCaseNumber */, |
|
188 TInt& /* aFailNextValue */); |
|
189 |
|
190 /** |
|
191 * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM |
|
192 * test environment. Usually no implementation is required. |
|
193 * @param aTestCaseFile Test case file (optional) |
|
194 * @param aCaseNumber Test case number (optional) |
|
195 * @return None |
|
196 */ |
|
197 virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, |
|
198 const TInt /* aCaseNumber */ ); |
|
199 |
|
200 private: |
|
201 |
|
202 /** |
|
203 * C++ default constructor. |
|
204 */ |
|
205 CWidgetRegistrySTIF(); |
|
206 |
|
207 /** |
|
208 * By default Symbian 2nd phase constructor is private. |
|
209 */ |
|
210 void ConstructL(); |
|
211 |
|
212 /** |
|
213 * Function returning test case name and pointer to test case function. |
|
214 * @since ?Series60_version |
|
215 * @param aCaseNumber test case number |
|
216 * @return TCaseInfo |
|
217 */ |
|
218 const TCaseInfo Case( const TInt aCaseNumber ) const; |
|
219 |
|
220 private: // tests |
|
221 |
|
222 // client session tests |
|
223 TInt ForceFailedL( TTestResult& aResult ); |
|
224 TInt ClientSessionCreateL( TTestResult& aResult ); |
|
225 TInt ClientSessionDisconnectFirstL( TTestResult& aResult ); |
|
226 TInt ClientSessionConnectL( TTestResult& aResult ); |
|
227 TInt ClientSessionTwoConnectL( TTestResult& aResult ); |
|
228 TInt ClientSessionDisconnectL( TTestResult& aResult ); |
|
229 TInt ClientSessionVersionL( TTestResult& aResult ); |
|
230 TInt ClientSessionIsWidgetNullL( TTestResult& aResult ); |
|
231 TInt ClientSessionIsWidgetInvalidL( TTestResult& aResult ); |
|
232 TInt ClientSessionIsWidgetValidL( TTestResult& aResult ); |
|
233 TInt ClientSessionWidgetExistsL( TTestResult& aResult ); |
|
234 TInt ClientSessionIsWidgetRunningNullL( TTestResult& aResult ); |
|
235 TInt ClientSessionIsWidgetRunningValidL( TTestResult& aResult ); |
|
236 TInt ClientSessionIsWidgetRunningInvalidL( TTestResult& aResult ); |
|
237 TInt ClientSessionWidgetCountL( TTestResult& aResult ); |
|
238 |
|
239 TInt ClientSessionWidgetExistsOverflowL(TTestResult& aResult); |
|
240 TInt ClientSessionWidgetExistsValidL(TTestResult& aResult); |
|
241 TInt ClientSessionGetWidgetPathL( TTestResult& aResult ); |
|
242 TInt ClientSessionGetWidgetUidL( TTestResult& aResult ); |
|
243 TInt ClientSessionGetWidgetUidValidL( TTestResult& aResult ); |
|
244 TInt ClientSessionGetWidgetUidForUrlL( TTestResult& aResult ); |
|
245 TInt ClientSessionGetAvailableUidL( TTestResult& aResult ); |
|
246 TInt ClientSessionGetAvailableUidNullL( TTestResult& aResult ); |
|
247 TInt ClientSessionGetWidgetBundleIdL( TTestResult& aResult ); |
|
248 TInt ClientSessionGetWidgetBundleNameL( TTestResult& aResult ); |
|
249 TInt ClientSessionGetWidgetPropertyValueL( TTestResult& aResult ); |
|
250 TInt ClientSessionInstalledWidgetsL( TTestResult& aResult ); |
|
251 TInt ClientSessionRunningWidgetsL( TTestResult& aResult ); |
|
252 TInt ClientSessionRegisterWidgetL( TTestResult& aResult ); |
|
253 TInt ClientSessionDeRegisterWidgetL( TTestResult& aResult ); |
|
254 TInt ClientSessionSetActiveL( TTestResult& aResult ); |
|
255 TInt ClientSessionGetLprojNameL( TTestResult& aResult ); |
|
256 TInt ClientSessionSecurityPolicyId( TTestResult& aResult ); |
|
257 |
|
258 private: // Data |
|
259 |
|
260 TUid iValidUid; |
|
261 CStifLogger* iLog; |
|
262 RFs iFileSystem; |
|
263 }; |
|
264 |
|
265 #endif // WIDGETREGISTRYSTIF_H |
|
266 |
|
267 // End of File |