1 /* |
|
2 * Copyright (c) 2008-2009 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 "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // [INCLUDE FILES] - do not remove |
|
20 #include <e32svr.h> |
|
21 #include <ecom.h> |
|
22 #include <StifParser.h> |
|
23 #include <StifTestEventInterface.h> |
|
24 #include <Stiftestinterface.h> |
|
25 #include <mediacollectionmanager.h> |
|
26 #include "CollectionManagerTest.h" |
|
27 |
|
28 #include "mdsutils.h" |
|
29 |
|
30 // ============================ MEMBER FUNCTIONS =============================== |
|
31 |
|
32 // ----------------------------------------------------------------------------- |
|
33 // CCollectionManagerTest::Delete |
|
34 // Delete here all resources allocated and opened from test methods. |
|
35 // Called from destructor. |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 void CCollectionManagerTest::Delete() |
|
39 { |
|
40 |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CCollectionManagerTest::RunMethodL |
|
45 // Run specified method. Contains also table of test mothods and their names. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 TInt CCollectionManagerTest::RunMethodL( |
|
49 CStifItemParser& aItem ) |
|
50 { |
|
51 |
|
52 static TStifFunctionInfo const KFunctions[] = |
|
53 { |
|
54 // Copy this line for every implemented function. |
|
55 // First string is the function name used in TestScripter script file. |
|
56 // Second is the actual implementation member function. |
|
57 |
|
58 // engine |
|
59 ENTRY( "CreateCollectionManager", CCollectionManagerTest::CreateCollectionManagerL ), |
|
60 ENTRY( "GetCollectionInfos", CCollectionManagerTest::GetCollectionInfosL ), |
|
61 ENTRY( "CollectionInfoById", CCollectionManagerTest::CollectionInfoByIdL ), |
|
62 ENTRY( "CreateCollection", CCollectionManagerTest::CreateCollectionL ), |
|
63 ENTRY( "DeleteCollection", CCollectionManagerTest::DeleteCollectionL ), |
|
64 ENTRY( "RenameCollection", CCollectionManagerTest::RenameCollectionL ), |
|
65 ENTRY( "AddToCollection", CCollectionManagerTest::AddToCollectionL ), |
|
66 ENTRY( "RemoveFromCollectionL", CCollectionManagerTest::RemoveFromCollectionL ), |
|
67 ENTRY( "GetCollectionItemArray", CCollectionManagerTest::GetCollectionItemArrayL ), |
|
68 ENTRY( "GetCollectionIdByItem", CCollectionManagerTest::GetCollectionIdByItemL ), |
|
69 ENTRY( "AddCollectionObserver", CCollectionManagerTest::AddCollectionObserverL ), |
|
70 ENTRY( "RemoveCollectionObserver", CCollectionManagerTest::RemoveCollectionObserverL ), |
|
71 ENTRY( "GetDriveById", CCollectionManagerTest::GetDriveByIdL ), |
|
72 ENTRY( "EndTestSession", CCollectionManagerTest::EndTestSessionL ) |
|
73 }; |
|
74 |
|
75 const TInt count = sizeof( KFunctions ) / |
|
76 sizeof( TStifFunctionInfo ); |
|
77 |
|
78 return RunInternalL( KFunctions, count, aItem ); |
|
79 |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CCollectionManagerTest::CollectionChangedL |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CCollectionManagerTest::CollectionChangedL( const TArray<TInt>& /*aCollectionIdArray*/ ) |
|
87 { |
|
88 // This is not going to be called |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CCollectionManagerTest::CollectionManagerErrorL |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 void CCollectionManagerTest::CollectionManagerErrorL( TInt /*aError*/ ) |
|
96 { |
|
97 // This is not going to be called |
|
98 } |
|
99 |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CCollectionManagerTest::CreateCollectionManagerLL |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 TInt CCollectionManagerTest::CreateCollectionManagerL( CStifItemParser& /* aItem */ ) |
|
106 { |
|
107 iCollectionManager = MediaCollectionManagerFactory::CreateCollectionManagerL( ); |
|
108 |
|
109 return KErrNone; |
|
110 } |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CCollectionManagerTest::GetCollectionInfosL |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 TInt CCollectionManagerTest::GetCollectionInfosL( CStifItemParser& /* aItem */ ) |
|
117 { |
|
118 _LIT( KMsg1, "Enter GetCollectionInfosL" ); |
|
119 iLog->Log( KMsg1 ); |
|
120 RDebug::Print( KMsg1 ); |
|
121 |
|
122 TInt error( KErrNone ); |
|
123 |
|
124 if( iCollectionManager ) |
|
125 { |
|
126 RPointerArray<MMediaCollectionInfo> collectionInfoArray; |
|
127 TRAP( error, iCollectionManager->GetCollectionInfosL( collectionInfoArray ) ); |
|
128 if( error != KErrNotSupported && error != KErrNone ) |
|
129 { |
|
130 return error; |
|
131 } |
|
132 error = KErrNone; |
|
133 const TInt infoArrayCount( collectionInfoArray.Count() ); |
|
134 if( infoArrayCount > 0 ) |
|
135 { |
|
136 error = KErrUnknown; |
|
137 } |
|
138 } |
|
139 else |
|
140 { |
|
141 error = KErrUnknown; |
|
142 } |
|
143 |
|
144 _LIT( KMsg2, "Exit GetCollectionInfosL" ); |
|
145 iLog->Log( KMsg2 ); |
|
146 RDebug::Print( KMsg2 ); |
|
147 |
|
148 return error; |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CCollectionManagerTest::CollectionInfoByIdL |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 TInt CCollectionManagerTest::CollectionInfoByIdL( CStifItemParser& /*aItem*/ ) |
|
156 { |
|
157 _LIT( KMsg1, "Enter CollectionInfoByIdL" ); |
|
158 iLog->Log( KMsg1 ); |
|
159 RDebug::Print( KMsg1 ); |
|
160 |
|
161 TInt collectionID( KErrNotFound ); |
|
162 TInt error( KErrNone ); |
|
163 MMediaCollectionInfo* mci = NULL; |
|
164 if( !iCollectionManager ) |
|
165 { |
|
166 return KErrUnknown; |
|
167 } |
|
168 |
|
169 TRAP( error, mci = iCollectionManager->CollectionInfoByIdLC( collectionID ) ); |
|
170 if( error != KErrNotSupported && error != KErrNone ) |
|
171 { |
|
172 return error; |
|
173 } |
|
174 |
|
175 if( mci ) |
|
176 { |
|
177 return KErrCorrupt; |
|
178 } |
|
179 |
|
180 TRAP( error, mci = iCollectionManager->CollectionInfoByIdLC( 0 ) ); |
|
181 if( error != KErrNotSupported && error != KErrNone ) |
|
182 { |
|
183 return error; |
|
184 } |
|
185 |
|
186 if( mci ) |
|
187 { |
|
188 return KErrCorrupt; |
|
189 } |
|
190 |
|
191 _LIT( KMsg2, "Exit CollectionInfoByIdL" ); |
|
192 iLog->Log( KMsg2 ); |
|
193 RDebug::Print( KMsg2 ); |
|
194 |
|
195 return KErrNone; |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------------------------- |
|
199 // CCollectionManagerTest::CreateCollectionL |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 TInt CCollectionManagerTest::CreateCollectionL( CStifItemParser& /* aItem */ ) |
|
203 { |
|
204 _LIT( KMsg1, "Enter CreateCollectionL" ); |
|
205 iLog->Log( KMsg1 ); |
|
206 RDebug::Print( KMsg1 ); |
|
207 |
|
208 if( !iCollectionManager ) |
|
209 { |
|
210 return KErrUnknown; |
|
211 } |
|
212 |
|
213 _LIT( KTestAlbumName, "TestAlbum" ); |
|
214 HBufC* collectionName = KTestAlbumName().AllocL(); |
|
215 RArray<TInt> types; |
|
216 types.AppendL( 1 ); |
|
217 TInt32 properties = EMCPhoneMemoryCollection; |
|
218 |
|
219 TInt collectionId( KErrNotFound ); |
|
220 TInt error( KErrNone ); |
|
221 TRAP( error, collectionId = iCollectionManager->CreateCollectionL( *collectionName, types.Array(), properties ) ); |
|
222 if( error != KErrNotSupported && error != KErrNone ) |
|
223 { |
|
224 delete collectionName; |
|
225 collectionName = NULL; |
|
226 return error; |
|
227 } |
|
228 |
|
229 properties = EMCMmcCollection; |
|
230 TRAP( error, collectionId = iCollectionManager->CreateCollectionL( *collectionName, types.Array(), properties ) ); |
|
231 if( error != KErrNotSupported && error != KErrNone ) |
|
232 { |
|
233 delete collectionName; |
|
234 collectionName = NULL; |
|
235 return error; |
|
236 } |
|
237 |
|
238 MMediaCollectionInfo* mci = NULL; |
|
239 TRAP( error, iCollectionManager->CollectionInfoByIdLC( collectionId ) ); |
|
240 if( error != KErrNotSupported && error != KErrNone ) |
|
241 { |
|
242 delete collectionName; |
|
243 collectionName = NULL; |
|
244 return error; |
|
245 } |
|
246 |
|
247 if( mci ) |
|
248 { |
|
249 delete collectionName; |
|
250 collectionName = NULL; |
|
251 return KErrCorrupt; |
|
252 } |
|
253 |
|
254 delete collectionName; |
|
255 collectionName = NULL; |
|
256 |
|
257 _LIT( KMsg2, "Exit CreateCollectionL" ); |
|
258 iLog->Log( KMsg2 ); |
|
259 RDebug::Print( KMsg2 ); |
|
260 |
|
261 return KErrNone; |
|
262 } |
|
263 |
|
264 // ----------------------------------------------------------------------------- |
|
265 // CCollectionManagerTest::DeleteCollectionL |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 TInt CCollectionManagerTest::DeleteCollectionL( CStifItemParser& /* aItem */ ) |
|
269 { |
|
270 _LIT( KMsg1, "Enter DeleteCollectionL" ); |
|
271 iLog->Log( KMsg1 ); |
|
272 RDebug::Print( KMsg1 ); |
|
273 |
|
274 if( !iCollectionManager ) |
|
275 { |
|
276 return KErrUnknown; |
|
277 } |
|
278 |
|
279 TInt collectionId( KErrNotFound ); |
|
280 TInt error( KErrNone ); |
|
281 TRAP( error, iCollectionManager->DeleteCollectionL( collectionId ) ); |
|
282 if( error != KErrNotSupported && error != KErrNone ) |
|
283 { |
|
284 return error; |
|
285 } |
|
286 |
|
287 collectionId = 0; |
|
288 TRAP( error, iCollectionManager->DeleteCollectionL( collectionId ) ); |
|
289 if( error != KErrNotSupported && error != KErrNone ) |
|
290 { |
|
291 return error; |
|
292 } |
|
293 |
|
294 _LIT( KMsg2, "Exit DeleteCollectionL" ); |
|
295 iLog->Log( KMsg2 ); |
|
296 RDebug::Print( KMsg2 ); |
|
297 |
|
298 return KErrNone; |
|
299 } |
|
300 |
|
301 // ----------------------------------------------------------------------------- |
|
302 // CCollectionManagerTest::RenameCollectionL |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 TInt CCollectionManagerTest::RenameCollectionL( CStifItemParser& /* aItem */ ) |
|
306 { |
|
307 _LIT( KMsg1, "Enter RenameCollectionL" ); |
|
308 iLog->Log( KMsg1 ); |
|
309 RDebug::Print( KMsg1 ); |
|
310 |
|
311 if( !iCollectionManager ) |
|
312 { |
|
313 return KErrUnknown; |
|
314 } |
|
315 |
|
316 TInt collectionId( KErrNotFound ); |
|
317 TInt error( KErrNone ); |
|
318 |
|
319 _LIT( KTestAlbumName, "NewTestAlbum" ); |
|
320 HBufC* collectionNewName = KTestAlbumName().AllocL(); |
|
321 |
|
322 TRAP( error, iCollectionManager->RenameCollectionL( collectionId, *collectionNewName ) ); |
|
323 if( error != KErrNotSupported && error != KErrNone ) |
|
324 { |
|
325 delete collectionNewName; |
|
326 collectionNewName = NULL; |
|
327 return error; |
|
328 } |
|
329 |
|
330 MMediaCollectionInfo* mci = NULL; |
|
331 |
|
332 TRAP( error, mci= iCollectionManager->CollectionInfoByIdLC( collectionId ) ); |
|
333 if( error != KErrNotSupported && error != KErrNone ) |
|
334 { |
|
335 delete collectionNewName; |
|
336 collectionNewName = NULL; |
|
337 return error; |
|
338 } |
|
339 |
|
340 if( mci ) |
|
341 { |
|
342 delete collectionNewName; |
|
343 collectionNewName = NULL; |
|
344 return KErrCorrupt; |
|
345 } |
|
346 |
|
347 delete collectionNewName; |
|
348 collectionNewName = NULL; |
|
349 |
|
350 _LIT( KMsg2, "Exit RenameCollectionL" ); |
|
351 iLog->Log( KMsg2 ); |
|
352 RDebug::Print( KMsg2 ); |
|
353 |
|
354 return KErrNone; |
|
355 } |
|
356 |
|
357 // ----------------------------------------------------------------------------- |
|
358 // CCollectionManagerTest::AddToCollectionL |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 TInt CCollectionManagerTest::AddToCollectionL( CStifItemParser& /* aItem */ ) |
|
362 { |
|
363 _LIT( KMsg1, "Enter AddToCollectionL" ); |
|
364 iLog->Log( KMsg1 ); |
|
365 RDebug::Print( KMsg1 ); |
|
366 |
|
367 if( !iCollectionManager ) |
|
368 { |
|
369 return KErrUnknown; |
|
370 } |
|
371 |
|
372 const TInt itemCount( 500 ); |
|
373 CDesCArray* newItemArray = new (ELeave) CDesCArrayFlat( itemCount ); |
|
374 |
|
375 for( TInt i = 0 ; i < itemCount ; ++i ) |
|
376 { |
|
377 TBuf<40> b; |
|
378 b.Num( i ); |
|
379 b.Append( _L("TestItem") ); |
|
380 newItemArray->AppendL( b ); |
|
381 } |
|
382 |
|
383 TInt collectionId( KErrNotFound ); |
|
384 TInt error( KErrNone ); |
|
385 TRAP( error, iCollectionManager->AddToCollectionL( collectionId, *newItemArray, ETrue ) ); |
|
386 if( error != KErrNotSupported && error != KErrNone ) |
|
387 { |
|
388 delete newItemArray; |
|
389 newItemArray = NULL; |
|
390 return error; |
|
391 } |
|
392 |
|
393 TRAP( error, iCollectionManager->AddToCollectionL( collectionId, *newItemArray, EFalse ) ); |
|
394 if( error != KErrNotSupported && error != KErrNone ) |
|
395 { |
|
396 delete newItemArray; |
|
397 newItemArray = NULL; |
|
398 return error; |
|
399 } |
|
400 |
|
401 delete newItemArray; |
|
402 newItemArray = NULL; |
|
403 |
|
404 _LIT( KMsg2, "Exit AddToCollectionL" ); |
|
405 iLog->Log( KMsg2 ); |
|
406 RDebug::Print( KMsg2 ); |
|
407 |
|
408 return KErrNone; |
|
409 } |
|
410 |
|
411 // ----------------------------------------------------------------------------- |
|
412 // CCollectionManagerTest::RemoveFromCollectionL |
|
413 // ----------------------------------------------------------------------------- |
|
414 // |
|
415 TInt CCollectionManagerTest::RemoveFromCollectionL( CStifItemParser& /* aItem */ ) |
|
416 { |
|
417 _LIT( KMsg1, "Enter RemoveFromCollectionL" ); |
|
418 iLog->Log( KMsg1 ); |
|
419 RDebug::Print( KMsg1 ); |
|
420 |
|
421 if( !iCollectionManager ) |
|
422 { |
|
423 return KErrUnknown; |
|
424 } |
|
425 |
|
426 const TInt itemCount( 500 ); |
|
427 CDesCArray* removeItemArray = new (ELeave) CDesCArrayFlat( itemCount ); |
|
428 |
|
429 for( TInt i = 0 ; i < itemCount ; ++i ) |
|
430 { |
|
431 TBuf<40> b; |
|
432 b.Num( i ); |
|
433 b.Append( _L("TestItem") ); |
|
434 removeItemArray->AppendL( b ); |
|
435 } |
|
436 |
|
437 TInt collectionId( KErrNotFound ); |
|
438 TInt error( KErrNone ); |
|
439 TRAP( error, iCollectionManager->RemoveFromCollectionL( collectionId, *removeItemArray ) ); |
|
440 if( error != KErrNotSupported && error != KErrNone ) |
|
441 { |
|
442 delete removeItemArray; |
|
443 removeItemArray = NULL; |
|
444 return error; |
|
445 } |
|
446 |
|
447 delete removeItemArray; |
|
448 removeItemArray = NULL; |
|
449 |
|
450 _LIT( KMsg2, "Exit RemoveFromCollectionL" ); |
|
451 iLog->Log( KMsg2 ); |
|
452 RDebug::Print( KMsg2 ); |
|
453 |
|
454 return KErrNone; |
|
455 } |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // CCollectionManagerTest::RemoveFromAllCollectionsL |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 TInt CCollectionManagerTest::RemoveFromAllCollectionsL( CStifItemParser& /*aItem*/ ) |
|
462 { |
|
463 _LIT( KMsg1, "Enter RemoveFromAllCollectionsL" ); |
|
464 iLog->Log( KMsg1 ); |
|
465 RDebug::Print( KMsg1 ); |
|
466 |
|
467 if( !iCollectionManager ) |
|
468 { |
|
469 return KErrUnknown; |
|
470 } |
|
471 |
|
472 const TInt itemCount( 500 ); |
|
473 CDesCArray* removeItemArray = new (ELeave) CDesCArrayFlat( itemCount ); |
|
474 CleanupStack::PushL( removeItemArray ); |
|
475 |
|
476 for( TInt i = 0 ; i < itemCount ; ++i ) |
|
477 { |
|
478 TBuf<40> b; |
|
479 b.Num( i ); |
|
480 b.Append( _L("TestItem") ); |
|
481 removeItemArray->AppendL( b ); |
|
482 } |
|
483 |
|
484 TInt error( KErrNone ); |
|
485 TRAP( error, iCollectionManager->RemoveFromAllCollectionsL( *removeItemArray ) ); |
|
486 if( error != KErrNotSupported && error != KErrNone ) |
|
487 { |
|
488 CleanupStack::PopAndDestroy( removeItemArray ); |
|
489 removeItemArray = NULL; |
|
490 return error; |
|
491 } |
|
492 |
|
493 CleanupStack::PopAndDestroy( removeItemArray ); |
|
494 removeItemArray = NULL; |
|
495 |
|
496 _LIT( KMsg2, "Exit RemoveFromAllCollectionsL" ); |
|
497 iLog->Log( KMsg2 ); |
|
498 RDebug::Print( KMsg2 ); |
|
499 |
|
500 return KErrNone; |
|
501 } |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // CCollectionManagerTest::GetCollectionItemArrayL |
|
505 // ----------------------------------------------------------------------------- |
|
506 // |
|
507 TInt CCollectionManagerTest::GetCollectionItemArrayL( CStifItemParser& /*aItem*/ ) |
|
508 { |
|
509 _LIT( KMsg1, "Enter GetCollectionItemArrayL" ); |
|
510 iLog->Log( KMsg1 ); |
|
511 RDebug::Print( KMsg1 ); |
|
512 |
|
513 if( !iCollectionManager ) |
|
514 { |
|
515 return KErrUnknown; |
|
516 } |
|
517 |
|
518 CDesCArraySeg* collectionItemArray = new (ELeave) CDesCArraySeg( 4 ); |
|
519 CleanupStack::PushL( collectionItemArray ); |
|
520 |
|
521 TInt collectionId( KErrNotFound ); |
|
522 TInt error( KErrNone ); |
|
523 TRAP( error, iCollectionManager->GetCollectionItemArrayL( collectionId, *collectionItemArray ) ); |
|
524 if( error != KErrNotSupported && error != KErrNone ) |
|
525 { |
|
526 CleanupStack::PopAndDestroy(collectionItemArray); |
|
527 return error; |
|
528 } |
|
529 |
|
530 if( collectionItemArray->Count() > 0 ) |
|
531 { |
|
532 CleanupStack::PopAndDestroy(collectionItemArray); |
|
533 return KErrUnknown; |
|
534 } |
|
535 |
|
536 CleanupStack::PopAndDestroy(collectionItemArray); |
|
537 |
|
538 _LIT( KMsg2, "Exit GetCollectionItemArrayL" ); |
|
539 iLog->Log( KMsg2 ); |
|
540 RDebug::Print( KMsg2 ); |
|
541 |
|
542 return KErrNone; |
|
543 } |
|
544 |
|
545 // ----------------------------------------------------------------------------- |
|
546 // CCollectionManagerTest::GetCollectionIdByItemL |
|
547 // ----------------------------------------------------------------------------- |
|
548 // |
|
549 TInt CCollectionManagerTest::GetCollectionIdByItemL( CStifItemParser& /* aItem */ ) |
|
550 { |
|
551 _LIT( KMsg1, "Enter GetCollectionIdByItemL" ); |
|
552 iLog->Log( KMsg1 ); |
|
553 RDebug::Print( KMsg1 ); |
|
554 |
|
555 if( !iCollectionManager ) |
|
556 { |
|
557 return KErrUnknown; |
|
558 } |
|
559 |
|
560 _LIT( KTestItemName, "GetCollectionIdByItemTestItem"); |
|
561 HBufC* getCollectionIdByItemTestItemName = KTestItemName().AllocL(); |
|
562 |
|
563 RArray<TInt> idArray; |
|
564 CleanupClosePushL( idArray ); |
|
565 TInt error( KErrNone ); |
|
566 TRAP( error, iCollectionManager->GetCollectionIdByItemL( *getCollectionIdByItemTestItemName, idArray ) ); |
|
567 if( error != KErrNotSupported && error != KErrNone ) |
|
568 { |
|
569 CleanupStack::PopAndDestroy(&idArray); |
|
570 delete getCollectionIdByItemTestItemName; |
|
571 getCollectionIdByItemTestItemName = NULL; |
|
572 return error; |
|
573 } |
|
574 |
|
575 const TInt idArrayCount( idArray.Count() ); |
|
576 if( idArrayCount > 0 ) |
|
577 { |
|
578 CleanupStack::PopAndDestroy(&idArray); |
|
579 delete getCollectionIdByItemTestItemName; |
|
580 getCollectionIdByItemTestItemName = NULL; |
|
581 return KErrUnknown; |
|
582 } |
|
583 |
|
584 CleanupStack::PopAndDestroy(&idArray); |
|
585 |
|
586 delete getCollectionIdByItemTestItemName; |
|
587 getCollectionIdByItemTestItemName = NULL; |
|
588 |
|
589 _LIT( KMsg2, "Enter GetCollectionIdByItemL" ); |
|
590 iLog->Log( KMsg2 ); |
|
591 RDebug::Print( KMsg2 ); |
|
592 |
|
593 return KErrNone; |
|
594 } |
|
595 |
|
596 // ----------------------------------------------------------------------------- |
|
597 // CCollectionManagerTest::AddCollectionObserverL |
|
598 // ----------------------------------------------------------------------------- |
|
599 // |
|
600 TInt CCollectionManagerTest::AddCollectionObserverL( CStifItemParser& /* aItem */ ) |
|
601 { |
|
602 _LIT( KMsg1, "Enter AddCollectionObserverL" ); |
|
603 iLog->Log( KMsg1 ); |
|
604 RDebug::Print( KMsg1 ); |
|
605 |
|
606 if( !iCollectionManager ) |
|
607 { |
|
608 return KErrUnknown; |
|
609 } |
|
610 |
|
611 TInt err( KErrNone ); |
|
612 TRAP( err, iCollectionManager->AddCollectionObserverL( *this ) ); |
|
613 if( err != KErrNotSupported && err != KErrNone ) |
|
614 { |
|
615 return err; |
|
616 } |
|
617 |
|
618 _LIT( KMsg2, "Exit AddCollectionObserverL" ); |
|
619 iLog->Log( KMsg2 ); |
|
620 RDebug::Print( KMsg2 ); |
|
621 |
|
622 return KErrNone; |
|
623 } |
|
624 |
|
625 // ----------------------------------------------------------------------------- |
|
626 // CCollectionManagerTest::RemoveCollectionObserverL |
|
627 // ----------------------------------------------------------------------------- |
|
628 // |
|
629 TInt CCollectionManagerTest::RemoveCollectionObserverL( CStifItemParser& /* aItem */ ) |
|
630 { |
|
631 _LIT( KMsg1, "Enter RemoveCollectionObserverL" ); |
|
632 iLog->Log( KMsg1 ); |
|
633 RDebug::Print( KMsg1 ); |
|
634 |
|
635 if( !iCollectionManager ) |
|
636 { |
|
637 return KErrUnknown; |
|
638 } |
|
639 |
|
640 TInt err( KErrNone ); |
|
641 TRAP( err, iCollectionManager->AddCollectionObserverL( *this ) ); |
|
642 if( err != KErrNotSupported && err != KErrNone ) |
|
643 { |
|
644 return err; |
|
645 } |
|
646 |
|
647 TRAP( err, iCollectionManager->RemoveCollectionObserverL( *this ) ); |
|
648 if( err != KErrNotSupported && err != KErrNone ) |
|
649 { |
|
650 return err; |
|
651 } |
|
652 |
|
653 _LIT( KMsg2, "Exit RemoveCollectionObserverL" ); |
|
654 iLog->Log( KMsg2 ); |
|
655 RDebug::Print( KMsg2 ); |
|
656 |
|
657 return KErrNone; |
|
658 } |
|
659 |
|
660 // ----------------------------------------------------------------------------- |
|
661 // CCollectionManagerTest::GetDriveByIdL |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 TInt CCollectionManagerTest::GetDriveByIdL( CStifItemParser& /* aItem */ ) |
|
665 { |
|
666 _LIT( KMsg1, "Enter GetDriveByIdL" ); |
|
667 iLog->Log( KMsg1 ); |
|
668 RDebug::Print( KMsg1 ); |
|
669 |
|
670 if( !iCollectionManager ) |
|
671 { |
|
672 return KErrUnknown; |
|
673 } |
|
674 |
|
675 TInt collectionId( KErrNotFound ); |
|
676 |
|
677 TInt32 drive( 100 ); |
|
678 TInt error( KErrNone ); |
|
679 |
|
680 TRAP( error, drive = iCollectionManager->GetDriveByIdL( collectionId ) ); |
|
681 if( error != KErrNotSupported && error != KErrNone ) |
|
682 { |
|
683 return error; |
|
684 } |
|
685 |
|
686 if( drive != 100 ) |
|
687 { |
|
688 return KErrUnknown; |
|
689 } |
|
690 |
|
691 _LIT( KMsg2, "Exit GetDriveByIdL" ); |
|
692 iLog->Log( KMsg2 ); |
|
693 RDebug::Print( KMsg2 ); |
|
694 |
|
695 return KErrNone; |
|
696 } |
|
697 |
|
698 // ----------------------------------------------------------------------------- |
|
699 // CCollectionManagerTest::EndTestSessionL |
|
700 // ----------------------------------------------------------------------------- |
|
701 // |
|
702 TInt CCollectionManagerTest::EndTestSessionL( CStifItemParser& /* aItem */ ) |
|
703 { |
|
704 delete iCollectionManager; |
|
705 iCollectionManager = NULL; |
|
706 |
|
707 return KErrNone; |
|
708 } |
|
709 |
|
710 // [End of File] - Do not remove |
|