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 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: ?Description* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef VCXCONNUTILTEST_H |
|
19 #define VCXCONNUTILTEST_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <StifLogger.h> |
|
23 #include <TestScripterInternal.h> |
|
24 #include <StifTestModule.h> |
|
25 |
|
26 #include "MIptvTestTimerObserver.h" |
|
27 |
|
28 #include "vcxconnutilengineobserver.h" |
|
29 #include "VCXConnUtilTestPSObserver.h" |
|
30 #include "../../../../videoconnutility/inc/vcxconnectionutility.hrh" |
|
31 #include "../../../../videoconnutility/inc/vcxconnutilcommon.h" |
|
32 |
|
33 // CONSTANTS |
|
34 const TInt KVcxConnUtilTestModeSubscriber = 0; |
|
35 const TInt KVcxConnUtilTestModeConnectivity = 1; |
|
36 const TInt KVcxConnUtilTestModeBoth = 2; // Default mode, P&S is subscribed and connection creation is allowed |
|
37 |
|
38 const TInt KTimeoutTimerId = 0; |
|
39 |
|
40 // MACROS |
|
41 |
|
42 // Logging path |
|
43 _LIT( KVCXConnUtilTestLogPath, "\\logs\\testframework\\VCXConnUtilTest\\" ); |
|
44 // Log file |
|
45 _LIT( KVCXConnUtilTestLogFile, "VCXConnUtilTest.txt" ); |
|
46 _LIT( KVCXConnUtilTestLogFileWithTitle, "VCXConnUtilTest_[%S].txt" ); |
|
47 |
|
48 // FUNCTION PROTOTYPES |
|
49 //?type ?function_name(?arg_list); |
|
50 |
|
51 // FORWARD DECLARATIONS |
|
52 //class ?FORWARD_CLASSNAME; |
|
53 class CVCXConnUtilTest; |
|
54 class CVCXTestCommon; |
|
55 class CVCXConnUtilTestSubscriber; |
|
56 class CIptvTestTimer; |
|
57 class CIptvTestActiveWait; |
|
58 |
|
59 // DATA TYPES |
|
60 //enum ?declaration |
|
61 //typedef ?declaration |
|
62 //extern ?data_type; |
|
63 |
|
64 // CLASS DECLARATION |
|
65 |
|
66 class TVcxConnTestPSProperty |
|
67 { |
|
68 public: |
|
69 TVcxConnTestPSProperty( ) |
|
70 { |
|
71 iIsInteger = EFalse; |
|
72 } |
|
73 TVcxConnTestPSProperty( TInt aProperty, TInt aValue ) |
|
74 { |
|
75 iProperty = aProperty; |
|
76 iIntegerValue = aValue; |
|
77 iIsInteger = ETrue; |
|
78 } |
|
79 TVcxConnTestPSProperty( TInt aProperty, TDesC& aValue ) |
|
80 { |
|
81 iProperty = aProperty; |
|
82 iStringValue = aValue; |
|
83 iIsInteger = EFalse; |
|
84 } |
|
85 ~TVcxConnTestPSProperty( ) |
|
86 { |
|
87 |
|
88 } |
|
89 public: |
|
90 TBool iIsInteger; |
|
91 TInt iProperty; |
|
92 TInt iIntegerValue; |
|
93 TBufC<256> iStringValue; |
|
94 }; |
|
95 |
|
96 /** |
|
97 * CVCXConnUtilTest test class for STIF Test Framework TestScripter. |
|
98 */ |
|
99 NONSHARABLE_CLASS(CVCXConnUtilTest) : public CScriptBase, |
|
100 public MVCXConnUtilTestPSObserver, |
|
101 public MIptvTestTimerObserver |
|
102 { |
|
103 public: // Constructors and destructor |
|
104 |
|
105 /** |
|
106 * Two-phased constructor. |
|
107 */ |
|
108 static CVCXConnUtilTest* NewL( CTestModuleIf& aTestModuleIf ); |
|
109 |
|
110 /** |
|
111 * Destructor. |
|
112 */ |
|
113 virtual ~CVCXConnUtilTest(); |
|
114 |
|
115 public: // New functions |
|
116 |
|
117 public: // Functions from base classes |
|
118 |
|
119 /** |
|
120 * From CScriptBase Runs a script line. |
|
121 * @since ?Series60_version |
|
122 * @param aItem Script line containing method name and parameters |
|
123 * @return Symbian OS error code |
|
124 */ |
|
125 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
126 |
|
127 /** |
|
128 * From MVCXConnUtilTestPSObserver, called when P&S key changes. |
|
129 */ |
|
130 void ValueChangedL( const TUid& aUid, const TUint32& aKey, const TInt& aValue ); |
|
131 |
|
132 /** |
|
133 * From MVCXConnUtilTestPSObserver, called when P&S key changes. |
|
134 */ |
|
135 void ValueChangedL( const TUid& aUid, const TUint32& aKey, const TDesC& aValue ); |
|
136 |
|
137 /** |
|
138 * From MIptvTestTimerObserver Handles timer completion |
|
139 * @since |
|
140 * @param aTimerId |
|
141 * @param aError |
|
142 */ |
|
143 void TimerComplete(TInt aTimerId, TInt aError); |
|
144 |
|
145 private: // New functions |
|
146 |
|
147 /** |
|
148 * Gets name string for property. |
|
149 */ |
|
150 void GetPropertyNameL( TInt aProperty, TDes& aPropertyName ); |
|
151 |
|
152 /** |
|
153 * Gets connection name into a string. |
|
154 */ |
|
155 void GetConnectionStatusL( TInt aConnectionStatus, TDes& aStatusString ); |
|
156 |
|
157 /** |
|
158 * Checks that the tester process is still alive. Leaves if it's dead. |
|
159 */ |
|
160 void TesterExeAliveL(); |
|
161 |
|
162 void CreateTesterProcessL(); |
|
163 |
|
164 protected: // New functions |
|
165 |
|
166 private: |
|
167 |
|
168 /** |
|
169 * C++ default constructor. |
|
170 */ |
|
171 CVCXConnUtilTest( CTestModuleIf& aTestModuleIf ); |
|
172 |
|
173 /** |
|
174 * By default Symbian 2nd phase constructor is private. |
|
175 */ |
|
176 void ConstructL(); |
|
177 |
|
178 /** |
|
179 * Frees all resources allocated from test methods. |
|
180 * @since ?Series60_version |
|
181 */ |
|
182 void Delete(); |
|
183 |
|
184 /** |
|
185 * Test methods are listed below. |
|
186 */ |
|
187 |
|
188 /** |
|
189 * Tries to close all tester exe's, should be called in start of each case before call |
|
190 * to any CreateL. |
|
191 */ |
|
192 virtual TInt PrepareCaseL( CStifItemParser& aItem ); |
|
193 |
|
194 /** |
|
195 * Commands the tester exe to shutdown checks for any error codes for the process exit. |
|
196 * Should be called in end of each test case before deleting test module. |
|
197 */ |
|
198 virtual TInt ShutdownTesterL( CStifItemParser& aItem ); |
|
199 |
|
200 /** |
|
201 * Initializes the test module. |
|
202 * @param mode, If KVcxConnUtilTestModeNormal |
|
203 * - Doesn't subscribe ConnUtil P&S keys. |
|
204 * - Main use connectivity. |
|
205 * |
|
206 * If KVcxConnUtilTestModeSubscribe |
|
207 * - Subscribes ConnUtil P&S keys and keeps track of the changes. |
|
208 * - Doesn't create instance of ConnUtil, can't be used for connectivity. |
|
209 * @param caseId. |
|
210 */ |
|
211 virtual TInt CreateL( CStifItemParser& aItem ); |
|
212 |
|
213 /** |
|
214 * Calls CVcxConnectionUtility::GetIap which creates connection. |
|
215 * Can only be used when test module is created in KVcxConnUtilTestModeNormal mode. |
|
216 */ |
|
217 virtual TInt GetIapL( CStifItemParser& aItem ); |
|
218 |
|
219 /** |
|
220 * Calls CVcxConnectionUtility::WapIdFromIapIdL for the defined IAP. |
|
221 * @param iapName, if IAP is not found then invalid IAP ID is used. |
|
222 */ |
|
223 virtual TInt WapIdFromIapIdL( CStifItemParser& aItem ); |
|
224 |
|
225 /** |
|
226 * Calls CVcxConnectionUtility::Disconnect which disconnects active connection. |
|
227 * Can only be used when test module is created in KVcxConnUtilTestModeNormal mode. |
|
228 */ |
|
229 virtual TInt DisconnectL( CStifItemParser& aItem ); |
|
230 |
|
231 /** |
|
232 * Calls CVcxConnectionUtility::Disconnect which disconnects active connection. |
|
233 * Can be used always. |
|
234 */ |
|
235 virtual TInt CheckPropertyL( CStifItemParser& aItem ); |
|
236 |
|
237 /** |
|
238 * Sets roaming flag which is returned to ConnUtil upon request. |
|
239 * Can only be used when test module is created in KVcxConnUtilTestModeNormal mode. |
|
240 */ |
|
241 virtual TInt SetRoamingAllowedL( CStifItemParser& aItem ); |
|
242 |
|
243 /** |
|
244 * Sets flag for test module to cause User::Leave when it gets roaming request. |
|
245 * Can only be used when test module is created in KVcxConnUtilTestModeNormal mode. |
|
246 */ |
|
247 virtual TInt SetLeaveAtRoamingRequestL( CStifItemParser& aItem ); |
|
248 |
|
249 /** |
|
250 * Sets delay before roaming request is answered. |
|
251 * Can only be used when test module is created in KVcxConnUtilTestModeNormal mode. |
|
252 */ |
|
253 virtual TInt SetDelayBeforeRoamingRequestL( CStifItemParser& aItem ); |
|
254 |
|
255 /** |
|
256 * Gets the values for ConnUtil P&S properties and prints 'em to debug ouput. |
|
257 * Can be used always. |
|
258 */ |
|
259 virtual TInt PrintConnUtilDetails( CStifItemParser& aItem ); |
|
260 |
|
261 /** |
|
262 * Adds property and value to queue of waited P&S changes. |
|
263 * @param property |
|
264 * @param value |
|
265 * Can only be used when test module is created in KVcxConnUtilTestModeSubscriber mode. |
|
266 */ |
|
267 virtual TInt AddWaitedPropertyL( CStifItemParser& aItem ); |
|
268 |
|
269 /** |
|
270 * Adds property that is causes error signal while there's properties in queue |
|
271 * added with AddWaitedProperty. |
|
272 * @param property |
|
273 * @param value |
|
274 * Can only be used when test module is created in KVcxConnUtilTestModeSubscriber mode. |
|
275 */ |
|
276 virtual TInt AddNotAllowedPropertyL( CStifItemParser& aItem ); |
|
277 |
|
278 /** |
|
279 * Resets the queue of expected property changes. |
|
280 * Can only be used when test module is created in KVcxConnUtilTestModeSubscriber mode. |
|
281 */ |
|
282 virtual TInt ResetWaitedPropertiesL( CStifItemParser& aItem ); |
|
283 |
|
284 /** |
|
285 * After call to this when queue for waited properties is empty the test script will be signaled. |
|
286 * Can only be used when test module is created in KVcxConnUtilTestModeSubscriber mode. |
|
287 */ |
|
288 virtual TInt WaitForPropertyQueueL( CStifItemParser& aItem ); |
|
289 |
|
290 private: // Data |
|
291 |
|
292 CVCXTestCommon* iTestCommon; |
|
293 |
|
294 // KVcxConnUtilTestModeSubscriber or KVcxConnUtilTestModeNormal |
|
295 TInt iMode; |
|
296 |
|
297 CVCXConnUtilTestSubscriber* iConnectionStatusSubscriber; |
|
298 CVCXConnUtilTestSubscriber* iIapIdSubscriber; |
|
299 CVCXConnUtilTestSubscriber* iSnapIdSubscriber; |
|
300 CVCXConnUtilTestSubscriber* iMasterExistsSubscriber; |
|
301 CVCXConnUtilTestSubscriber* iNbrConnInstancesSubscriber; |
|
302 CVCXConnUtilTestSubscriber* iRoamingRequestStatusSubscriber; |
|
303 CVCXConnUtilTestSubscriber* iNbrRoamRespSubscriber; |
|
304 CVCXConnUtilTestSubscriber* iNbRoamAcceptedSubscriber; |
|
305 |
|
306 // Array of P&S changes to properties of VcxConnUtil |
|
307 RArray<TVcxConnTestPSProperty> iWaitedPSChanges; |
|
308 |
|
309 RArray<TVcxConnTestPSProperty> iNotAllowedPSChanges; |
|
310 |
|
311 TBool iWaitingForEmptyPropertyQueue; |
|
312 |
|
313 // Timeout timer |
|
314 CIptvTestTimer* iTimeoutTimer; |
|
315 |
|
316 CIptvTestActiveWait* iWait; |
|
317 |
|
318 // Is wait for connection request enabled. |
|
319 TInt iWaitTimedRequest; |
|
320 |
|
321 // This will show in function traces. |
|
322 TBuf<256> iName; |
|
323 |
|
324 // Testexe |
|
325 RProcess iProcess; |
|
326 |
|
327 TInt iPSKeyBase; |
|
328 |
|
329 CVCXConnUtilTestSubscriber* iTesterGetAckResponseSubscriber; |
|
330 CVCXConnUtilTestSubscriber* iTesterResponseSubscriber; |
|
331 |
|
332 CVCXConnUtilTestSubscriber* iTesterCountSubscriber; |
|
333 |
|
334 TBool iShutdownCalled; |
|
335 |
|
336 TBool iTesterCountChangedAlready; |
|
337 }; |
|
338 |
|
339 #endif // VCXCONNUTILTEST_H |
|
340 |
|
341 // End of File |
|