|
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 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32svr.h> |
|
22 #include <StifParser.h> |
|
23 #include <Stiftestinterface.h> |
|
24 |
|
25 #include "VCXScheduledReminderTest.h" |
|
26 |
|
27 #include <f32file.h> |
|
28 #include "VCXTestLog.h" |
|
29 #include "CIptvUtil.h" |
|
30 #include <s32mem.h> |
|
31 #include "CIptvTestUtilities.h" |
|
32 |
|
33 #include <ipvideo/CCseSchedulerAPI.h> |
|
34 #include <ipvideo/CCseScheduledProgram.h> |
|
35 //#include <CseSchedulerPluginIF.hrh> |
|
36 #include "iptvvodscheduleddownloaddefinitions.h" |
|
37 #include "IptvEngineUids.h" |
|
38 |
|
39 #include "CIptvTestTimer.h" |
|
40 |
|
41 // EXTERNAL DATA STRUCTURES |
|
42 //extern ?external_data; |
|
43 |
|
44 // EXTERNAL FUNCTION PROTOTYPES |
|
45 //extern ?external_function( ?arg_type,?arg_type ); |
|
46 |
|
47 // CONSTANTS |
|
48 const TInt KTestPanic = -69; |
|
49 const TInt KTmpBufLen = 256; |
|
50 const TInt32 KInvalidPluginUid = -1; |
|
51 |
|
52 // MACROS |
|
53 //#define ?macro ?macro_def |
|
54 |
|
55 // LOCAL CONSTANTS AND MACROS |
|
56 //const ?type ?constant_var = ?constant; |
|
57 //#define ?macro_name ?macro_def |
|
58 |
|
59 // MODULE DATA STRUCTURES |
|
60 //enum ?declaration |
|
61 //typedef ?declaration |
|
62 |
|
63 // LOCAL FUNCTION PROTOTYPES |
|
64 //?type ?function_name( ?arg_type, ?arg_type ); |
|
65 |
|
66 // FORWARD DECLARATIONS |
|
67 //class ?FORWARD_CLASSNAME; |
|
68 |
|
69 // ============================= LOCAL FUNCTIONS =============================== |
|
70 void PrintTime(TTime time) |
|
71 { |
|
72 TDateTime date(time.DateTime()); |
|
73 _LIT( KTimeFormat, "Time = %d.%d.%d %d:%d" ); |
|
74 TBuf<80> buffer; |
|
75 buffer.Format( KTimeFormat, date.Day() + 1, date.Month() + 1, date.Year(), date.Hour(), date.Minute() ); |
|
76 VCXLOGLO2( "%S", &buffer ); |
|
77 } |
|
78 |
|
79 |
|
80 // ============================ MEMBER FUNCTIONS =============================== |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CVCXScheduledReminderTest::Delete |
|
84 // Delete here all resources allocated and opened from test methods. |
|
85 // Called from destructor. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CVCXScheduledReminderTest::Delete() |
|
89 { |
|
90 VCXLOGLO1(">>>CVCXScheduledReminderTest::Delete"); |
|
91 if(iSchedulerClient) |
|
92 { |
|
93 delete iSchedulerClient; |
|
94 iSchedulerClient = NULL; |
|
95 } |
|
96 |
|
97 if(iTestUtil!=NULL) |
|
98 { |
|
99 delete iTestUtil; |
|
100 iTestUtil=NULL; |
|
101 } |
|
102 |
|
103 if(iShutdownTimer!=NULL) |
|
104 { |
|
105 iShutdownTimer->CancelTimer(); |
|
106 delete iShutdownTimer; |
|
107 iShutdownTimer = NULL; |
|
108 } |
|
109 |
|
110 iScheduleArray.ResetAndDestroy(); |
|
111 iScheduleArray.Close(); |
|
112 VCXLOGLO1("<<<CVCXScheduledReminderTest::Delete"); |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CVCXScheduledReminderTest::RunMethodL |
|
117 // Run specified method. Contains also table of test mothods and their names. |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 TInt CVCXScheduledReminderTest::RunMethodL( |
|
121 CStifItemParser& aItem ) |
|
122 { |
|
123 |
|
124 static TStifFunctionInfo const KFunctions[] = |
|
125 { |
|
126 // Copy this line for every implemented function. |
|
127 // First string is the function name used in TestScripter script file. |
|
128 // Second is the actual implementation member function. |
|
129 ENTRY( "Create", CVCXScheduledReminderTest::CreateL ), |
|
130 ENTRY( "RefreshService", CVCXScheduledReminderTest::RefreshServiceL ), |
|
131 ENTRY( "SetIap", CVCXScheduledReminderTest::SetIapL ), |
|
132 ENTRY( "ScheduleDownload", CVCXScheduledReminderTest::ScheduleDownloadL ), |
|
133 ENTRY( "AddSchedule", CVCXScheduledReminderTest::AddScheduleL ), |
|
134 ENTRY( "RemoveSchedule", CVCXScheduledReminderTest::RemoveScheduleL ), |
|
135 ENTRY( "RemoveAllSchedules", CVCXScheduledReminderTest::RemoveAllSchedulesL ), |
|
136 ENTRY( "RemoveAllFromArray", CVCXScheduledReminderTest::RemoveAllFromArrayL ), |
|
137 ENTRY( "GetSchedulesByAppUid", CVCXScheduledReminderTest::GetSchedulesByAppUidL ), |
|
138 ENTRY( "GetOverlappingSchedules", CVCXScheduledReminderTest::GetOverlappingSchedulesL ), |
|
139 ENTRY( "GetSchedulesByPluginUid", CVCXScheduledReminderTest::GetSchedulesByPluginUidL ), |
|
140 ENTRY( "GetSchedulesByType", CVCXScheduledReminderTest::GetSchedulesByTypeL ), |
|
141 ENTRY( "GetSchedulesByTime", CVCXScheduledReminderTest::GetSchedulesByTimeL ), |
|
142 ENTRY( "CheckCount", CVCXScheduledReminderTest::CheckCountL ), |
|
143 ENTRY( "EmptyArray", CVCXScheduledReminderTest::EmptyArray ), |
|
144 ENTRY( "AdjustClock", CVCXScheduledReminderTest::AdjustClockL ), |
|
145 ENTRY( "SetTimeout", CVCXScheduledReminderTest::SetTimeoutL ), |
|
146 }; |
|
147 |
|
148 const TInt count = sizeof( KFunctions ) / |
|
149 sizeof( TStifFunctionInfo ); |
|
150 |
|
151 return RunInternalL( KFunctions, count, aItem ); |
|
152 |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CIptvVodDlApiTest::SetTimeoutL |
|
157 // Set the timeout timer for the testcase. Timeout is given as 1/1000 seconds. |
|
158 // Timeout's max value is 2147482 ms = 37 minutes. |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 TInt CVCXScheduledReminderTest::SetTimeoutL( CStifItemParser& aItem ) |
|
162 { |
|
163 VCXLOGLO1(">>>CVCXScheduledReminderTest::SetTimeoutL"); |
|
164 |
|
165 iShutdownTimer = CIptvTestTimer::NewL(*this, 0); |
|
166 |
|
167 TInt timeout(0); |
|
168 |
|
169 if(iShutdownTimer != NULL) |
|
170 { |
|
171 if(KErrNone!=aItem.GetNextInt(timeout)) |
|
172 { |
|
173 VCXLOGLO1("Timeout value missing"); |
|
174 VCXLOGLO1("<<<CVCXScheduledReminderTest::SetTimeoutL"); |
|
175 |
|
176 delete iShutdownTimer; |
|
177 iShutdownTimer = NULL; |
|
178 return KErrArgument; |
|
179 } |
|
180 } |
|
181 else |
|
182 { |
|
183 VCXLOGLO1("Couldn't create the timer"); |
|
184 VCXLOGLO1("<<<CVCXScheduledReminderTest::SetTimeoutL"); |
|
185 |
|
186 return KErrGeneral; |
|
187 } |
|
188 |
|
189 TTimeIntervalMicroSeconds32 interval((timeout * 1000)); |
|
190 |
|
191 iShutdownTimer->After(interval); |
|
192 |
|
193 VCXLOGLO1("<<<CVCXScheduledReminderTest::SetTimeoutL"); |
|
194 |
|
195 return KErrNone; |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CVCXScheduledReminderTest::TimerComplete |
|
200 // |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 void CVCXScheduledReminderTest::TimerComplete( TInt /* aTimerId */, TInt /* aError */ ) |
|
204 { |
|
205 VCXLOGLO1(">>>CVCXScheduledReminderTest::TimerComplete"); |
|
206 |
|
207 VCXLOGLO1("XXXXXXXX TESTCASE TIMEOUT XXXXXXXXX"); |
|
208 |
|
209 Signal( KErrTimedOut ); |
|
210 //User::Leave( KErrTimedOut ); |
|
211 |
|
212 VCXLOGLO1("<<<CVCXScheduledReminderTest::TimerComplete"); |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CVCXScheduledReminderTest::CreateL |
|
217 // |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 TInt CVCXScheduledReminderTest::CreateL( CStifItemParser& /*aItem*/ ) |
|
221 { |
|
222 VCXLOGLO1(">>>CVCXScheduledReminderTest::CreateL"); |
|
223 // Print to UI |
|
224 _LIT( KVCXScheduledReminderTest, "VCXScheduledReminderTest" ); |
|
225 _LIT( KCreate, "In Create" ); |
|
226 TestModuleIf().Printf( 0, KVCXScheduledReminderTest, KCreate ); |
|
227 // Print to log file |
|
228 iLog->Log( KCreate ); |
|
229 |
|
230 iSchedulerClient = CCseSchedulerApi::NewL(); |
|
231 |
|
232 iTestUtil = CIptvTestUtilities::NewL(); |
|
233 |
|
234 VCXLOGLO1("<<<CVCXScheduledReminderTest::CreateL"); |
|
235 |
|
236 return KErrNone; |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // CVCXScheduledReminderTest::RefreshServiceL |
|
241 // |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 TInt CVCXScheduledReminderTest::RefreshServiceL( CStifItemParser& aItem ) |
|
245 { |
|
246 VCXLOGLO1(">>>CVCXScheduledReminderTest::RefreshServiceL"); |
|
247 // Print to UI |
|
248 _LIT( KVCXScheduledReminderTest, "VCXScheduledReminderTest" ); |
|
249 _LIT( KRefreshService, "In RefreshService" ); |
|
250 TestModuleIf().Printf( 0, KVCXScheduledReminderTest, KRefreshService ); |
|
251 // Print to log file |
|
252 iLog->Log( KRefreshService ); |
|
253 |
|
254 TUint serviceId = GetServiceL(aItem); |
|
255 |
|
256 aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing); |
|
257 |
|
258 TTime refreshDate(0); |
|
259 |
|
260 TPtrC dateString; |
|
261 if(aItem.GetNextString(dateString) != KErrNone) { |
|
262 VCXLOGLO1("CVCXScheduledReminderTest::RefreshServiceL -- No date given as parameter, using Universal Time."); |
|
263 refreshDate.UniversalTime(); |
|
264 } |
|
265 else { |
|
266 VCXLOGLO2("CVCXScheduledReminderTest::RefreshServiceL -- Using date string %S", &dateString); |
|
267 TInt err; |
|
268 err = refreshDate.Set( dateString ); |
|
269 if( err != KErrNone ) { |
|
270 VCXLOGLO2("CVCXScheduledReminderTest::RefreshServiceL -- refreshDate.Set() returned error code %d", err); |
|
271 return KErrArgument; |
|
272 } |
|
273 } |
|
274 |
|
275 VCXLOGLO2("CSchedulingTest::RefreshService: sid = %d", serviceId); |
|
276 |
|
277 TInt ret = iTestUtil->RefreshService(serviceId, refreshDate); |
|
278 |
|
279 VCXLOGLO2("CSchedulingTest::RefreshService returned %d", ret); |
|
280 |
|
281 VCXLOGLO1("<<<CVCXScheduledReminderTest::RefreshServiceL"); |
|
282 |
|
283 return KErrNone; |
|
284 } |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // CVCXScheduledReminderTest::SetIapL ( service (name or id), iap (name or id) ) |
|
288 // |
|
289 // ----------------------------------------------------------------------------- |
|
290 // |
|
291 TInt CVCXScheduledReminderTest::SetIapL( CStifItemParser& aItem ) |
|
292 { |
|
293 VCXLOGLO1(">>>CVCXScheduledReminderTest::SetIapL"); |
|
294 // Print to UI |
|
295 _LIT( KVCXScheduledReminderTest, "VCXScheduledReminderTest" ); |
|
296 _LIT( KSetIap, "In SetIap" ); |
|
297 TestModuleIf().Printf( 0, KVCXScheduledReminderTest, KSetIap ); |
|
298 // Print to log file |
|
299 iLog->Log( KSetIap ); |
|
300 |
|
301 TUint sid = GetServiceL(aItem); |
|
302 TUint iap = GetIapL(aItem); |
|
303 |
|
304 VCXLOGLO3("CSchedulingTest::SetIap: sid = %d, iap = %d",sid, iap); |
|
305 |
|
306 TInt ret = iTestUtil->SetUsedIap(sid, iap); |
|
307 |
|
308 VCXLOGLO2("CSchedulingTest: SetUsedIap returned %d", ret); |
|
309 |
|
310 VCXLOGLO1("<<<CVCXScheduledReminderTest::SetIapL"); |
|
311 |
|
312 return ret; |
|
313 } |
|
314 |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CVCXScheduledReminderTest::ScheduleDownloadL(start, end, service ) |
|
318 // |
|
319 // start and end times are given as seconds relative to this moment. |
|
320 // If values are negative, times are in the past. |
|
321 // Service can be name or id |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 TInt CVCXScheduledReminderTest::ScheduleDownloadL( CStifItemParser& aItem ) |
|
325 { |
|
326 VCXLOGLO1(">>>CVCXScheduledReminderTest::ScheduleDownloadL"); |
|
327 // Print to UI |
|
328 _LIT( KVCXScheduledReminderTest, "VCXScheduledReminderTest" ); |
|
329 _LIT( KScheduleDownload, "In ScheduleDownload" ); |
|
330 TestModuleIf().Printf( 0, KVCXScheduledReminderTest, KScheduleDownload ); |
|
331 // Print to log file |
|
332 iLog->Log( KScheduleDownload ); |
|
333 |
|
334 CCseScheduledProgram* program = CCseScheduledProgram::NewL(); |
|
335 |
|
336 |
|
337 TInt start(0); |
|
338 TInt end(0); |
|
339 aItem.GetNextInt(start); |
|
340 aItem.GetNextInt(end); |
|
341 TTime now; |
|
342 now.UniversalTime(); |
|
343 TTime startTime = now + TTimeIntervalSeconds(start); |
|
344 TTime endTime = now + TTimeIntervalSeconds(end); |
|
345 program->SetStartTime(TTime(startTime)); |
|
346 program->SetEndTime(TTime(endTime)); |
|
347 |
|
348 |
|
349 VCXLOGLO1("Now / Universal time:"); |
|
350 PrintTime(now); |
|
351 TTime local; |
|
352 local.HomeTime(); |
|
353 VCXLOGLO1("Now / Local time:"); |
|
354 PrintTime(local); |
|
355 VCXLOGLO1("Scheduled starttime:"); |
|
356 PrintTime(startTime); |
|
357 VCXLOGLO1("Scheduled endtime:"); |
|
358 PrintTime(endTime); |
|
359 |
|
360 |
|
361 TUint id = GetServiceL(aItem); |
|
362 HBufC8* dataBuf = HBufC8::NewLC(sizeof(TIptvServiceId)); |
|
363 TPtr8 dataPtr(dataBuf->Des()); |
|
364 RDesWriteStream writeStream; |
|
365 CleanupClosePushL(writeStream); |
|
366 writeStream.Open(dataPtr); |
|
367 writeStream.WriteUint32L(id); |
|
368 CleanupStack::PopAndDestroy(&writeStream); |
|
369 program->SetApplicationDataL(dataPtr); |
|
370 CleanupStack::PopAndDestroy(dataBuf); |
|
371 |
|
372 |
|
373 TPtrC name(_L("<empty>")); |
|
374 //aItem.GetNextString(name); |
|
375 TBuf8<KTmpBufLen> nameBuf; |
|
376 nameBuf.Copy(name); |
|
377 program->SetName(nameBuf); |
|
378 |
|
379 |
|
380 TInt dbId(id); |
|
381 //aItem.GetNextInt(dbId); |
|
382 program->SetDbIdentifier(dbId); |
|
383 |
|
384 |
|
385 TInt appUid( IPTV_SERVER_UID ); |
|
386 //aItem.GetNextInt(appUid); |
|
387 program->SetAppUid(appUid); |
|
388 |
|
389 |
|
390 TInt pluginUid( KIptvScheduledDownloadPluginImplementationUid ); |
|
391 //aItem.GetNextInt(pluginUid); |
|
392 program->SetPluginUid(pluginUid); |
|
393 |
|
394 |
|
395 TInt type( CCseScheduledProgram::ECseScheduleDownload ); |
|
396 //aItem.GetNextInt(type); |
|
397 program->SetScheduleType(type); |
|
398 |
|
399 //TUint32 pluginType = CCseScheduledProgram::ECseUniPlugin; |
|
400 //program->SetPluginType(pluginType); |
|
401 |
|
402 iSchedulerClient->AddSchedule(*program); |
|
403 |
|
404 |
|
405 VCXLOGLO1("<<<CVCXScheduledReminderTest::ScheduleDownloadL"); |
|
406 |
|
407 return KErrNone; |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // CVCXScheduledReminderTest::AddScheduleL( CStifItemParser& aItem ) |
|
412 // |
|
413 // ----------------------------------------------------------------------------- |
|
414 // |
|
415 TInt CVCXScheduledReminderTest::AddScheduleL( CStifItemParser& aItem ) |
|
416 { |
|
417 VCXLOGLO1(">>>VCXScheduledReminderTest::AddScheduleL"); |
|
418 |
|
419 // Print to UI |
|
420 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
421 _LIT( KWhere, "In ScheduleDownload" ); |
|
422 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
423 |
|
424 // Construct the program |
|
425 CCseScheduledProgram* program = CCseScheduledProgram::NewL(); |
|
426 CleanupStack::PushL( program ); |
|
427 |
|
428 TPtrC name(_L("<empty>")); |
|
429 TBuf8<KTmpBufLen> nameBuf; |
|
430 nameBuf.Copy(name); |
|
431 program->SetName(nameBuf); |
|
432 VCXLOGLO2("VCXScheduledReminderTest: ServiceName: %S", &nameBuf); |
|
433 |
|
434 // Set type |
|
435 TInt schedType( 0 ); |
|
436 if( aItem.GetNextInt( schedType ) != KErrNone ) |
|
437 { |
|
438 VCXLOGLO1("Unable to read NextInt"); |
|
439 VCXLOGLO1("<<<VCXScheduledReminderTest::AddScheduleL"); |
|
440 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
441 return KErrArgument; |
|
442 } |
|
443 program->SetScheduleType( schedType ); |
|
444 VCXLOGLO2("VCXScheduledReminderTest: ScheduleType: %d", schedType); |
|
445 |
|
446 // Set start & end |
|
447 TInt start(0); |
|
448 TInt end(0); |
|
449 if( aItem.GetNextInt(start) != KErrNone ) |
|
450 { |
|
451 VCXLOGLO1("Unable to read NextInt to start"); |
|
452 VCXLOGLO1("<<<VCXScheduledReminderTest::AddScheduleL"); |
|
453 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
454 return KErrArgument; |
|
455 } |
|
456 if( aItem.GetNextInt(end) != KErrNone ) |
|
457 { |
|
458 VCXLOGLO1("Unable to read NextInt to end"); |
|
459 VCXLOGLO1("<<<VCXScheduledReminderTest::AddScheduleL"); |
|
460 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
461 return KErrArgument; |
|
462 } |
|
463 TTime now; |
|
464 now.UniversalTime(); |
|
465 TTime startTime = now + TTimeIntervalSeconds(start); |
|
466 TTime endTime = now + TTimeIntervalSeconds(end); |
|
467 VCXLOGLO2("VCXScheduledReminderTest: Start: %d", start); |
|
468 VCXLOGLO2("VCXScheduledReminderTest: End: %d", end); |
|
469 program->SetStartTime(TTime(startTime)); |
|
470 program->SetEndTime(TTime(endTime)); |
|
471 |
|
472 // Print times |
|
473 VCXLOGLO1("Now / Universal time:"); |
|
474 PrintTime(now); |
|
475 TTime local; |
|
476 local.HomeTime(); |
|
477 VCXLOGLO1("Now / Local time:"); |
|
478 PrintTime(local); |
|
479 VCXLOGLO1("Scheduled starttime:"); |
|
480 PrintTime(TTime(startTime)); |
|
481 VCXLOGLO1("Scheduled endtime:"); |
|
482 PrintTime(TTime(endTime)); |
|
483 |
|
484 // Set plugin UID to use |
|
485 TInt pluginId( 0 ); |
|
486 if ( aItem.GetNextInt( pluginId ) != KErrNone ) |
|
487 { |
|
488 VCXLOGLO1("Unable to read NextInt"); |
|
489 VCXLOGLO1("<<<VCXScheduledReminderTest::AddScheduleL"); |
|
490 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
491 return KErrArgument; |
|
492 } |
|
493 |
|
494 program->SetPluginUid( GetPluginUidByNumber(pluginId) ); |
|
495 |
|
496 // Set plugin type |
|
497 TInt pluginType( 0 ); |
|
498 if ( aItem.GetNextInt( pluginType ) != KErrNone ) |
|
499 { |
|
500 VCXLOGLO1("Unable to read NextInt"); |
|
501 VCXLOGLO1("<<<VCXScheduledReminderTest::AddScheduleL"); |
|
502 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
503 return KErrArgument; |
|
504 } |
|
505 if( pluginType == 0 ) |
|
506 { |
|
507 program->SetPluginType( CCseScheduledProgram::ECseUniPlugin ); |
|
508 } |
|
509 else |
|
510 { |
|
511 program->SetPluginType( CCseScheduledProgram::ECseMultiPlugin ); |
|
512 } |
|
513 |
|
514 // Set app uid |
|
515 // This is used as a default, does it matter? |
|
516 program->SetAppUid( IPTV_SERVER_UID ); |
|
517 |
|
518 // Set application data |
|
519 TUint id = GetServiceL(aItem); |
|
520 VCXLOGLO2("VCXScheduledReminderTest: Using Service id: %d", id); |
|
521 HBufC8* dataBuf = HBufC8::NewLC(sizeof(TIptvServiceId)); |
|
522 TPtr8 dataPtr(dataBuf->Des()); |
|
523 RDesWriteStream writeStream; |
|
524 CleanupClosePushL(writeStream); |
|
525 writeStream.Open(dataPtr); |
|
526 writeStream.WriteUint32L(id); |
|
527 CleanupStack::PopAndDestroy(&writeStream); |
|
528 program->SetApplicationDataL(dataPtr); |
|
529 CleanupStack::PopAndDestroy(dataBuf); |
|
530 |
|
531 VCXLOGLO1("VCXScheduledReminderTest::AddScheduleL: Adding following item:"); |
|
532 program->DebugDump(); |
|
533 |
|
534 // Add schedule to engine |
|
535 TInt error( 0 ); |
|
536 error = iSchedulerClient->AddSchedule(*program); |
|
537 VCXLOGLO2("VCXScheduledReminderTest: AddSchedule returned %d", error); |
|
538 |
|
539 CleanupStack::PopAndDestroy( program ); |
|
540 |
|
541 VCXLOGLO1("<<<VCXScheduledReminderTest::AddScheduleL"); |
|
542 |
|
543 return error; |
|
544 } |
|
545 |
|
546 // ----------------------------------------------------------------------------- |
|
547 // CVCXScheduledReminderTest::RemoveScheduleL( CStifItemParser& aItem ) |
|
548 // |
|
549 // ----------------------------------------------------------------------------- |
|
550 // |
|
551 TInt CVCXScheduledReminderTest::RemoveScheduleL( CStifItemParser& aItem ) |
|
552 { |
|
553 VCXLOGLO1(">>>CVCXScheduledReminderTest::RemoveScheduleL"); |
|
554 |
|
555 // Print to UI |
|
556 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
557 _LIT( KWhere, "In RemoveSchedule" ); |
|
558 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
559 |
|
560 TInt index( 0 ); |
|
561 |
|
562 // Attempt to read from aItem |
|
563 if( aItem.GetNextInt( index ) != KErrNone ) |
|
564 { |
|
565 VCXLOGLO1("CVCXScheduledReminderTest::RemoveScheduleL: Unable to read parameter"); |
|
566 VCXLOGLO1("<<<CVCXScheduledReminderTest::RemoveScheduleL"); |
|
567 return KErrArgument; |
|
568 } |
|
569 |
|
570 // Attempt to remove schedule by given index |
|
571 TInt error( KErrNone ); |
|
572 error = iSchedulerClient->RemoveSchedule( index ); |
|
573 VCXLOGLO2("VCXScheduledReminderTest: RemoveSchedule returned %d", error); |
|
574 |
|
575 VCXLOGLO1("<<<CVCXScheduledReminderTest::RemoveScheduleL"); |
|
576 return error; |
|
577 } |
|
578 |
|
579 // ----------------------------------------------------------------------------- |
|
580 // CVCXScheduledReminderTest::RemoveAllSchedulesL( CStifItemParser& aItem ) |
|
581 // |
|
582 // ----------------------------------------------------------------------------- |
|
583 // |
|
584 TInt CVCXScheduledReminderTest::RemoveAllSchedulesL( CStifItemParser& /* aItem */ ) |
|
585 { |
|
586 VCXLOGLO1(">>>CVCXScheduledReminderTest::RemoveAllSchedulesL"); |
|
587 |
|
588 // Print to UI |
|
589 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
590 _LIT( KWhere, "In RemoveAllSchedules" ); |
|
591 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
592 |
|
593 RPointerArray<CCseScheduledProgram> tempArray; |
|
594 iSchedulerClient->GetSchedulesByAppUid( IPTV_SERVER_UID, tempArray ); |
|
595 |
|
596 TInt count( 0 ); |
|
597 TInt error( 0 ); |
|
598 for( count = 0; count < tempArray.Count(); count++ ) |
|
599 { |
|
600 error = iSchedulerClient->RemoveSchedule( tempArray[count]->DbIdentifier() ); |
|
601 VCXLOGLO2("CVCXScheduledReminderTest: RemoveSchedule returned %d", error); |
|
602 } |
|
603 |
|
604 tempArray.ResetAndDestroy(); |
|
605 tempArray.Close(); |
|
606 |
|
607 VCXLOGLO1("<<<CVCXScheduledReminderTest::RemoveAllSchedulesL"); |
|
608 return error; |
|
609 } |
|
610 |
|
611 // ----------------------------------------------------------------------------- |
|
612 // CVCXScheduledReminderTest::RemoveAllFromArrayL( CStifItemParser& aItem ) |
|
613 // |
|
614 // ----------------------------------------------------------------------------- |
|
615 // |
|
616 TInt CVCXScheduledReminderTest::RemoveAllFromArrayL( CStifItemParser& aItem ) |
|
617 { |
|
618 VCXLOGLO1(">>>CVCXScheduledReminderTest::RemoveAllFromArrayL"); |
|
619 |
|
620 // Print to UI |
|
621 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
622 _LIT( KWhere, "In RemoveAllFromArrayL" ); |
|
623 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
624 |
|
625 TInt count( 0 ); |
|
626 TInt error( 0 ); |
|
627 for( count = 0; count < iScheduleArray.Count(); count++ ) |
|
628 { |
|
629 error = iSchedulerClient->RemoveSchedule( iScheduleArray[count]->DbIdentifier() ); |
|
630 VCXLOGLO2("CVCXScheduledReminderTest: RemoveSchedule returned %d", error); |
|
631 } |
|
632 |
|
633 // Clean up the iScheduleArray |
|
634 EmptyArray( aItem ); |
|
635 |
|
636 VCXLOGLO1("<<<CVCXScheduledReminderTest::RemoveAllFromArrayL"); |
|
637 return error; |
|
638 } |
|
639 |
|
640 // ----------------------------------------------------------------------------- |
|
641 // CVCXScheduledReminderTest::GetScheduleL() |
|
642 // |
|
643 // ----------------------------------------------------------------------------- |
|
644 // |
|
645 TInt CVCXScheduledReminderTest::GetScheduleL( CStifItemParser& /* aItem */ ) |
|
646 { |
|
647 VCXLOGLO1(">>>CVCXScheduledReminderTest::GetScheduleL"); |
|
648 |
|
649 // Print to UI |
|
650 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
651 _LIT( KWhere, "In GetScheduleL" ); |
|
652 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
653 |
|
654 CCseScheduledProgram* iProgram = CCseScheduledProgram::NewL(); |
|
655 |
|
656 TInt error( 0 ); |
|
657 error = iSchedulerClient->GetSchedule( NULL, iProgram ); |
|
658 VCXLOGLO2("CVCXScheduledReminderTest::GetScheduleL: error: %d", error); |
|
659 |
|
660 // Print |
|
661 iProgram->DebugDump(); |
|
662 |
|
663 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetScheduleL"); |
|
664 return error; |
|
665 } |
|
666 |
|
667 // ----------------------------------------------------------------------------- |
|
668 // CVCXScheduledReminderTest::GetSchedulesByAppUid() |
|
669 // |
|
670 // ----------------------------------------------------------------------------- |
|
671 // |
|
672 TInt CVCXScheduledReminderTest::GetSchedulesByAppUidL( CStifItemParser& /* aItem */ ) |
|
673 { |
|
674 VCXLOGLO1(">>>CVCXScheduledReminderTest::GetSchedulesByAppUidL"); |
|
675 |
|
676 // Print to UI |
|
677 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
678 _LIT( KWhere, "In GetSchedulesByAppUIDL" ); |
|
679 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
680 |
|
681 // Fetch schedules from client |
|
682 TInt error( 0 ); |
|
683 error = iSchedulerClient->GetSchedulesByAppUid( IPTV_SERVER_UID, iScheduleArray ); |
|
684 VCXLOGLO2("CVCXScheduledReminderTest: GetSchedulesByAppUid returned errorcode %d", error); |
|
685 |
|
686 // Print schedules |
|
687 PrintArray( iScheduleArray ); |
|
688 |
|
689 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesByAppUidL"); |
|
690 return error; |
|
691 } |
|
692 |
|
693 // ----------------------------------------------------------------------------- |
|
694 // CVCXScheduledReminderTest::GetOverlappingSchedulesL() |
|
695 // |
|
696 // ----------------------------------------------------------------------------- |
|
697 // |
|
698 TInt CVCXScheduledReminderTest::GetOverlappingSchedulesL( CStifItemParser& aItem ) |
|
699 { |
|
700 VCXLOGLO1(">>>CVCXScheduledReminderTest::GetOverlappingSchedulesL"); |
|
701 |
|
702 // Print to UI |
|
703 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
704 _LIT( KWhere, "In GetOverlappingSchedulesL" ); |
|
705 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
706 |
|
707 CCseScheduledProgram* program = CCseScheduledProgram::NewL(); |
|
708 CleanupStack::PushL( program ); |
|
709 |
|
710 //Program object, add type and starttime/endtime, etc etc |
|
711 TInt type( 0 ); |
|
712 if( aItem.GetNextInt( type ) != KErrNone ) |
|
713 { |
|
714 VCXLOGLO1("Unable to read NextInt"); |
|
715 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesL"); |
|
716 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
717 return KErrArgument; |
|
718 } |
|
719 |
|
720 // Start & end times |
|
721 TInt start(0); |
|
722 TInt end(0); |
|
723 if( aItem.GetNextInt( start ) != KErrNone ) |
|
724 { |
|
725 VCXLOGLO1("Unable to read NextInt"); |
|
726 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesL"); |
|
727 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
728 return KErrArgument; |
|
729 } |
|
730 |
|
731 if( aItem.GetNextInt( end ) != KErrNone ) |
|
732 { |
|
733 VCXLOGLO1("Unable to read NextInt"); |
|
734 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesL"); |
|
735 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
736 return KErrArgument; |
|
737 } |
|
738 |
|
739 TTime now; |
|
740 now.UniversalTime(); |
|
741 TTime startTime = now - TTimeIntervalDays( start ); |
|
742 TTime endTime = now + TTimeIntervalDays( end ); |
|
743 |
|
744 // Set the needed values |
|
745 program->SetScheduleType( type ); |
|
746 program->SetStartTime( startTime ); |
|
747 program->SetEndTime( endTime ); |
|
748 |
|
749 // Fetch schedules from client |
|
750 TInt error( 0 ); |
|
751 error = iSchedulerClient->GetOverlappingSchedules( *program, iScheduleArray ); |
|
752 VCXLOGLO2("CVCXScheduledReminderTest: GetOverlappingSchedules returned errorcode %d", error); |
|
753 |
|
754 CleanupStack::PopAndDestroy(); //CCseScheduledProgram |
|
755 |
|
756 // Print schedules |
|
757 PrintArray( iScheduleArray ); |
|
758 |
|
759 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetOverlappingSchedulesL"); |
|
760 return error; |
|
761 } |
|
762 |
|
763 // ----------------------------------------------------------------------------- |
|
764 // CVCXScheduledReminderTest::GetSchedulesByPluginUIDL() |
|
765 // |
|
766 // ----------------------------------------------------------------------------- |
|
767 // |
|
768 TInt CVCXScheduledReminderTest::GetSchedulesByPluginUidL( CStifItemParser& aItem ) |
|
769 { |
|
770 VCXLOGLO1(">>>CVCXScheduledReminderTest::GetSchedulesByPluginUidL"); |
|
771 |
|
772 // Print to UI |
|
773 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
774 _LIT( KWhere, "In GetSchedulesByPluginUidL" ); |
|
775 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
776 |
|
777 // Set plugin UID to use |
|
778 TInt pluginId( 0 ); |
|
779 if ( aItem.GetNextInt( pluginId ) != KErrNone ) |
|
780 { |
|
781 VCXLOGLO1("Unable to read NextInt"); |
|
782 VCXLOGLO1("<<<VCXScheduledReminderTest::GetSchedulesByPluginUidL"); |
|
783 return KErrArgument; |
|
784 } |
|
785 |
|
786 TInt32 pluginUid( 0 ); |
|
787 pluginUid = GetPluginUidByNumber(pluginId); |
|
788 |
|
789 // Fetch schedules from client |
|
790 TInt error( 0 ); |
|
791 error = iSchedulerClient->GetSchedulesByPluginUid( pluginUid, iScheduleArray ); |
|
792 VCXLOGLO2("CVCXScheduledReminderTest: GetSchedulesByPluginUidL returned errorcode %d", error); |
|
793 |
|
794 // Print schedules |
|
795 PrintArray( iScheduleArray ); |
|
796 |
|
797 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesByPluginUidL"); |
|
798 return error; |
|
799 } |
|
800 |
|
801 // ----------------------------------------------------------------------------- |
|
802 // CVCXScheduledReminderTest::GetSchedulesByTypeL() |
|
803 // |
|
804 // ----------------------------------------------------------------------------- |
|
805 // |
|
806 TInt CVCXScheduledReminderTest::GetSchedulesByTypeL( CStifItemParser& aItem ) |
|
807 { |
|
808 VCXLOGLO1(">>>CVCXScheduledReminderTest::GetSchedulesByTypeL"); |
|
809 |
|
810 // Print to UI |
|
811 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
812 _LIT( KWhere, "In GetSchedulesByTypeL" ); |
|
813 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
814 |
|
815 TInt type( 0 ); |
|
816 if( aItem.GetNextInt( type ) != KErrNone ) |
|
817 { |
|
818 VCXLOGLO1("Unable to read NextInt"); |
|
819 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesL"); |
|
820 return KErrArgument; |
|
821 } |
|
822 |
|
823 // Fetch schedules from client |
|
824 TInt error( 0 ); |
|
825 error = iSchedulerClient->GetSchedulesByType( type, iScheduleArray ); |
|
826 VCXLOGLO2("<<<CVCXScheduledReminderTest: GetSchedulesByType returned errorcode %d", error); |
|
827 |
|
828 // Print schedules |
|
829 PrintArray( iScheduleArray ); |
|
830 |
|
831 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesByTypeL"); |
|
832 return error; |
|
833 } |
|
834 |
|
835 // ----------------------------------------------------------------------------- |
|
836 // CVCXScheduledReminderTest::GetSchedulesByTime() |
|
837 // |
|
838 // ----------------------------------------------------------------------------- |
|
839 // |
|
840 TInt CVCXScheduledReminderTest::GetSchedulesByTimeL( CStifItemParser& aItem ) |
|
841 { |
|
842 VCXLOGLO1(">>>CVCXScheduledReminderTest::GetSchedulesByTimeL"); |
|
843 |
|
844 // Print to UI |
|
845 _LIT( KModule, "VCXScheduledReminderTest" ); |
|
846 _LIT( KWhere, "In GetSchedulesByTimeL" ); |
|
847 TestModuleIf().Printf( 0, KModule, KWhere ); |
|
848 |
|
849 // Start & end times |
|
850 TInt start( 0 ); |
|
851 TInt end( 0 ); |
|
852 if( aItem.GetNextInt( start ) != KErrNone ) |
|
853 { |
|
854 VCXLOGLO1("Unable to read NextInt"); |
|
855 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesL"); |
|
856 return KErrArgument; |
|
857 } |
|
858 if( aItem.GetNextInt( end ) != KErrNone ) |
|
859 { |
|
860 VCXLOGLO1("Unable to read NextInt"); |
|
861 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesL"); |
|
862 return KErrArgument; |
|
863 } |
|
864 TTime now; |
|
865 now.UniversalTime(); |
|
866 TTime startTime = now - TTimeIntervalDays( start ); |
|
867 TTime endTime = now + TTimeIntervalDays( end ); |
|
868 |
|
869 // Fetch schedules from client |
|
870 TInt error( 0 ); |
|
871 error = iSchedulerClient->GetSchedulesByTime( startTime, endTime, iScheduleArray ); |
|
872 VCXLOGLO2("VCXScheduledReminderTest: GetSchedulesByTime returned errorcode %d", error); |
|
873 |
|
874 // Print schedules |
|
875 PrintArray( iScheduleArray ); |
|
876 |
|
877 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetSchedulesByTimeL"); |
|
878 return error; |
|
879 } |
|
880 |
|
881 // ----------------------------------------------------------------------------- |
|
882 // CVCXScheduledReminderTest::CheckCountL() |
|
883 // |
|
884 // ----------------------------------------------------------------------------- |
|
885 // |
|
886 TInt CVCXScheduledReminderTest::CheckCountL( CStifItemParser& aItem ) |
|
887 { |
|
888 VCXLOGLO1(">>>CVCXScheduledReminderTest::CheckCountL"); |
|
889 TInt expectedCount( 0 ); |
|
890 TInt error( KErrNone ); |
|
891 |
|
892 if( aItem.GetNextInt( expectedCount ) != KErrNone ) |
|
893 { |
|
894 VCXLOGLO1("Unable to read NextInt"); |
|
895 VCXLOGLO1("<<<CVCXScheduledReminderTest::CheckCountL"); |
|
896 return KErrArgument; |
|
897 } |
|
898 |
|
899 VCXLOGLO2("CVCXScheduledReminderTest::CheckCountL: Expecting %d items", expectedCount); |
|
900 VCXLOGLO2("CVCXScheduledReminderTest::CheckCountL: iScheduleArray.Count() = %d", iScheduleArray.Count()); |
|
901 |
|
902 if( iScheduleArray.Count() != expectedCount ) |
|
903 { |
|
904 VCXLOGLO1("CVCXScheduledReminderTest::CheckCountL: The amount of scheduled items doesn't match the expected value!"); |
|
905 error = KErrGeneral; |
|
906 } |
|
907 VCXLOGLO1("<<<CVCXScheduledReminderTest::CheckCountL"); |
|
908 return error; |
|
909 } |
|
910 |
|
911 // ----------------------------------------------------------------------------- |
|
912 // CVCXScheduledReminderTest::CheckCountL() |
|
913 // |
|
914 // ----------------------------------------------------------------------------- |
|
915 // |
|
916 TInt CVCXScheduledReminderTest::EmptyArray( CStifItemParser& /* aItem */ ) |
|
917 { |
|
918 iScheduleArray.Reset(); |
|
919 return KErrNone; |
|
920 } |
|
921 |
|
922 // ----------------------------------------------------------------------------- |
|
923 // CVCXScheduledReminderTest::CompareScheduleLists() |
|
924 // Compare schedule array to the class member array |
|
925 // ----------------------------------------------------------------------------- |
|
926 // |
|
927 TBool CVCXScheduledReminderTest::CompareScheduleLists( RPointerArray<CCseScheduledProgram> aList ) |
|
928 { |
|
929 // if the amount of items doesn't match, then lists obviously don't match |
|
930 if( aList.Count() != iScheduleArray.Count() ) |
|
931 { |
|
932 return EFalse; |
|
933 } |
|
934 |
|
935 // compare every item |
|
936 TInt count(0); |
|
937 for( count = 0; count < iScheduleArray.Count(); count++ ) |
|
938 { |
|
939 if( !CompareScheduleItems( aList[count], iScheduleArray[count] ) ) |
|
940 { |
|
941 return EFalse; |
|
942 } |
|
943 } |
|
944 |
|
945 // finally, if previous tests didn't return false, the lists obviously match! |
|
946 return ETrue; |
|
947 } |
|
948 |
|
949 // ----------------------------------------------------------------------------- |
|
950 // CVCXScheduledReminderTest::CompareScheduleItems() |
|
951 // Compares given programs |
|
952 // ----------------------------------------------------------------------------- |
|
953 // |
|
954 TBool CVCXScheduledReminderTest::CompareScheduleItems( CCseScheduledProgram* aFirst, CCseScheduledProgram* aSecond ) |
|
955 { |
|
956 // Now this is easy and stupid. Is there any convenient way? |
|
957 |
|
958 if( aFirst->Name() != aSecond->Name() ) return EFalse; |
|
959 if( aFirst->StartTime() != aSecond->StartTime() ) return EFalse; |
|
960 if( aFirst->EndTime() != aSecond->EndTime() ) return EFalse; |
|
961 if( aFirst->AppUid() != aSecond->AppUid() ) return EFalse; |
|
962 if( aFirst->PluginUid() != aSecond->PluginUid() ) return EFalse; |
|
963 if( aFirst->ApplicationData() != aSecond->ApplicationData() ) return EFalse; |
|
964 if( aFirst->DbIdentifier() != aSecond->DbIdentifier() ) return EFalse; |
|
965 if( aFirst->ScheduleType() != aSecond->ScheduleType() ) return EFalse; |
|
966 |
|
967 // If all else "fails" |
|
968 return ETrue; |
|
969 } |
|
970 |
|
971 // ----------------------------------------------------------------------------- |
|
972 // CVCXScheduledReminderTest::PrintArray() |
|
973 // |
|
974 // ----------------------------------------------------------------------------- |
|
975 // |
|
976 void CVCXScheduledReminderTest::PrintArray( RPointerArray<CCseScheduledProgram> aList ) |
|
977 { |
|
978 TInt count( 0 ); |
|
979 for( count = 0; count < aList.Count(); count++ ) |
|
980 { |
|
981 aList[count]->DebugDump(); |
|
982 } |
|
983 } |
|
984 |
|
985 // ----------------------------------------------------------------------------- |
|
986 // CVCXScheduledReminderTest::GetPluginUidByNumber( TInt aValue ) |
|
987 // Returns plugin uid based on number |
|
988 // ----------------------------------------------------------------------------- |
|
989 // |
|
990 TInt32 CVCXScheduledReminderTest::GetPluginUidByNumber( TInt aValue ) |
|
991 { |
|
992 TInt32 pluginUID( 0 ); |
|
993 |
|
994 switch( aValue ) |
|
995 { |
|
996 case 0: |
|
997 { |
|
998 VCXLOGLO1("VCXScheduledReminderTest: Plugin id: KSceSchedulerPluginEcomIfUid"); |
|
999 //pluginUID = KSceSchedulerPluginEcomIfUid; |
|
1000 break; |
|
1001 } |
|
1002 case 1: |
|
1003 { |
|
1004 VCXLOGLO1("VCXScheduledReminderTest: Plugin id: KIptvSchedulerPluginIpmlementationUid"); |
|
1005 //pluginUID = KIptvSchedulerPluginIpmlementationUid; |
|
1006 break; |
|
1007 } |
|
1008 case 2: |
|
1009 { |
|
1010 VCXLOGLO1("VCXScheduledReminderTest: Plugin id: KIptvSchedulerPluginUid"); |
|
1011 //pluginUID = KIptvSchedulerPluginUid; |
|
1012 break; |
|
1013 } |
|
1014 case 3: |
|
1015 { |
|
1016 VCXLOGLO1("VCXScheduledReminderTest: Plugin id: INVALID PLUGIN UID"); |
|
1017 pluginUID = KInvalidPluginUid; |
|
1018 break; |
|
1019 } |
|
1020 default: |
|
1021 { |
|
1022 VCXLOGLO1("VCXScheduledReminderTest: Plugin id: KIptvScheduledDownloadPluginImplementationUid"); |
|
1023 pluginUID = KIptvScheduledDownloadPluginImplementationUid; |
|
1024 break; |
|
1025 } |
|
1026 } |
|
1027 return pluginUID; |
|
1028 } |
|
1029 |
|
1030 // ----------------------------------------------------------------------------- |
|
1031 // CVCXScheduledReminderTest::AdjustClockL ( timeintervalinseconds ) |
|
1032 // adds to given interval to current system time. interval may also be negative. |
|
1033 // ----------------------------------------------------------------------------- |
|
1034 // |
|
1035 TInt CVCXScheduledReminderTest::AdjustClockL( CStifItemParser& aItem ) |
|
1036 { |
|
1037 VCXLOGLO1(">>>CVCXScheduledReminderTest::AdjustClockL"); |
|
1038 // Print to UI |
|
1039 _LIT( KVCXScheduledReminderTest, "VCXScheduledReminderTest" ); |
|
1040 _LIT( KAdjustClock, "In AdjustClock" ); |
|
1041 TestModuleIf().Printf( 0, KVCXScheduledReminderTest, KAdjustClock ); |
|
1042 // Print to log file |
|
1043 iLog->Log( KAdjustClock ); |
|
1044 |
|
1045 TInt tmp; |
|
1046 T1L( aItem.GetNextInt(tmp), KErrNone ); |
|
1047 TTimeIntervalSeconds ts(tmp); |
|
1048 |
|
1049 TTime oldTime; |
|
1050 oldTime.UniversalTime(); |
|
1051 |
|
1052 User::SetUTCTime(TTime(oldTime + ts)); |
|
1053 |
|
1054 VCXLOGLO2("CSchedulingTest: AdjustClock ts: %d", ts.Int()); |
|
1055 |
|
1056 VCXLOGLO1("<<<CVCXScheduledReminderTest::AdjustClockL"); |
|
1057 |
|
1058 return KErrNone; |
|
1059 } |
|
1060 |
|
1061 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1062 |
|
1063 // ----------------------------------------------------------------------------- |
|
1064 // CVCXScheduledReminderTest::GetServiceL |
|
1065 // If aItem = string, returns given service's id, otherwise returns given number. |
|
1066 // ----------------------------------------------------------------------------- |
|
1067 // |
|
1068 TUint32 CVCXScheduledReminderTest::GetServiceL(CStifItemParser& aItem) |
|
1069 { |
|
1070 VCXLOGLO1(">>>CVCXScheduledReminderTest::GetServiceL"); |
|
1071 |
|
1072 TPtrC serviceName; |
|
1073 TUint serviceId(0); |
|
1074 |
|
1075 aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing); |
|
1076 |
|
1077 if( KErrNone == aItem.GetNextString(serviceName) && iTestUtil!=NULL) |
|
1078 { |
|
1079 VCXLOGLO2("CVCXScheduledReminderTest:: Service name = %S",&serviceName); |
|
1080 TInt sidTemp(0); |
|
1081 |
|
1082 if( iTestUtil->GetServiceIdByNameL(serviceName, sidTemp) == KErrNone ) |
|
1083 { |
|
1084 serviceId = sidTemp; |
|
1085 } |
|
1086 else |
|
1087 { |
|
1088 TLex lex(serviceName); |
|
1089 TInt64 tmp2; |
|
1090 if(lex.Val(tmp2)==KErrNone) |
|
1091 { |
|
1092 serviceId = tmp2; |
|
1093 VCXLOGLO2("Service name not found, using parsed int %d.",serviceId); |
|
1094 } |
|
1095 else |
|
1096 { |
|
1097 VCXLOGLO1("Service not found"); |
|
1098 _LIT(KTestErr, "Invalid service"); |
|
1099 User::Panic(KTestErr, KTestPanic); |
|
1100 } |
|
1101 } |
|
1102 } |
|
1103 else |
|
1104 { |
|
1105 VCXLOGLO1("Missing parameter: service"); |
|
1106 _LIT(KTestErr, "Service missing"); |
|
1107 User::Panic(KTestErr,KTestPanic); |
|
1108 } |
|
1109 |
|
1110 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetServiceL"); |
|
1111 return serviceId; |
|
1112 } |
|
1113 |
|
1114 // ----------------------------------------------------------------------------- |
|
1115 // CVCXScheduledReminderTest::GetIapL |
|
1116 // If aItem = string, returns given iap's id, otherwise returns given number. |
|
1117 // ----------------------------------------------------------------------------- |
|
1118 // |
|
1119 TUint32 CVCXScheduledReminderTest::GetIapL( CStifItemParser& aItem ) { |
|
1120 VCXLOGLO1(">>>CVCXScheduledReminderTest::GetIapL"); |
|
1121 |
|
1122 TPtrC iapName; |
|
1123 TUint32 iapId(0); |
|
1124 |
|
1125 aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing); |
|
1126 |
|
1127 /* |
|
1128 TInt temp; |
|
1129 if( aItem.GetNextInt( temp ) == KErrNone ) { |
|
1130 iapId = (TUint32)temp; |
|
1131 VCXLOGLO2("Using int %d as Iap ID.",iapId); |
|
1132 } |
|
1133 else { |
|
1134 aItem.GetNextString(iapName); |
|
1135 if( !iTestUtil->GetIapIdL(iapName, iapId) ) { |
|
1136 VCXLOGLO1("Iap not found"); |
|
1137 _LIT(KTestErr, "Invalid iap"); |
|
1138 User::Panic(KTestErr,KTestPanic); |
|
1139 } |
|
1140 }*/ |
|
1141 |
|
1142 |
|
1143 if( KErrNone == aItem.GetNextString(iapName) && iTestUtil!=NULL) { |
|
1144 VCXLOGLO2("CVCXScheduledReminderTest:: Iap name = %S",&iapName); |
|
1145 if( !iTestUtil->GetIapIdL(iapName, iapId) ) { |
|
1146 TLex lex(iapName); |
|
1147 TInt64 tmp1; |
|
1148 if(lex.Val(tmp1)==KErrNone) { |
|
1149 iapId = tmp1; |
|
1150 VCXLOGLO2("Iap name not found, using parsed int %d.",iapId); |
|
1151 } |
|
1152 else { |
|
1153 VCXLOGLO1("Iap not found"); |
|
1154 _LIT(KTestErr, "Invalid iap"); |
|
1155 User::Panic(KTestErr,KTestPanic); |
|
1156 } |
|
1157 } |
|
1158 } |
|
1159 else { |
|
1160 VCXLOGLO1("Error finding Iap !"); |
|
1161 _LIT(KTestErr, "iap missing"); |
|
1162 User::Panic(KTestErr,KTestPanic); |
|
1163 } |
|
1164 |
|
1165 VCXLOGLO1("<<<CVCXScheduledReminderTest::GetIapL"); |
|
1166 return iapId; |
|
1167 } |
|
1168 |
|
1169 // End of File |