|
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 // INCLUDE FILES |
|
19 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroyPushL |
|
20 #include <e32svr.h> |
|
21 #include <StifParser.h> |
|
22 #include <Stiftestinterface.h> |
|
23 #include <centralrepository.h> |
|
24 #include <collate.h> |
|
25 |
|
26 #include "VCXTestLog.h" |
|
27 #include "VCXTestCommon.h" |
|
28 #include "CIptvTestActiveWait.h" |
|
29 #include "CIptvTestTimer.h" |
|
30 #include "VCXTestStatsKeeper.h" |
|
31 |
|
32 #include "VCXMyVideosCollectionPluginTest.h" |
|
33 #include "VCXMyVideosCollectionPluginTester.h" |
|
34 #include "VCXMyVideosTestCommon.h" |
|
35 #include "VCXMyVideosTestDlWatcher.h" |
|
36 #include "VCXMyVideosTestServiceEmu.h" |
|
37 #include "VCXTestMdsDbModifier.h" |
|
38 |
|
39 #include <mpxmedia.h> |
|
40 #include <mpxmediageneraldefs.h> |
|
41 #include <mpxmediageneralextdefs.h> |
|
42 |
|
43 #include "vcxmyvideosuids.h" |
|
44 |
|
45 // CONSTANTS |
|
46 |
|
47 const TInt KVcxTestFileSize3GB = -999; |
|
48 |
|
49 // MACROS |
|
50 #define VCXMVTEST_ERR(err) ( iStatsEnabled ) ? KErrNone : err |
|
51 |
|
52 // MODULE DATA STRUCTURES |
|
53 |
|
54 // ============================ MEMBER FUNCTIONS =============================== |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CVCXMyVideosCollectionPluginTest::Delete |
|
58 // Delete here all resources allocated and opened from test methods. |
|
59 // Called from destructor. |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 void CVCXMyVideosCollectionPluginTest::Delete() |
|
63 { |
|
64 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::Delete ---------->"); |
|
65 |
|
66 delete iTester; |
|
67 iTester = NULL; |
|
68 |
|
69 if( iDeleteSideloadedFilesAndFolders ) |
|
70 { |
|
71 iDeleteSideloadedFilesAndFolders = EFalse; |
|
72 CStifItemParser* parser = NULL; |
|
73 TRAP_IGNORE( EmptySideloadFoldersL( *parser ) ); // oeh noes |
|
74 } |
|
75 |
|
76 iSideloadedFiles.ResetAndDestroy(); |
|
77 |
|
78 // Remove folders used in sideloading, if they'r empty |
|
79 for( TInt i=0; i < iSideloadFolders.Count(); i++ ) |
|
80 { |
|
81 HBufC* path = iSideloadFolders[i]; |
|
82 TInt pos = 0; |
|
83 TInt firstPos = 0; |
|
84 while( ETrue ) |
|
85 { |
|
86 pos = path->Des().LocateReverse('\\'); |
|
87 firstPos = path->Des().Locate('\\'); |
|
88 // Check that it's not the root folder. |
|
89 if( pos != KErrNotFound && pos != firstPos ) |
|
90 { |
|
91 // Remove last folder from the path string, or the filename. |
|
92 path->Des().SetLength( pos+1 ); |
|
93 if( DeleteDirectoryIfEmpty( iFs, *iFileMan, *path ) != KErrNone) |
|
94 { |
|
95 break; |
|
96 } |
|
97 // Remove trailing backslash. |
|
98 path->Des().SetLength( pos ); |
|
99 } |
|
100 else |
|
101 { |
|
102 break; |
|
103 } |
|
104 } |
|
105 } |
|
106 |
|
107 iSideloadFolders.ResetAndDestroy(); |
|
108 |
|
109 delete iTestCommon; |
|
110 iTestCommon = NULL; |
|
111 |
|
112 #ifdef __WINSCW__ |
|
113 iClient.Close(); |
|
114 #endif // __WINSCW__ |
|
115 |
|
116 if( iActiveWait ) |
|
117 { |
|
118 iActiveWait->Stop(); |
|
119 delete iActiveWait; |
|
120 iActiveWait = NULL; |
|
121 } |
|
122 |
|
123 if( iActiveWaitBlocking ) |
|
124 { |
|
125 iActiveWaitBlocking->Stop(); |
|
126 delete iActiveWaitBlocking; |
|
127 iActiveWaitBlocking = NULL; |
|
128 } |
|
129 |
|
130 if( iTimeoutTimer ) |
|
131 { |
|
132 iTimeoutTimer->CancelTimer(); |
|
133 delete iTimeoutTimer; |
|
134 iTimeoutTimer = NULL; |
|
135 } |
|
136 |
|
137 if( iCoolDownTimer ) |
|
138 { |
|
139 iCoolDownTimer->CancelTimer(); |
|
140 delete iCoolDownTimer; |
|
141 iCoolDownTimer = NULL; |
|
142 } |
|
143 |
|
144 delete iMpxMedia; |
|
145 iMpxMedia = NULL; |
|
146 |
|
147 delete iServiceEmu; |
|
148 iServiceEmu = NULL; |
|
149 |
|
150 delete iMdsDbModifier; |
|
151 iMdsDbModifier = NULL; |
|
152 |
|
153 delete iFileMan; |
|
154 iFileMan = NULL; |
|
155 |
|
156 iFs.Close(); |
|
157 |
|
158 delete iStats; |
|
159 iStats = NULL; |
|
160 |
|
161 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::Delete <----------"); |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CVCXMyVideosCollectionPluginTest::RunMethodL |
|
166 // Run specified method. Contains also table of test mothods and their names. |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 TInt CVCXMyVideosCollectionPluginTest::RunMethodL( |
|
170 CStifItemParser& aItem ) |
|
171 { |
|
172 |
|
173 static TStifFunctionInfo const KFunctions[] = |
|
174 { |
|
175 // Copy this line for every implemented function. |
|
176 // First string is the function name used in TestScripter script file. |
|
177 // Second is the actual implementation member function. |
|
178 ENTRY( "Create", CVCXMyVideosCollectionPluginTest::CreateL ), |
|
179 |
|
180 ENTRY( "EnableStats", CVCXMyVideosCollectionPluginTest::EnableStatsL ), |
|
181 ENTRY( "SetPreferredMemory", CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL ), |
|
182 ENTRY( "SetSortingOrder", CVCXMyVideosCollectionPluginTest::SetSortingOrderL ), |
|
183 ENTRY( "SetAutomaticRefresh", CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh ), |
|
184 ENTRY( "SetQuietMode", CVCXMyVideosCollectionPluginTest::SetQuietMode ), |
|
185 ENTRY( "CoolDown", CVCXMyVideosCollectionPluginTest::CoolDownL ), |
|
186 ENTRY( "DisableDownloadCheck", CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL ), |
|
187 ENTRY( "SetFileCheck", CVCXMyVideosCollectionPluginTest::SetFileCheckL ), |
|
188 ENTRY( "SetAutoResume", CVCXMyVideosCollectionPluginTest::SetAutoResumeL ), |
|
189 |
|
190 ENTRY( "OpenCollection", CVCXMyVideosCollectionPluginTest::OpenCollectionL ), |
|
191 ENTRY( "OpenLevel", CVCXMyVideosCollectionPluginTest::OpenLevelL ), |
|
192 ENTRY( "RefreshContents", CVCXMyVideosCollectionPluginTest::RefreshContentsL ), |
|
193 ENTRY( "GetMediasByMpxId", CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL ), |
|
194 ENTRY( "CloseLevel", CVCXMyVideosCollectionPluginTest::CloseLevelL ), |
|
195 |
|
196 ENTRY( "GetMediaFullDetails", CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL ), |
|
197 ENTRY( "GetMediaFullDetailsByMpxId", CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL ), |
|
198 ENTRY( "GetAllMediaFullDetails", CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL ), |
|
199 ENTRY( "SetMediaDetail", CVCXMyVideosCollectionPluginTest::SetMediaDetailL ), |
|
200 ENTRY( "CheckMediaDetail", CVCXMyVideosCollectionPluginTest::CheckMediaDetailL ), |
|
201 ENTRY( "CheckMediaCount", CVCXMyVideosCollectionPluginTest::CheckMediaCountL ), |
|
202 ENTRY( "CheckMinimumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL ), |
|
203 ENTRY( "CheckMaximumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL ), |
|
204 ENTRY( "CheckDownloadCount", CVCXMyVideosCollectionPluginTest::CheckDownloadCountL ), |
|
205 |
|
206 ENTRY( "CreateCopyOfMedia", CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL ), |
|
207 ENTRY( "CreateEmptyMedia", CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL ), |
|
208 ENTRY( "AddMedia", CVCXMyVideosCollectionPluginTest::AddMediaL ), |
|
209 ENTRY( "SetMedia", CVCXMyVideosCollectionPluginTest::SetMediaL ), |
|
210 ENTRY( "OutsideMediaUpdate", CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL ), |
|
211 ENTRY( "CancelNextOperation", CVCXMyVideosCollectionPluginTest::CancelNextOperationL ), |
|
212 |
|
213 ENTRY( "DeleteFileOfMedia", CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL ), |
|
214 ENTRY( "DeleteFilesOfAllMedias", CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL ), |
|
215 ENTRY( "RemoveMedia", CVCXMyVideosCollectionPluginTest::RemoveMediaL ), |
|
216 ENTRY( "RemoveAllMedia", CVCXMyVideosCollectionPluginTest::RemoveAllMediaL ), |
|
217 ENTRY( "MoveMedia", CVCXMyVideosCollectionPluginTest::MoveMediaL ), |
|
218 ENTRY( "MoveMedias", CVCXMyVideosCollectionPluginTest::MoveMediasL ), |
|
219 ENTRY( "CancelMove", CVCXMyVideosCollectionPluginTest::CancelMoveL ), |
|
220 ENTRY( "CopyMedia", CVCXMyVideosCollectionPluginTest::CopyMediaL ), |
|
221 ENTRY( "CopyMedias", CVCXMyVideosCollectionPluginTest::CopyMediasL ), |
|
222 ENTRY( "CancelCopy", CVCXMyVideosCollectionPluginTest::CancelCopyL ), |
|
223 ENTRY( "DeleteMedia", CVCXMyVideosCollectionPluginTest::DeleteMediaL ), |
|
224 ENTRY( "DeleteMedias", CVCXMyVideosCollectionPluginTest::DeleteMediasL ), |
|
225 ENTRY( "CancelDelete", CVCXMyVideosCollectionPluginTest::CancelDeleteL ), |
|
226 |
|
227 ENTRY( "CreateVideoFile", CVCXMyVideosCollectionPluginTest::CreateVideoFileL ), |
|
228 ENTRY( "CreateVideoFileNoWait", CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ), |
|
229 ENTRY( "EnsureDriveForVideos", CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL ), |
|
230 ENTRY( "EmptySideloadFolders", CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL ), |
|
231 ENTRY( "SetDeleteSideloadedVideos", CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos ), |
|
232 |
|
233 ENTRY( "Download", CVCXMyVideosCollectionPluginTest::DownloadL ), |
|
234 ENTRY( "ResumeDownload", CVCXMyVideosCollectionPluginTest::ResumeDownloadL ), |
|
235 ENTRY( "ResumeAllDownloads", CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL ), |
|
236 ENTRY( "DownloadUsingMedia", CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL ), |
|
237 ENTRY( "ResumeDownloadUsingMedia", CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL ), |
|
238 ENTRY( "DownloadUrl", CVCXMyVideosCollectionPluginTest::DownloadUrlL ), |
|
239 ENTRY( "CancelDownload", CVCXMyVideosCollectionPluginTest::CancelDownloadL ), |
|
240 ENTRY( "CancelDownloadById", CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL ), |
|
241 ENTRY( "PauseDownload", CVCXMyVideosCollectionPluginTest::PauseDownloadL ), |
|
242 ENTRY( "PauseDownloadByUrl", CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL ), |
|
243 ENTRY( "CheckDownloadProgress", CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL ), |
|
244 |
|
245 ENTRY( "WaitAllDownloads", CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL ), |
|
246 ENTRY( "WaitForMessage", CVCXMyVideosCollectionPluginTest::WaitForMessageL ), |
|
247 ENTRY( "WaitForAnyMessage", CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL ), |
|
248 ENTRY( "WaitForMessages", CVCXMyVideosCollectionPluginTest::WaitForMessagesL ), |
|
249 |
|
250 }; |
|
251 |
|
252 const TInt count = sizeof( KFunctions ) / |
|
253 sizeof( TStifFunctionInfo ); |
|
254 |
|
255 return RunInternalL( KFunctions, count, aItem ); |
|
256 |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CVCXMyVideosCollectionPluginTest::EnableStatsL |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 TInt CVCXMyVideosCollectionPluginTest::EnableStatsL( CStifItemParser& aItem ) |
|
264 { |
|
265 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::EnableStatsL ---------->"); |
|
266 // Print to UI |
|
267 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
268 _LIT( KWhere, "In EnableStatsL" ); |
|
269 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
270 // Print to log file |
|
271 iLog->Log( KWhere ); |
|
272 |
|
273 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
274 |
|
275 TPtrC statsName; |
|
276 TPtrC fileName; |
|
277 User::LeaveIfError( aItem.GetNextString( statsName) ); |
|
278 User::LeaveIfError( aItem.GetNextString( fileName) ); |
|
279 |
|
280 TRAP_IGNORE( iStats->StartStatsKeepingL( statsName, fileName ) ); |
|
281 iStatsEnabled = ETrue; |
|
282 |
|
283 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EnableStatsL <----------"); |
|
284 return KErrNone; |
|
285 } |
|
286 |
|
287 // ----------------------------------------------------------------------------- |
|
288 // CVCXMyVideosCollectionPluginTest::CreateL |
|
289 // ----------------------------------------------------------------------------- |
|
290 // |
|
291 TInt CVCXMyVideosCollectionPluginTest::CreateL( CStifItemParser& aItem ) |
|
292 { |
|
293 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateL ---------->"); |
|
294 // Print to UI |
|
295 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
296 _LIT( KWhere, "In CreateL" ); |
|
297 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
298 // Print to log file |
|
299 iLog->Log( KWhere ); |
|
300 |
|
301 User::LeaveIfError( iFs.Connect() ); |
|
302 iFileMan = CFileMan::NewL( iFs ); |
|
303 |
|
304 aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing); |
|
305 |
|
306 iTestCommon = CVCXTestCommon::NewL(); |
|
307 iStats = CVCXTestStatsKeeper::NewL(); |
|
308 iTester = CVCXMyVideosCollectionPluginTester::NewL( this, iTestCommon, iStats ); |
|
309 iActiveWait = CIptvTestActiveWait::NewL(); |
|
310 iActiveWaitBlocking = CIptvTestActiveWait::NewL(); |
|
311 iTimeoutTimer = CIptvTestTimer::NewL(*this, 0); |
|
312 iCoolDownTimer = CIptvTestTimer::NewL(*this, 1); |
|
313 |
|
314 #ifdef __WINSCW__ |
|
315 TInt err = iClient.Connect(); |
|
316 if( KErrNone != err ) |
|
317 { |
|
318 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Could not start MDS server session! Err: %d", err); |
|
319 } |
|
320 #endif // __WINSCW__ |
|
321 |
|
322 iAutoResume = ETrue; |
|
323 |
|
324 iTester->SetAutoResume( iAutoResume ); |
|
325 |
|
326 iServiceEmu = CVCXMyVideosTestServiceEmu::NewL(); |
|
327 |
|
328 iMdsDbModifier = CVCXTestMdsDbModifier::NewL(); |
|
329 |
|
330 iCurrentSortOrder = EVcxMyVideosSortingNone; |
|
331 |
|
332 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateL <----------"); |
|
333 return KErrNone; |
|
334 } |
|
335 |
|
336 // ----------------------------------------------------------------------------- |
|
337 // CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 TInt CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL( CStifItemParser& aItem ) |
|
341 { |
|
342 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL ---------->"); |
|
343 // Print to UI |
|
344 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
345 _LIT( KWhere, "In SetPreferredMemoryL" ); |
|
346 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
347 // Print to log file |
|
348 iLog->Log( KWhere ); |
|
349 |
|
350 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
351 |
|
352 TInt drive(0); |
|
353 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
354 |
|
355 // These were defined in CVcxMyVideosDownloadUtil::PreferredMemoryDesL() |
|
356 const TInt KVcxCenRepUid = 0x102750E2; // same as KIptvCenRepUid in CIptvUtil.h |
|
357 const TInt KVcxCenRepPreferredMemoryKey = 0x01; // same as KIptvCenRepPreferredMemoryKey in CIptvUtil.h |
|
358 |
|
359 TUid uid; |
|
360 uid.iUid = KVcxCenRepUid; |
|
361 |
|
362 CRepository* cenRep = CRepository::NewLC( uid ); |
|
363 User::LeaveIfError( cenRep->Set( KVcxCenRepPreferredMemoryKey, drive ) ); |
|
364 CleanupStack::PopAndDestroy( cenRep ); |
|
365 |
|
366 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL <----------"); |
|
367 return KErrNone; |
|
368 } |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CVCXMyVideosCollectionPluginTest::SetSortingOrderL |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 TInt CVCXMyVideosCollectionPluginTest::SetSortingOrderL( CStifItemParser& aItem ) |
|
375 { |
|
376 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetSortingOrderL ---------->"); |
|
377 // Print to UI |
|
378 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
379 _LIT( KWhere, "In SetSortingOrderL" ); |
|
380 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
381 // Print to log file |
|
382 iLog->Log( KWhere ); |
|
383 |
|
384 TInt value(0); |
|
385 TInt err = aItem.GetNextInt( value ); |
|
386 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: New sorting order: %d", value); |
|
387 |
|
388 TUid uid; |
|
389 uid.iUid = KVcxMyVideosCollectionCenrepUid; |
|
390 |
|
391 CRepository* cenRep = CRepository::NewLC( uid ); |
|
392 User::LeaveIfError( cenRep->Set( KVcxMyVideosCollectionCenrepKeySortingOrder, value ) ); |
|
393 CleanupStack::PopAndDestroy( cenRep ); |
|
394 |
|
395 TRAP( err, DoTotalRefreshL() ); |
|
396 |
|
397 iCurrentSortOrder = value; |
|
398 |
|
399 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetSortingOrderL <----------"); |
|
400 return VCXMVTEST_ERR( err ); |
|
401 } |
|
402 |
|
403 // ----------------------------------------------------------------------------- |
|
404 // CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 TInt CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh( CStifItemParser& aItem ) |
|
408 { |
|
409 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh ---------->"); |
|
410 // Print to UI |
|
411 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
412 _LIT( KWhere, "In SetAutomaticRefresh" ); |
|
413 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
414 // Print to log file |
|
415 iLog->Log( KWhere ); |
|
416 |
|
417 TInt value(0); |
|
418 TInt err = aItem.GetNextInt( value ); |
|
419 |
|
420 if( iTester ) |
|
421 { |
|
422 iTester->SetAutomaticRefresh( static_cast<TBool>(value) ); |
|
423 } |
|
424 |
|
425 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh <----------"); |
|
426 return VCXMVTEST_ERR( err ); |
|
427 } |
|
428 |
|
429 // ----------------------------------------------------------------------------- |
|
430 // CVCXMyVideosCollectionPluginTest::SetQuietMode |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 TInt CVCXMyVideosCollectionPluginTest::SetQuietMode( CStifItemParser& aItem ) |
|
434 { |
|
435 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetQuietMode ---------->"); |
|
436 // Print to UI |
|
437 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
438 _LIT( KWhere, "In SetQuietMode" ); |
|
439 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
440 // Print to log file |
|
441 iLog->Log( KWhere ); |
|
442 |
|
443 TInt value(0); |
|
444 TInt err = aItem.GetNextInt( value ); |
|
445 |
|
446 if( iTester ) |
|
447 { |
|
448 iTester->SetQuietMode( static_cast<TBool>(value) ); |
|
449 } |
|
450 |
|
451 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetQuietMode <----------"); |
|
452 return VCXMVTEST_ERR( err ); |
|
453 } |
|
454 |
|
455 // ----------------------------------------------------------------------------- |
|
456 // CIptvMyVideosApiTest::CoolDownL |
|
457 // ----------------------------------------------------------------------------- |
|
458 // |
|
459 TInt CVCXMyVideosCollectionPluginTest::CoolDownL( CStifItemParser& /* aItem */ ) |
|
460 { |
|
461 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CoolDownL ---------->"); |
|
462 // Print to UI |
|
463 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
464 _LIT( KWhere, "In CoolDownL" ); |
|
465 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
466 // Print to log file |
|
467 iLog->Log( KWhere ); |
|
468 |
|
469 iCoolDownWait = ETrue; |
|
470 iCoolDownTimer->After( KTimeoutSecond * 5 ); |
|
471 iActiveWait->Start(); |
|
472 |
|
473 if( iEventError == KErrAbort ) |
|
474 { |
|
475 iEventError = KErrNone; |
|
476 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error, ABORTING!"); |
|
477 User::Leave( KErrAbort ); |
|
478 } |
|
479 |
|
480 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CoolDownL <----------"); |
|
481 return KErrNone; |
|
482 } |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // CIptvMyVideosApiTest::DisableDownloadCheckL |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 TInt CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL( CStifItemParser& /* aItem */ ) |
|
489 { |
|
490 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL"); |
|
491 if( iTester ) |
|
492 { |
|
493 iTester->GetDownloadWatcher()->DisableDownloadCheck(); |
|
494 } |
|
495 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL"); |
|
496 return KErrNone; |
|
497 } |
|
498 |
|
499 // ----------------------------------------------------------------------------- |
|
500 // CIptvMyVideosApiTest::SetFileCheckL |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 TInt CVCXMyVideosCollectionPluginTest::SetFileCheckL( CStifItemParser& aItem ) |
|
504 { |
|
505 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetFileCheckL"); |
|
506 |
|
507 TInt value(0); |
|
508 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
509 iFileCheckDisabled = !(static_cast<TBool>(value)); |
|
510 |
|
511 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetFileCheckL"); |
|
512 return KErrNone; |
|
513 } |
|
514 |
|
515 // ----------------------------------------------------------------------------- |
|
516 // CIptvMyVideosApiTest::SetAutoResumeL |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 TInt CVCXMyVideosCollectionPluginTest::SetAutoResumeL( CStifItemParser& aItem ) |
|
520 { |
|
521 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetAutoResumeL ---------->"); |
|
522 // Print to UI |
|
523 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
524 _LIT( KWhere, "In SetAutoResumeL" ); |
|
525 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
526 // Print to log file |
|
527 iLog->Log( KWhere ); |
|
528 |
|
529 TInt autoResume(0); |
|
530 User::LeaveIfError( aItem.GetNextInt( autoResume ) ); |
|
531 iAutoResume = autoResume; |
|
532 if( iTester ) |
|
533 { |
|
534 iTester->SetAutoResume( iAutoResume ); |
|
535 } |
|
536 |
|
537 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetAutoResumeL <----------"); |
|
538 return KErrNone; |
|
539 } |
|
540 |
|
541 // ----------------------------------------------------------------------------- |
|
542 // CVCXMyVideosCollectionPluginTest::OpenCollectionL |
|
543 // ----------------------------------------------------------------------------- |
|
544 // |
|
545 TInt CVCXMyVideosCollectionPluginTest::OpenCollectionL( CStifItemParser& aItem ) |
|
546 { |
|
547 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::OpenCollectionL ---------->"); |
|
548 // Print to UI |
|
549 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
550 _LIT( KWhere, "In OpenCollectionL" ); |
|
551 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
552 // Print to log file |
|
553 iLog->Log( KWhere ); |
|
554 |
|
555 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
556 TUint32 collectionId( 0 ); |
|
557 TPtrC collectionIdStr; |
|
558 if( aItem.GetNextString( collectionIdStr ) == KErrNone ) |
|
559 { |
|
560 TLex lex( collectionIdStr ); |
|
561 User::LeaveIfError( lex.Val( collectionId, EHex ) ); |
|
562 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: collectionId: 0x%x", collectionId); |
|
563 } |
|
564 |
|
565 if( collectionId == 0 ) |
|
566 { |
|
567 collectionId = KVcxUidMyVideosMpxCollection; |
|
568 } |
|
569 |
|
570 iLastReceivedMessage = -1; |
|
571 |
|
572 TInt err( KErrNotReady ); |
|
573 if( iTester ) |
|
574 { |
|
575 TRAP( err, iTester->OpenCollectionL( collectionId ) ); |
|
576 } |
|
577 |
|
578 if( err != KErrNone ) |
|
579 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
580 |
|
581 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenCollectionL <----------"); |
|
582 return VCXMVTEST_ERR( err ); |
|
583 } |
|
584 |
|
585 // ----------------------------------------------------------------------------- |
|
586 // CVCXMyVideosCollectionPluginTest::OpenLevelL |
|
587 // ----------------------------------------------------------------------------- |
|
588 // |
|
589 TInt CVCXMyVideosCollectionPluginTest::OpenLevelL( CStifItemParser& aItem ) |
|
590 { |
|
591 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::OpenLevelL ---------->"); |
|
592 // Print to UI |
|
593 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
594 _LIT( KWhere, "In OpenLevelL" ); |
|
595 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
596 // Print to log file |
|
597 iLog->Log( KWhere ); |
|
598 |
|
599 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
600 TInt index; |
|
601 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
602 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: index: %d", index); |
|
603 |
|
604 iLastReceivedMessage = -1; |
|
605 |
|
606 TInt err( KErrNotReady ); |
|
607 if( iTester ) |
|
608 { |
|
609 TRAP( err, iTester->OpenLevelL( index ) ); |
|
610 } |
|
611 |
|
612 if( err != KErrNone ) |
|
613 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
614 |
|
615 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelL <----------"); |
|
616 return VCXMVTEST_ERR( err ); |
|
617 } |
|
618 |
|
619 // ----------------------------------------------------------------------------- |
|
620 // CVCXMyVideosCollectionPluginTest::CloseLevelL |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 TInt CVCXMyVideosCollectionPluginTest::CloseLevelL( CStifItemParser& /* aItem */ ) |
|
624 { |
|
625 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CloseLevelL ---------->"); |
|
626 // Print to UI |
|
627 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
628 _LIT( KWhere, "In CloseLevelL" ); |
|
629 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
630 // Print to log file |
|
631 iLog->Log( KWhere ); |
|
632 |
|
633 iLastReceivedMessage = -1; |
|
634 |
|
635 TInt err( KErrNotReady ); |
|
636 if( iTester ) |
|
637 { |
|
638 TRAP( err, iTester->CloseLevelL() ); |
|
639 } |
|
640 |
|
641 if( err != KErrNone ) |
|
642 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
643 |
|
644 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CloseLevelL <----------"); |
|
645 return VCXMVTEST_ERR( err ); |
|
646 } |
|
647 |
|
648 // ----------------------------------------------------------------------------- |
|
649 // CVCXMyVideosCollectionPluginTest::RefreshContentsL |
|
650 // ----------------------------------------------------------------------------- |
|
651 // |
|
652 TInt CVCXMyVideosCollectionPluginTest::RefreshContentsL( CStifItemParser& aItem ) |
|
653 { |
|
654 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RefreshContentsL ---------->"); |
|
655 // Print to UI |
|
656 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
657 _LIT( KWhere, "In RefreshContentsL" ); |
|
658 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
659 // Print to log file |
|
660 iLog->Log( KWhere ); |
|
661 |
|
662 iLastReceivedMessage = -1; |
|
663 |
|
664 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
665 |
|
666 TInt err( KErrNotReady ); |
|
667 if( iTester ) |
|
668 { |
|
669 TRAP( err, iTester->RefreshContentsL() ); |
|
670 } |
|
671 |
|
672 if( err != KErrNone ) |
|
673 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
674 |
|
675 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RefreshContentsL <----------"); |
|
676 return VCXMVTEST_ERR( err ); |
|
677 } |
|
678 |
|
679 // ----------------------------------------------------------------------------- |
|
680 // CVCXMyVideosCollectionPluginTest::RefreshContentsL |
|
681 // ----------------------------------------------------------------------------- |
|
682 // |
|
683 TInt CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL( CStifItemParser& aItem ) |
|
684 { |
|
685 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL ---------->"); |
|
686 // Print to UI |
|
687 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
688 _LIT( KWhere, "In GetMediasByMpxIdL" ); |
|
689 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
690 // Print to log file |
|
691 iLog->Log( KWhere ); |
|
692 |
|
693 iLastReceivedMessage = -1; |
|
694 |
|
695 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
696 |
|
697 TInt startIndex; |
|
698 User::LeaveIfError( aItem.GetNextInt( startIndex ) ); |
|
699 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: startIndex: %d", startIndex); |
|
700 |
|
701 TInt endIndex; |
|
702 User::LeaveIfError( aItem.GetNextInt( endIndex ) ); |
|
703 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: endIndex: %d", endIndex); |
|
704 |
|
705 TBool syncCall( EFalse ); |
|
706 TInt syncCallInt(0); |
|
707 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
708 { |
|
709 syncCall = static_cast<TBool>(syncCallInt); |
|
710 } |
|
711 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
712 |
|
713 TInt err( KErrNotReady ); |
|
714 if( iTester ) |
|
715 { |
|
716 TRAP( err, iTester->GetMediasByMpxIdL( startIndex, endIndex, syncCall ) ); |
|
717 } |
|
718 |
|
719 if( err != KErrNone ) |
|
720 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
721 |
|
722 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL <----------"); |
|
723 return VCXMVTEST_ERR( err ); |
|
724 } |
|
725 |
|
726 // ----------------------------------------------------------------------------- |
|
727 // CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL |
|
728 // ----------------------------------------------------------------------------- |
|
729 // |
|
730 TInt CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL( CStifItemParser& aItem ) |
|
731 { |
|
732 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL ---------->"); |
|
733 // Print to UI |
|
734 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
735 _LIT( KWhere, "In GetMediaFullDetailsL" ); |
|
736 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
737 // Print to log file |
|
738 iLog->Log( KWhere ); |
|
739 |
|
740 iLastReceivedMessage = -1; |
|
741 |
|
742 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
743 |
|
744 TInt drive(0); |
|
745 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
746 |
|
747 TInt index; |
|
748 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
749 |
|
750 RArray<TInt> messages; |
|
751 messages.Append( KVCXMYVideosTestMessageCollectionMedia ); |
|
752 |
|
753 TInt err( KErrNotReady ); |
|
754 if( iTester ) |
|
755 { |
|
756 TRAP( err, iTester->GetMediaFullDetailsL( drive, index ) ); |
|
757 } |
|
758 |
|
759 if( err == KErrNone ) |
|
760 { |
|
761 TRAPD( err, WaitForMessagesL( ETrue, messages, 1, ETrue ) ); |
|
762 messages.Reset(); |
|
763 |
|
764 if( err == KErrNone ) |
|
765 { |
|
766 CMPXMedia* media = iTester->GetLastFullMedia(); |
|
767 TRAP_IGNORE( iTester->PrintMPXMediaL( *media, ETrue ) ); |
|
768 } |
|
769 } |
|
770 |
|
771 if( err != KErrNone ) |
|
772 { |
|
773 VCXLOGLO2("CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL err: %d", err); |
|
774 } |
|
775 |
|
776 messages.Reset(); |
|
777 |
|
778 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL <----------"); |
|
779 return VCXMVTEST_ERR( err ); |
|
780 } |
|
781 |
|
782 // ----------------------------------------------------------------------------- |
|
783 // CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL |
|
784 // ----------------------------------------------------------------------------- |
|
785 // |
|
786 TInt CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL( CStifItemParser& aItem ) |
|
787 { |
|
788 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL ---------->"); |
|
789 // Print to UI |
|
790 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
791 _LIT( KWhere, "In GetMediaFullDetailsByMpxIdL" ); |
|
792 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
793 // Print to log file |
|
794 iLog->Log( KWhere ); |
|
795 |
|
796 iLastReceivedMessage = -1; |
|
797 |
|
798 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
799 |
|
800 TInt drive(0); |
|
801 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
802 |
|
803 TInt index; |
|
804 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
805 |
|
806 TBool sync; |
|
807 TInt syncInt; |
|
808 if( aItem.GetNextInt( syncInt ) != KErrNone ) |
|
809 { |
|
810 sync = EFalse; |
|
811 } |
|
812 else |
|
813 { |
|
814 sync = static_cast<TBool>( syncInt ); |
|
815 } |
|
816 |
|
817 RArray<TInt> messages; |
|
818 messages.Append( KVCXMYVideosTestMessageCollectionMedia ); |
|
819 |
|
820 TInt err( KErrNotReady ); |
|
821 if( iTester ) |
|
822 { |
|
823 TRAP( err, iTester->GetMediaFullDetailsByMpxIdL( drive, index, sync ) ); |
|
824 } |
|
825 |
|
826 if( err == KErrNone ) |
|
827 { |
|
828 TRAPD( err, WaitForMessagesL( ETrue, messages, 1, ETrue ) ); |
|
829 messages.Reset(); |
|
830 |
|
831 if( err == KErrNone ) |
|
832 { |
|
833 CMPXMedia* media = iTester->GetLastFullMedia(); |
|
834 TRAP_IGNORE( iTester->PrintMPXMediaL( *media, ETrue ) ); |
|
835 } |
|
836 } |
|
837 |
|
838 if( err != KErrNone ) |
|
839 { |
|
840 VCXLOGLO2("CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL err: %d", err); |
|
841 } |
|
842 |
|
843 messages.Reset(); |
|
844 |
|
845 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL <----------"); |
|
846 return VCXMVTEST_ERR( err ); |
|
847 } |
|
848 |
|
849 // ----------------------------------------------------------------------------- |
|
850 // CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL |
|
851 // ----------------------------------------------------------------------------- |
|
852 // |
|
853 TInt CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL( CStifItemParser& aItem ) |
|
854 { |
|
855 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL ---------->"); |
|
856 // Print to UI |
|
857 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
858 _LIT( KWhere, "In GetAllMediaFullDetailsL" ); |
|
859 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
860 // Print to log file |
|
861 iLog->Log( KWhere ); |
|
862 |
|
863 iLastReceivedMessage = -1; |
|
864 |
|
865 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
866 |
|
867 TInt err( KErrNotReady ); |
|
868 if( iTester ) |
|
869 { |
|
870 TRAP( err, iTester->GetAllMediaFullDetailsL( ) ); |
|
871 } |
|
872 |
|
873 if( err != KErrNone ) |
|
874 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
875 |
|
876 iLastReceivedMessage = -1; |
|
877 |
|
878 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL <----------"); |
|
879 return VCXMVTEST_ERR( err ); |
|
880 } |
|
881 |
|
882 // ----------------------------------------------------------------------------- |
|
883 // CVCXMyVideosCollectionPluginTest::CheckMediaDetailL |
|
884 // ----------------------------------------------------------------------------- |
|
885 // |
|
886 TInt CVCXMyVideosCollectionPluginTest::CheckMediaDetailL( CStifItemParser& aItem ) |
|
887 { |
|
888 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediaDetailL ---------->"); |
|
889 // Print to UI |
|
890 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
891 _LIT( KWhere, "In CheckMediaDetailL" ); |
|
892 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
893 // Print to log file |
|
894 iLog->Log( KWhere ); |
|
895 |
|
896 TInt err( KErrNone ); |
|
897 |
|
898 TRAP_IGNORE( WaitForRefreshL( EFalse ) ); // Wait for possible refresh to finish. |
|
899 |
|
900 iLastReceivedMessage = -1; |
|
901 |
|
902 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
903 |
|
904 TInt drive(0); |
|
905 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
906 |
|
907 TInt itemIndex(0); |
|
908 User::LeaveIfError( aItem.GetNextInt( itemIndex ) ); |
|
909 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: item index: %d", itemIndex); |
|
910 |
|
911 if( itemIndex < 0 || itemIndex >= iTester->GetMediaCount() ) |
|
912 { |
|
913 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", itemIndex); |
|
914 User::Leave( KErrArgument ); |
|
915 } |
|
916 |
|
917 TInt mpxAttributeMappingId(0); |
|
918 User::LeaveIfError( aItem.GetNextInt( mpxAttributeMappingId ) ); |
|
919 |
|
920 TVcxTestMediaAttributeType type; |
|
921 TMPXAttributeData mpxMediaAttribute; |
|
922 User::LeaveIfError( MapMpxMediaAttribute( |
|
923 static_cast<TVcxTestMediaAttributeIdMapping>(mpxAttributeMappingId), |
|
924 mpxMediaAttribute, type ) ); |
|
925 |
|
926 |
|
927 CMPXMedia* media( NULL ); |
|
928 TRAP( err, media = iTester->GetMediaL( drive, itemIndex ) ); |
|
929 |
|
930 // If attribute is not supported, fetch full media details. |
|
931 if( media && !media->IsSupported( mpxMediaAttribute ) ) |
|
932 { |
|
933 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Requesting full media details."); |
|
934 RArray<TInt> messages; |
|
935 messages.Append( KVCXMYVideosTestMessageCollectionMedia ); |
|
936 TRAP( err, iTester->GetMediaFullDetailsL( drive, itemIndex ) ); |
|
937 if( err == KErrNone ) |
|
938 { |
|
939 TRAP( err, WaitForMessagesL( ETrue, messages, 5, ETrue ) ); |
|
940 media = iTester->GetLastFullMedia(); |
|
941 } |
|
942 messages.Reset(); |
|
943 } |
|
944 |
|
945 if( err != KErrNone ) |
|
946 { |
|
947 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------"); |
|
948 return VCXMVTEST_ERR( err ); |
|
949 } |
|
950 |
|
951 if( !media->IsSupported( mpxMediaAttribute ) ) |
|
952 { |
|
953 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error: iAttributeId: %d, iContentId: %d is not supported.", |
|
954 mpxMediaAttribute.iAttributeId == 0, mpxMediaAttribute.iContentId); |
|
955 |
|
956 iTester->PrintMPXMediaL( *media, ETrue ); |
|
957 |
|
958 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <---------"); |
|
959 return VCXMVTEST_ERR( KErrNotSupported ); |
|
960 } |
|
961 |
|
962 if( type == EVcxTestMediaAttributeTypeString ) |
|
963 { |
|
964 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type text"); |
|
965 |
|
966 TPtrC expectedValue; |
|
967 User::LeaveIfError( aItem.GetNextString( expectedValue ) ); |
|
968 |
|
969 const TDesC& value = media->ValueText( mpxMediaAttribute ); |
|
970 |
|
971 if( expectedValue != value ) |
|
972 { |
|
973 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %S and expected: %S", &value, &expectedValue); |
|
974 err = KErrCorrupt; |
|
975 } |
|
976 } |
|
977 |
|
978 if( type == EVcxTestMediaAttributeTypeTTime ) |
|
979 { |
|
980 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TInt64(date)"); |
|
981 |
|
982 User::Leave( KErrNotSupported ); |
|
983 #if 0 |
|
984 //TPtrC expectedValue; |
|
985 //User::LeaveIfError( aItem.GetNextString( expectedValue ) ); |
|
986 |
|
987 TInt64 value = *(*media).Value<TInt64>( mpxMediaAttribute ); |
|
988 |
|
989 TTime time ( value ); |
|
990 TBuf<60> timeStr; |
|
991 _LIT(KDateTimeString, "%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%H%:1%T%:2%S%.%*C2%:3%-B"); |
|
992 time.FormatL(timeStr, KDateTimeString); |
|
993 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: date value: %S", &timeStr); |
|
994 #endif |
|
995 } |
|
996 |
|
997 if( type == EVcxTestMediaAttributeTypeTDateTime ) |
|
998 { |
|
999 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TDateTime"); |
|
1000 |
|
1001 User::Leave( KErrNotSupported ); |
|
1002 #if 0 |
|
1003 TInt expectedValue; |
|
1004 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1005 |
|
1006 TTime time ( *(*media).Value<TDateTime>( mpxMediaAttribute ) ); |
|
1007 |
|
1008 TBuf<60> timeStr; |
|
1009 _LIT(KDateTimeString, "%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%H%:1%T%:2%S%.%*C2%:3%-B"); |
|
1010 time.FormatL(timeStr, KDateTimeString); |
|
1011 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: date value: %S", &timeStr); |
|
1012 #endif |
|
1013 } |
|
1014 |
|
1015 if( type == EVcxTestMediaAttributeTypeTInt ) |
|
1016 { |
|
1017 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TInt"); |
|
1018 TInt expectedValue; |
|
1019 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1020 |
|
1021 TInt value = *(*media).Value<TInt>( mpxMediaAttribute ); |
|
1022 |
|
1023 if( expectedValue != value ) |
|
1024 { |
|
1025 err = KErrCorrupt; |
|
1026 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %d and expected: %d", value, expectedValue); |
|
1027 } |
|
1028 } |
|
1029 |
|
1030 if( type == EVcxTestMediaAttributeTypeTUint ) |
|
1031 { |
|
1032 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TUint"); |
|
1033 |
|
1034 TInt expectedValue; |
|
1035 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1036 |
|
1037 TUint value = *(*media).Value<TUint>( mpxMediaAttribute ); |
|
1038 |
|
1039 if( expectedValue != value ) |
|
1040 { |
|
1041 err = KErrCorrupt; |
|
1042 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %d and expected: %d", value, expectedValue); |
|
1043 } |
|
1044 } |
|
1045 |
|
1046 if( type == EVcxTestMediaAttributeTypeTUint8 ) |
|
1047 { |
|
1048 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TUint8"); |
|
1049 |
|
1050 TInt expectedValue; |
|
1051 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1052 |
|
1053 TUint8 value = *(*media).Value<TUint8>( mpxMediaAttribute ); |
|
1054 |
|
1055 if( expectedValue != value ) |
|
1056 { |
|
1057 err = KErrCorrupt; |
|
1058 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %d and expected: %d", value, expectedValue); |
|
1059 } |
|
1060 } |
|
1061 |
|
1062 TBool isCategoryNewItemCount = |
|
1063 mpxMediaAttribute.iAttributeId == KVcxMediaMyVideosCategoryNewItemCount.iAttributeId && |
|
1064 mpxMediaAttribute.iContentId == KVcxMediaMyVideosCategoryNewItemCount.iContentId; |
|
1065 TInt isCategoryItemCount = |
|
1066 mpxMediaAttribute.iAttributeId == KVcxMediaMyVideosCategoryItemCount.iAttributeId && |
|
1067 mpxMediaAttribute.iContentId == KVcxMediaMyVideosCategoryItemCount.iContentId; |
|
1068 |
|
1069 // Category item counts. |
|
1070 if( isCategoryNewItemCount || isCategoryItemCount ) |
|
1071 { |
|
1072 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting item counts for category."); |
|
1073 |
|
1074 TInt expectedValue; |
|
1075 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1076 |
|
1077 // Get actual count from item. |
|
1078 TUint32 count = *(*media).Value<TUint32>( mpxMediaAttribute ); |
|
1079 |
|
1080 // Get count of ROM medias for this category. |
|
1081 |
|
1082 TUint flags = ( isCategoryNewItemCount ? EVcxMyVideosVideoNew : 0 ); |
|
1083 |
|
1084 CMPXMediaArray* medias = GetMediasForLevelL( itemIndex, flags ); |
|
1085 |
|
1086 TInt romCount = 0; |
|
1087 for( TInt i = 0; i < medias->Count(); i++ ) |
|
1088 { |
|
1089 CMPXMedia* collectionMedia = (*medias)[i]; |
|
1090 if( collectionMedia->IsSupported( KMPXMediaGeneralUri ) ) |
|
1091 { |
|
1092 const TDesC& url = collectionMedia->ValueText( KMPXMediaGeneralUri ); |
|
1093 if( url.FindC( _L("z:" ) ) != KErrNotFound ) |
|
1094 { |
|
1095 romCount++; |
|
1096 } |
|
1097 } |
|
1098 } |
|
1099 |
|
1100 delete medias; |
|
1101 |
|
1102 if( expectedValue != count ) |
|
1103 { |
|
1104 // Check ROM videos are not interfering. |
|
1105 if( romCount != count - expectedValue ) |
|
1106 { |
|
1107 err = KErrCorrupt; |
|
1108 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %d and expected: %d", count, expectedValue); |
|
1109 } |
|
1110 } |
|
1111 } |
|
1112 else |
|
1113 // Other TUInt32 values. |
|
1114 if( type == EVcxTestMediaAttributeTypeTUint32 ) |
|
1115 { |
|
1116 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TUint32"); |
|
1117 |
|
1118 TInt expectedValue; |
|
1119 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1120 |
|
1121 TUint32 value = *(*media).Value<TUint32>( mpxMediaAttribute ); |
|
1122 |
|
1123 if( expectedValue != value ) |
|
1124 { |
|
1125 err = KErrCorrupt; |
|
1126 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %d and expected: %d", value, expectedValue); |
|
1127 } |
|
1128 } |
|
1129 |
|
1130 if( type == EVcxTestMediaAttributeTypeTReal32 ) |
|
1131 { |
|
1132 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TReal32"); |
|
1133 |
|
1134 TInt num; |
|
1135 User::LeaveIfError( aItem.GetNextInt( num ) ); |
|
1136 TReal32 expectedValue( num ); |
|
1137 |
|
1138 TInt digits; |
|
1139 if( aItem.GetNextInt( digits ) == KErrNone ) |
|
1140 { |
|
1141 expectedValue += static_cast<TReal32>(digits)/10000; |
|
1142 } |
|
1143 |
|
1144 TReal32 value = *(*media).Value<TReal32>( mpxMediaAttribute ); |
|
1145 |
|
1146 if( expectedValue != value ) |
|
1147 { |
|
1148 err = KErrCorrupt; |
|
1149 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %f and expected: %f", value, expectedValue); |
|
1150 } |
|
1151 } |
|
1152 |
|
1153 if( type == EVcxTestMediaAttributeTypeTInt32 ) |
|
1154 { |
|
1155 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TInt32"); |
|
1156 |
|
1157 TInt expectedValue; |
|
1158 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1159 |
|
1160 TInt32 value = *(*media).Value<TUint32>( mpxMediaAttribute ); |
|
1161 |
|
1162 if( expectedValue != value ) |
|
1163 { |
|
1164 err = KErrCorrupt; |
|
1165 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %d and expected: %d", value, expectedValue); |
|
1166 } |
|
1167 } |
|
1168 |
|
1169 if( type == EVcxTestMediaAttributeTypeTInt8 ) |
|
1170 { |
|
1171 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TInt8"); |
|
1172 |
|
1173 TInt expectedValue; |
|
1174 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1175 |
|
1176 TInt8 value = *(*media).Value<TInt8>( mpxMediaAttribute ); |
|
1177 |
|
1178 if( expectedValue != value ) |
|
1179 { |
|
1180 err = KErrCorrupt; |
|
1181 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %d and expected: %d", value, expectedValue); |
|
1182 } |
|
1183 } |
|
1184 |
|
1185 if( type == EVcxTestMediaAttributeTypeTMPXItemId ) |
|
1186 { |
|
1187 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TMPXItemId"); |
|
1188 |
|
1189 TInt expectedValue; |
|
1190 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1191 |
|
1192 TInt expectedValue2; |
|
1193 User::LeaveIfError( aItem.GetNextInt( expectedValue2 ) ); |
|
1194 |
|
1195 TMPXItemId itemId; |
|
1196 itemId.iId1 = expectedValue; |
|
1197 itemId.iId2 = expectedValue2; |
|
1198 |
|
1199 TMPXItemId value = *(*media).Value<TMPXItemId>( mpxMediaAttribute ); |
|
1200 |
|
1201 if( itemId != value ) |
|
1202 { |
|
1203 err = KErrCorrupt; |
|
1204 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: expected Id1: %d, Id2: %d", itemId.iId1, itemId.iId2); |
|
1205 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: actual Id1: %d, Id2: %d", value.iId1, value.iId2); |
|
1206 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR no match!"); |
|
1207 } |
|
1208 } |
|
1209 |
|
1210 if( type == EVcxTestMediaAttributeTypeTInt64 ) |
|
1211 { |
|
1212 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type TInt64"); |
|
1213 |
|
1214 TInt expectedValue; |
|
1215 User::LeaveIfError( aItem.GetNextInt( expectedValue ) ); |
|
1216 |
|
1217 TInt64 value = *(*media).Value<TInt64>( mpxMediaAttribute ); |
|
1218 |
|
1219 if( expectedValue != value ) |
|
1220 { |
|
1221 err = KErrCorrupt; |
|
1222 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, values do not match: %d and expected: %d", value, expectedValue); |
|
1223 } |
|
1224 } |
|
1225 |
|
1226 if ( type == EVcxTestMediaAttributeTypeMvFlags ) |
|
1227 { |
|
1228 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type MV flags ( TUint32 )"); |
|
1229 |
|
1230 TUint32 value = *(*media).Value<TUint32>( mpxMediaAttribute ); |
|
1231 |
|
1232 TInt expectedValue(0); |
|
1233 while( aItem.GetNextInt( expectedValue ) == KErrNone ) |
|
1234 { |
|
1235 if( ! (value & expectedValue) ) |
|
1236 { |
|
1237 err = KErrCorrupt; |
|
1238 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error, flag is: %d, flag %d is not set!", value, expectedValue); |
|
1239 } |
|
1240 } |
|
1241 } |
|
1242 |
|
1243 if( err != KErrNone ) |
|
1244 { |
|
1245 TRAP_IGNORE( iTester->PrintMediasL( NULL, EFalse, _L("Videos") ) ); |
|
1246 } |
|
1247 |
|
1248 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------"); |
|
1249 return VCXMVTEST_ERR( err ); |
|
1250 } |
|
1251 |
|
1252 // ----------------------------------------------------------------------------- |
|
1253 // CVCXMyVideosCollectionPluginTest::SetItemDetailsL |
|
1254 // ----------------------------------------------------------------------------- |
|
1255 // |
|
1256 TInt CVCXMyVideosCollectionPluginTest::SetMediaDetailL( CStifItemParser& aItem ) |
|
1257 { |
|
1258 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetMediaDetailL ---------->"); |
|
1259 // Print to UI |
|
1260 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1261 _LIT( KWhere, "In SetMediaDetailL" ); |
|
1262 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1263 // Print to log file |
|
1264 iLog->Log( KWhere ); |
|
1265 |
|
1266 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1267 |
|
1268 if( !iMpxMedia ) |
|
1269 { |
|
1270 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!"); |
|
1271 User::Leave( KErrArgument ); |
|
1272 } |
|
1273 |
|
1274 TInt mpxAttributeMappingId(0); |
|
1275 User::LeaveIfError( aItem.GetNextInt( mpxAttributeMappingId ) ); |
|
1276 |
|
1277 TVcxTestMediaAttributeType type; |
|
1278 TMPXAttributeData mpxMediaAttribute; |
|
1279 User::LeaveIfError( MapMpxMediaAttribute( |
|
1280 static_cast<TVcxTestMediaAttributeIdMapping>(mpxAttributeMappingId), |
|
1281 mpxMediaAttribute, type ) ); |
|
1282 |
|
1283 TInt err( KErrNone ); |
|
1284 |
|
1285 if( type == EVcxTestMediaAttributeTypeString ) |
|
1286 { |
|
1287 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type text"); |
|
1288 |
|
1289 TPtrC value; |
|
1290 User::LeaveIfError( aItem.GetNextString( value ) ); |
|
1291 |
|
1292 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %S", &value); |
|
1293 iMpxMedia->SetTextValueL( mpxMediaAttribute, value ); |
|
1294 } |
|
1295 |
|
1296 if( type == EVcxTestMediaAttributeTypeTTime ) |
|
1297 { |
|
1298 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TInt64(date)"); |
|
1299 |
|
1300 TTime time; |
|
1301 time.UniversalTime(); |
|
1302 TTimeIntervalSeconds timeOffset = User::UTCOffset(); |
|
1303 TTime localTime = time + timeOffset; |
|
1304 |
|
1305 TInt64 value = localTime.Int64(); |
|
1306 iMpxMedia->SetTObjectValueL<TInt64>( mpxMediaAttribute, value ); |
|
1307 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Set to current time."); |
|
1308 } |
|
1309 |
|
1310 if( type == EVcxTestMediaAttributeTypeTDateTime ) |
|
1311 { |
|
1312 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TDateTime"); |
|
1313 |
|
1314 User::Leave( KErrNotSupported ); |
|
1315 #if 0 |
|
1316 TDateTime time; |
|
1317 iMpxMedia->SetTObjectValueL<TDateTime>( mpxMediaAttribute, time ); |
|
1318 //VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1319 #endif |
|
1320 } |
|
1321 |
|
1322 if( type == EVcxTestMediaAttributeTypeTInt ) |
|
1323 { |
|
1324 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TInt"); |
|
1325 TInt value; |
|
1326 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
1327 iMpxMedia->SetTObjectValueL<TInt>( mpxMediaAttribute, value ); |
|
1328 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1329 } |
|
1330 |
|
1331 if( type == EVcxTestMediaAttributeTypeTUint ) |
|
1332 { |
|
1333 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TUint"); |
|
1334 |
|
1335 TInt value; |
|
1336 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
1337 iMpxMedia->SetTObjectValueL<TUint>( mpxMediaAttribute, value ); |
|
1338 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1339 } |
|
1340 |
|
1341 if( type == EVcxTestMediaAttributeTypeTUint8 ) |
|
1342 { |
|
1343 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TUint8"); |
|
1344 |
|
1345 TInt value; |
|
1346 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
1347 iMpxMedia->SetTObjectValueL<TUint8>( mpxMediaAttribute, value ); |
|
1348 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1349 } |
|
1350 |
|
1351 if( type == EVcxTestMediaAttributeTypeTUint32 ) |
|
1352 { |
|
1353 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TUint32"); |
|
1354 |
|
1355 TInt value; |
|
1356 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
1357 iMpxMedia->SetTObjectValueL<TUint32>( mpxMediaAttribute, value ); |
|
1358 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1359 } |
|
1360 |
|
1361 if( type == EVcxTestMediaAttributeTypeTReal32 ) |
|
1362 { |
|
1363 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TReal32"); |
|
1364 |
|
1365 TInt num; |
|
1366 User::LeaveIfError( aItem.GetNextInt( num ) ); |
|
1367 TReal32 value( num ); |
|
1368 |
|
1369 TInt digits; |
|
1370 if( aItem.GetNextInt( digits ) == KErrNone ) |
|
1371 { |
|
1372 value += static_cast<TReal32>(digits)/10000; |
|
1373 } |
|
1374 |
|
1375 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %f", value); |
|
1376 |
|
1377 iMpxMedia->SetTObjectValueL<TReal32>( mpxMediaAttribute, value ); |
|
1378 } |
|
1379 |
|
1380 if( type == EVcxTestMediaAttributeTypeTInt32 ) |
|
1381 { |
|
1382 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TInt32"); |
|
1383 |
|
1384 TInt value; |
|
1385 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
1386 iMpxMedia->SetTObjectValueL<TInt32>( mpxMediaAttribute, value ); |
|
1387 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1388 } |
|
1389 |
|
1390 if( type == EVcxTestMediaAttributeTypeTMPXItemId ) |
|
1391 { |
|
1392 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type EVcxTestMediaAttributeTypeTMPXItemId"); |
|
1393 |
|
1394 TInt value; |
|
1395 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
1396 |
|
1397 TInt value2; |
|
1398 User::LeaveIfError( aItem.GetNextInt( value2 ) ); |
|
1399 |
|
1400 TMPXItemId itemId; |
|
1401 itemId.iId1 = value; |
|
1402 itemId.iId2 = value2; |
|
1403 |
|
1404 iMpxMedia->SetTObjectValueL<TMPXItemId>( mpxMediaAttribute, itemId ); |
|
1405 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: Set to Id1: %d, Id2: %d", value, value2); |
|
1406 } |
|
1407 |
|
1408 if( type == EVcxTestMediaAttributeTypeTInt8 ) |
|
1409 { |
|
1410 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TInt8"); |
|
1411 |
|
1412 TInt value; |
|
1413 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
1414 iMpxMedia->SetTObjectValueL<TInt8>( mpxMediaAttribute, value ); |
|
1415 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1416 } |
|
1417 |
|
1418 if( type == EVcxTestMediaAttributeTypeTInt64 ) |
|
1419 { |
|
1420 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type TInt64"); |
|
1421 |
|
1422 TInt value; |
|
1423 User::LeaveIfError( aItem.GetNextInt( value ) ); |
|
1424 if( value == KVcxTestFileSize3GB ) |
|
1425 { |
|
1426 iMpxMedia->SetTObjectValueL<TInt64>( mpxMediaAttribute, 3000000000 ); |
|
1427 } |
|
1428 else |
|
1429 { |
|
1430 iMpxMedia->SetTObjectValueL<TInt64>( mpxMediaAttribute, value ); |
|
1431 } |
|
1432 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1433 } |
|
1434 |
|
1435 if ( type == EVcxTestMediaAttributeTypeMvFlags ) |
|
1436 { |
|
1437 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Setting attribute of type MV flags ( TUint32 )"); |
|
1438 |
|
1439 TInt value(0); |
|
1440 while( aItem.GetNextInt( value ) == KErrNone ) |
|
1441 { |
|
1442 value |= value; |
|
1443 } |
|
1444 iMpxMedia->SetTObjectValueL<TUint32>( mpxMediaAttribute, value ); |
|
1445 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value); |
|
1446 } |
|
1447 |
|
1448 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaDetailL <----------"); |
|
1449 return VCXMVTEST_ERR( err ); |
|
1450 } |
|
1451 |
|
1452 // ----------------------------------------------------------------------------- |
|
1453 // CIptvMyVideosApiTest::CheckMediaCountL |
|
1454 // ----------------------------------------------------------------------------- |
|
1455 // |
|
1456 TInt CVCXMyVideosCollectionPluginTest::CheckMediaCountL( CStifItemParser& aItem ) |
|
1457 { |
|
1458 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediaCountL ---------->"); |
|
1459 // Print to UI |
|
1460 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1461 _LIT( KWhere, "In CheckMediaCountL" ); |
|
1462 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1463 // Print to log file |
|
1464 iLog->Log( KWhere ); |
|
1465 |
|
1466 WaitForRefreshL( EFalse ); // Wait for possible refresh to finish. |
|
1467 |
|
1468 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1469 |
|
1470 TInt drive(0); |
|
1471 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
1472 |
|
1473 TInt expectedCount(0); |
|
1474 User::LeaveIfError(aItem.GetNextInt(expectedCount)); |
|
1475 |
|
1476 TRAPD( err, CheckMediasL( expectedCount, drive, 0 ) ); |
|
1477 |
|
1478 if( err != KErrNone ) |
|
1479 { |
|
1480 iTester->PrintMediasL( NULL, EFalse, _L("Videos") ); |
|
1481 } |
|
1482 |
|
1483 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaCountL <----------"); |
|
1484 return VCXMVTEST_ERR( err ); |
|
1485 } |
|
1486 |
|
1487 // ----------------------------------------------------------------------------- |
|
1488 // CIptvMyVideosApiTest::CheckMinimumMediaCountL |
|
1489 // ----------------------------------------------------------------------------- |
|
1490 // |
|
1491 TInt CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL( CStifItemParser& aItem ) |
|
1492 { |
|
1493 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL ---------->"); |
|
1494 // Print to UI |
|
1495 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1496 _LIT( KWhere, "In CheckMinimumMediaCountL" ); |
|
1497 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1498 // Print to log file |
|
1499 iLog->Log( KWhere ); |
|
1500 |
|
1501 WaitForRefreshL( EFalse ); // Wait for possible refresh to finish. |
|
1502 |
|
1503 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1504 |
|
1505 TInt drive(0); |
|
1506 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
1507 |
|
1508 TInt expectedCount(0); |
|
1509 User::LeaveIfError(aItem.GetNextInt(expectedCount)); |
|
1510 |
|
1511 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: drive: %d", drive); |
|
1512 |
|
1513 TRAPD( err, CheckMediasL( expectedCount, drive, -1 ) ); |
|
1514 |
|
1515 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL <----------"); |
|
1516 return VCXMVTEST_ERR( err ); |
|
1517 } |
|
1518 |
|
1519 // ----------------------------------------------------------------------------- |
|
1520 // CIptvMyVideosApiTest::CheckMaximumMediaCountL |
|
1521 // ----------------------------------------------------------------------------- |
|
1522 // |
|
1523 TInt CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL( CStifItemParser& aItem ) |
|
1524 { |
|
1525 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL ---------->"); |
|
1526 // Print to UI |
|
1527 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1528 _LIT( KWhere, "In CheckMaximumMediaCountL" ); |
|
1529 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1530 // Print to log file |
|
1531 iLog->Log( KWhere ); |
|
1532 |
|
1533 WaitForRefreshL( EFalse ); // Wait for possible refresh to finish. |
|
1534 |
|
1535 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1536 |
|
1537 TInt drive(0); |
|
1538 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
1539 |
|
1540 TInt expectedCount(0); |
|
1541 User::LeaveIfError( aItem.GetNextInt(expectedCount) ); |
|
1542 |
|
1543 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: drive: %d", drive); |
|
1544 |
|
1545 TRAPD( err, CheckMediasL( expectedCount, drive, 1 ) ); |
|
1546 |
|
1547 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL <----------"); |
|
1548 return VCXMVTEST_ERR( err ); |
|
1549 } |
|
1550 |
|
1551 // ----------------------------------------------------------------------------- |
|
1552 // CIptvMyVideosApiTest::CheckDownloadCountL |
|
1553 // ----------------------------------------------------------------------------- |
|
1554 // |
|
1555 TInt CVCXMyVideosCollectionPluginTest::CheckDownloadCountL( CStifItemParser& aItem ) |
|
1556 { |
|
1557 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckDownloadCountL ---------->"); |
|
1558 // Print to UI |
|
1559 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1560 _LIT( KWhere, "In CheckMediaCountL" ); |
|
1561 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1562 // Print to log file |
|
1563 iLog->Log( KWhere ); |
|
1564 |
|
1565 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1566 |
|
1567 WaitForRefreshL( EFalse ); // Wait for possible refresh to finish. |
|
1568 |
|
1569 TInt expectedCount(0); |
|
1570 User::LeaveIfError(aItem.GetNextInt(expectedCount)); |
|
1571 |
|
1572 TInt err( KErrNotReady ); |
|
1573 if( iTester ) |
|
1574 { |
|
1575 err = KErrNone; |
|
1576 if( iTester->GetDownloadWatcher()->GetDownloadCount() != expectedCount ) |
|
1577 { |
|
1578 err = KErrCorrupt; |
|
1579 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: Not expected count of downloads!"); |
|
1580 } |
|
1581 } |
|
1582 |
|
1583 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckDownloadCountL <----------"); |
|
1584 return VCXMVTEST_ERR( err ); |
|
1585 } |
|
1586 |
|
1587 // ----------------------------------------------------------------------------- |
|
1588 // CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL |
|
1589 // ----------------------------------------------------------------------------- |
|
1590 // |
|
1591 TInt CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL( CStifItemParser& aItem ) |
|
1592 { |
|
1593 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL ---------->"); |
|
1594 // Print to UI |
|
1595 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1596 _LIT( KWhere, "In CreateCopyOfMediaL" ); |
|
1597 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1598 // Print to log file |
|
1599 iLog->Log( KWhere ); |
|
1600 |
|
1601 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1602 |
|
1603 TInt drive(0); |
|
1604 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
1605 |
|
1606 TInt index(0); |
|
1607 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
1608 |
|
1609 if( index < 0 || index >= iTester->GetMediaCount() ) |
|
1610 { |
|
1611 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", index); |
|
1612 User::Leave( KErrArgument ); |
|
1613 } |
|
1614 |
|
1615 TInt fullCopy(1); |
|
1616 if( aItem.GetNextInt( fullCopy ) != KErrNone ) |
|
1617 { |
|
1618 fullCopy = 1; |
|
1619 } |
|
1620 |
|
1621 if( iTester->GetMediaCount() <= 0 ) |
|
1622 { |
|
1623 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: There's zero medias!"); |
|
1624 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------"); |
|
1625 return VCXMVTEST_ERR( KErrArgument ); |
|
1626 } |
|
1627 |
|
1628 if( iMpxMedia ) |
|
1629 { |
|
1630 delete iMpxMedia; |
|
1631 iMpxMedia = NULL; |
|
1632 } |
|
1633 |
|
1634 TInt err( KErrNone ); |
|
1635 |
|
1636 if( fullCopy ) |
|
1637 { |
|
1638 iLastReceivedMessage = -1; |
|
1639 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Requesting full media details."); |
|
1640 RArray<TInt> messages; |
|
1641 messages.Append( KVCXMYVideosTestMessageCollectionMedia ); |
|
1642 TRAP( err, iTester->GetMediaFullDetailsL( drive, index ) ); |
|
1643 if( err == KErrNone ) |
|
1644 { |
|
1645 TRAP( err, WaitForMessagesL( ETrue, messages, 5, ETrue ) ); |
|
1646 |
|
1647 if( err == KErrNone ) |
|
1648 { |
|
1649 CMPXMedia* copiedMedia = iTester->GetLastFullMedia(); |
|
1650 |
|
1651 const TDesC& title = copiedMedia->ValueText( KMPXMediaGeneralTitle ); |
|
1652 TMPXItemId itemId = *(copiedMedia->Value<TMPXItemId>( KMPXMediaGeneralId )); |
|
1653 |
|
1654 VCXLOGLO4("CVCXMyVideosCollectionPluginTest:: Creating copy of MPX media: %S, id1: %d, id2: %d.", &title, itemId.iId1, itemId.iId2); |
|
1655 TRAP( err, iMpxMedia = copiedMedia->CopyL( *copiedMedia ) ); |
|
1656 } |
|
1657 } |
|
1658 messages.Reset(); |
|
1659 } |
|
1660 else |
|
1661 { |
|
1662 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Creating empty MPX media."); |
|
1663 iMpxMedia = CMPXMedia::NewL(); |
|
1664 |
|
1665 CMPXMedia* copiedMedia( NULL ); |
|
1666 |
|
1667 TRAP( err, copiedMedia = iTester->GetMediaL( drive, index ) ); |
|
1668 |
|
1669 if( copiedMedia ) |
|
1670 { |
|
1671 TMPXItemId mpxId = *(copiedMedia->Value<TMPXItemId>( KMPXMediaGeneralId )); |
|
1672 iMpxMedia->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, mpxId ); |
|
1673 } |
|
1674 } |
|
1675 |
|
1676 if( err != KErrNone ) |
|
1677 { |
|
1678 VCXLOGLO2("<<<CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
1679 } |
|
1680 |
|
1681 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------"); |
|
1682 return VCXMVTEST_ERR( err ); |
|
1683 } |
|
1684 |
|
1685 // ----------------------------------------------------------------------------- |
|
1686 // CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL |
|
1687 // ----------------------------------------------------------------------------- |
|
1688 // |
|
1689 TInt CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL( CStifItemParser& aItem ) |
|
1690 { |
|
1691 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL ---------->"); |
|
1692 // Print to UI |
|
1693 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1694 _LIT( KWhere, "In CreateEmptyMediaL" ); |
|
1695 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1696 // Print to log file |
|
1697 iLog->Log( KWhere ); |
|
1698 |
|
1699 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1700 |
|
1701 if( iMpxMedia ) |
|
1702 { |
|
1703 delete iMpxMedia; |
|
1704 iMpxMedia = NULL; |
|
1705 } |
|
1706 |
|
1707 iMpxMedia = CMPXMedia::NewL(); |
|
1708 |
|
1709 TMPXItemId mpxId; |
|
1710 mpxId.iId1 = 0; |
|
1711 mpxId.iId2 = 0; |
|
1712 iMpxMedia->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, mpxId ); |
|
1713 |
|
1714 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL <----------"); |
|
1715 return KErrNone; |
|
1716 } |
|
1717 |
|
1718 // ----------------------------------------------------------------------------- |
|
1719 // CVCXMyVideosCollectionPluginTest::AddMediaL |
|
1720 // ----------------------------------------------------------------------------- |
|
1721 // |
|
1722 TInt CVCXMyVideosCollectionPluginTest::AddMediaL( CStifItemParser& aItem ) |
|
1723 { |
|
1724 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::AddMediaL ---------->"); |
|
1725 // Print to UI |
|
1726 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1727 _LIT( KWhere, "In AddMediaL" ); |
|
1728 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1729 // Print to log file |
|
1730 iLog->Log( KWhere ); |
|
1731 |
|
1732 iLastReceivedMessage = -1; |
|
1733 |
|
1734 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1735 |
|
1736 TInt syncCallInt(0); |
|
1737 User::LeaveIfError( aItem.GetNextInt( syncCallInt ) ); |
|
1738 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt); |
|
1739 TBool syncCall = static_cast<TBool>(syncCallInt); |
|
1740 |
|
1741 TRAPD( err, iTester->AddMediaL( iMpxMedia, syncCall ) ); |
|
1742 |
|
1743 #ifndef __WINSCW__ |
|
1744 // In urel builds add media is not supported, check mpx plugin file size if this is urel or udeb build. |
|
1745 if( err == KErrNotSupported ) |
|
1746 { |
|
1747 RFile rf; |
|
1748 _LIT( KVCXTestSystemDriveMpxPluginPath, "z:\\sys\\bin\\vcxmyvideoscollectionplugin.dll" ); |
|
1749 _LIT( KVCXTestUserDriveMpxPluginPath, "c:\\sys\\bin\\vcxmyvideoscollectionplugin.dll" ); |
|
1750 |
|
1751 TInt err2( KErrNone ); |
|
1752 if( BaflUtils::FileExists( iFs, KVCXTestUserDriveMpxPluginPath ) ) |
|
1753 { |
|
1754 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Open C drive bin."); |
|
1755 err2 = rf.Open( iFs, KVCXTestUserDriveMpxPluginPath, EFileRead|EFileShareAny ); |
|
1756 } |
|
1757 else |
|
1758 { |
|
1759 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Open Z drive bin."); |
|
1760 err2 = rf.Open( iFs, KVCXTestSystemDriveMpxPluginPath, EFileRead|EFileShareAny ); |
|
1761 } |
|
1762 |
|
1763 if( err2 == KErrNone ) |
|
1764 { |
|
1765 TInt size(0); |
|
1766 if( rf.Size( size ) == KErrNone ) |
|
1767 { |
|
1768 if( size < 1024*40 ) |
|
1769 { |
|
1770 err = KErrNone; |
|
1771 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !OBS! Looks like UREL build, Add media failed as expected."); |
|
1772 iAddMediaCmdCount++; // Increase 'fake' video count for media count check. |
|
1773 } |
|
1774 else |
|
1775 { |
|
1776 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !OBS! ERROR: UDEB build I guess, add media failed, check this."); |
|
1777 } |
|
1778 } |
|
1779 rf.Close(); |
|
1780 } |
|
1781 else |
|
1782 { |
|
1783 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Open plugin binary failed: %d", err2); |
|
1784 } |
|
1785 } |
|
1786 #endif // __WINSCW__ |
|
1787 |
|
1788 |
|
1789 if( err != KErrNone ) |
|
1790 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
1791 |
|
1792 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::AddMediaL <----------"); |
|
1793 return VCXMVTEST_ERR( err ); |
|
1794 } |
|
1795 |
|
1796 // ----------------------------------------------------------------------------- |
|
1797 // CVCXMyVideosCollectionPluginTest::SetMediaL |
|
1798 // ----------------------------------------------------------------------------- |
|
1799 // |
|
1800 TInt CVCXMyVideosCollectionPluginTest::SetMediaL( CStifItemParser& aItem ) |
|
1801 { |
|
1802 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetMediaL ---------->"); |
|
1803 // Print to UI |
|
1804 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1805 _LIT( KWhere, "In SetMediaL" ); |
|
1806 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1807 // Print to log file |
|
1808 iLog->Log( KWhere ); |
|
1809 |
|
1810 if( !iMpxMedia ) |
|
1811 { |
|
1812 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!"); |
|
1813 User::Leave( KErrArgument ); |
|
1814 } |
|
1815 |
|
1816 iLastReceivedMessage = -1; |
|
1817 |
|
1818 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1819 |
|
1820 TInt syncCallInt(0); |
|
1821 User::LeaveIfError( aItem.GetNextInt( syncCallInt ) ); |
|
1822 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt); |
|
1823 TBool syncCall = static_cast<TBool>(syncCallInt); |
|
1824 |
|
1825 TInt err( KErrNotReady ); |
|
1826 if( iTester ) |
|
1827 { |
|
1828 TRAP( err, iTester->SetMediaL( iMpxMedia, syncCall ) ); |
|
1829 } |
|
1830 |
|
1831 if( err != KErrNone ) |
|
1832 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
1833 |
|
1834 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaL <----------"); |
|
1835 return VCXMVTEST_ERR( err ); |
|
1836 } |
|
1837 |
|
1838 // ----------------------------------------------------------------------------- |
|
1839 // CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL |
|
1840 // ----------------------------------------------------------------------------- |
|
1841 // |
|
1842 TInt CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL( CStifItemParser& aItem ) |
|
1843 { |
|
1844 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL ---------->"); |
|
1845 // Print to UI |
|
1846 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1847 _LIT( KWhere, "In OutsideMediaUpdateL" ); |
|
1848 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1849 // Print to log file |
|
1850 iLog->Log( KWhere ); |
|
1851 |
|
1852 if( !iMpxMedia ) |
|
1853 { |
|
1854 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!"); |
|
1855 User::Leave( KErrArgument ); |
|
1856 } |
|
1857 |
|
1858 iLastReceivedMessage = -1; |
|
1859 |
|
1860 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1861 |
|
1862 TRAPD( err, iMdsDbModifier->UpdateVideoL( *iMpxMedia ) ); |
|
1863 |
|
1864 if( err != KErrNone ) |
|
1865 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
1866 |
|
1867 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL <----------"); |
|
1868 return VCXMVTEST_ERR( err ); |
|
1869 } |
|
1870 |
|
1871 // ----------------------------------------------------------------------------- |
|
1872 // CIptvMyVideosApiTest::RemoveMediaL |
|
1873 // ----------------------------------------------------------------------------- |
|
1874 // |
|
1875 TInt CVCXMyVideosCollectionPluginTest::RemoveMediaL( CStifItemParser& aItem ) |
|
1876 { |
|
1877 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveMediaL ---------->"); |
|
1878 // Print to UI |
|
1879 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1880 _LIT( KWhere, "In RemoveMediaL" ); |
|
1881 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1882 // Print to log file |
|
1883 iLog->Log( KWhere ); |
|
1884 |
|
1885 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1886 |
|
1887 TInt drive(0); |
|
1888 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
1889 |
|
1890 TInt index(0); |
|
1891 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
1892 |
|
1893 TBool syncCall( EFalse ); |
|
1894 TInt syncCallInt(0); |
|
1895 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
1896 { |
|
1897 syncCall = static_cast<TBool>(syncCallInt); |
|
1898 } |
|
1899 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
1900 |
|
1901 iLastReceivedMessage = -1; |
|
1902 |
|
1903 TInt err( KErrNotReady ); |
|
1904 if( iTester ) |
|
1905 { |
|
1906 TRAP( err, iTester->RemoveMediaL( drive, index, syncCall ) ); |
|
1907 } |
|
1908 |
|
1909 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveMediaL <----------"); |
|
1910 return VCXMVTEST_ERR( err ); |
|
1911 } |
|
1912 |
|
1913 // ----------------------------------------------------------------------------- |
|
1914 // CIptvMyVideosApiTest::RemoveAllMediaL |
|
1915 // ----------------------------------------------------------------------------- |
|
1916 // |
|
1917 TInt CVCXMyVideosCollectionPluginTest::RemoveAllMediaL( CStifItemParser& aItem ) |
|
1918 { |
|
1919 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveAllMediaL ---------->"); |
|
1920 // Print to UI |
|
1921 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
1922 _LIT( KWhere, "In RemoveAllMediaL" ); |
|
1923 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
1924 // Print to log file |
|
1925 iLog->Log( KWhere ); |
|
1926 |
|
1927 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1928 |
|
1929 iLastReceivedMessage = -1; |
|
1930 |
|
1931 TRAP_IGNORE( iTester->EnsureMediaFilesAreNotInUseL() ); |
|
1932 |
|
1933 TInt error( KErrNone ); |
|
1934 |
|
1935 TInt mediaCount = iTester->GetMediaCount(); |
|
1936 |
|
1937 // Store info about the mpx items. |
|
1938 RArray<TUint> mpxIds; |
|
1939 CleanupClosePushL( mpxIds ); |
|
1940 |
|
1941 RArray<TUint> downloadIds; |
|
1942 CleanupClosePushL( downloadIds ); |
|
1943 |
|
1944 RArray<TInt> downloadStates; |
|
1945 CleanupClosePushL( downloadStates ); |
|
1946 |
|
1947 RPointerArray<HBufC> filePaths; |
|
1948 CleanupResetAndDestroyPushL( filePaths ); |
|
1949 |
|
1950 // Get ids and other needed details. |
|
1951 |
|
1952 for( TInt i=0; i<mediaCount; i++ ) |
|
1953 { |
|
1954 CMPXMedia* media( NULL ); |
|
1955 VCXLOGLO2("CVCXMyVideosCollectionPluginTest::RemoveAllMediaL: GetMedia %d", i); |
|
1956 TRAP( error, media = iTester->GetMediaL( -1, i ) ); |
|
1957 |
|
1958 if( error != KErrNone ) |
|
1959 { |
|
1960 CleanupStack::PopAndDestroy( &filePaths ); |
|
1961 CleanupStack::PopAndDestroy( &downloadStates ); |
|
1962 CleanupStack::PopAndDestroy( &downloadIds ); |
|
1963 CleanupStack::PopAndDestroy( &mpxIds ); |
|
1964 |
|
1965 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveAllMediaL <----------"); |
|
1966 return VCXMVTEST_ERR( error ); |
|
1967 } |
|
1968 |
|
1969 if( media && media->IsSupported( KMPXMediaGeneralUri ) ) |
|
1970 { |
|
1971 TUint32 downloadId = 0; |
|
1972 if( media->IsSupported( KVcxMediaMyVideosDownloadId ) ) |
|
1973 { |
|
1974 downloadId = media->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId ); |
|
1975 } |
|
1976 |
|
1977 TInt state = -1; |
|
1978 if( media->IsSupported( KVcxMediaMyVideosDownloadState ) ) |
|
1979 { |
|
1980 state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState ); |
|
1981 } |
|
1982 |
|
1983 HBufC* path( NULL ); |
|
1984 if( media->IsSupported( KMPXMediaGeneralUri ) ) |
|
1985 { |
|
1986 path = media->ValueText( KMPXMediaGeneralUri ).AllocL(); |
|
1987 } |
|
1988 else |
|
1989 { |
|
1990 path = HBufC::NewL( 32 ); |
|
1991 } |
|
1992 |
|
1993 TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId )); |
|
1994 |
|
1995 filePaths.Append( path ); |
|
1996 downloadIds.Append( downloadId ); |
|
1997 downloadStates.Append( state ); |
|
1998 mpxIds.Append( itemId.iId1 ); |
|
1999 } |
|
2000 } |
|
2001 |
|
2002 // Cancel downloads. |
|
2003 |
|
2004 for( TInt i = mpxIds.Count()-1; i >= 0; i-- ) |
|
2005 { |
|
2006 if( downloadIds[i] != 0 || downloadStates[i] != -1 ) |
|
2007 { |
|
2008 // Cancel the download. |
|
2009 RArray<TInt> messages; |
|
2010 if( BaflUtils::FileExists( iFs, filePaths[i]->Des() ) ) |
|
2011 { |
|
2012 messages.Append( KVCXMYVideosTestMessageMpxItemDeleted ); |
|
2013 } |
|
2014 messages.Append( KVCXMYVideosTestMessageCommandComplete ); |
|
2015 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
2016 TRAP( error, iTester->CancelDownloadL( mpxIds[i], downloadIds[i], filePaths[i]->Des(), EFalse ) ); |
|
2017 if( error == KErrNone ) |
|
2018 { |
|
2019 TRAP( error, WaitForMessagesL( ETrue, messages, 30, ETrue ) ); |
|
2020 } |
|
2021 messages.Reset(); |
|
2022 // Error occured, lets hope deleting works. |
|
2023 if( error != KErrNone ) |
|
2024 { |
|
2025 downloadIds[i] = 0; |
|
2026 downloadStates[i] = -1; |
|
2027 } |
|
2028 } |
|
2029 } |
|
2030 |
|
2031 // Get current list of medias. |
|
2032 |
|
2033 CMPXMediaArray* medias( NULL ); |
|
2034 medias = iTester->SelectMediasL( -1, 0, iTester->GetMediaCount() ); |
|
2035 CleanupStack::PushL( medias ); |
|
2036 |
|
2037 TInt retries = 3; |
|
2038 |
|
2039 // Delete the videos, and retry few times if needed. |
|
2040 while( iTester->GetMediaCount() > 0 && retries-- > 0 ) |
|
2041 { |
|
2042 // Get medias to delete. |
|
2043 TRAP( error, iTester->DeleteMediasByMpxIdsL( medias, EFalse ) ); |
|
2044 |
|
2045 if( error == KErrNone ) |
|
2046 { |
|
2047 // Wait for deletion to complete. |
|
2048 RArray<TInt> messages; |
|
2049 CleanupClosePushL( messages ); |
|
2050 messages.Append( KVCXMYVideosTestMessageDeleteResp ); |
|
2051 messages.Append( KVCXMYVideosTestMessageCommandComplete ); |
|
2052 messages.Append( KVCXMYVideosTestMessageDeleteStarted ); |
|
2053 |
|
2054 TInt timeout = medias->Count()*5 + 60; |
|
2055 |
|
2056 TRAP( error, WaitForMessagesL( ETrue, messages, timeout, ETrue ) ); |
|
2057 CleanupStack::PopAndDestroy( &messages ); |
|
2058 } |
|
2059 |
|
2060 CleanupStack::PopAndDestroy( medias ); |
|
2061 |
|
2062 // Refresh the medias. |
|
2063 RArray<TInt> messages; |
|
2064 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
2065 TRAP( error, iTester->RefreshContentsL() ); |
|
2066 if( error == KErrNone ) |
|
2067 { |
|
2068 TRAP( error, WaitForMessagesL( ETrue, messages, 120, ETrue ) ); |
|
2069 } |
|
2070 messages.Reset(); |
|
2071 |
|
2072 medias = iTester->SelectMediasL( -1, 0, iTester->GetMediaCount() ); |
|
2073 CleanupStack::PushL( medias ); |
|
2074 |
|
2075 if( iTester->GetMediaCount() > 0 ) |
|
2076 { |
|
2077 User::After( 60 * 1000000 ); // Wait a minute. |
|
2078 } |
|
2079 } |
|
2080 |
|
2081 CleanupStack::PopAndDestroy( medias ); |
|
2082 |
|
2083 iLastReceivedMessage = -1; |
|
2084 |
|
2085 CleanupStack::PopAndDestroy( &filePaths ); |
|
2086 CleanupStack::PopAndDestroy( &downloadStates ); |
|
2087 CleanupStack::PopAndDestroy( &downloadIds ); |
|
2088 CleanupStack::PopAndDestroy( &mpxIds ); |
|
2089 |
|
2090 if( iTester && iTester->GetDownloadWatcher() ) |
|
2091 { |
|
2092 iTester->GetDownloadWatcher()->Reset(); |
|
2093 } |
|
2094 |
|
2095 if( iTester->GetMediaCount() > 0 ) |
|
2096 { |
|
2097 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: All medias could not be removed."); |
|
2098 error = KErrCorrupt; |
|
2099 } |
|
2100 |
|
2101 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveAllMediaL <----------"); |
|
2102 return VCXMVTEST_ERR( error ); |
|
2103 } |
|
2104 |
|
2105 // ----------------------------------------------------------------------------- |
|
2106 // CIptvMyVideosApiTest::MoveMediaL |
|
2107 // ----------------------------------------------------------------------------- |
|
2108 // |
|
2109 TInt CVCXMyVideosCollectionPluginTest::MoveMediaL( CStifItemParser& aItem ) |
|
2110 { |
|
2111 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::MoveMediaL ---------->"); |
|
2112 // Print to UI |
|
2113 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2114 _LIT( KWhere, "In MoveMediaL" ); |
|
2115 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2116 // Print to log file |
|
2117 iLog->Log( KWhere ); |
|
2118 |
|
2119 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2120 |
|
2121 iLastReceivedMessage = -1; |
|
2122 |
|
2123 TInt sourceDrive(0); |
|
2124 User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) ); |
|
2125 |
|
2126 TInt index(0); |
|
2127 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
2128 |
|
2129 TInt destDrive(0); |
|
2130 User::LeaveIfError( GetDriveParam( aItem, destDrive ) ); |
|
2131 |
|
2132 TBool syncCall( EFalse ); |
|
2133 TInt syncCallInt(0); |
|
2134 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2135 { |
|
2136 syncCall = static_cast<TBool>(syncCallInt); |
|
2137 } |
|
2138 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2139 |
|
2140 TInt err( KErrNotReady ); |
|
2141 if( iTester ) |
|
2142 { |
|
2143 TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() ); |
|
2144 err = VCXMVTEST_ERR( err ); |
|
2145 if( err == KErrNone ) |
|
2146 { |
|
2147 TRAP( err, iTester->MoveMediasL( sourceDrive, index, index+1, destDrive, syncCall ) ); |
|
2148 } |
|
2149 } |
|
2150 |
|
2151 if( err != KErrNone ) |
|
2152 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2153 |
|
2154 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediaL <----------"); |
|
2155 return VCXMVTEST_ERR( err ); |
|
2156 } |
|
2157 |
|
2158 // ----------------------------------------------------------------------------- |
|
2159 // CIptvMyVideosApiTest::MoveMediasL |
|
2160 // ----------------------------------------------------------------------------- |
|
2161 // |
|
2162 TInt CVCXMyVideosCollectionPluginTest::MoveMediasL( CStifItemParser& aItem ) |
|
2163 { |
|
2164 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::MoveMediasL ---------->"); |
|
2165 // Print to UI |
|
2166 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2167 _LIT( KWhere, "In MoveMediasL" ); |
|
2168 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2169 // Print to log file |
|
2170 iLog->Log( KWhere ); |
|
2171 |
|
2172 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2173 |
|
2174 iLastReceivedMessage = -1; |
|
2175 |
|
2176 TInt sourceDrive(0); |
|
2177 User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) ); |
|
2178 |
|
2179 TInt index(0); |
|
2180 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
2181 |
|
2182 TInt endIndex(0); |
|
2183 User::LeaveIfError( aItem.GetNextInt( endIndex ) ); |
|
2184 |
|
2185 TInt destDrive(0); |
|
2186 User::LeaveIfError( GetDriveParam( aItem, destDrive ) ); |
|
2187 |
|
2188 TBool syncCall( EFalse ); |
|
2189 TInt syncCallInt(0); |
|
2190 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2191 { |
|
2192 syncCall = static_cast<TBool>(syncCallInt); |
|
2193 } |
|
2194 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2195 |
|
2196 TInt err( KErrNotReady ); |
|
2197 if( iTester ) |
|
2198 { |
|
2199 TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() ); |
|
2200 err = VCXMVTEST_ERR( err ); |
|
2201 if( err == KErrNone ) |
|
2202 { |
|
2203 TRAP( err, iTester->MoveMediasL( sourceDrive, index, endIndex, destDrive, syncCall ) ); |
|
2204 } |
|
2205 } |
|
2206 |
|
2207 if( err != KErrNone ) |
|
2208 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2209 |
|
2210 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediasL <----------"); |
|
2211 return VCXMVTEST_ERR( err ); |
|
2212 } |
|
2213 |
|
2214 // ----------------------------------------------------------------------------- |
|
2215 // CIptvMyVideosApiTest::CancelMoveL |
|
2216 // ----------------------------------------------------------------------------- |
|
2217 // |
|
2218 TInt CVCXMyVideosCollectionPluginTest::CancelMoveL( CStifItemParser& aItem ) |
|
2219 { |
|
2220 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelMoveL ---------->"); |
|
2221 // Print to UI |
|
2222 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2223 _LIT( KWhere, "In CancelMoveL" ); |
|
2224 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2225 // Print to log file |
|
2226 iLog->Log( KWhere ); |
|
2227 |
|
2228 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2229 |
|
2230 iLastReceivedMessage = -1; |
|
2231 |
|
2232 TBool syncCall( ETrue ); |
|
2233 TInt syncCallInt(0); |
|
2234 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2235 { |
|
2236 syncCall = static_cast<TBool>(syncCallInt); |
|
2237 } |
|
2238 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2239 |
|
2240 TInt err( KErrNotReady ); |
|
2241 if( iTester ) |
|
2242 { |
|
2243 TRAP( err, iTester->CancelMoveOrCopyL( syncCall ) ); |
|
2244 } |
|
2245 |
|
2246 if( err != KErrNone ) |
|
2247 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2248 |
|
2249 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelMoveL <----------"); |
|
2250 return VCXMVTEST_ERR( err ); |
|
2251 } |
|
2252 |
|
2253 // ----------------------------------------------------------------------------- |
|
2254 // CIptvMyVideosApiTest::CopyMediaL |
|
2255 // ----------------------------------------------------------------------------- |
|
2256 // |
|
2257 TInt CVCXMyVideosCollectionPluginTest::CopyMediaL( CStifItemParser& aItem ) |
|
2258 { |
|
2259 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CopyMediaL ---------->"); |
|
2260 // Print to UI |
|
2261 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2262 _LIT( KWhere, "In CopyMediaL" ); |
|
2263 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2264 // Print to log file |
|
2265 iLog->Log( KWhere ); |
|
2266 |
|
2267 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2268 |
|
2269 iLastReceivedMessage = -1; |
|
2270 |
|
2271 TInt sourceDrive(0); |
|
2272 User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) ); |
|
2273 |
|
2274 TInt index(0); |
|
2275 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
2276 |
|
2277 TInt destDrive(0); |
|
2278 User::LeaveIfError( GetDriveParam( aItem, destDrive ) ); |
|
2279 |
|
2280 TBool syncCall( EFalse ); |
|
2281 TInt syncCallInt(0); |
|
2282 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2283 { |
|
2284 syncCall = static_cast<TBool>(syncCallInt); |
|
2285 } |
|
2286 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2287 |
|
2288 TInt err( KErrNotReady ); |
|
2289 if( iTester ) |
|
2290 { |
|
2291 TRAP( err, iTester->CopyMediasL( sourceDrive, index, index+1, destDrive, syncCall ) ); |
|
2292 } |
|
2293 |
|
2294 if( err != KErrNone ) |
|
2295 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2296 |
|
2297 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediaL <----------"); |
|
2298 return VCXMVTEST_ERR( err ); |
|
2299 } |
|
2300 |
|
2301 // ----------------------------------------------------------------------------- |
|
2302 // CIptvMyVideosApiTest::CopyMediasL |
|
2303 // ----------------------------------------------------------------------------- |
|
2304 // |
|
2305 TInt CVCXMyVideosCollectionPluginTest::CopyMediasL( CStifItemParser& aItem ) |
|
2306 { |
|
2307 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CopyMediasL ---------->"); |
|
2308 // Print to UI |
|
2309 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2310 _LIT( KWhere, "In CopyMediasL" ); |
|
2311 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2312 // Print to log file |
|
2313 iLog->Log( KWhere ); |
|
2314 |
|
2315 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2316 |
|
2317 iLastReceivedMessage = -1; |
|
2318 |
|
2319 TInt sourceDrive(0); |
|
2320 User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) ); |
|
2321 |
|
2322 TInt index(0); |
|
2323 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
2324 |
|
2325 TInt endIndex(0); |
|
2326 User::LeaveIfError( aItem.GetNextInt( endIndex ) ); |
|
2327 |
|
2328 TInt destDrive(0); |
|
2329 User::LeaveIfError( GetDriveParam( aItem, destDrive ) ); |
|
2330 |
|
2331 TBool syncCall( EFalse ); |
|
2332 TInt syncCallInt(0); |
|
2333 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2334 { |
|
2335 syncCall = static_cast<TBool>(syncCallInt); |
|
2336 } |
|
2337 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2338 |
|
2339 TInt err( KErrNotReady ); |
|
2340 if( iTester ) |
|
2341 { |
|
2342 TRAP( err, iTester->CopyMediasL( sourceDrive, index, endIndex, destDrive, syncCall ) ); |
|
2343 } |
|
2344 |
|
2345 if( err != KErrNone ) |
|
2346 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2347 |
|
2348 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediasL <----------"); |
|
2349 return VCXMVTEST_ERR( err ); |
|
2350 } |
|
2351 |
|
2352 // ----------------------------------------------------------------------------- |
|
2353 // CIptvMyVideosApiTest::CancelCopyL |
|
2354 // ----------------------------------------------------------------------------- |
|
2355 // |
|
2356 TInt CVCXMyVideosCollectionPluginTest::CancelCopyL( CStifItemParser& aItem ) |
|
2357 { |
|
2358 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelCopyL ---------->"); |
|
2359 // Print to UI |
|
2360 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2361 _LIT( KWhere, "In CancelCopyL" ); |
|
2362 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2363 // Print to log file |
|
2364 iLog->Log( KWhere ); |
|
2365 |
|
2366 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2367 |
|
2368 iLastReceivedMessage = -1; |
|
2369 |
|
2370 TBool syncCall( EFalse ); |
|
2371 TInt syncCallInt(0); |
|
2372 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2373 { |
|
2374 syncCall = static_cast<TBool>(syncCallInt); |
|
2375 } |
|
2376 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2377 |
|
2378 TInt err( KErrNotReady ); |
|
2379 if( iTester ) |
|
2380 { |
|
2381 TRAP( err, iTester->CancelMoveOrCopyL( syncCall ) ); |
|
2382 } |
|
2383 |
|
2384 if( err != KErrNone ) |
|
2385 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2386 |
|
2387 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelCopyL <----------"); |
|
2388 return VCXMVTEST_ERR( err ); |
|
2389 } |
|
2390 |
|
2391 // ----------------------------------------------------------------------------- |
|
2392 // CIptvMyVideosApiTest::DeleteMediaL |
|
2393 // ----------------------------------------------------------------------------- |
|
2394 // |
|
2395 TInt CVCXMyVideosCollectionPluginTest::DeleteMediaL( CStifItemParser& aItem ) |
|
2396 { |
|
2397 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteMediaL ---------->"); |
|
2398 // Print to UI |
|
2399 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2400 _LIT( KWhere, "In DeleteMediaL" ); |
|
2401 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2402 // Print to log file |
|
2403 iLog->Log( KWhere ); |
|
2404 |
|
2405 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2406 |
|
2407 iLastReceivedMessage = -1; |
|
2408 |
|
2409 TInt sourceDrive(0); |
|
2410 User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) ); |
|
2411 |
|
2412 TInt index(0); |
|
2413 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
2414 |
|
2415 TBool syncCall( ETrue ); |
|
2416 TInt syncCallInt(0); |
|
2417 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2418 { |
|
2419 syncCall = static_cast<TBool>(syncCallInt); |
|
2420 } |
|
2421 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2422 |
|
2423 TInt err( KErrNotReady ); |
|
2424 if( iTester ) |
|
2425 { |
|
2426 TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() ); |
|
2427 err = VCXMVTEST_ERR( err ); |
|
2428 if( err == KErrNone ) |
|
2429 { |
|
2430 TRAP( err, iTester->DeleteMediasL( sourceDrive, index, index+1, syncCall ) ); |
|
2431 } |
|
2432 } |
|
2433 |
|
2434 if( err != KErrNone ) |
|
2435 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2436 |
|
2437 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediaL <----------"); |
|
2438 return VCXMVTEST_ERR( err ); |
|
2439 } |
|
2440 |
|
2441 // ----------------------------------------------------------------------------- |
|
2442 // CIptvMyVideosApiTest::DeleteMediasL |
|
2443 // ----------------------------------------------------------------------------- |
|
2444 // |
|
2445 TInt CVCXMyVideosCollectionPluginTest::DeleteMediasL( CStifItemParser& aItem ) |
|
2446 { |
|
2447 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteMediasL ---------->"); |
|
2448 // Print to UI |
|
2449 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2450 _LIT( KWhere, "In DeleteMediasL" ); |
|
2451 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2452 // Print to log file |
|
2453 iLog->Log( KWhere ); |
|
2454 |
|
2455 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2456 |
|
2457 iLastReceivedMessage = -1; |
|
2458 |
|
2459 TInt sourceDrive(0); |
|
2460 User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) ); |
|
2461 |
|
2462 TInt index(0); |
|
2463 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
2464 |
|
2465 TInt endIndex(0); |
|
2466 User::LeaveIfError( aItem.GetNextInt( endIndex ) ); |
|
2467 |
|
2468 TBool syncCall( EFalse ); |
|
2469 TInt syncCallInt(0); |
|
2470 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2471 { |
|
2472 syncCall = static_cast<TBool>(syncCallInt); |
|
2473 } |
|
2474 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2475 |
|
2476 TInt err( KErrNotReady ); |
|
2477 if( iTester ) |
|
2478 { |
|
2479 TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() ); |
|
2480 err = VCXMVTEST_ERR( err ); |
|
2481 if( err == KErrNone ) |
|
2482 { |
|
2483 TRAP( err, iTester->DeleteMediasL( sourceDrive, index, endIndex, syncCall ) ); |
|
2484 } |
|
2485 } |
|
2486 |
|
2487 if( err != KErrNone ) |
|
2488 { |
|
2489 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2490 } |
|
2491 |
|
2492 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediasL <----------"); |
|
2493 return VCXMVTEST_ERR( err ); |
|
2494 } |
|
2495 |
|
2496 // ----------------------------------------------------------------------------- |
|
2497 // CIptvMyVideosApiTest::CancelDeleteL |
|
2498 // ----------------------------------------------------------------------------- |
|
2499 // |
|
2500 TInt CVCXMyVideosCollectionPluginTest::CancelDeleteL( CStifItemParser& aItem ) |
|
2501 { |
|
2502 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDeleteL ---------->"); |
|
2503 // Print to UI |
|
2504 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2505 _LIT( KWhere, "In CancelDeleteL" ); |
|
2506 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2507 // Print to log file |
|
2508 iLog->Log( KWhere ); |
|
2509 |
|
2510 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2511 |
|
2512 iLastReceivedMessage = -1; |
|
2513 |
|
2514 TBool syncCall( ETrue ); |
|
2515 TInt syncCallInt(0); |
|
2516 if( aItem.GetNextInt( syncCallInt ) == KErrNone ) |
|
2517 { |
|
2518 syncCall = static_cast<TBool>(syncCallInt); |
|
2519 } |
|
2520 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCall ); |
|
2521 |
|
2522 TInt err( KErrNotReady ); |
|
2523 if( iTester ) |
|
2524 { |
|
2525 TRAP( err, iTester->CancelDeleteL( syncCall ) ); |
|
2526 } |
|
2527 |
|
2528 if( err != KErrNone ) |
|
2529 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2530 |
|
2531 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDeleteL <----------"); |
|
2532 return VCXMVTEST_ERR( err ); |
|
2533 } |
|
2534 |
|
2535 //---------------------------------------------------------------------------- |
|
2536 // CIptvMyVideosApiTest::CancelNextOperationL |
|
2537 // ----------------------------------------------------------------------------- |
|
2538 // |
|
2539 TInt CVCXMyVideosCollectionPluginTest::CancelNextOperationL( CStifItemParser& /* aItem */ ) |
|
2540 { |
|
2541 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelNextOperationL ---------->"); |
|
2542 // Print to UI |
|
2543 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2544 _LIT( KWhere, "In CancelNextOperationL" ); |
|
2545 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2546 // Print to log file |
|
2547 iLog->Log( KWhere ); |
|
2548 |
|
2549 iCancelNextOperation = ETrue; |
|
2550 |
|
2551 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelNextOperationL <----------"); |
|
2552 return KErrNone; |
|
2553 } |
|
2554 |
|
2555 // ----------------------------------------------------------------------------- |
|
2556 // CIptvMyVideosApiTest::DeleteFileOfMediaL |
|
2557 // ----------------------------------------------------------------------------- |
|
2558 // |
|
2559 TInt CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL( CStifItemParser& aItem ) |
|
2560 { |
|
2561 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL ---------->"); |
|
2562 // Print to UI |
|
2563 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2564 _LIT( KWhere, "In DeleteFileOfMediaL" ); |
|
2565 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2566 // Print to log file |
|
2567 iLog->Log( KWhere ); |
|
2568 |
|
2569 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2570 |
|
2571 TInt drive(0); |
|
2572 User::LeaveIfError( GetDriveParam( aItem, drive ) ); |
|
2573 |
|
2574 TInt index(0); |
|
2575 User::LeaveIfError( aItem.GetNextInt( index ) ); |
|
2576 |
|
2577 if( index < 0 || index >= iTester->GetMediaCount() ) |
|
2578 { |
|
2579 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", index); |
|
2580 User::Leave( KErrArgument ); |
|
2581 } |
|
2582 |
|
2583 iLastReceivedMessage = -1; |
|
2584 |
|
2585 TRAPD( err, iTester->DeleteFileOfMediaL( drive, index ) ); |
|
2586 |
|
2587 if( err != KErrNone ) |
|
2588 { |
|
2589 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
2590 } |
|
2591 |
|
2592 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL <----------"); |
|
2593 return VCXMVTEST_ERR( err ); |
|
2594 } |
|
2595 |
|
2596 // ----------------------------------------------------------------------------- |
|
2597 // CIptvMyVideosApiTest::DeleteFilesOfAllMediasL |
|
2598 // ----------------------------------------------------------------------------- |
|
2599 // |
|
2600 TInt CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL( CStifItemParser& /* aItem */ ) |
|
2601 { |
|
2602 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL ---------->"); |
|
2603 // Print to UI |
|
2604 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2605 _LIT( KWhere, "In DeleteFilesOfAllMediasL" ); |
|
2606 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2607 // Print to log file |
|
2608 iLog->Log( KWhere ); |
|
2609 |
|
2610 iLastReceivedMessage = -1; |
|
2611 |
|
2612 TInt err( KErrNotReady ); |
|
2613 if( iTester ) |
|
2614 { |
|
2615 TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() ); |
|
2616 err = VCXMVTEST_ERR( err ); |
|
2617 if( err == KErrNone ) |
|
2618 { |
|
2619 TRAP( err, iTester->DeleteAllMediaFilesL() ); |
|
2620 } |
|
2621 } |
|
2622 |
|
2623 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL <----------"); |
|
2624 return VCXMVTEST_ERR( err ); |
|
2625 } |
|
2626 |
|
2627 // ----------------------------------------------------------------------------- |
|
2628 // CIptvMyVideosApiTest::CreateVideoFileL |
|
2629 // ----------------------------------------------------------------------------- |
|
2630 // |
|
2631 TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CStifItemParser& aItem ) |
|
2632 { |
|
2633 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateVideoFileL ---------->"); |
|
2634 // Print to UI |
|
2635 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2636 _LIT( KWhere, "In CreateVideoFileL" ); |
|
2637 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2638 // Print to log file |
|
2639 iLog->Log( KWhere ); |
|
2640 |
|
2641 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2642 |
|
2643 TInt temp(0); |
|
2644 |
|
2645 // Parameter video type |
|
2646 CIptvTestVideoCreator::TIptvTestVideoType videoType; |
|
2647 User::LeaveIfError( aItem.GetNextInt(temp) ); |
|
2648 videoType = static_cast<CIptvTestVideoCreator::TIptvTestVideoType>(temp); |
|
2649 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType); |
|
2650 |
|
2651 // Parameter drive letter |
|
2652 TPtrC driveLetter; |
|
2653 User::LeaveIfError(aItem.GetNextString(driveLetter)); |
|
2654 #ifdef __WINSCW__ |
|
2655 driveLetter.Set(_L("C")); |
|
2656 #endif |
|
2657 |
|
2658 // Parameter path and filename |
|
2659 TPtrC filename; |
|
2660 User::LeaveIfError(aItem.GetNextString(filename)); |
|
2661 if(filename.Length() < 64) |
|
2662 { |
|
2663 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: filename: %S", &filename); |
|
2664 } |
|
2665 |
|
2666 // Parameter video size |
|
2667 TInt size(-1); |
|
2668 if( aItem.GetNextInt(size) != KErrNone ) |
|
2669 { |
|
2670 size = -1; |
|
2671 } |
|
2672 |
|
2673 // Parameter video count |
|
2674 TInt count(1); |
|
2675 if( aItem.GetNextInt( count ) != KErrNone || count <= 0 ) |
|
2676 { |
|
2677 count = 1; |
|
2678 } |
|
2679 |
|
2680 TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, ETrue ) ); |
|
2681 |
|
2682 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileL <----------"); |
|
2683 return VCXMVTEST_ERR( err ); |
|
2684 } |
|
2685 |
|
2686 // ----------------------------------------------------------------------------- |
|
2687 // CIptvMyVideosApiTest::CreateVideoFileNoWaitL |
|
2688 // ----------------------------------------------------------------------------- |
|
2689 // |
|
2690 TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL( CStifItemParser& aItem ) |
|
2691 { |
|
2692 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ---------->"); |
|
2693 // Print to UI |
|
2694 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2695 _LIT( KWhere, "In CreateVideoFileNoWaitL" ); |
|
2696 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2697 // Print to log file |
|
2698 iLog->Log( KWhere ); |
|
2699 |
|
2700 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2701 |
|
2702 TInt temp(0); |
|
2703 |
|
2704 // Parameter video type |
|
2705 CIptvTestVideoCreator::TIptvTestVideoType videoType; |
|
2706 User::LeaveIfError( aItem.GetNextInt(temp) ); |
|
2707 videoType = static_cast<CIptvTestVideoCreator::TIptvTestVideoType>(temp); |
|
2708 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType); |
|
2709 |
|
2710 // Parameter drive letter |
|
2711 TPtrC driveLetter; |
|
2712 User::LeaveIfError(aItem.GetNextString(driveLetter)); |
|
2713 #ifdef __WINSCW__ |
|
2714 driveLetter.Set(_L("C")); |
|
2715 #endif |
|
2716 |
|
2717 // Parameter path and filename |
|
2718 TPtrC filename; |
|
2719 User::LeaveIfError(aItem.GetNextString(filename)); |
|
2720 if(filename.Length() < 64) |
|
2721 { |
|
2722 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: filename: %S", &filename); |
|
2723 } |
|
2724 |
|
2725 // Parameter video size |
|
2726 TInt size(-1); |
|
2727 if( aItem.GetNextInt( size ) != KErrNone ) |
|
2728 { |
|
2729 size = -1; |
|
2730 } |
|
2731 |
|
2732 size = size == 0 ? size -1 : size; |
|
2733 |
|
2734 // Parameter video count |
|
2735 TInt count(1); |
|
2736 if( aItem.GetNextInt( count ) != KErrNone || count <= 0 ) |
|
2737 { |
|
2738 count = 1; |
|
2739 } |
|
2740 |
|
2741 TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, EFalse ) ); |
|
2742 |
|
2743 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ---------->"); |
|
2744 return VCXMVTEST_ERR( err ); |
|
2745 } |
|
2746 |
|
2747 // ----------------------------------------------------------------------------- |
|
2748 // CIptvMyVideosApiTest::CreateVideoFileL |
|
2749 // ----------------------------------------------------------------------------- |
|
2750 // |
|
2751 void CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CIptvTestVideoCreator::TIptvTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync ) |
|
2752 { |
|
2753 HBufC* path = HBufC::NewL( 2048 ); |
|
2754 CleanupStack::PushL(path); |
|
2755 |
|
2756 // Make sure path exists and resolve path + filename |
|
2757 TInt pos = aFileName.LocateReverse('\\'); |
|
2758 // Folder is specified in the test case |
|
2759 if(pos != KErrNotFound) |
|
2760 { |
|
2761 path->Des().Copy( aDriveLetter ); |
|
2762 path->Des().Append( aFileName.Left( pos+1 ) ); |
|
2763 if( path->Des().Length() < 64 ) |
|
2764 { |
|
2765 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: path: %S", path); |
|
2766 } |
|
2767 BaflUtils::EnsurePathExistsL(iFs, path->Des()); |
|
2768 |
|
2769 path->Des().Copy( aDriveLetter ); |
|
2770 path->Des().Append( aFileName ); |
|
2771 } |
|
2772 // No folder specified. If drive is C use :\data\my videos, else :\my videos |
|
2773 else |
|
2774 { |
|
2775 path->Des().Copy( aDriveLetter ); |
|
2776 TInt driveNum(0); |
|
2777 RFs::CharToDrive( aDriveLetter[0], driveNum ); |
|
2778 if( driveNum == EDriveC ) |
|
2779 { |
|
2780 path->Des().Append( _L(":\\data\\my videos\\") ); |
|
2781 } |
|
2782 else |
|
2783 { |
|
2784 path->Des().Append( _L(":\\my videos\\") ); |
|
2785 } |
|
2786 |
|
2787 if( path->Des().Length() < 64 ) |
|
2788 { |
|
2789 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: path: %S", path); |
|
2790 } |
|
2791 |
|
2792 BaflUtils::EnsurePathExistsL( iFs, path->Des() ); |
|
2793 path->Des().Append( aFileName ); |
|
2794 } |
|
2795 |
|
2796 path->ReAllocL( path->Des().Length()+1 ); |
|
2797 |
|
2798 // Save path for later cleanup |
|
2799 HBufC* pathOnly = path->Des().Left( path->Des().LocateReverse('\\') + 1 ).AllocL(); |
|
2800 CleanupStack::PushL( pathOnly ); |
|
2801 TBool pathStoredAlready = EFalse; |
|
2802 for( TInt i = 0; i < iSideloadFolders.Count(); i++ ) |
|
2803 { |
|
2804 if( iSideloadFolders[i]->Des().Find( *pathOnly ) != KErrNotFound ) |
|
2805 { |
|
2806 pathStoredAlready = ETrue; |
|
2807 break; |
|
2808 } |
|
2809 } |
|
2810 if( !pathStoredAlready ) |
|
2811 { |
|
2812 CleanupStack::Pop( pathOnly ); |
|
2813 iSideloadFolders.Append( pathOnly ); |
|
2814 } |
|
2815 else |
|
2816 { |
|
2817 CleanupStack::PopAndDestroy( pathOnly ); |
|
2818 } |
|
2819 |
|
2820 // Create file(s) |
|
2821 TInt err( KErrNone ); |
|
2822 |
|
2823 iLastReceivedMessage = -1; |
|
2824 |
|
2825 if( aVideoCount == 1 ) |
|
2826 { |
|
2827 // Save the path for later use. |
|
2828 CleanupStack::Pop( path ); |
|
2829 iSideloadedFiles.Append( path ); |
|
2830 |
|
2831 // Create the video. |
|
2832 TRAP( err, iTestCommon->CreateVideoFileL( aType, *path, aSize ) ); |
|
2833 if(err != KErrNone) |
|
2834 { |
|
2835 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFileL returned error: %d:", err); |
|
2836 } |
|
2837 TRAP_IGNORE( iStats->ActionStartL( KSideloadVideoActionId, _L("Sideload video") ) ); |
|
2838 } |
|
2839 else |
|
2840 { |
|
2841 TRAP( err, iTestCommon->CreateVideoFilesL( aType, *path, aVideoCount, iSideloadedFiles ) ); |
|
2842 if(err != KErrNone) |
|
2843 { |
|
2844 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFilesL returned error: %d:", err); |
|
2845 } |
|
2846 for( TInt i = 0; i < aVideoCount; i++ ) |
|
2847 { |
|
2848 TRAP_IGNORE( iStats->ActionStartL( KSideloadVideoActionId, _L("Sideload video") ) ); |
|
2849 } |
|
2850 CleanupStack::PopAndDestroy( path ); |
|
2851 } |
|
2852 |
|
2853 if( iTester ) |
|
2854 { |
|
2855 // Wait until videos have been created and collection refreshed. |
|
2856 // Only if category is open. |
|
2857 if( aDoSync && iTester->GetCurrentLevel() == 3 ) |
|
2858 { |
|
2859 // Disable automatic refresh if adding multiple videos. |
|
2860 if( aVideoCount > 1 ) |
|
2861 { |
|
2862 iTester->SetAutomaticRefresh( EFalse ); |
|
2863 } |
|
2864 |
|
2865 // Wait for insertion events. |
|
2866 RArray<TInt> messages; |
|
2867 for( TInt i=0; i<aVideoCount; i++ ) |
|
2868 { |
|
2869 messages.Append( KVCXMYVideosTestMessageMpxItemInserted ); |
|
2870 } |
|
2871 // Only one video added, refresh is automatic. |
|
2872 if( aVideoCount <= 1 ) |
|
2873 { |
|
2874 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
2875 } |
|
2876 |
|
2877 TInt timeout = aVideoCount*5 + 60; |
|
2878 |
|
2879 WaitForMessagesL( ETrue, messages, timeout, ETrue ); |
|
2880 messages.Reset(); |
|
2881 |
|
2882 // Multiple videos added, refresh. |
|
2883 if( aVideoCount > 1 ) |
|
2884 { |
|
2885 iTester->RefreshContentsL(); |
|
2886 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
2887 CleanupClosePushL( messages ); |
|
2888 WaitForMessagesL( ETrue, messages, 60, ETrue ); |
|
2889 CleanupStack::PopAndDestroy( &messages ); |
|
2890 iTester->SetAutomaticRefresh( ETrue ); |
|
2891 } |
|
2892 } |
|
2893 } |
|
2894 } |
|
2895 |
|
2896 // ----------------------------------------------------------------------------- |
|
2897 // CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL |
|
2898 // Delete everything from sideloading folders. |
|
2899 // ----------------------------------------------------------------------------- |
|
2900 // |
|
2901 TInt CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL( CStifItemParser& aItem ) |
|
2902 { |
|
2903 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL ---------->"); |
|
2904 // Print to UI |
|
2905 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2906 _LIT( KWhere, "In EnsureDriveForVideosL" ); |
|
2907 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2908 // Print to log file |
|
2909 iLog->Log( KWhere ); |
|
2910 |
|
2911 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
2912 |
|
2913 // Parameter drive letter |
|
2914 TPtrC driveLetter; |
|
2915 User::LeaveIfError(aItem.GetNextString(driveLetter)); |
|
2916 |
|
2917 TInt drive(0); |
|
2918 if( driveLetter == _L("anydrive") ) |
|
2919 { |
|
2920 drive = -1; |
|
2921 } |
|
2922 else |
|
2923 { |
|
2924 User::LeaveIfError( iFs.CharToDrive( driveLetter[0], drive ) ); |
|
2925 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: drive: %S = %d", &driveLetter, drive ); |
|
2926 } |
|
2927 |
|
2928 TInt amount(0); |
|
2929 User::LeaveIfError( aItem.GetNextInt( amount ) ); |
|
2930 |
|
2931 TInt videoCount = iTester->GetVideoCountForDrive( drive ); |
|
2932 |
|
2933 TInt err( KErrNone ); |
|
2934 |
|
2935 if( videoCount < amount ) |
|
2936 { |
|
2937 VCXLOGLO2("CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL: drive has less than %d videos.", amount); |
|
2938 |
|
2939 // Parameter path and filename |
|
2940 TPtrC filename; |
|
2941 User::LeaveIfError(aItem.GetNextString(filename)); |
|
2942 if(filename.Length() < 64) |
|
2943 { |
|
2944 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: filename: %S", &filename); |
|
2945 } |
|
2946 |
|
2947 TInt createCount = amount - videoCount; |
|
2948 |
|
2949 TRAP( err, CreateVideoFileL( |
|
2950 CIptvTestVideoCreator::IptvTestVideoMpeg4, driveLetter, filename, -1, createCount, ETrue ) ); |
|
2951 } |
|
2952 else |
|
2953 if( videoCount > amount ) |
|
2954 { |
|
2955 VCXLOGLO2("CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL: drive has more than %d videos.", amount); |
|
2956 |
|
2957 TInt deleteCount = videoCount - amount; |
|
2958 |
|
2959 TRAP_IGNORE( iTester->EnsureMediaFilesAreNotInUseL() ); |
|
2960 TRAP( err, iTester->DeleteMediasL( drive, 0, deleteCount, EFalse ) ); |
|
2961 |
|
2962 if( err == KErrNone ) |
|
2963 { |
|
2964 // Wait for deletion to complete. |
|
2965 RArray<TInt> messages; |
|
2966 CleanupClosePushL( messages ); |
|
2967 messages.Append( KVCXMYVideosTestMessageDeleteResp ); |
|
2968 messages.Append( KVCXMYVideosTestMessageCommandComplete ); |
|
2969 messages.Append( KVCXMYVideosTestMessageDeleteStarted ); |
|
2970 |
|
2971 TInt timeout = deleteCount*5 + 60; |
|
2972 |
|
2973 TRAP_IGNORE( WaitForMessagesL( ETrue, messages, timeout, ETrue ) ); |
|
2974 CleanupStack::PopAndDestroy( &messages ); |
|
2975 } |
|
2976 } |
|
2977 else |
|
2978 { |
|
2979 VCXLOGLO2("CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL: drive already has %d videos.", amount); |
|
2980 } |
|
2981 |
|
2982 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL <----------"); |
|
2983 return VCXMVTEST_ERR( err ); |
|
2984 } |
|
2985 |
|
2986 // ----------------------------------------------------------------------------- |
|
2987 // CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL |
|
2988 // Delete everything from sideloading folders. |
|
2989 // ----------------------------------------------------------------------------- |
|
2990 // |
|
2991 TInt CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL( CStifItemParser& /*aItem*/ ) |
|
2992 { |
|
2993 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL ---------->"); |
|
2994 // Print to UI |
|
2995 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
2996 _LIT( KWhere, "In EmptySideloadFoldersL" ); |
|
2997 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
2998 // Print to log file |
|
2999 iLog->Log( KWhere ); |
|
3000 |
|
3001 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Sideloaded file count: %d", iSideloadedFiles.Count()); |
|
3002 |
|
3003 if( iSideloadedFiles.Count() <= 0 ) |
|
3004 { |
|
3005 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL <----------"); |
|
3006 return KErrNone; |
|
3007 } |
|
3008 |
|
3009 RPointerArray<HBufC> filesInUse; |
|
3010 CleanupResetAndDestroyPushL( filesInUse ); |
|
3011 |
|
3012 iLastReceivedMessage = -1; |
|
3013 |
|
3014 TInt i; |
|
3015 // Delete files |
|
3016 for(i=iSideloadedFiles.Count()-1; i>=0; i--) |
|
3017 { |
|
3018 HBufC16* path = iSideloadedFiles[i]; |
|
3019 CleanupStack::PushL( path ); |
|
3020 iSideloadedFiles.Remove( i ); |
|
3021 |
|
3022 TInt err = iFs.Delete( path->Des() ); |
|
3023 if( err == KErrInUse ) |
|
3024 { |
|
3025 CleanupStack::Pop( path ); |
|
3026 filesInUse.Append( path ); |
|
3027 } |
|
3028 else |
|
3029 { |
|
3030 CleanupStack::PopAndDestroy( path ); |
|
3031 if( err != KErrNone ) |
|
3032 { |
|
3033 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: delete error: %d", err); |
|
3034 } |
|
3035 } |
|
3036 } |
|
3037 |
|
3038 // Try again deleting files which were in use |
|
3039 for( i = filesInUse.Count()-1; i >= 0; i--) |
|
3040 { |
|
3041 HBufC16* path = filesInUse[i]; |
|
3042 CleanupStack::PushL( path ); |
|
3043 filesInUse.Remove( i ); |
|
3044 |
|
3045 // Delete file |
|
3046 iTestCommon->EnsureFileIsNotInUse( *path ); |
|
3047 TInt err = iFs.Delete( path->Des() ); |
|
3048 if( err != KErrNone ) |
|
3049 { |
|
3050 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: delete 2nd error: %d", err); |
|
3051 } |
|
3052 |
|
3053 CleanupStack::PopAndDestroy( path ); |
|
3054 } |
|
3055 |
|
3056 CleanupStack::PopAndDestroy( &filesInUse ); |
|
3057 |
|
3058 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL <----------"); |
|
3059 return KErrNone; |
|
3060 } |
|
3061 |
|
3062 // ----------------------------------------------------------------------------- |
|
3063 // CIptvMyVideosApiTest::SetDeleteSideloadedVideos |
|
3064 // ----------------------------------------------------------------------------- |
|
3065 // |
|
3066 TInt CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos( CStifItemParser& /* aItem */ ) |
|
3067 { |
|
3068 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos ---------->"); |
|
3069 iDeleteSideloadedFilesAndFolders = ETrue; |
|
3070 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos <----------"); |
|
3071 return KErrNone; |
|
3072 } |
|
3073 |
|
3074 // ----------------------------------------------------------------------------- |
|
3075 // CIptvMyVideosApiTest::DownloadL |
|
3076 // ----------------------------------------------------------------------------- |
|
3077 // |
|
3078 TInt CVCXMyVideosCollectionPluginTest::DownloadL( CStifItemParser& aItem ) |
|
3079 { |
|
3080 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadL ---------->"); |
|
3081 iLastReceivedMessage = -1; |
|
3082 TRAPD( err, DownloadOrResumeL( aItem, EFalse, EFalse ) ); |
|
3083 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadL <----------"); |
|
3084 return VCXMVTEST_ERR( err ); |
|
3085 } |
|
3086 |
|
3087 // ----------------------------------------------------------------------------- |
|
3088 // CIptvMyVideosApiTest::ResumeDownloadL |
|
3089 // ----------------------------------------------------------------------------- |
|
3090 // |
|
3091 TInt CVCXMyVideosCollectionPluginTest::ResumeDownloadL( CStifItemParser& aItem ) |
|
3092 { |
|
3093 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeDownloadL ---------->"); |
|
3094 iLastReceivedMessage = -1; |
|
3095 TRAPD( err, DownloadOrResumeL( aItem, EFalse, ETrue ) ); |
|
3096 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeDownloadL <----------"); |
|
3097 return VCXMVTEST_ERR( err ); |
|
3098 } |
|
3099 |
|
3100 // ----------------------------------------------------------------------------- |
|
3101 // CIptvMyVideosApiTest::ResumeAllDownloadsL |
|
3102 // ----------------------------------------------------------------------------- |
|
3103 // |
|
3104 TInt CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL( CStifItemParser& /* aItem */ ) |
|
3105 { |
|
3106 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL ---------->"); |
|
3107 // Print to UI |
|
3108 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3109 _LIT( KWhere, "In ResumeAllDownloadsL" ); |
|
3110 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3111 // Print to log file |
|
3112 iLog->Log( KWhere ); |
|
3113 |
|
3114 TRAPD( err, iTester->ResumeAllDownloadsL() ); |
|
3115 |
|
3116 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL <----------"); |
|
3117 return VCXMVTEST_ERR( err ); |
|
3118 } |
|
3119 |
|
3120 // ----------------------------------------------------------------------------- |
|
3121 // CIptvMyVideosApiTest::DownloadUsingMediaL |
|
3122 // ----------------------------------------------------------------------------- |
|
3123 // |
|
3124 TInt CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL( CStifItemParser& aItem ) |
|
3125 { |
|
3126 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL ---------->"); |
|
3127 |
|
3128 if( !iMpxMedia ) |
|
3129 { |
|
3130 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!"); |
|
3131 User::Leave( KErrArgument ); |
|
3132 } |
|
3133 |
|
3134 iLastReceivedMessage = -1; |
|
3135 |
|
3136 TRAPD( err, DownloadOrResumeL( aItem, ETrue, EFalse ) ); |
|
3137 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL <----------"); |
|
3138 return VCXMVTEST_ERR( err ); |
|
3139 } |
|
3140 |
|
3141 // ----------------------------------------------------------------------------- |
|
3142 // CIptvMyVideosApiTest::ResumeDownloadUsingMediaL |
|
3143 // ----------------------------------------------------------------------------- |
|
3144 // |
|
3145 TInt CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL( CStifItemParser& aItem ) |
|
3146 { |
|
3147 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL ---------->"); |
|
3148 |
|
3149 if( !iMpxMedia ) |
|
3150 { |
|
3151 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!"); |
|
3152 User::Leave( KErrArgument ); |
|
3153 } |
|
3154 |
|
3155 iLastReceivedMessage = -1; |
|
3156 |
|
3157 TRAPD( err, DownloadOrResumeL( aItem, ETrue, ETrue ) ); |
|
3158 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL <----------"); |
|
3159 return VCXMVTEST_ERR( err ); |
|
3160 } |
|
3161 |
|
3162 // ----------------------------------------------------------------------------- |
|
3163 // CIptvMyVideosApiTest::DownloadOrResumeL |
|
3164 // ----------------------------------------------------------------------------- |
|
3165 // |
|
3166 void CVCXMyVideosCollectionPluginTest::DownloadOrResumeL( CStifItemParser& aItem, TBool aUseCurrentMedia, TBool aResume ) |
|
3167 { |
|
3168 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadOrResumeL"); |
|
3169 // Print to UI |
|
3170 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3171 _LIT( KWhere, "In DownloadOrResumeL" ); |
|
3172 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3173 // Print to log file |
|
3174 iLog->Log( KWhere ); |
|
3175 |
|
3176 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
3177 |
|
3178 iLastReceivedMessage = -1; |
|
3179 |
|
3180 TUint32 iapId(0); |
|
3181 TPtrC iapName; |
|
3182 User::LeaveIfError( aItem.GetNextString( iapName ) ); |
|
3183 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapName: %S", &iapName); |
|
3184 |
|
3185 if( iapName == KVCXTestZeroIap ) |
|
3186 { |
|
3187 iapId = 0; |
|
3188 } |
|
3189 else |
|
3190 if( iapName == KVCXTestInvalidIap ) |
|
3191 { |
|
3192 iapId = 10001; |
|
3193 } |
|
3194 else |
|
3195 { |
|
3196 User::LeaveIfError( iTestCommon->GetIapIdL(iapName, iapId) ); |
|
3197 } |
|
3198 |
|
3199 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapId: %d", iapId); |
|
3200 |
|
3201 TPtrC serviceName; |
|
3202 User::LeaveIfError( aItem.GetNextString( serviceName ) ); |
|
3203 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName); |
|
3204 |
|
3205 TInt serviceId(0); |
|
3206 User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) ); |
|
3207 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId); |
|
3208 |
|
3209 TInt contentId(0); |
|
3210 User::LeaveIfError( aItem.GetNextInt( contentId ) ); |
|
3211 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId); |
|
3212 |
|
3213 TInt syncCallInt(0); |
|
3214 User::LeaveIfError( aItem.GetNextInt( syncCallInt ) ); |
|
3215 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt); |
|
3216 TBool syncCall = static_cast<TBool>(syncCallInt); |
|
3217 |
|
3218 TPtrC userName; |
|
3219 if( KErrNone == aItem.GetNextString( userName ) ) |
|
3220 { |
|
3221 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: userName: %S", &userName); |
|
3222 } |
|
3223 else |
|
3224 { |
|
3225 userName.Set( _L("") ); |
|
3226 } |
|
3227 |
|
3228 TPtrC password; |
|
3229 if( KErrNone == aItem.GetNextString( password ) ) |
|
3230 { |
|
3231 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: password: %S", &password); |
|
3232 } |
|
3233 else |
|
3234 { |
|
3235 password.Set( _L("") ); |
|
3236 } |
|
3237 |
|
3238 const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId ); |
|
3239 const TPtrC title = iServiceEmu->GetContentTitleL( serviceId, contentId ); |
|
3240 |
|
3241 TInt err(0); |
|
3242 if( !aUseCurrentMedia ) |
|
3243 { |
|
3244 if( !aResume ) |
|
3245 { |
|
3246 TRAP( err, iTester->StartDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, NULL ) ); |
|
3247 } |
|
3248 else |
|
3249 { |
|
3250 TRAP( err, iTester->ResumeDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, NULL ) ); |
|
3251 } |
|
3252 } |
|
3253 else |
|
3254 { |
|
3255 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: passing current media to MPX plugin."); |
|
3256 if( !aResume ) |
|
3257 { |
|
3258 TRAP( err, iTester->StartDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, iMpxMedia ) ); |
|
3259 } |
|
3260 else |
|
3261 { |
|
3262 TRAP( err, iTester->ResumeDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, iMpxMedia ) ); |
|
3263 } |
|
3264 } |
|
3265 |
|
3266 // Set autoresume on if there's only one paused download. |
|
3267 CVCXMyVideosTestDlWatcher* dlWatcher = iTester->GetDownloadWatcher(); |
|
3268 if( aResume && dlWatcher && !iAutoResume ) |
|
3269 { |
|
3270 TInt pausedDlCount = 0; |
|
3271 for( TInt i=0; i<dlWatcher->GetDownloadCount(); i++ ) |
|
3272 { |
|
3273 CVCXMyVideosTestDownload* dl = dlWatcher->GetDownloadByIndex( i ); |
|
3274 if( dl->iState == EVcxMyVideosDlStatePaused ) |
|
3275 { |
|
3276 pausedDlCount++; |
|
3277 } |
|
3278 } |
|
3279 if( pausedDlCount == 1 ) |
|
3280 { |
|
3281 iAutoResume = ETrue; |
|
3282 iTester->SetAutoResume( ETrue ); |
|
3283 } |
|
3284 } |
|
3285 |
|
3286 if( err != KErrNone ) |
|
3287 { |
|
3288 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
3289 User::Leave( err ); |
|
3290 } |
|
3291 |
|
3292 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadOrResumeL"); |
|
3293 } |
|
3294 |
|
3295 // ----------------------------------------------------------------------------- |
|
3296 // CIptvMyVideosApiTest::DownloadUrlL |
|
3297 // ----------------------------------------------------------------------------- |
|
3298 // |
|
3299 TInt CVCXMyVideosCollectionPluginTest::DownloadUrlL( CStifItemParser& aItem ) |
|
3300 { |
|
3301 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadUrlL ---------->"); |
|
3302 // Print to UI |
|
3303 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3304 _LIT( KWhere, "In DownloadUrlL" ); |
|
3305 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3306 // Print to log file |
|
3307 iLog->Log( KWhere ); |
|
3308 |
|
3309 iLastReceivedMessage = -1; |
|
3310 |
|
3311 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
3312 |
|
3313 TUint32 iapId(0); |
|
3314 TPtrC iapName; |
|
3315 User::LeaveIfError( aItem.GetNextString( iapName ) ); |
|
3316 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapName: %S", &iapName); |
|
3317 User::LeaveIfError( iTestCommon->GetIapIdL(iapName, iapId) ); |
|
3318 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapId: %d", iapId); |
|
3319 |
|
3320 TPtrC url; |
|
3321 User::LeaveIfError( aItem.GetNextString( url ) ); |
|
3322 |
|
3323 TInt syncCallInt(0); |
|
3324 User::LeaveIfError( aItem.GetNextInt( syncCallInt ) ); |
|
3325 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt); |
|
3326 TBool syncCall = static_cast<TBool>(syncCallInt); |
|
3327 |
|
3328 TPtrC userName; |
|
3329 if( KErrNone == aItem.GetNextString( userName ) ) |
|
3330 { |
|
3331 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: userName: %S", &userName); |
|
3332 } |
|
3333 else |
|
3334 { |
|
3335 userName.Set( _L("") ); |
|
3336 } |
|
3337 |
|
3338 TPtrC password; |
|
3339 if( KErrNone == aItem.GetNextString( password ) ) |
|
3340 { |
|
3341 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: password: %S", &password); |
|
3342 } |
|
3343 else |
|
3344 { |
|
3345 password.Set( _L("") ); |
|
3346 } |
|
3347 |
|
3348 if( url == KVCXTestZeroUrl) |
|
3349 { |
|
3350 url.Set( _L("" ) ); |
|
3351 } |
|
3352 |
|
3353 TInt err( KErrNone ); |
|
3354 |
|
3355 if( iTester ) |
|
3356 { |
|
3357 if( url == KVCXMYVideosTest2kURLTag ) |
|
3358 { |
|
3359 TRAP( err, iTester->StartDownloadL( _L("2kcharsurl"), iapId, 0, 0, KVCXMYVideosTest2kURL, syncCall, userName, password, NULL ) ); |
|
3360 } |
|
3361 else |
|
3362 if( url == KVCXMYVideosTest1kURLTag ) |
|
3363 { |
|
3364 TRAP( err, iTester->StartDownloadL( _L("1kcharsurl"), iapId, 0, 0, KVCXMYVideosTest1kURL, syncCall, userName, password, NULL ) ); |
|
3365 } |
|
3366 else |
|
3367 { |
|
3368 TRAP( err, iTester->StartDownloadL( _L("urldl"), iapId, 0, 0, url, syncCall, userName, password, NULL ) ); |
|
3369 } |
|
3370 } |
|
3371 |
|
3372 if( err != KErrNone ) |
|
3373 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
3374 |
|
3375 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadUrlL <----------"); |
|
3376 return VCXMVTEST_ERR( err ); |
|
3377 } |
|
3378 |
|
3379 // ----------------------------------------------------------------------------- |
|
3380 // CIptvMyVideosApiTest::CancelDownloadL |
|
3381 // ----------------------------------------------------------------------------- |
|
3382 // |
|
3383 TInt CVCXMyVideosCollectionPluginTest::CancelDownloadL( CStifItemParser& aItem ) |
|
3384 { |
|
3385 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDownloadL ---------->"); |
|
3386 // Print to UI |
|
3387 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3388 _LIT( KWhere, "In CancelDownloadL" ); |
|
3389 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3390 // Print to log file |
|
3391 iLog->Log( KWhere ); |
|
3392 |
|
3393 iLastReceivedMessage = -1; |
|
3394 |
|
3395 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
3396 |
|
3397 TPtrC serviceName; |
|
3398 User::LeaveIfError( aItem.GetNextString( serviceName ) ); |
|
3399 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName); |
|
3400 |
|
3401 TInt serviceId(0); |
|
3402 User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) ); |
|
3403 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId); |
|
3404 |
|
3405 TInt contentId(0); |
|
3406 User::LeaveIfError( aItem.GetNextInt( contentId ) ); |
|
3407 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId); |
|
3408 |
|
3409 TInt syncCallInt(0); |
|
3410 User::LeaveIfError( aItem.GetNextInt( syncCallInt ) ); |
|
3411 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt); |
|
3412 TBool syncCall = static_cast<TBool>(syncCallInt); |
|
3413 |
|
3414 const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId ); |
|
3415 |
|
3416 CVCXMyVideosTestDownload* dl = iTester->GetDownloadWatcher()->GetDownload( serviceId, contentId, url ); |
|
3417 |
|
3418 TInt err( KErrNotReady ); |
|
3419 if( !dl ) |
|
3420 { |
|
3421 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Could not find download with specified params!"); |
|
3422 } |
|
3423 else |
|
3424 if( iTester ) |
|
3425 { |
|
3426 TRAP( err, iTester->CancelDownloadL( dl, syncCall ) ); |
|
3427 } |
|
3428 |
|
3429 if( err != KErrNone ) |
|
3430 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
3431 |
|
3432 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDownloadL <----------"); |
|
3433 return VCXMVTEST_ERR( err ); |
|
3434 } |
|
3435 |
|
3436 // ----------------------------------------------------------------------------- |
|
3437 // CIptvMyVideosApiTest::CancelDownloadByIdL |
|
3438 // ----------------------------------------------------------------------------- |
|
3439 // |
|
3440 TInt CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL( CStifItemParser& aItem ) |
|
3441 { |
|
3442 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL ---------->"); |
|
3443 // Print to UI |
|
3444 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3445 _LIT( KWhere, "In CancelDownloadByIdL" ); |
|
3446 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3447 // Print to log file |
|
3448 iLog->Log( KWhere ); |
|
3449 |
|
3450 iLastReceivedMessage = -1; |
|
3451 |
|
3452 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
3453 |
|
3454 TInt mpxId(0); |
|
3455 User::LeaveIfError( aItem.GetNextInt( mpxId ) ); |
|
3456 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: mpxId: %d", mpxId); |
|
3457 |
|
3458 TInt downloadId(0); |
|
3459 User::LeaveIfError( aItem.GetNextInt( downloadId ) ); |
|
3460 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: downloadId: %d", downloadId); |
|
3461 |
|
3462 TInt syncCallInt(0); |
|
3463 User::LeaveIfError( aItem.GetNextInt( syncCallInt ) ); |
|
3464 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt); |
|
3465 TBool syncCall = static_cast<TBool>(syncCallInt); |
|
3466 |
|
3467 _LIT(KVCxTestEmptyString, "NULL"); |
|
3468 TPtrC downloadPath; |
|
3469 if( aItem.GetNextString( downloadPath ) != KErrNone ) |
|
3470 { |
|
3471 downloadPath.Set( KVCxTestEmptyString ); |
|
3472 } |
|
3473 |
|
3474 TInt err( KErrNotReady ); |
|
3475 if( iTester ) |
|
3476 { |
|
3477 TRAP( err, iTester->CancelDownloadL( mpxId, downloadId, downloadPath, syncCall ) ); |
|
3478 } |
|
3479 |
|
3480 if( err != KErrNone ) |
|
3481 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
3482 |
|
3483 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL <----------"); |
|
3484 return VCXMVTEST_ERR( err ); |
|
3485 } |
|
3486 |
|
3487 // ----------------------------------------------------------------------------- |
|
3488 // CIptvMyVideosApiTest::PauseDownloadL |
|
3489 // ----------------------------------------------------------------------------- |
|
3490 // |
|
3491 TInt CVCXMyVideosCollectionPluginTest::PauseDownloadL( CStifItemParser& aItem ) |
|
3492 { |
|
3493 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::PauseDownloadL ---------->"); |
|
3494 // Print to UI |
|
3495 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3496 _LIT( KWhere, "In PauseDownloadL" ); |
|
3497 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3498 // Print to log file |
|
3499 iLog->Log( KWhere ); |
|
3500 |
|
3501 iLastReceivedMessage = -1; |
|
3502 |
|
3503 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
3504 |
|
3505 TPtrC serviceName; |
|
3506 User::LeaveIfError( aItem.GetNextString( serviceName ) ); |
|
3507 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName); |
|
3508 |
|
3509 TInt serviceId(0); |
|
3510 User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) ); |
|
3511 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId); |
|
3512 |
|
3513 TInt contentId(0); |
|
3514 User::LeaveIfError( aItem.GetNextInt( contentId ) ); |
|
3515 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId); |
|
3516 |
|
3517 TInt syncCallInt(0); |
|
3518 User::LeaveIfError( aItem.GetNextInt( syncCallInt ) ); |
|
3519 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt); |
|
3520 TBool syncCall = static_cast<TBool>(syncCallInt); |
|
3521 |
|
3522 const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId ); |
|
3523 |
|
3524 TInt err( KErrNotReady ); |
|
3525 if( iTester ) |
|
3526 { |
|
3527 // Disable autoresume |
|
3528 iAutoResume = EFalse; |
|
3529 iTester->SetAutoResume( iAutoResume ); |
|
3530 |
|
3531 TRAP( err, iTester->PauseDownloadL( serviceId, contentId, url, syncCall ) ); |
|
3532 } |
|
3533 |
|
3534 if( err != KErrNone ) |
|
3535 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
3536 |
|
3537 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::PauseDownloadL <----------"); |
|
3538 return VCXMVTEST_ERR( err ); |
|
3539 } |
|
3540 |
|
3541 // ----------------------------------------------------------------------------- |
|
3542 // CIptvMyVideosApiTest::PauseDownloadByUrlL |
|
3543 // ----------------------------------------------------------------------------- |
|
3544 // |
|
3545 TInt CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL( CStifItemParser& aItem ) |
|
3546 { |
|
3547 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL ---------->"); |
|
3548 // Print to UI |
|
3549 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3550 _LIT( KWhere, "In PauseDownloadByUrlL" ); |
|
3551 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3552 // Print to log file |
|
3553 iLog->Log( KWhere ); |
|
3554 |
|
3555 iLastReceivedMessage = -1; |
|
3556 |
|
3557 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
3558 |
|
3559 TPtrC url; |
|
3560 User::LeaveIfError( aItem.GetNextString( url ) ); |
|
3561 |
|
3562 TInt err( KErrNotReady ); |
|
3563 if( iTester ) |
|
3564 { |
|
3565 // Disable autoresume |
|
3566 iAutoResume = EFalse; |
|
3567 iTester->SetAutoResume( iAutoResume ); |
|
3568 |
|
3569 TRAP( err, iTester->PauseDownloadL( url, EFalse ) ); |
|
3570 } |
|
3571 |
|
3572 if( err != KErrNone ) |
|
3573 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err); |
|
3574 |
|
3575 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::PauseDownloadL <----------"); |
|
3576 return VCXMVTEST_ERR( err ); |
|
3577 } |
|
3578 |
|
3579 // ----------------------------------------------------------------------------- |
|
3580 // CIptvMyVideosApiTest::CheckDownloadProgressL |
|
3581 // ----------------------------------------------------------------------------- |
|
3582 // |
|
3583 TInt CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL( CStifItemParser& aItem ) |
|
3584 { |
|
3585 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL ---------->"); |
|
3586 // Print to UI |
|
3587 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3588 _LIT( KWhere, "In CheckDownloadProgressL" ); |
|
3589 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3590 // Print to log file |
|
3591 iLog->Log( KWhere ); |
|
3592 |
|
3593 iLastReceivedMessage = -1; |
|
3594 |
|
3595 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
3596 |
|
3597 TPtrC serviceName; |
|
3598 User::LeaveIfError( aItem.GetNextString( serviceName ) ); |
|
3599 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName); |
|
3600 |
|
3601 TInt serviceId(0); |
|
3602 User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) ); |
|
3603 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId); |
|
3604 |
|
3605 TInt contentId(0); |
|
3606 User::LeaveIfError( aItem.GetNextInt( contentId ) ); |
|
3607 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId); |
|
3608 |
|
3609 TInt minimumProgress( 0 ); |
|
3610 User::LeaveIfError( aItem.GetNextInt( minimumProgress ) ); |
|
3611 |
|
3612 const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId ); |
|
3613 |
|
3614 CVCXMyVideosTestDlWatcher* dlWatcher = iTester->GetDownloadWatcher(); |
|
3615 |
|
3616 TInt err( KErrNotReady ); |
|
3617 |
|
3618 if( dlWatcher ) |
|
3619 { |
|
3620 CVCXMyVideosTestDownload* dl = dlWatcher->GetDownload( serviceId, contentId, url ); |
|
3621 |
|
3622 if( dl ) |
|
3623 { |
|
3624 if( dl->iProgress < minimumProgress ) |
|
3625 { |
|
3626 err = KErrCorrupt; |
|
3627 } |
|
3628 else |
|
3629 { |
|
3630 err = KErrNone; |
|
3631 } |
|
3632 } |
|
3633 } |
|
3634 |
|
3635 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL <----------"); |
|
3636 return VCXMVTEST_ERR( err ); |
|
3637 } |
|
3638 |
|
3639 // ----------------------------------------------------------------------------- |
|
3640 // CIptvMyVideosApiTest::WaitAllDownloadsL |
|
3641 // ----------------------------------------------------------------------------- |
|
3642 // |
|
3643 TInt CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL( CStifItemParser& aItem ) |
|
3644 { |
|
3645 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL ---------->"); |
|
3646 // Print to UI |
|
3647 _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" ); |
|
3648 _LIT( KWhere, "In WaitAllDownloadsL" ); |
|
3649 TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere ); |
|
3650 // Print to log file |
|
3651 iLog->Log( KWhere ); |
|
3652 |
|
3653 TInt err( KErrNone ); |
|
3654 |
|
3655 TInt minutes(0); |
|
3656 if( aItem.GetNextInt( minutes ) != KErrNone ) |
|
3657 { |
|
3658 minutes = 10; |
|
3659 } |
|
3660 iTimeoutTimer->After( KTimeoutMinute * minutes ); |
|
3661 |
|
3662 iWaitingForAllDownloads = ETrue; |
|
3663 |
|
3664 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL <----------"); |
|
3665 return VCXMVTEST_ERR( err ); |
|
3666 } |
|
3667 |
|
3668 // ----------------------------------------------------------------------------- |
|
3669 // CIptvMyVideosApiTest::WaitForMessageL |
|
3670 // ----------------------------------------------------------------------------- |
|
3671 // |
|
3672 TInt CVCXMyVideosCollectionPluginTest::WaitForMessageL( CStifItemParser& aItem ) |
|
3673 { |
|
3674 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForMessageL ---------->"); |
|
3675 |
|
3676 _LIT( KWhere, "In WaitForMessageL" ); |
|
3677 // Print to log file |
|
3678 iLog->Log( KWhere ); |
|
3679 |
|
3680 TInt message(0); |
|
3681 User::LeaveIfError( aItem.GetNextInt( message ) ); |
|
3682 |
|
3683 TInt timeout(0); |
|
3684 User::LeaveIfError( aItem.GetNextInt( timeout ) ); |
|
3685 |
|
3686 TInt count(0); |
|
3687 if( aItem.GetNextInt( count ) != KErrNone ) |
|
3688 { |
|
3689 count = 1; |
|
3690 } |
|
3691 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: count: %d", count); |
|
3692 |
|
3693 _LIT(KWhat,"MsgWait"); |
|
3694 _LIT(KDesc, "All: %d"); |
|
3695 TestModuleIf().Printf( 0, KWhat, KDesc, count ); |
|
3696 |
|
3697 RArray<TInt> messages; |
|
3698 |
|
3699 iWaitedTestMessages.Reset(); |
|
3700 for( TInt i=0; i<count; i++ ) |
|
3701 { |
|
3702 messages.Append( message ); |
|
3703 } |
|
3704 |
|
3705 TRAPD( err, WaitForMessagesL( EFalse, messages, timeout, ETrue ) ); |
|
3706 |
|
3707 messages.Reset(); |
|
3708 |
|
3709 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessageL <----------"); |
|
3710 return VCXMVTEST_ERR( err ); |
|
3711 } |
|
3712 |
|
3713 // ----------------------------------------------------------------------------- |
|
3714 // CIptvMyVideosApiTest::WaitForAnyMessageL |
|
3715 // ----------------------------------------------------------------------------- |
|
3716 // |
|
3717 TInt CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL( CStifItemParser& aItem ) |
|
3718 { |
|
3719 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL ---------->"); |
|
3720 // Print to UI |
|
3721 _LIT( KWhere, "In WaitForAnyMessageL" ); |
|
3722 // Print to log file |
|
3723 iLog->Log( KWhere ); |
|
3724 |
|
3725 TInt timeout(0); |
|
3726 User::LeaveIfError( aItem.GetNextInt( timeout ) ); |
|
3727 |
|
3728 RArray<TInt> messages; |
|
3729 |
|
3730 TInt message(0); |
|
3731 TInt error = KErrNone; |
|
3732 while( error == KErrNone ) |
|
3733 { |
|
3734 error = aItem.GetNextInt( message ); |
|
3735 if( error == KErrNone ) |
|
3736 { |
|
3737 messages.Append( message ); |
|
3738 } |
|
3739 } |
|
3740 |
|
3741 _LIT(KWhat,"MsgWait"); |
|
3742 _LIT(KDesc, "Any: %d"); |
|
3743 TestModuleIf().Printf( 0, KWhat, KDesc, messages.Count() ); |
|
3744 |
|
3745 if( error != KErrNone && error != KErrNotFound ) |
|
3746 { |
|
3747 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error reading parameters from script."); |
|
3748 } |
|
3749 else |
|
3750 { |
|
3751 TRAP( error, WaitForMessagesL( EFalse, messages, timeout, EFalse ) ); |
|
3752 } |
|
3753 |
|
3754 messages.Reset(); |
|
3755 |
|
3756 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL <----------"); |
|
3757 return VCXMVTEST_ERR( error ); |
|
3758 } |
|
3759 |
|
3760 // ----------------------------------------------------------------------------- |
|
3761 // CIptvMyVideosApiTest::WaitForMessagesL |
|
3762 // ----------------------------------------------------------------------------- |
|
3763 // |
|
3764 TInt CVCXMyVideosCollectionPluginTest::WaitForMessagesL( CStifItemParser& aItem ) |
|
3765 { |
|
3766 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForMessagesL ---------->"); |
|
3767 // Print to UI |
|
3768 _LIT( KWhere, "In WaitForMessagesL" ); |
|
3769 // Print to log file |
|
3770 iLog->Log( KWhere ); |
|
3771 |
|
3772 TInt timeout(0); |
|
3773 User::LeaveIfError( aItem.GetNextInt( timeout ) ); |
|
3774 |
|
3775 RArray<TInt> messages; |
|
3776 |
|
3777 TInt message(0); |
|
3778 TInt error = KErrNone; |
|
3779 while( error == KErrNone ) |
|
3780 { |
|
3781 error = aItem.GetNextInt( message ); |
|
3782 if( error == KErrNone ) |
|
3783 { |
|
3784 messages.Append( message ); |
|
3785 } |
|
3786 } |
|
3787 |
|
3788 _LIT(KWhat,"MsgWait"); |
|
3789 _LIT(KDesc, "All: %d"); |
|
3790 TestModuleIf().Printf( 0, KWhat, KDesc, messages.Count() ); |
|
3791 |
|
3792 if( error != KErrNone && error != KErrNotFound ) |
|
3793 { |
|
3794 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error reading parameters from script."); |
|
3795 } |
|
3796 else |
|
3797 { |
|
3798 TRAP( error, WaitForMessagesL( EFalse, messages, timeout, ETrue ) ); |
|
3799 } |
|
3800 |
|
3801 messages.Reset(); |
|
3802 |
|
3803 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessagesL <----------"); |
|
3804 return VCXMVTEST_ERR( error ); |
|
3805 } |
|
3806 |
|
3807 // ----------------------------------------------------------------------------- |
|
3808 // CIptvMyVideosApiTest::WaitForMessagesL |
|
3809 // ----------------------------------------------------------------------------- |
|
3810 // |
|
3811 void CVCXMyVideosCollectionPluginTest::WaitForMessagesL( TBool aBlock, RArray<TInt>& aMessages, TInt aTimeout, |
|
3812 TBool aWaitAll ) |
|
3813 { |
|
3814 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForMessagesL 2"); |
|
3815 if( aMessages.Count() <= 0 ) |
|
3816 { |
|
3817 User::Leave( KErrArgument ); |
|
3818 } |
|
3819 |
|
3820 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Timeout: %d seconds", aTimeout); |
|
3821 |
|
3822 iWaitingForAllMessages = aWaitAll; |
|
3823 |
|
3824 iMessageWaitTimeout = aTimeout; |
|
3825 iTimeoutTimer->After( aTimeout * KTimeoutSecond ); |
|
3826 |
|
3827 iWaitedTestMessages.Reset(); |
|
3828 |
|
3829 TBool messageReceivedAlready( EFalse ); |
|
3830 |
|
3831 for( TInt i=0; i<aMessages.Count(); i++ ) |
|
3832 { |
|
3833 TBuf<256> msgStr; |
|
3834 GetMessageDesc( aMessages[i], msgStr); |
|
3835 |
|
3836 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: MsgQueue: wait: %S (%d)", &msgStr, aMessages[i]); |
|
3837 |
|
3838 iWaitedTestMessages.Append( aMessages[i] ); |
|
3839 |
|
3840 if( aMessages[i] == iLastReceivedMessage ) |
|
3841 { |
|
3842 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Received this message already."); |
|
3843 iLastReceivedMessage = -1; |
|
3844 |
|
3845 HandleVcxMvTesterMessageL( aMessages[i], KErrNone ); |
|
3846 messageReceivedAlready = ETrue; |
|
3847 } |
|
3848 } |
|
3849 |
|
3850 if( aBlock && !messageReceivedAlready ) |
|
3851 { |
|
3852 iMessageWaitIsBlocking = ETrue; |
|
3853 iActiveWaitBlocking->Start(); |
|
3854 iMessageWaitIsBlocking = EFalse; |
|
3855 |
|
3856 // Only leave if it was blocking call. |
|
3857 TInt error( iEventError ); |
|
3858 iEventError = KErrNone; |
|
3859 User::LeaveIfError( error ); |
|
3860 } |
|
3861 |
|
3862 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessagesL 2"); |
|
3863 } |
|
3864 |
|
3865 // ----------------------------------------------------------------------------- |
|
3866 // CVCXMyVideosCollectionPluginTest::DeleteDirectoryIfEmpty() |
|
3867 // ----------------------------------------------------------------------------- |
|
3868 // |
|
3869 TInt CVCXMyVideosCollectionPluginTest::DeleteDirectoryIfEmpty( RFs& aFs, CFileMan& aFileMan, const TDesC& aDirectory ) |
|
3870 { |
|
3871 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteDirectoryIfEmpty"); |
|
3872 CDir* dirList = NULL; |
|
3873 |
|
3874 TInt result = aFs.GetDir( aDirectory, KEntryAttNormal | KEntryAttMatchMask, ESortByName, dirList ); |
|
3875 if( result != KErrNone ) VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: getdir result: %d", result ); |
|
3876 if( result == KErrNone && dirList->Count() == 0 ) |
|
3877 { |
|
3878 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: deleting folder: %S", &aDirectory ); |
|
3879 TInt err(KErrNone); |
|
3880 err = aFileMan.RmDir( aDirectory ); |
|
3881 if( err != KErrNone ) |
|
3882 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: delete error: %d", err ); |
|
3883 } |
|
3884 |
|
3885 delete dirList; |
|
3886 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteDirectoryIfEmpty"); |
|
3887 return KErrNone; |
|
3888 } |
|
3889 |
|
3890 // ----------------------------------------------------------------------------- |
|
3891 // CIptvMyVideosApiTest::MapMpxMediaAttribute |
|
3892 // ----------------------------------------------------------------------------- |
|
3893 // |
|
3894 TInt CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute( |
|
3895 TVcxTestMediaAttributeIdMapping aMapping, TMPXAttributeData& aAttribute, TVcxTestMediaAttributeType& aType ) |
|
3896 { |
|
3897 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute"); |
|
3898 |
|
3899 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: mapping id: %d", aMapping); |
|
3900 |
|
3901 aAttribute.iAttributeId = 0; |
|
3902 aAttribute.iContentId = 0; |
|
3903 |
|
3904 switch( aMapping ) |
|
3905 { |
|
3906 case EVcxTestMapping_KMPXMediaGeneralId: |
|
3907 { |
|
3908 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralId"); |
|
3909 aAttribute = KMPXMediaGeneralId; |
|
3910 aType = EVcxTestMediaAttributeTypeTMPXItemId; |
|
3911 } |
|
3912 break; |
|
3913 |
|
3914 case EVcxTestMapping_KMPXMediaGeneralTitle: |
|
3915 { |
|
3916 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralTitle"); |
|
3917 aAttribute = KMPXMediaGeneralTitle; |
|
3918 aType = EVcxTestMediaAttributeTypeString; |
|
3919 } |
|
3920 break; |
|
3921 |
|
3922 case EVcxTestMapping_KMPXMediaGeneralComment: |
|
3923 { |
|
3924 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralComment"); |
|
3925 aAttribute = KMPXMediaGeneralComment; |
|
3926 aType = EVcxTestMediaAttributeTypeString; |
|
3927 } |
|
3928 break; |
|
3929 |
|
3930 case EVcxTestMapping_KMPXMediaGeneralUri: |
|
3931 { |
|
3932 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralUri"); |
|
3933 aAttribute = KMPXMediaGeneralUri; |
|
3934 aType = EVcxTestMediaAttributeTypeString; |
|
3935 } |
|
3936 break; |
|
3937 |
|
3938 case EVcxTestMapping_KMPXMediaGeneralSize: |
|
3939 { |
|
3940 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralSize"); |
|
3941 aAttribute = KMPXMediaGeneralSize; |
|
3942 aType = EVcxTestMediaAttributeTypeTInt; |
|
3943 } |
|
3944 break; |
|
3945 |
|
3946 case EVcxTestMapping_KMPXMediaGeneralExtSizeInt64: |
|
3947 { |
|
3948 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralExtSizeInt64"); |
|
3949 aAttribute = KMPXMediaGeneralExtSizeInt64; |
|
3950 aType = EVcxTestMediaAttributeTypeTInt64; |
|
3951 } |
|
3952 break; |
|
3953 |
|
3954 case EVcxTestMapping_KMPXMediaGeneralDate: |
|
3955 { |
|
3956 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralDate"); |
|
3957 aAttribute = KMPXMediaGeneralDate; |
|
3958 aType = EVcxTestMediaAttributeTypeTInt64; |
|
3959 } |
|
3960 break; |
|
3961 |
|
3962 case EVcxTestMapping_KMPXMediaGeneralFlags: |
|
3963 { |
|
3964 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralFlags"); |
|
3965 aAttribute = KMPXMediaGeneralFlags; |
|
3966 aType = EVcxTestMediaAttributeTypeMvFlags; |
|
3967 } |
|
3968 break; |
|
3969 |
|
3970 case EVcxTestMapping_KMPXMediaGeneralCopyright: |
|
3971 { |
|
3972 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralCopyright"); |
|
3973 aAttribute = KMPXMediaGeneralCopyright; |
|
3974 aType = EVcxTestMediaAttributeTypeString; |
|
3975 } |
|
3976 break; |
|
3977 |
|
3978 case EVcxTestMapping_KMPXMediaGeneralMimeType: |
|
3979 { |
|
3980 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralMimeType"); |
|
3981 aAttribute = KMPXMediaGeneralMimeType; |
|
3982 aType = EVcxTestMediaAttributeTypeString; |
|
3983 } |
|
3984 break; |
|
3985 |
|
3986 case EVcxTestMapping_KVcxMediaMyVideosModifiedDate: |
|
3987 { |
|
3988 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosModifiedDate"); |
|
3989 aAttribute = KVcxMediaMyVideosModifiedDate; |
|
3990 aType = EVcxTestMediaAttributeTypeTInt64; |
|
3991 } |
|
3992 break; |
|
3993 |
|
3994 case EVcxTestMapping_KVcxMediaMyVideosModifiedDateCurrent: |
|
3995 { |
|
3996 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosModifiedDate"); |
|
3997 aAttribute = KVcxMediaMyVideosModifiedDate; |
|
3998 aType = EVcxTestMediaAttributeTypeTTime; |
|
3999 } |
|
4000 break; |
|
4001 |
|
4002 case EVcxTestMapping_KVcxMediaMyVideosAgeProfile: |
|
4003 { |
|
4004 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosAgeProfile"); |
|
4005 aAttribute = KVcxMediaMyVideosAgeProfile; |
|
4006 aType = EVcxTestMediaAttributeTypeTInt32; |
|
4007 } |
|
4008 break; |
|
4009 |
|
4010 case EVcxTestMapping_KVcxMediaMyVideosAudioLanguage: |
|
4011 { |
|
4012 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosAudioLanguage"); |
|
4013 aAttribute = KVcxMediaMyVideosAudioLanguage; |
|
4014 aType = EVcxTestMediaAttributeTypeString; |
|
4015 } |
|
4016 break; |
|
4017 |
|
4018 case EVcxTestMapping_KVcxMediaMyVideosAuthor: |
|
4019 { |
|
4020 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosAuthor"); |
|
4021 aAttribute = KVcxMediaMyVideosAuthor; |
|
4022 aType = EVcxTestMediaAttributeTypeString; |
|
4023 } |
|
4024 break; |
|
4025 |
|
4026 case EVcxTestMapping_KVcxMediaMyVideosOrigin: |
|
4027 { |
|
4028 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosOrigin"); |
|
4029 aAttribute = KVcxMediaMyVideosOrigin; |
|
4030 aType = EVcxTestMediaAttributeTypeTUint8; |
|
4031 } |
|
4032 break; |
|
4033 |
|
4034 case EVcxTestMapping_KVcxMediaMyVideosDuration: |
|
4035 { |
|
4036 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosDuration"); |
|
4037 aAttribute = KVcxMediaMyVideosDuration; |
|
4038 aType = EVcxTestMediaAttributeTypeTReal32; |
|
4039 } |
|
4040 break; |
|
4041 |
|
4042 case EVcxTestMapping_KMPXMediaGeneralLastPlaybackPosition: |
|
4043 { |
|
4044 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KMPXMediaGeneralLastPlaybackPosition"); |
|
4045 aAttribute = KMPXMediaGeneralLastPlaybackPosition; |
|
4046 aType = EVcxTestMediaAttributeTypeTInt; |
|
4047 } |
|
4048 break; |
|
4049 |
|
4050 case EVcxTestMapping_KVcxMediaMyVideosDownloadId: |
|
4051 { |
|
4052 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosDownloadId"); |
|
4053 aAttribute = KVcxMediaMyVideosDownloadId; |
|
4054 aType = EVcxTestMediaAttributeTypeTUint32; |
|
4055 } |
|
4056 break; |
|
4057 |
|
4058 case EVcxTestMapping_KVcxMediaMyVideosRemoteUrl: |
|
4059 { |
|
4060 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosRemoteUrl"); |
|
4061 aAttribute = KVcxMediaMyVideosRemoteUrl; |
|
4062 aType = EVcxTestMediaAttributeTypeString; |
|
4063 } |
|
4064 break; |
|
4065 |
|
4066 case EVcxTestMapping_KVcxMediaMyVideosDownloadState: |
|
4067 { |
|
4068 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosDownloadState"); |
|
4069 aAttribute = KVcxMediaMyVideosDownloadState; |
|
4070 aType = EVcxTestMediaAttributeTypeTUint8; |
|
4071 } |
|
4072 break; |
|
4073 |
|
4074 case EVcxTestMapping_KVcxMediaMyVideosIapId: |
|
4075 { |
|
4076 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosIapId"); |
|
4077 aAttribute = KVcxMediaMyVideosIapId; |
|
4078 aType = EVcxTestMediaAttributeTypeTUint32; |
|
4079 } |
|
4080 break; |
|
4081 |
|
4082 case EVcxTestMapping_KVcxMediaMyVideosUsername: |
|
4083 { |
|
4084 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosUsername"); |
|
4085 aAttribute = KVcxMediaMyVideosUsername; |
|
4086 aType = EVcxTestMediaAttributeTypeString; |
|
4087 } |
|
4088 break; |
|
4089 |
|
4090 case EVcxTestMapping_KVcxMediaMyVideosPassword: |
|
4091 { |
|
4092 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosPassword"); |
|
4093 aAttribute = KVcxMediaMyVideosPassword; |
|
4094 aType = EVcxTestMediaAttributeTypeString; |
|
4095 } |
|
4096 break; |
|
4097 |
|
4098 case EVcxTestMapping_KVcxMediaMyVideosCommandId: |
|
4099 { |
|
4100 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosCommandId"); |
|
4101 aAttribute = KVcxMediaMyVideosCommandId; |
|
4102 aType = EVcxTestMediaAttributeTypeTUint; |
|
4103 } |
|
4104 break; |
|
4105 |
|
4106 case EVcxTestMapping_KVcxMediaMyVideosDownloadProgress: |
|
4107 { |
|
4108 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosDownloadProgress"); |
|
4109 aAttribute = KVcxMediaMyVideosDownloadProgress; |
|
4110 aType = EVcxTestMediaAttributeTypeTInt8; |
|
4111 } |
|
4112 break; |
|
4113 |
|
4114 case EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount: |
|
4115 { |
|
4116 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosCategoryItemCount"); |
|
4117 aAttribute = KVcxMediaMyVideosCategoryItemCount; |
|
4118 aType = EVcxTestMediaAttributeTypeTUint32; |
|
4119 } |
|
4120 break; |
|
4121 |
|
4122 case EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount: |
|
4123 { |
|
4124 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosCategoryNewItemCount"); |
|
4125 aAttribute = KVcxMediaMyVideosCategoryNewItemCount; |
|
4126 aType = EVcxTestMediaAttributeTypeTUint32; |
|
4127 } |
|
4128 break; |
|
4129 |
|
4130 case EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName: |
|
4131 { |
|
4132 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosCategoryNewItemName"); |
|
4133 aAttribute = KVcxMediaMyVideosCategoryNewItemName; |
|
4134 aType = EVcxTestMediaAttributeTypeString; |
|
4135 } |
|
4136 break; |
|
4137 |
|
4138 case EVcxTestMapping_KVcxMediaMyVideosAudioFourCc: |
|
4139 { |
|
4140 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: KVcxMediaMyVideosCategoryNewItemName"); |
|
4141 aAttribute = KVcxMediaMyVideosAudioFourCc; |
|
4142 aType = EVcxTestMediaAttributeTypeTUint32; |
|
4143 } |
|
4144 break; |
|
4145 } |
|
4146 |
|
4147 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: iAttributeId: %d, iContentId: %d", aAttribute.iAttributeId == 0, aAttribute.iContentId); |
|
4148 |
|
4149 TInt err( KErrNone ); |
|
4150 if( aAttribute.iAttributeId == 0 && aAttribute.iContentId == 0 ) |
|
4151 { |
|
4152 err = KErrNotFound; |
|
4153 } |
|
4154 |
|
4155 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute"); |
|
4156 return VCXMVTEST_ERR( err ); |
|
4157 } |
|
4158 |
|
4159 // ----------------------------------------------------------------------------- |
|
4160 // CIptvMyVideosApiTest::GetMessageDesc |
|
4161 // ----------------------------------------------------------------------------- |
|
4162 // |
|
4163 void CVCXMyVideosCollectionPluginTest::GetMessageDesc( TInt aMessage, TDes& aMsgBuff ) |
|
4164 { |
|
4165 switch( aMessage ) |
|
4166 { |
|
4167 case KVCXMYVideosTestMessageNotAccepted: |
|
4168 { |
|
4169 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageNotAccepted") ); |
|
4170 } |
|
4171 break; |
|
4172 |
|
4173 case KVCXMYVideosTestMessageDlSucceeded: |
|
4174 { |
|
4175 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDlSucceeded") ); |
|
4176 } |
|
4177 break; |
|
4178 case KVCXMYVideosTestMessageDlFailed: |
|
4179 { |
|
4180 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDlFailed") ); |
|
4181 } |
|
4182 break; |
|
4183 case KVCXMYVideosTestMessageDlPaused: |
|
4184 { |
|
4185 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDlPaused") ); |
|
4186 } |
|
4187 break; |
|
4188 case KVCXMYVideosTestMessageDlGeneral: |
|
4189 { |
|
4190 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDlGeneral") ); |
|
4191 } |
|
4192 break; |
|
4193 case KVCXMYVideosTestMessageDlRunning: |
|
4194 { |
|
4195 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDlRunning") ); |
|
4196 } |
|
4197 break; |
|
4198 case KVCXMYVideosTestMessageDlCanceled: |
|
4199 { |
|
4200 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDlCanceled") ); |
|
4201 } |
|
4202 break; |
|
4203 case KVCXMYVideosTestMessageDlProgressed: |
|
4204 { |
|
4205 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDlProgressed") ); |
|
4206 } |
|
4207 break; |
|
4208 case KVCXMYVideosTestMessageCollectionMessageError: |
|
4209 { |
|
4210 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionMessageError") ); |
|
4211 } |
|
4212 break; |
|
4213 case KVCXMYVideosTestMessageCollectionOpened: |
|
4214 { |
|
4215 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionOpened") ); |
|
4216 } |
|
4217 break; |
|
4218 case KVCXMYVideosTestMessagePlaylistOpened: |
|
4219 { |
|
4220 aMsgBuff.Copy( _L("KVCXMYVideosTestMessagePlaylistOpened") ); |
|
4221 } |
|
4222 break; |
|
4223 case KVCXMYVideosTestMessageCollectionMedia: |
|
4224 { |
|
4225 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionMedia") ); |
|
4226 } |
|
4227 break; |
|
4228 case KVCXMYVideosTestMessageCommandComplete: |
|
4229 { |
|
4230 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCommandComplete") ); |
|
4231 } |
|
4232 break; |
|
4233 case KVCXMYVideosTestMessageGotMediasByKMpxId: |
|
4234 { |
|
4235 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageGotMediasByKMpxId") ); |
|
4236 } |
|
4237 break; |
|
4238 case KVCXMYVideosTestMessageMoveResp: |
|
4239 { |
|
4240 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMoveResp") ); |
|
4241 } |
|
4242 break; |
|
4243 case KVCXMYVideosTestMessageCopyResp: |
|
4244 { |
|
4245 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCopyResp") ); |
|
4246 } |
|
4247 break; |
|
4248 case KVCXMYVideosTestMessageCopyOrMoveStarted: |
|
4249 { |
|
4250 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCopyOrMoveStarted") ); |
|
4251 } |
|
4252 break; |
|
4253 case KVCXMYVideosTestMessageDeleteStarted: |
|
4254 { |
|
4255 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDeleteStarted") ); |
|
4256 } |
|
4257 break; |
|
4258 case KVCXMYVideosTestMessageDeleteResp: |
|
4259 { |
|
4260 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageDeleteResp") ); |
|
4261 } |
|
4262 break; |
|
4263 case KVCXMYVideosTestMessageCommandCanceled: |
|
4264 { |
|
4265 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCommandCanceled") ); |
|
4266 } |
|
4267 break; |
|
4268 case KVCXMYVideosTestMessageCollectionGeneral: |
|
4269 { |
|
4270 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionGeneral") ); |
|
4271 } |
|
4272 break; |
|
4273 case KVCXMYVideosTestMessageCollectionItemChanged: |
|
4274 { |
|
4275 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionItemChanged") ); |
|
4276 } |
|
4277 break; |
|
4278 case KVCXMYVideosTestMessageCollectionCategoryChanged: |
|
4279 { |
|
4280 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionCategoryChanged") ); |
|
4281 } |
|
4282 break; |
|
4283 case KVCXMYVideosTestMessageMpxItemInserted: |
|
4284 { |
|
4285 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemInserted") ); |
|
4286 } |
|
4287 break; |
|
4288 case KVCXMYVideosTestMessageMpxItemDeleted: |
|
4289 { |
|
4290 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemDeleted") ); |
|
4291 } |
|
4292 break; |
|
4293 case KVCXMYVideosTestMessageMpxItemModified: |
|
4294 { |
|
4295 aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemModified") ); |
|
4296 } |
|
4297 break; |
|
4298 case KVCXMyVideosTestMessageVideoListOrderChanged: |
|
4299 { |
|
4300 aMsgBuff.Copy( _L("KVCXMyVideosTestMessageVideoListOrderChanged") ); |
|
4301 } |
|
4302 break; |
|
4303 case KVCXMYVideosTestErrorDownloadNotFound: |
|
4304 { |
|
4305 aMsgBuff.Copy( _L("KVCXMYVideosTestErrorDownloadNotFound") ); |
|
4306 } |
|
4307 break; |
|
4308 case KVCXMYVideosTestErrorFileNotFound: |
|
4309 { |
|
4310 aMsgBuff.Copy( _L("KVCXMYVideosTestErrorFileNotFound") ); |
|
4311 } |
|
4312 break; |
|
4313 |
|
4314 default: |
|
4315 { |
|
4316 aMsgBuff.Copy( _L("") ); |
|
4317 } |
|
4318 break; |
|
4319 |
|
4320 } |
|
4321 } |
|
4322 |
|
4323 // ----------------------------------------------------------------------------- |
|
4324 // CIptvMyVideosApiTest::CheckMediasL |
|
4325 // ----------------------------------------------------------------------------- |
|
4326 // |
|
4327 void CVCXMyVideosCollectionPluginTest::CheckMediasL( TInt aExpectedVideoCount, TInt aDrive, TInt aCheckType ) |
|
4328 { |
|
4329 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediasL"); |
|
4330 |
|
4331 TInt actualVideoCount(0); |
|
4332 |
|
4333 // File check |
|
4334 TInt videoCount = iTester->GetMediaCount(); |
|
4335 |
|
4336 // attribute check that they are in allowed values |
|
4337 |
|
4338 for( TInt i = videoCount-1; i >= 0; i-- ) |
|
4339 { |
|
4340 CMPXMedia* media = iTester->GetMediaL( -1, i ); |
|
4341 |
|
4342 if( media->IsSupported( KMPXMediaGeneralUri ) ) |
|
4343 { |
|
4344 TMPXItemId itemId = *( media->Value<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
4345 |
|
4346 const TDesC& localFilePath = media->ValueText( KMPXMediaGeneralUri ); |
|
4347 |
|
4348 // Drive specified |
|
4349 if( aDrive != -1 ) |
|
4350 { |
|
4351 TInt drive(0); |
|
4352 User::LeaveIfError( iFs.CharToDrive( localFilePath[0], drive ) ); |
|
4353 // Don't count/check this file. |
|
4354 if( drive != aDrive ) |
|
4355 { |
|
4356 continue; |
|
4357 } |
|
4358 } |
|
4359 |
|
4360 actualVideoCount++; |
|
4361 |
|
4362 TInt state = -1; |
|
4363 if( media->IsSupported( KVcxMediaMyVideosDownloadState ) ) |
|
4364 { |
|
4365 state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState ); |
|
4366 } |
|
4367 |
|
4368 TUint32 downloadId = 0; |
|
4369 if( media->IsSupported( KVcxMediaMyVideosDownloadId ) ) |
|
4370 { |
|
4371 downloadId = media->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId ); |
|
4372 } |
|
4373 |
|
4374 // No file check for ongoing downloads |
|
4375 if( !iFileCheckDisabled && ( downloadId == 0 || state == EVcxMyVideosDlStateDownloaded ) ) |
|
4376 { |
|
4377 if( !iFs.IsValidName( localFilePath ) ) |
|
4378 { |
|
4379 VCXLOGLO1("CVCXMyVideosCollectionPluginTest: ERROR. File path is not valid."); |
|
4380 VCXLOGLO2("Local file path: %S", &localFilePath); |
|
4381 User::Leave( KErrCorrupt ); |
|
4382 } |
|
4383 |
|
4384 if( !BaflUtils::FileExists( iFs, localFilePath ) ) |
|
4385 { |
|
4386 VCXLOGLO2("CVCXMyVideosCollectionPluginTest: ERROR. File doesn't exist! Mpx id: %d", itemId.iId1); |
|
4387 VCXLOGLO2("Local file path: %S", &localFilePath); |
|
4388 User::Leave( KErrGeneral ); |
|
4389 } |
|
4390 |
|
4391 for( TInt e = videoCount-1; e >= 0; e-- ) |
|
4392 { |
|
4393 CMPXMedia* media2 = iTester->GetMediaL( -1, e ); |
|
4394 TMPXItemId itemId2 = *( media2->Value<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
4395 if( media2->IsSupported( KMPXMediaGeneralUri ) ) |
|
4396 { |
|
4397 const TDesC& localFilePath2 = media2->ValueText( KMPXMediaGeneralUri ); |
|
4398 |
|
4399 TCollationMethod cm = *Mem::CollationMethodByIndex( 0 ); |
|
4400 cm.iFlags |= TCollationMethod::EFoldCase; |
|
4401 |
|
4402 if( localFilePath.CompareC( localFilePath2, 0, &cm ) == KErrNone && itemId.iId1 != itemId2.iId1 ) |
|
4403 { |
|
4404 VCXLOGLO3("CVCXMyVideosCollectionPluginTest: ERROR. 2 items with same path! Mpx id: %d & id: %d", itemId.iId1, itemId2.iId1); |
|
4405 User::Leave( KErrGeneral ); |
|
4406 } |
|
4407 } |
|
4408 } |
|
4409 } |
|
4410 } |
|
4411 } |
|
4412 |
|
4413 _LIT(KWhat,"CountCheck"); |
|
4414 _LIT(KDesc, "%d/%d"); |
|
4415 TestModuleIf().Printf( 0, KWhat, KDesc, actualVideoCount, aExpectedVideoCount); |
|
4416 |
|
4417 VCXLOGLO2("CVCXMyVideosCollectionPluginTest: Actual count: %d", actualVideoCount ); |
|
4418 |
|
4419 if( aCheckType < 0 ) |
|
4420 { |
|
4421 VCXLOGLO2("CVCXMyVideosCollectionPluginTest: Minimum count: %d", aExpectedVideoCount ); |
|
4422 |
|
4423 if ( actualVideoCount < aExpectedVideoCount ) |
|
4424 { |
|
4425 User::Leave( KErrGeneral ); |
|
4426 } |
|
4427 } |
|
4428 else |
|
4429 if( aCheckType > 0 ) |
|
4430 { |
|
4431 VCXLOGLO2("CVCXMyVideosCollectionPluginTest: Maximum count: %d", aExpectedVideoCount ); |
|
4432 |
|
4433 if ( actualVideoCount > aExpectedVideoCount ) |
|
4434 { |
|
4435 User::Leave( KErrGeneral ); |
|
4436 } |
|
4437 } |
|
4438 else |
|
4439 { |
|
4440 VCXLOGLO2("CVCXMyVideosCollectionPluginTest: Expected count: %d", aExpectedVideoCount ); |
|
4441 |
|
4442 if ( aExpectedVideoCount + iAddMediaCmdCount != actualVideoCount ) |
|
4443 { |
|
4444 User::Leave( KErrGeneral ); |
|
4445 } |
|
4446 } |
|
4447 |
|
4448 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediasL"); |
|
4449 } |
|
4450 |
|
4451 // ----------------------------------------------------------------------------- |
|
4452 // CIptvMyVideosApiTest::GetDriveParam |
|
4453 // ----------------------------------------------------------------------------- |
|
4454 // |
|
4455 TInt CVCXMyVideosCollectionPluginTest::GetDriveParam( CStifItemParser& aItem, TInt& aDrive ) |
|
4456 { |
|
4457 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
4458 |
|
4459 TPtrC driveLetter; |
|
4460 TInt err = aItem.GetNextString( driveLetter ); |
|
4461 if( err == KErrNone ) |
|
4462 { |
|
4463 if( driveLetter == _L("anydrive") ) |
|
4464 { |
|
4465 aDrive = -1; |
|
4466 } |
|
4467 else |
|
4468 { |
|
4469 err = iFs.CharToDrive( driveLetter[0], aDrive ); |
|
4470 VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: drive: %S = %d", &driveLetter, aDrive ); |
|
4471 } |
|
4472 } |
|
4473 |
|
4474 return VCXMVTEST_ERR( err ); |
|
4475 } |
|
4476 |
|
4477 // ----------------------------------------------------------------------------- |
|
4478 // CIptvMyVideosApiTest::DoTotalRefreshL |
|
4479 // ----------------------------------------------------------------------------- |
|
4480 // |
|
4481 void CVCXMyVideosCollectionPluginTest::DoTotalRefreshL() |
|
4482 { |
|
4483 if( iTester && iTester->GetCurrentLevel() == 3 ) |
|
4484 { |
|
4485 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Close & Open ------>"); |
|
4486 |
|
4487 TInt currentOpenLevelIndex = iTester->GetCurrentOpenLevelIndex(); |
|
4488 |
|
4489 // Close current level |
|
4490 TRAPD( err, iTester->CloseLevelL() ); |
|
4491 if( err == KErrNone ) |
|
4492 { |
|
4493 WaitForRefreshL( ETrue ); |
|
4494 } |
|
4495 |
|
4496 // Open it again |
|
4497 TRAP( err, iTester->OpenLevelL( currentOpenLevelIndex ) ); |
|
4498 if( err == KErrNone ) |
|
4499 { |
|
4500 WaitForRefreshL( ETrue ); |
|
4501 } |
|
4502 |
|
4503 |
|
4504 // And refresh |
|
4505 TRAP( err, iTester->RefreshContentsL() ); |
|
4506 if( err == KErrNone ) |
|
4507 { |
|
4508 WaitForRefreshL( ETrue ); |
|
4509 } |
|
4510 } |
|
4511 } |
|
4512 |
|
4513 // ----------------------------------------------------------------------------- |
|
4514 // CIptvMyVideosApiTest::WaitForRefreshL |
|
4515 // ----------------------------------------------------------------------------- |
|
4516 // |
|
4517 void CVCXMyVideosCollectionPluginTest::WaitForRefreshL( TBool aForcedWait ) |
|
4518 { |
|
4519 if( iTester && ( iTester->IsRefreshing() || aForcedWait ) ) |
|
4520 { |
|
4521 RArray<TInt> messages; |
|
4522 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
4523 CleanupClosePushL( messages ); |
|
4524 WaitForMessagesL( ETrue, messages, 10, ETrue ); |
|
4525 CleanupStack::PopAndDestroy( &messages ); |
|
4526 } |
|
4527 } |
|
4528 |
|
4529 // ----------------------------------------------------------------------------- |
|
4530 // CIptvMyVideosApiTest::GetMediasForLevelL |
|
4531 // ----------------------------------------------------------------------------- |
|
4532 // |
|
4533 CMPXMediaArray* CVCXMyVideosCollectionPluginTest::GetMediasForLevelL( TInt aLevel, TUint aFlagsFilter ) |
|
4534 { |
|
4535 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::GetMediasForLevelL ---------->"); |
|
4536 |
|
4537 iLastReceivedMessage = -1; |
|
4538 |
|
4539 TInt prevCurrentLevel = iTester->GetCurrentLevel(); |
|
4540 TInt prevOpenLevelIndex = iTester->GetCurrentOpenLevelIndex(); |
|
4541 |
|
4542 TInt error( KErrNotReady ); |
|
4543 |
|
4544 TBool wrongLevelOpen = ( prevCurrentLevel == 3 && prevOpenLevelIndex != aLevel ); |
|
4545 TBool levelNotOpen = ( prevCurrentLevel >= 2 ); |
|
4546 |
|
4547 if( wrongLevelOpen || levelNotOpen ) |
|
4548 { |
|
4549 RArray<TInt> messages; |
|
4550 CleanupClosePushL( messages ); |
|
4551 if( !levelNotOpen ) |
|
4552 { |
|
4553 // Close current level. |
|
4554 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
4555 TRAP( error, iTester->CloseLevelL() ); |
|
4556 if( error == KErrNone ) |
|
4557 { |
|
4558 WaitForMessagesL( ETrue, messages, 10, ETrue ); |
|
4559 } |
|
4560 messages.Reset(); |
|
4561 } |
|
4562 |
|
4563 // Open the wanted level. |
|
4564 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
4565 TRAP( error, iTester->OpenLevelL( aLevel ) ); |
|
4566 if( error == KErrNone ) |
|
4567 { |
|
4568 WaitForMessagesL( ETrue, messages, 30, ETrue ); |
|
4569 } |
|
4570 |
|
4571 CleanupStack::PopAndDestroy( &messages ); |
|
4572 } |
|
4573 |
|
4574 // Get the medias. |
|
4575 const CMPXMediaArray* collectionMediaArray = iTester->GetAllCollectionMedia(); |
|
4576 |
|
4577 CMPXMediaArray* medias = CMPXMediaArray::NewL(); |
|
4578 |
|
4579 for( TInt i = 0; i < collectionMediaArray->Count(); i++ ) |
|
4580 { |
|
4581 CMPXMedia* media = (*collectionMediaArray)[i]; |
|
4582 // Default flags is none if item does not have the detail. |
|
4583 TInt flags( 0 ); |
|
4584 if( media->IsSupported( KMPXMediaGeneralFlags ) ) |
|
4585 { |
|
4586 flags = *media->Value<TUint>( KMPXMediaGeneralFlags ); |
|
4587 } |
|
4588 // No flags specified or it matches with medias flags |
|
4589 TBool fagsMatch = static_cast<TBool>( flags & aFlagsFilter ); |
|
4590 if( !aFlagsFilter || fagsMatch ) |
|
4591 { |
|
4592 if( media->IsSupported( KMPXMediaGeneralTitle ) ) |
|
4593 { |
|
4594 const TDesC& title = media->ValueText( KMPXMediaGeneralTitle ); |
|
4595 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Adding media: %S", &title); |
|
4596 } |
|
4597 |
|
4598 medias->AppendL( *media ); |
|
4599 } |
|
4600 } |
|
4601 |
|
4602 if( levelNotOpen || wrongLevelOpen ) |
|
4603 { |
|
4604 // Close current level. |
|
4605 TRAP( error, iTester->CloseLevelL() ); |
|
4606 if( error == KErrNone ) |
|
4607 { |
|
4608 RArray<TInt> messages; |
|
4609 CleanupClosePushL( messages ); |
|
4610 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
4611 WaitForMessagesL( ETrue, messages, 10, ETrue ); |
|
4612 CleanupStack::PopAndDestroy( &messages ); |
|
4613 } |
|
4614 |
|
4615 // Open the previous level. |
|
4616 if( wrongLevelOpen ) |
|
4617 { |
|
4618 TRAP( error, iTester->OpenLevelL( prevOpenLevelIndex ) ); |
|
4619 if( error == KErrNone ) |
|
4620 { |
|
4621 RArray<TInt> messages; |
|
4622 CleanupClosePushL( messages ); |
|
4623 messages.Append( KVCXMYVideosTestMessageCollectionOpened ); |
|
4624 WaitForMessagesL( ETrue, messages, 30, ETrue ); |
|
4625 CleanupStack::PopAndDestroy( &messages ); |
|
4626 } |
|
4627 } |
|
4628 } |
|
4629 |
|
4630 User::LeaveIfError( error ); |
|
4631 |
|
4632 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediasForLevelL <----------"); |
|
4633 return medias; |
|
4634 } |
|
4635 |
|
4636 // ----------------------------------------------------------------------------- |
|
4637 // CIptvMyVideosApiTest::HandleVcxMvTesterMessageL |
|
4638 // ----------------------------------------------------------------------------- |
|
4639 // |
|
4640 void CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL( TInt aMessage, TInt aError ) |
|
4641 { |
|
4642 VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL"); |
|
4643 |
|
4644 TBuf<256> msgStr; |
|
4645 GetMessageDesc( aMessage, msgStr); |
|
4646 |
|
4647 iLastReceivedMessage = aMessage; |
|
4648 |
|
4649 VCXLOGLO4("CVCXMyVideosCollectionPluginTest:: MsgQueue: received: %S (%d), aError: %d", &msgStr, aMessage, aError); |
|
4650 |
|
4651 // Tester requires to abort test run. |
|
4652 if( aMessage == KVCXMYVideosTestMessageCollectionGeneral && aError == KErrAbort ) |
|
4653 { |
|
4654 iEventError = aError; |
|
4655 Signal( aError ); |
|
4656 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL"); |
|
4657 return; |
|
4658 } |
|
4659 |
|
4660 // Print info about video count to STIF UI. |
|
4661 if( aMessage == KVCXMYVideosTestMessageCollectionOpened || |
|
4662 aMessage == KVCXMYVideosTestMessageListComplete || |
|
4663 aMessage == KVCXMYVideosTestMessageCollectionOpened || |
|
4664 aMessage == KVCXMYVideosTestMessageGotMediasByKMpxId ) |
|
4665 { |
|
4666 _LIT(KWhat, "VidCount"); |
|
4667 _LIT(KDesc, "%d"); |
|
4668 TInt videoCount = iTester->GetMediaCount(); |
|
4669 TestModuleIf().Printf( 0, KWhat, KDesc, videoCount ); |
|
4670 } |
|
4671 |
|
4672 |
|
4673 // Waiting for messages from mpx plugin to stop. |
|
4674 if( iCoolDownWait ) |
|
4675 { |
|
4676 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: MsgQueue: Cooling down."); |
|
4677 iCoolDownTimer->After( KTimeoutSecond * 5 ); |
|
4678 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL"); |
|
4679 return; |
|
4680 } |
|
4681 |
|
4682 if( aMessage == KVCXMYVideosTestMessageDlSucceeded || |
|
4683 aMessage == KVCXMYVideosTestMessageDlFailed || |
|
4684 aMessage == KVCXMYVideosTestMessageDlPaused || |
|
4685 aMessage == KVCXMYVideosTestMessageDlGeneral || |
|
4686 aMessage == KVCXMYVideosTestErrorDownloadNotFound ) |
|
4687 { |
|
4688 TInt activeDownloads = iTester->GetActiveDownloadCountL(); |
|
4689 TInt downloads = iTester->GetDownloadWatcher()->GetDownloadCount(); |
|
4690 _LIT(KWhat, "Downloads"); |
|
4691 _LIT(KDesc, "%d/%d"); |
|
4692 TestModuleIf().Printf( 0, KWhat, KDesc, activeDownloads, downloads ); |
|
4693 |
|
4694 if( aError != KErrNone ) |
|
4695 { |
|
4696 iLastDownloadError = aError; |
|
4697 } |
|
4698 } |
|
4699 |
|
4700 // Inform script of paused download when auto resume is off. |
|
4701 if( !iWaitingForAllDownloads && aMessage == KVCXMYVideosTestMessageDlPaused && !iAutoResume ) |
|
4702 { |
|
4703 // Add message to waited list and continue processing, check for signaling is done later. |
|
4704 iWaitedTestMessages.Reset(); |
|
4705 iWaitedTestMessages.AppendL( aMessage ); |
|
4706 } |
|
4707 |
|
4708 // Waiting for all downloads to complete. Check downloads and signal if needed. |
|
4709 if( iWaitingForAllDownloads ) |
|
4710 { |
|
4711 TInt activeDownloads = iTester->GetActiveDownloadCountL(); |
|
4712 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Ongoing download count: %d", activeDownloads); |
|
4713 |
|
4714 if( activeDownloads <= 0 ) |
|
4715 { |
|
4716 iTimeoutTimer->CancelTimer(); |
|
4717 iWaitingForAllDownloads = EFalse; |
|
4718 |
|
4719 TInt downloadCount = iTester->GetDownloadWatcher()->GetDownloadCount(); |
|
4720 TInt maxFailsToSucceed = downloadCount / 3; |
|
4721 TInt fails = iTester->GetDownloadWatcher()->GetFailedDownloadCount(); |
|
4722 |
|
4723 if( maxFailsToSucceed <= 0 ) |
|
4724 { |
|
4725 maxFailsToSucceed = 0; |
|
4726 } |
|
4727 |
|
4728 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: download count: %d", downloadCount); |
|
4729 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: failed download count: %d", fails); |
|
4730 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: max allowed fails: %d", maxFailsToSucceed); |
|
4731 |
|
4732 if( fails > maxFailsToSucceed ) |
|
4733 { |
|
4734 if( iLastDownloadError != KErrNone ) |
|
4735 { |
|
4736 iEventError = iLastDownloadError; |
|
4737 } |
|
4738 else |
|
4739 { |
|
4740 iEventError = KVCXMYVideosTestMessageDlFailed; |
|
4741 } |
|
4742 } |
|
4743 else |
|
4744 { |
|
4745 iEventError = KErrNone; |
|
4746 } |
|
4747 |
|
4748 // Add message to waited list and continue processing, check for signaling is done later. |
|
4749 iWaitedTestMessages.Reset(); |
|
4750 iWaitedTestMessages.AppendL( aMessage ); |
|
4751 } |
|
4752 } |
|
4753 |
|
4754 // See if there's cancel needed for move, copy or delete. |
|
4755 if( aError == KErrNone && iCancelNextOperation ) |
|
4756 { |
|
4757 if( aMessage == KVCXMYVideosTestMessageCopyOrMoveStarted ) |
|
4758 { |
|
4759 TRAP( aError, iTester->CancelMoveOrCopyL( ETrue ) ); |
|
4760 } |
|
4761 |
|
4762 if( aMessage == KVCXMYVideosTestMessageDeleteStarted ) |
|
4763 { |
|
4764 TRAP( aError, iTester->CancelDeleteL( ETrue ) ); |
|
4765 iCancelNextOperation = EFalse; |
|
4766 } |
|
4767 } |
|
4768 |
|
4769 // Check for errors. |
|
4770 if( aError != KErrNone && !iWaitingForAllDownloads ) |
|
4771 { |
|
4772 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
|
4773 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Error: %d <----------", aError); |
|
4774 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
|
4775 |
|
4776 iLastReceivedMessage = 0; |
|
4777 if( !iMessageWaitIsBlocking ) |
|
4778 { |
|
4779 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------"); |
|
4780 Signal( VCXMVTEST_ERR( aError ) ); |
|
4781 TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), aError ); |
|
4782 iEventError = KErrNone; |
|
4783 } |
|
4784 else |
|
4785 { |
|
4786 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Stop wait <----------"); |
|
4787 iActiveWaitBlocking->Stop(); |
|
4788 iEventError = aError; |
|
4789 } |
|
4790 |
|
4791 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL"); |
|
4792 return; |
|
4793 } |
|
4794 |
|
4795 // Signal script if message is waited for. |
|
4796 for( TInt i = 0; i < iWaitedTestMessages.Count(); i++ ) |
|
4797 { |
|
4798 if( aMessage == iWaitedTestMessages[i] ) |
|
4799 { |
|
4800 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: MsgQueue: found from wait queue."); |
|
4801 iWaitedTestMessages.Remove(i); |
|
4802 |
|
4803 TBool doSignal = EFalse; |
|
4804 |
|
4805 // Signal for any matching message. |
|
4806 if( !iWaitingForAllMessages ) |
|
4807 { |
|
4808 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: MsgQueue: Waiting any message, signal ok."); |
|
4809 doSignal = ETrue; |
|
4810 } |
|
4811 // Signal if all messages have been received. |
|
4812 else |
|
4813 { |
|
4814 if( iWaitedTestMessages.Count() >= 0 ) |
|
4815 { |
|
4816 _LIT(KWhat,"MsgWait"); |
|
4817 _LIT(KDesc, "Left: %d"); |
|
4818 TestModuleIf().Printf( 0, KWhat, KDesc, iWaitedTestMessages.Count() ); |
|
4819 } |
|
4820 |
|
4821 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: MsgQueue: %d messages left in queue.", iWaitedTestMessages.Count() ); |
|
4822 if( iWaitedTestMessages.Count() == 0 ) |
|
4823 { |
|
4824 doSignal = ETrue; |
|
4825 } |
|
4826 else |
|
4827 { |
|
4828 // Restart the timeout for next message. |
|
4829 iTimeoutTimer->Cancel(); |
|
4830 iTimeoutTimer->After( iMessageWaitTimeout * KTimeoutSecond ); |
|
4831 break; |
|
4832 } |
|
4833 } |
|
4834 |
|
4835 if( doSignal ) |
|
4836 { |
|
4837 iWaitedTestMessages.Reset(); |
|
4838 |
|
4839 if( iEventError != KErrNone ) |
|
4840 { |
|
4841 VCXLOGLO1( "CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
|
4842 VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Error: %d <---------", iEventError); |
|
4843 VCXLOGLO1( "CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); |
|
4844 } |
|
4845 |
|
4846 if( !iMessageWaitIsBlocking ) |
|
4847 { |
|
4848 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------"); |
|
4849 Signal( VCXMVTEST_ERR( iEventError ) ); |
|
4850 TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), iEventError ); |
|
4851 iEventError = KErrNone; |
|
4852 } |
|
4853 else |
|
4854 { |
|
4855 VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Stop wait <----------"); |
|
4856 iActiveWaitBlocking->Stop(); |
|
4857 } |
|
4858 |
|
4859 iTimeoutTimer->CancelTimer(); |
|
4860 iLastReceivedMessage = 0; |
|
4861 break; |
|
4862 } |
|
4863 } |
|
4864 } |
|
4865 |
|
4866 VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL"); |
|
4867 } |
|
4868 |
|
4869 // ----------------------------------------------------------------------------- |
|
4870 // CIptvEpgEngineTest::TimerComplete |
|
4871 // ----------------------------------------------------------------------------- |
|
4872 // |
|
4873 void CVCXMyVideosCollectionPluginTest::TimerComplete(TInt aTimerId, TInt aError) |
|
4874 { |
|
4875 if( aTimerId == 0 ) |
|
4876 { |
|
4877 if( iActiveWaitBlocking ) |
|
4878 iActiveWaitBlocking->Stop(); |
|
4879 |
|
4880 if( aError == KErrNone ) |
|
4881 { |
|
4882 VCXLOGLO2( "CVCXMyVideosCollectionPluginTest::TimerComplete: TESTCASE TIMEOUT -------> Last error from events: %d.", |
|
4883 iEventError ); |
|
4884 |
|
4885 iEventError = ( iEventError != KErrNone ? iEventError : KErrTimedOut ); |
|
4886 |
|
4887 // Script is waiting for signal. |
|
4888 if( !iMessageWaitIsBlocking ) |
|
4889 { |
|
4890 VCXLOGLO2( "CVCXMyVideosCollectionPluginTest:: Signaling: %d", iEventError); |
|
4891 Signal( VCXMVTEST_ERR( iEventError ) ); |
|
4892 } |
|
4893 |
|
4894 TRAP_IGNORE( iStats->ActionEndL( 0, iEventError ) ); |
|
4895 |
|
4896 TestModuleIf().Printf( 0, _L("Timedout"), _L("%d"), iEventError ); |
|
4897 } |
|
4898 } |
|
4899 |
|
4900 if( aTimerId == 1 ) |
|
4901 { |
|
4902 VCXLOGLO1("CVCXMyVideosCollectionPluginTest::TimerComplete: Cooldown done. ------->"); |
|
4903 iActiveWait->Stop(); |
|
4904 iCoolDownWait = EFalse; |
|
4905 |
|
4906 iWaitingForAllDownloads = EFalse; |
|
4907 iWaitedTestMessages.Reset(); |
|
4908 iLastReceivedMessage = 0; |
|
4909 } |
|
4910 } |
|
4911 |
|
4912 // End of File |
|
4913 |