mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/src/HarvesterClientTestScripterBlocks.cpp
branchRCL_3
changeset 12 9f21bab39f42
parent 0 c53acadfccc6
child 13 4a4892eec172
equal deleted inserted replaced
10:ab88d4a85041 12:9f21bab39f42
    75         ENTRY( "QueryAudioObjectByIdIndex", CHarvesterClientTestScripter::QueryAudioObjectByIdIndexL ),
    75         ENTRY( "QueryAudioObjectByIdIndex", CHarvesterClientTestScripter::QueryAudioObjectByIdIndexL ),
    76         ENTRY( "RemoveObject", CHarvesterClientTestScripter::RemoveObjectL ),
    76         ENTRY( "RemoveObject", CHarvesterClientTestScripter::RemoveObjectL ),
    77         ENTRY( "Results", CHarvesterClientTestScripter::Results ),     
    77         ENTRY( "Results", CHarvesterClientTestScripter::Results ),     
    78         ENTRY( "AddHarvesterEventObserver", CHarvesterClientTestScripter::AddHarvesterEventObserverL ),
    78         ENTRY( "AddHarvesterEventObserver", CHarvesterClientTestScripter::AddHarvesterEventObserverL ),
    79         ENTRY( "RemoveHarvesterEventObserver", CHarvesterClientTestScripter::RemoveHarvesterEventObserverL ),
    79         ENTRY( "RemoveHarvesterEventObserver", CHarvesterClientTestScripter::RemoveHarvesterEventObserverL ),
       
    80         ENTRY( "SetUpBlacklist", CHarvesterClientTestScripter::SetUpBlacklistL ),
       
    81         ENTRY( "TearDownBlacklist", CHarvesterClientTestScripter::TearDownBlacklistL ),
       
    82         ENTRY( "AddFileToBlacklist", CHarvesterClientTestScripter::AddFileToBlacklistL ),
       
    83         ENTRY( "CheckBlacklist", CHarvesterClientTestScripter::CheckBlacklistL ),
       
    84         ENTRY( "RemoveFileFromBlacklist", CHarvesterClientTestScripter::RemoveFileFromBlacklistL ),
    80         };
    85         };
    81 
    86 
    82     const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
    87     const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
    83 
    88 
    84     return RunInternalL( KFunctions, count, aItem );
    89     return RunInternalL( KFunctions, count, aItem );
   483 		{
   488 		{
   484 		TInt err = iHc.RemoveHarvesterEventObserver( *this );
   489 		TInt err = iHc.RemoveHarvesterEventObserver( *this );
   485 	    TL( err == KErrNone );
   490 	    TL( err == KErrNone );
   486 		}
   491 		}
   487     
   492     
       
   493     return KErrNone;
       
   494     }
       
   495 
       
   496 // -----------------------------------------------------------------------------
       
   497 // CHarvesterClientTest::SetUpBlacklistL
       
   498 // -----------------------------------------------------------------------------
       
   499 //
       
   500 TInt CHarvesterClientTestScripter::SetUpBlacklistL( CStifItemParser& /*aItem*/ )
       
   501     {
       
   502     _LIT( KMsg1, "Enter SetUpBlacklistL" );
       
   503     iLog->Log( KMsg1 );
       
   504     RDebug::Print( KMsg1 );
       
   505     
       
   506     User::LeaveIfError( iBlacklistClient.Connect() );
       
   507     iBlacklistClient.LoadBlacklistL();
       
   508     iMediaIdUtil = &RMediaIdUtil::GetInstanceL();
       
   509     User::LeaveIfError( iFs.Connect() );
       
   510     
       
   511     _LIT( KMsg2, "Exit SetUpBlacklistL" );
       
   512     iLog->Log( KMsg2 );
       
   513     RDebug::Print( KMsg2 );
       
   514 
       
   515     return KErrNone;
       
   516     }
       
   517 
       
   518 // -----------------------------------------------------------------------------
       
   519 // CHarvesterClientTest::TearDownBlacklistL
       
   520 // -----------------------------------------------------------------------------
       
   521 //
       
   522 TInt CHarvesterClientTestScripter::TearDownBlacklistL( CStifItemParser& /*aItem*/ )
       
   523     {
       
   524     _LIT( KMsg1, "Enter TearDownBlacklistL" );
       
   525     iLog->Log( KMsg1 );
       
   526     RDebug::Print( KMsg1 );
       
   527    
       
   528     iBlacklistClient.CloseDBL();
       
   529     iBlacklistClient.Close();
       
   530     RMediaIdUtil::ReleaseInstance();
       
   531     iMediaIdUtil = NULL;
       
   532     iFs.Close();
       
   533     
       
   534     _LIT( KMsg2, "Exit TearDownBlacklistL" );
       
   535     iLog->Log( KMsg2 );
       
   536     RDebug::Print( KMsg2 );
       
   537 
       
   538     return KErrNone;
       
   539     }
       
   540 
       
   541 // -----------------------------------------------------------------------------
       
   542 // CHarvesterClientTest::AddFileToBlacklistL
       
   543 // -----------------------------------------------------------------------------
       
   544 //
       
   545 TInt CHarvesterClientTestScripter::AddFileToBlacklistL( CStifItemParser& aItem )
       
   546     {
       
   547     _LIT( KMsg1, "Enter AddFileToBlacklistL" );
       
   548     iLog->Log( KMsg1 );
       
   549     RDebug::Print( KMsg1 );
       
   550     
       
   551     TPtrC inputFile;
       
   552     User::LeaveIfError( aItem.GetNextString( inputFile ));
       
   553 
       
   554     TUint32 mediaId( 0 );
       
   555 //    TInt blackListError( KErrNone );
       
   556     TTime modified ( 0 );
       
   557 /*    
       
   558     blackListError = iMediaIdUtil->GetMediaId( inputFile, mediaId );
       
   559     if( blackListError != KErrNone )
       
   560         {
       
   561         return blackListError;
       
   562         }
       
   563     
       
   564     blackListError = iFs.Modified( inputFile, modified );
       
   565     if( blackListError != KErrNone )
       
   566         {
       
   567         return blackListError;
       
   568         }
       
   569 */    
       
   570     TRAPD( err, iBlacklistClient.AddL( inputFile, mediaId, modified ) );
       
   571     if( err != KErrNone )
       
   572         {
       
   573         return err;
       
   574         }
       
   575 
       
   576     _LIT( KMsg2, "Exit AddFileToBlacklistL" );
       
   577     iLog->Log( KMsg2 );
       
   578     RDebug::Print( KMsg2 );
       
   579 
       
   580     return KErrNone;
       
   581     }
       
   582 
       
   583 // -----------------------------------------------------------------------------
       
   584 // CHarvesterClientTest::CheckBlacklistL
       
   585 // -----------------------------------------------------------------------------
       
   586 //
       
   587 TInt CHarvesterClientTestScripter::CheckBlacklistL( CStifItemParser& aItem )
       
   588     {
       
   589     _LIT( KMsg1, "Enter CheckBlacklistL" );
       
   590     iLog->Log( KMsg1 );
       
   591     RDebug::Print( KMsg1 );
       
   592 
       
   593 //    iBlacklistClient.LoadBlacklistL();
       
   594     
       
   595     TPtrC inputFile;
       
   596     User::LeaveIfError( aItem.GetNextString( inputFile ));
       
   597     
       
   598     TUint32 mediaId( 0 );
       
   599 //    TInt blackListError( KErrNone );
       
   600     TTime modified ( 0 );
       
   601 /*    
       
   602     blackListError = iMediaIdUtil->GetMediaId( inputFile, mediaId );
       
   603     if( blackListError != KErrNone )
       
   604         {
       
   605         return blackListError;
       
   606         }
       
   607   
       
   608     blackListError = iFs.Modified( inputFile, modified );
       
   609     if( blackListError != KErrNone )
       
   610         {
       
   611         return blackListError;
       
   612         }
       
   613 */    
       
   614     TBool isBlacklisted( EFalse );
       
   615     TRAP_IGNORE( isBlacklisted = iBlacklistClient.IsBlacklistedL( inputFile, mediaId, modified ) );
       
   616     if( !isBlacklisted )
       
   617         {
       
   618         return KErrNotFound;
       
   619         }
       
   620 
       
   621     _LIT( KMsg2, "Exit CheckBlacklistL" );
       
   622     iLog->Log( KMsg2 );
       
   623     RDebug::Print( KMsg2 );
       
   624 
       
   625     return KErrNone;
       
   626     }
       
   627 
       
   628 // -----------------------------------------------------------------------------
       
   629 // CHarvesterClientTest::RemoveFileFromBlacklistL
       
   630 // -----------------------------------------------------------------------------
       
   631 //
       
   632 TInt CHarvesterClientTestScripter::RemoveFileFromBlacklistL( CStifItemParser& aItem )
       
   633     {
       
   634     _LIT( KMsg1, "Enter CheckBlacklistL" );
       
   635     iLog->Log( KMsg1 );
       
   636     RDebug::Print( KMsg1 );
       
   637     
       
   638     TPtrC inputFile;
       
   639     User::LeaveIfError( aItem.GetNextString( inputFile ));
       
   640     
       
   641     TUint32 mediaId( 0 );
       
   642 //    TInt blackListError( KErrNone );
       
   643     TTime modified ( 0 );
       
   644 /*    
       
   645     blackListError = iMediaIdUtil->GetMediaId( inputFile, mediaId );
       
   646     if( blackListError != KErrNone )
       
   647         {
       
   648         return blackListError;
       
   649         }
       
   650 */    
       
   651     TRAPD( err, iBlacklistClient.RemoveL( inputFile, mediaId ) );
       
   652     if( err != KErrNone )
       
   653         {
       
   654         return err;
       
   655         }
       
   656 
       
   657     _LIT( KMsg2, "Exit CheckBlacklistL" );
       
   658     iLog->Log( KMsg2 );
       
   659     RDebug::Print( KMsg2 );
       
   660 
   488     return KErrNone;
   661     return KErrNone;
   489     }
   662     }
   490 
   663 
   491 // -----------------------------------------------------------------------------
   664 // -----------------------------------------------------------------------------
   492 // CHarvesterClientTest::HarvestingUpdated
   665 // CHarvesterClientTest::HarvestingUpdated