mds_plat/content_listing_framework_collection_manager_api/tsrc/src/CollectionManagerTestBlocks.cpp
changeset 0 c53acadfccc6
child 26 9f21bab39f42
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     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 
       
   475     for( TInt i = 0 ; i < itemCount ; ++i )
       
   476         {
       
   477         TBuf<40> b;
       
   478         b.Num( i );
       
   479         b.Append( _L("TestItem") );
       
   480         removeItemArray->AppendL( b );
       
   481         }
       
   482     
       
   483     TInt error( KErrNone );
       
   484     TRAP( error, iCollectionManager->RemoveFromAllCollectionsL( *removeItemArray ) );
       
   485     if( error != KErrNotSupported && error != KErrNone )
       
   486         {
       
   487         delete removeItemArray;
       
   488         removeItemArray = NULL;
       
   489         return error;
       
   490         }
       
   491     
       
   492     delete removeItemArray;
       
   493     removeItemArray = NULL;
       
   494     
       
   495     _LIT( KMsg2, "Exit RemoveFromAllCollectionsL" );
       
   496     iLog->Log( KMsg2 );  
       
   497     RDebug::Print( KMsg2 );
       
   498 
       
   499     return KErrNone;
       
   500     }
       
   501 
       
   502 // -----------------------------------------------------------------------------
       
   503 // CCollectionManagerTest::GetCollectionItemArrayL
       
   504 // -----------------------------------------------------------------------------
       
   505 //
       
   506 TInt CCollectionManagerTest::GetCollectionItemArrayL( CStifItemParser& /*aItem*/ )
       
   507     {
       
   508     _LIT( KMsg1, "Enter GetCollectionItemArrayL" );
       
   509     iLog->Log( KMsg1 );  
       
   510     RDebug::Print( KMsg1 );
       
   511    
       
   512     if( !iCollectionManager )
       
   513         {
       
   514         return KErrUnknown;
       
   515         }
       
   516     
       
   517     CDesCArraySeg* collectionItemArray = new (ELeave) CDesCArraySeg( 4 );
       
   518     CleanupStack::PushL( collectionItemArray );
       
   519 
       
   520     TInt collectionId( KErrNotFound );
       
   521     TInt error( KErrNone );
       
   522     TRAP( error, iCollectionManager->GetCollectionItemArrayL( collectionId, *collectionItemArray ) );
       
   523     if( error != KErrNotSupported && error != KErrNone )
       
   524         {
       
   525         CleanupStack::PopAndDestroy(collectionItemArray);
       
   526         return error;
       
   527         }
       
   528     
       
   529     if( collectionItemArray->Count() > 0 )
       
   530         {
       
   531         CleanupStack::PopAndDestroy(collectionItemArray);
       
   532         return KErrUnknown;
       
   533         }
       
   534     
       
   535     CleanupStack::PopAndDestroy(collectionItemArray);
       
   536     
       
   537     _LIT( KMsg2, "Exit GetCollectionItemArrayL" );
       
   538     iLog->Log( KMsg2 );  
       
   539     RDebug::Print( KMsg2 );
       
   540     
       
   541     return KErrNone;
       
   542     }
       
   543 
       
   544 // -----------------------------------------------------------------------------
       
   545 // CCollectionManagerTest::GetCollectionIdByItemL
       
   546 // -----------------------------------------------------------------------------
       
   547 //
       
   548 TInt CCollectionManagerTest::GetCollectionIdByItemL( CStifItemParser& /* aItem */ )
       
   549     {
       
   550     _LIT( KMsg1, "Enter GetCollectionIdByItemL" );
       
   551     iLog->Log( KMsg1 );  
       
   552     RDebug::Print( KMsg1 );
       
   553 
       
   554     if( !iCollectionManager )
       
   555         {
       
   556         return KErrUnknown;
       
   557         }
       
   558     
       
   559     _LIT( KTestItemName, "GetCollectionIdByItemTestItem");
       
   560     HBufC* getCollectionIdByItemTestItemName = KTestItemName().AllocL();
       
   561     
       
   562     RArray<TInt> idArray;
       
   563     CleanupClosePushL( idArray );
       
   564     TInt error( KErrNone );
       
   565     TRAP( error, iCollectionManager->GetCollectionIdByItemL( *getCollectionIdByItemTestItemName, idArray ) );
       
   566     if( error != KErrNotSupported && error != KErrNone )
       
   567         {
       
   568         CleanupStack::PopAndDestroy(&idArray);
       
   569         delete getCollectionIdByItemTestItemName;
       
   570         getCollectionIdByItemTestItemName = NULL;
       
   571         return error;
       
   572         }
       
   573 
       
   574     const TInt idArrayCount( idArray.Count() );
       
   575     if( idArrayCount > 0 )
       
   576         {
       
   577         CleanupStack::PopAndDestroy(&idArray);
       
   578         delete getCollectionIdByItemTestItemName;
       
   579         getCollectionIdByItemTestItemName = NULL;
       
   580         return KErrUnknown;
       
   581         }
       
   582 
       
   583     CleanupStack::PopAndDestroy(&idArray);
       
   584 	
       
   585     delete getCollectionIdByItemTestItemName;
       
   586     getCollectionIdByItemTestItemName = NULL;
       
   587     
       
   588     _LIT( KMsg2, "Enter GetCollectionIdByItemL" );
       
   589     iLog->Log( KMsg2 );  
       
   590     RDebug::Print( KMsg2 );
       
   591     
       
   592     return KErrNone;
       
   593     }
       
   594 
       
   595 // -----------------------------------------------------------------------------
       
   596 // CCollectionManagerTest::AddCollectionObserverL
       
   597 // -----------------------------------------------------------------------------
       
   598 //
       
   599 TInt CCollectionManagerTest::AddCollectionObserverL( CStifItemParser& /* aItem */ )
       
   600     {
       
   601     _LIT( KMsg1, "Enter AddCollectionObserverL" );
       
   602     iLog->Log( KMsg1 );  
       
   603     RDebug::Print( KMsg1 );
       
   604 
       
   605     if( !iCollectionManager )
       
   606         {
       
   607         return KErrUnknown;
       
   608         }
       
   609     
       
   610     TInt err( KErrNone );
       
   611     TRAP( err, iCollectionManager->AddCollectionObserverL( *this ) );
       
   612     if( err != KErrNotSupported && err != KErrNone )
       
   613         {
       
   614         return err;
       
   615         }
       
   616     
       
   617     _LIT( KMsg2, "Exit AddCollectionObserverL" );
       
   618     iLog->Log( KMsg2 );  
       
   619     RDebug::Print( KMsg2 );
       
   620     
       
   621     return KErrNone;
       
   622     }
       
   623 
       
   624 // -----------------------------------------------------------------------------
       
   625 // CCollectionManagerTest::RemoveCollectionObserverL
       
   626 // -----------------------------------------------------------------------------
       
   627 //
       
   628 TInt CCollectionManagerTest::RemoveCollectionObserverL( CStifItemParser& /* aItem */ )
       
   629     {
       
   630     _LIT( KMsg1, "Enter RemoveCollectionObserverL" );
       
   631     iLog->Log( KMsg1 );  
       
   632     RDebug::Print( KMsg1 );
       
   633  
       
   634     if( !iCollectionManager )
       
   635         {
       
   636         return KErrUnknown;
       
   637         }
       
   638     
       
   639     TInt err( KErrNone );
       
   640     TRAP( err, iCollectionManager->AddCollectionObserverL( *this ) );
       
   641     if( err != KErrNotSupported && err != KErrNone )
       
   642         {
       
   643         return err;
       
   644         }
       
   645     
       
   646     TRAP( err, iCollectionManager->RemoveCollectionObserverL( *this ) );
       
   647     if( err != KErrNotSupported && err != KErrNone )
       
   648         {
       
   649         return err;
       
   650         }
       
   651     
       
   652     _LIT( KMsg2, "Exit RemoveCollectionObserverL" );
       
   653     iLog->Log( KMsg2 );  
       
   654     RDebug::Print( KMsg2 );
       
   655 	
       
   656     return KErrNone;
       
   657     }
       
   658 
       
   659 // -----------------------------------------------------------------------------
       
   660 // CCollectionManagerTest::GetDriveByIdL
       
   661 // -----------------------------------------------------------------------------
       
   662 //
       
   663 TInt CCollectionManagerTest::GetDriveByIdL( CStifItemParser& /* aItem */ )
       
   664     {
       
   665     _LIT( KMsg1, "Enter GetDriveByIdL" );
       
   666     iLog->Log( KMsg1 );
       
   667     RDebug::Print( KMsg1 );
       
   668     
       
   669     if( !iCollectionManager )
       
   670         {
       
   671         return KErrUnknown;
       
   672         }
       
   673     
       
   674     TInt collectionId( KErrNotFound );
       
   675 
       
   676     TInt32 drive( 100 );
       
   677     TInt error( KErrNone );
       
   678     
       
   679     TRAP( error, drive = iCollectionManager->GetDriveByIdL( collectionId ) );
       
   680     if( error != KErrNotSupported && error != KErrNone )
       
   681         {
       
   682         return error;
       
   683         }
       
   684     
       
   685     if( drive != 100 )
       
   686         {
       
   687         return KErrUnknown;
       
   688         }
       
   689     
       
   690     _LIT( KMsg2, "Exit GetDriveByIdL" );
       
   691     iLog->Log( KMsg2 );
       
   692     RDebug::Print( KMsg2 );
       
   693     
       
   694     return KErrNone;
       
   695     }
       
   696 
       
   697 // -----------------------------------------------------------------------------
       
   698 // CCollectionManagerTest::EndTestSessionL
       
   699 // -----------------------------------------------------------------------------
       
   700 //
       
   701 TInt CCollectionManagerTest::EndTestSessionL( CStifItemParser& /* aItem */ )
       
   702     {
       
   703     delete iCollectionManager;
       
   704     iCollectionManager = NULL;
       
   705     
       
   706     return KErrNone;
       
   707     }   
       
   708 
       
   709 //  [End of File] - Do not remove