author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 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 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: tsysinfogeneraltestsblocks |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include<f32file.h> |
26 |
||
27 |
#include "tsysinfogeneraltests.h" |
|
28 |
#include "tuseractivitynotifier.h" |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
29 |
#include "tcriticalmemnoti.h" |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
30 |
#include "tmemnotifier.h" |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
31 |
#include"tautolocknotifier.h" |
19 | 32 |
#include "sysinfoservice.h" |
33 |
#include"entitykeys.h" |
|
34 |
||
35 |
using namespace SysInfo; |
|
36 |
// ----------------------------------------------------------------------------- |
|
37 |
// CTSysInfoGeneralTests::Delete |
|
38 |
// Delete here all resources allocated and opened from test methods. |
|
39 |
// Called from destructor. |
|
40 |
// ----------------------------------------------------------------------------- |
|
41 |
// |
|
42 |
void CTSysInfoGeneralTests::Delete() |
|
43 |
{ |
|
44 |
||
45 |
} |
|
46 |
||
47 |
// ----------------------------------------------------------------------------- |
|
48 |
// CTSysInfoGeneralTests::RunMethodL |
|
49 |
// Run specified method. Contains also table of test mothods and their names. |
|
50 |
// ----------------------------------------------------------------------------- |
|
51 |
// |
|
52 |
TInt CTSysInfoGeneralTests::RunMethodL( |
|
53 |
CStifItemParser& aItem ) |
|
54 |
{ |
|
55 |
||
56 |
static TStifFunctionInfo const KFunctions[] = |
|
57 |
{ |
|
58 |
// Copy this line for every implemented function. |
|
59 |
// First string is the function name used in TestScripter script file. |
|
60 |
// Second is the actual implementation member function. |
|
61 |
ENTRY( "ConnectedAcc", CTSysInfoGeneralTests::ConnectedAcc), |
|
62 |
ENTRY( "AccStatus", CTSysInfoGeneralTests::AccStatus), |
|
63 |
ENTRY( "FlipStatus", CTSysInfoGeneralTests::FlipStatus), |
|
64 |
ENTRY( "GripStatus", CTSysInfoGeneralTests::GripStatus), |
|
65 |
ENTRY( "ActiveUSBModes", CTSysInfoGeneralTests::ActiveUSBModes), |
|
66 |
||
67 |
ENTRY( "GetActiveConnections", CTSysInfoGeneralTests::GetActiveConnections), |
|
68 |
ENTRY( "ConnNotification", CTSysInfoGeneralTests::ConnNotification), |
|
69 |
||
70 |
//MEMORY |
|
71 |
ENTRY( "MemoryCardNotifier-M", CTSysInfoGeneralTests::MemoryCardNotifierL), |
|
72 |
ENTRY( "CriticalMemOnDriveC-M", CTSysInfoGeneralTests::CriticalMemOnDriveCL), |
|
73 |
ENTRY( "CriticalMemOnDriveD-M", CTSysInfoGeneralTests::CriticalMemOnDriveDL), |
|
74 |
ENTRY( "CriticalMemOnDriveE-M", CTSysInfoGeneralTests::CriticalMemOnDriveEL), |
|
75 |
//DISPLAY |
|
76 |
ENTRY( "UserActivityNotifier-M", CTSysInfoGeneralTests::UserActivityNotifierL), |
|
77 |
ENTRY( "AutoLockNotifier", CTSysInfoGeneralTests::AutoLockNotifierL), |
|
78 |
}; |
|
79 |
||
80 |
const TInt count = sizeof( KFunctions ) / |
|
81 |
sizeof( TStifFunctionInfo ); |
|
82 |
||
83 |
return RunInternalL( KFunctions, count, aItem ); |
|
84 |
||
85 |
} |
|
86 |
||
87 |
||
88 |
||
89 |
||
90 |
// ----------------------------------------------------------------------------- |
|
91 |
// CTSysInfoGeneralTests::AccStatus |
|
92 |
// |
|
93 |
// ----------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
||
96 |
TInt CTSysInfoGeneralTests::AccStatus(CStifItemParser& /*aItem*/) |
|
97 |
{ |
|
98 |
_LIT( KExample, "AccStatus" ); |
|
99 |
iLog->Log( KExample ); |
|
100 |
||
101 |
int ret=0; |
|
102 |
// On Emulator this is not supported. |
|
103 |
#if (! (defined(__WINS__) || defined(__WINSCW__)) ) |
|
104 |
||
105 |
ret = AccStatusNotification(iLog); |
|
106 |
||
107 |
#endif |
|
108 |
if(ret==0) |
|
109 |
return KErrNone; |
|
110 |
else |
|
111 |
return KErrGeneral; |
|
112 |
} |
|
113 |
||
114 |
// ----------------------------------------------------------------------------- |
|
115 |
// CTSysInfoGeneralTests::FlipStatus |
|
116 |
// |
|
117 |
// ----------------------------------------------------------------------------- |
|
118 |
// |
|
119 |
TInt CTSysInfoGeneralTests::FlipStatus(CStifItemParser& /*aItem*/) |
|
120 |
{ int ret=0; |
|
121 |
// On Emulator this is not supported. |
|
122 |
#if (! (defined(__WINS__) || defined(__WINSCW__)) ) |
|
123 |
||
124 |
ret = FlipNotification(); |
|
125 |
#endif |
|
126 |
||
127 |
if(ret==0) |
|
128 |
return KErrNone; |
|
129 |
else |
|
130 |
return KErrGeneral; |
|
131 |
} |
|
132 |
||
133 |
// ----------------------------------------------------------------------------- |
|
134 |
// CTSysInfoGeneralTests::GripStatus |
|
135 |
// |
|
136 |
// ----------------------------------------------------------------------------- |
|
137 |
// |
|
138 |
TInt CTSysInfoGeneralTests::GripStatus(CStifItemParser& /*aItem*/) |
|
139 |
{ int ret=0; |
|
140 |
// On Emulator this is not supported. |
|
141 |
#if (! (defined(__WINS__) || defined(__WINSCW__)) ) |
|
142 |
||
143 |
ret = GripNotification(); |
|
144 |
#endif |
|
145 |
||
146 |
if(ret==0) |
|
147 |
return KErrNone; |
|
148 |
else |
|
149 |
return KErrGeneral; |
|
150 |
} |
|
151 |
||
152 |
// ----------------------------------------------------------------------------- |
|
153 |
// CTSysInfoGeneralTests::ActiveUSBModes |
|
154 |
// |
|
155 |
// ----------------------------------------------------------------------------- |
|
156 |
// |
|
157 |
TInt CTSysInfoGeneralTests::ActiveUSBModes(CStifItemParser& /*aItem*/) |
|
158 |
{ |
|
159 |
TInt result = KErrNone; |
|
160 |
TPtrC activeUsbmode; |
|
161 |
||
162 |
// On Emulator this is not supported. |
|
163 |
#if (! (defined(__WINS__) || defined(__WINSCW__)) ) |
|
164 |
||
165 |
||
166 |
__UHEAP_MARK; |
|
167 |
||
168 |
_LIT( KExample, "Active USB Modes:" ); |
|
169 |
iLog->Log( KExample ); |
|
170 |
||
171 |
||
172 |
CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
173 |
||
174 |
CleanupStack::PushL(iSysInfoService); |
|
175 |
||
176 |
CSysData* data1 = NULL; |
|
177 |
||
178 |
TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KActiveUSBMode,data1)); |
|
179 |
||
180 |
if(err1 == KErrNone) |
|
181 |
{ |
|
182 |
((CStringData*)data1)->StringData(activeUsbmode); |
|
183 |
iLog->Log(_L("active usb mode...............")); |
|
184 |
TBuf<50> mode; |
|
185 |
mode.Copy(activeUsbmode); |
|
186 |
iLog->Log(mode); |
|
187 |
||
188 |
||
189 |
} |
|
190 |
CleanupStack::Pop(1); |
|
191 |
result = err1; |
|
192 |
delete data1; |
|
193 |
delete iSysInfoService; |
|
194 |
||
195 |
__UHEAP_MARKEND; |
|
196 |
#endif |
|
197 |
return result; |
|
198 |
} |
|
199 |
||
200 |
// ----------------------------------------------------------------------------- |
|
201 |
// CTSysInfoGeneralTests::AutoLockNotifierL |
|
202 |
// |
|
203 |
// ----------------------------------------------------------------------------- |
|
204 |
// |
|
205 |
TInt CTSysInfoGeneralTests::AutoLockNotifierL(CStifItemParser& ) |
|
206 |
{ |
|
207 |
_LIT( KExample, "AutoLockNotifierL" ); |
|
208 |
iLog->Log( KExample ); |
|
209 |
TInt Err(PASS); |
|
210 |
||
211 |
__UHEAP_MARK; |
|
212 |
||
213 |
CAutoLockNotifier* test = CAutoLockNotifier::NewL(iLog,1); |
|
214 |
test->Start(); |
|
215 |
Err = test->Result(); |
|
216 |
delete test; |
|
217 |
||
218 |
__UHEAP_MARKEND; |
|
219 |
||
220 |
return Err; |
|
221 |
} |
|
222 |
// ----------------------------------------------------------------------------- |
|
223 |
// CTSysInfoGeneralTests::ConnectedAcc |
|
224 |
// |
|
225 |
// ----------------------------------------------------------------------------- |
|
226 |
// |
|
227 |
||
228 |
TInt CTSysInfoGeneralTests::ConnectedAcc(CStifItemParser& /*aItem*/) |
|
229 |
{ |
|
230 |
TInt result = KErrNone; |
|
231 |
TPtrC usbModes; |
|
232 |
// On Emulator this is not supported. |
|
233 |
#if (! (defined(__WINS__) || defined(__WINSCW__)) ) |
|
234 |
||
235 |
__UHEAP_MARK; |
|
236 |
||
237 |
_LIT( KExample, "Connected Accessories:" ); |
|
238 |
iLog->Log( KExample ); |
|
239 |
||
240 |
||
241 |
CSysInfoService* iSysInfoService = CSysInfoService::NewL(); |
|
242 |
||
243 |
CleanupStack::PushL(iSysInfoService); |
|
244 |
||
245 |
||
246 |
CSysData* data1 = NULL; |
|
247 |
||
248 |
const CAccessoryInfo* accInfo= NULL; |
|
249 |
||
250 |
TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KConnectedAccessories,data1)); |
|
251 |
||
252 |
if(err1 == KErrNone) |
|
253 |
{ |
|
254 |
for(TInt i=0;i< ((CAccList*)data1)->Count() ;i++) |
|
255 |
{ |
|
256 |
((CAccList*)data1)->AtL(i,accInfo); |
|
257 |
TBuf8<50> acctype ; |
|
258 |
TBuf8<50> accConnState; |
|
259 |
acctype.AppendNum( accInfo->AccessoryType() ); |
|
260 |
accConnState.AppendNum( accInfo->ConnectionState() ); |
|
261 |
iLog->Log(_L("Accessory Type:")); |
|
262 |
iLog->Log(acctype); |
|
263 |
||
264 |
iLog->Log(_L("Accessory Connection State:")); |
|
265 |
iLog->Log(accConnState); |
|
266 |
||
267 |
||
268 |
||
269 |
} |
|
270 |
} |
|
271 |
result = err1; |
|
272 |
CleanupStack::PopAndDestroy(1); |
|
273 |
delete data1; |
|
274 |
||
275 |
__UHEAP_MARKEND; |
|
276 |
#endif |
|
277 |
return result; |
|
278 |
} |
|
279 |
||
280 |
// ----------------------------------------------------------------------------- |
|
281 |
// CTSysInfoGeneralTests::GetActiveConnections |
|
282 |
// |
|
283 |
// ----------------------------------------------------------------------------- |
|
284 |
// |
|
285 |
TInt CTSysInfoGeneralTests::GetActiveConnections(CStifItemParser& /*aItem*/) |
|
286 |
{ |
|
287 |
_LIT( KExample, "GetActiveConnections" ); |
|
288 |
iLog->Log( KExample ); |
|
289 |
||
290 |
int ret=0; |
|
291 |
||
292 |
// On Emulator this is not supported. |
|
293 |
#if (! (defined(__WINS__) || defined(__WINSCW__)) ) |
|
294 |
||
295 |
ret = ActiveConnection(iLog); |
|
296 |
#endif |
|
297 |
||
298 |
if(ret==0) |
|
299 |
return KErrNone; |
|
300 |
else |
|
301 |
return KErrGeneral; |
|
302 |
} |
|
303 |
||
304 |
||
305 |
// ----------------------------------------------------------------------------- |
|
306 |
// CTSysInfoGeneralTests::ConnNotification |
|
307 |
// |
|
308 |
// ----------------------------------------------------------------------------- |
|
309 |
// |
|
310 |
||
311 |
TInt CTSysInfoGeneralTests::ConnNotification(CStifItemParser& /*aItem*/) |
|
312 |
{ |
|
313 |
||
314 |
_LIT( KExample, "ConnNotification" ); |
|
315 |
iLog->Log( KExample ); |
|
316 |
||
317 |
int ret=0; |
|
318 |
// On Emulator this is not supported. |
|
319 |
#if (! (defined(__WINS__) || defined(__WINSCW__)) ) |
|
320 |
||
321 |
ret = ConnectionNotification(iLog); |
|
322 |
#endif |
|
323 |
||
324 |
if(ret==0) |
|
325 |
return KErrNone; |
|
326 |
else |
|
327 |
return KErrGeneral; |
|
328 |
} |
|
329 |
||
330 |
TInt CTSysInfoGeneralTests::MemoryCardNotifierL(CStifItemParser& /*aItem*/) |
|
331 |
{ |
|
332 |
_LIT( KExample, "MemoryCardNotifierL" ); |
|
333 |
iLog->Log( KExample ); |
|
334 |
TInt Err(PASS); |
|
335 |
#if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
336 |
TestModuleIf().Printf( 1, _L("Waiting"), _L("Waiting") ); |
|
337 |
__UHEAP_MARK; |
|
338 |
||
339 |
CTestMemNotification* test = CTestMemNotification::NewL(iLog); |
|
340 |
test->Start(); |
|
341 |
Err = test->Result(); |
|
342 |
delete test; |
|
343 |
||
344 |
__UHEAP_MARKEND; |
|
345 |
#endif |
|
346 |
return Err; |
|
347 |
} |
|
348 |
||
349 |
TInt CTSysInfoGeneralTests::CriticalMemOnDriveCL(CStifItemParser& /*aItem*/) |
|
350 |
{ |
|
351 |
_LIT( KExample, "CriticalMemOnDriveCL" ); |
|
352 |
iLog->Log( KExample ); |
|
353 |
TInt Err(PASS); |
|
354 |
||
355 |
#if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
356 |
__UHEAP_MARK; |
|
357 |
||
358 |
CTCriticalMemNotification* test = CTCriticalMemNotification::NewL(iLog,EDriveC); |
|
359 |
test->Start(); |
|
360 |
Err = test->Result(); |
|
361 |
delete test; |
|
362 |
||
363 |
__UHEAP_MARKEND; |
|
364 |
#endif |
|
365 |
||
366 |
return Err; |
|
367 |
} |
|
368 |
||
369 |
TInt CTSysInfoGeneralTests::CriticalMemOnDriveDL(CStifItemParser& /*aItem*/) |
|
370 |
{ |
|
371 |
_LIT( KExample, "CriticalMemOnDriveDL" ); |
|
372 |
iLog->Log( KExample ); |
|
373 |
TInt Err(PASS); |
|
374 |
#if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
375 |
__UHEAP_MARK; |
|
376 |
||
377 |
CTCriticalMemNotification* test = CTCriticalMemNotification::NewL(iLog,EDriveD); |
|
378 |
test->Start(); |
|
379 |
Err = test->Result(); |
|
380 |
delete test; |
|
381 |
||
382 |
__UHEAP_MARKEND; |
|
383 |
#endif |
|
384 |
return Err; |
|
385 |
} |
|
386 |
||
387 |
TInt CTSysInfoGeneralTests::CriticalMemOnDriveEL(CStifItemParser& /*aItem*/) |
|
388 |
{ |
|
389 |
_LIT( KExample, "CriticalMemOnDriveDL" ); |
|
390 |
iLog->Log( KExample ); |
|
391 |
TInt Err(PASS); |
|
392 |
#if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
393 |
__UHEAP_MARK; |
|
394 |
||
395 |
CTCriticalMemNotification* test = CTCriticalMemNotification::NewL(iLog,EDriveE); |
|
396 |
test->Start(); |
|
397 |
Err = test->Result(); |
|
398 |
delete test; |
|
399 |
||
400 |
__UHEAP_MARKEND; |
|
401 |
#endif |
|
402 |
return Err; |
|
403 |
} |
|
404 |
||
405 |
TInt CTSysInfoGeneralTests::UserActivityNotifierL(CStifItemParser& ) |
|
406 |
{ |
|
407 |
_LIT( KExample, "UserInactivityNotifierL" ); |
|
408 |
iLog->Log( KExample ); |
|
409 |
TInt Err(PASS); |
|
410 |
||
411 |
__UHEAP_MARK; |
|
412 |
||
413 |
CTestUserActivity* test = CTestUserActivity::NewL(iLog,1,CTestUserActivity::ETESTACTIVITY); |
|
414 |
test->Start(); |
|
415 |
Err = test->Result(); |
|
416 |
delete test; |
|
417 |
||
418 |
__UHEAP_MARKEND; |
|
419 |
||
420 |
return Err; |
|
421 |
} |
|
422 |