videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTestBlocks.cpp
branchRCL_3
changeset 57 befca0ec475f
parent 56 839377eedc2b
equal deleted inserted replaced
56:839377eedc2b 57:befca0ec475f
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:   ?Description*
    15 */
    15 */
       
    16 
    16 
    17 
    17 // INCLUDE FILES
    18 // INCLUDE FILES
    18 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroyPushL
    19 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroyPushL
    19 #include <e32svr.h>
    20 #include <e32svr.h>
    20 #include <StifParser.h>
    21 #include <StifParser.h>
    21 #include <Stiftestinterface.h>
    22 #include <Stiftestinterface.h>
    22 #include <centralrepository.h>
    23 #include <centralrepository.h>
    23 #include <collate.h>
    24 #include <collate.h>
    24 
    25 
    25 #include "VCXTestLog.h"
    26 #include "VCXTestLog.h"
    26 #include "VCXMyVideosTestUtils.h"
    27 #include "VCXTestCommon.h"
    27 #include "CVcxTestActiveWait.h"
    28 #include "CIptvTestActiveWait.h"
    28 #include "CVcxTestTimer.h"
    29 #include "CIptvTestTimer.h"
       
    30 #include "VCXTestStatsKeeper.h"
    29 
    31 
    30 #include "VCXMyVideosCollectionPluginTest.h"
    32 #include "VCXMyVideosCollectionPluginTest.h"
    31 #include "VCXMyVideosCollectionPluginTester.h"
    33 #include "VCXMyVideosCollectionPluginTester.h"
    32 #include "VCXMyVideosTestUtils.h"
    34 #include "VCXMyVideosTestCommon.h"
       
    35 #include "VCXMyVideosTestDlWatcher.h"
       
    36 #include "VCXMyVideosTestServiceEmu.h"
    33 #include "VCXTestMdsDbModifier.h"
    37 #include "VCXTestMdsDbModifier.h"
    34 #include "VCXMyVideosTestCommon.h"
       
    35 
    38 
    36 #include <mpxmedia.h>
    39 #include <mpxmedia.h>
    37 #include <mpxmediageneraldefs.h>
    40 #include <mpxmediageneraldefs.h>
    38 #include <mpxmediageneralextdefs.h>
    41 #include <mpxmediageneralextdefs.h>
    39 
    42 
    40 #include "vcxmyvideosdefs.h"
       
    41 #include "vcxmyvideosuids.h"
    43 #include "vcxmyvideosuids.h"
    42 
    44 
    43 // CONSTANTS
    45 // CONSTANTS
    44 
    46 
    45 const TInt KVcxTestFileSize3GB = -999;
    47 const TInt KVcxTestFileSize3GB = -999;
    46 
    48 
    47 _LIT(KAbout2050CharsString, "asdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjai");
       
    48 _LIT(KVcxTestEmptyString, "");
       
    49 
       
    50 _LIT(KStifScriptInvalidRequest, "InvalidRequest");
       
    51 _LIT(KStifScriptEmptyString, "EmptyString");
       
    52 _LIT(KStifScript2KString, "2KString");
       
    53 
       
    54 // MACROS
    49 // MACROS
       
    50 #define VCXMVTEST_ERR(err) ( iStatsEnabled ) ? KErrNone : err 
    55 
    51 
    56 // MODULE DATA STRUCTURES
    52 // MODULE DATA STRUCTURES
    57 
    53 
    58 // ============================ MEMBER FUNCTIONS ===============================
    54 // ============================ MEMBER FUNCTIONS ===============================
    59 
    55 
   108             }
   104             }
   109         }
   105         }
   110 
   106 
   111     iSideloadFolders.ResetAndDestroy();
   107     iSideloadFolders.ResetAndDestroy();
   112 
   108 
   113     delete iTestUtils;
   109     delete iTestCommon;
   114     iTestUtils = NULL;
   110     iTestCommon = NULL;
   115 
   111 
   116 #ifdef __WINSCW__
   112 #ifdef __WINSCW__
   117     iClient.Close();
   113     iClient.Close();
   118 #endif // __WINSCW__
   114 #endif // __WINSCW__
   119 
   115 
   146         }
   142         }
   147 
   143 
   148     delete iMpxMedia;
   144     delete iMpxMedia;
   149     iMpxMedia = NULL;
   145     iMpxMedia = NULL;
   150     
   146     
       
   147     delete iServiceEmu;
       
   148     iServiceEmu = NULL;
       
   149     
   151     delete iMdsDbModifier;
   150     delete iMdsDbModifier;
   152     iMdsDbModifier = NULL;
   151     iMdsDbModifier = NULL;
   153 
   152 
   154     delete iFileMan;
   153     delete iFileMan;
   155     iFileMan = NULL;
   154     iFileMan = NULL;
   156 
   155 
   157     iFs.Close();
   156     iFs.Close();
       
   157     
       
   158     delete iStats;
       
   159     iStats = NULL;    
   158 
   160 
   159     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::Delete <----------");
   161     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::Delete <----------");
   160     }
   162     }
   161 
   163 
   162 // -----------------------------------------------------------------------------
   164 // -----------------------------------------------------------------------------
   173         // Copy this line for every implemented function.
   175         // Copy this line for every implemented function.
   174         // First string is the function name used in TestScripter script file.
   176         // First string is the function name used in TestScripter script file.
   175         // Second is the actual implementation member function.
   177         // Second is the actual implementation member function.
   176         ENTRY( "Create", CVCXMyVideosCollectionPluginTest::CreateL ),
   178         ENTRY( "Create", CVCXMyVideosCollectionPluginTest::CreateL ),
   177         
   179         
       
   180         ENTRY( "EnableStats", CVCXMyVideosCollectionPluginTest::EnableStatsL ),
       
   181         ENTRY( "SetPreferredMemory", CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL ),
   178         ENTRY( "SetSortingOrder", CVCXMyVideosCollectionPluginTest::SetSortingOrderL ),
   182         ENTRY( "SetSortingOrder", CVCXMyVideosCollectionPluginTest::SetSortingOrderL ),
   179         ENTRY( "SetAutomaticRefresh", CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh ),
   183         ENTRY( "SetAutomaticRefresh", CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh ),
   180         ENTRY( "SetQuietMode", CVCXMyVideosCollectionPluginTest::SetQuietMode ),
   184         ENTRY( "SetQuietMode", CVCXMyVideosCollectionPluginTest::SetQuietMode ),
   181         ENTRY( "CoolDown", CVCXMyVideosCollectionPluginTest::CoolDownL ),
   185         ENTRY( "CoolDown", CVCXMyVideosCollectionPluginTest::CoolDownL ),
       
   186         ENTRY( "DisableDownloadCheck", CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL ),
   182         ENTRY( "SetFileCheck", CVCXMyVideosCollectionPluginTest::SetFileCheckL ),
   187         ENTRY( "SetFileCheck", CVCXMyVideosCollectionPluginTest::SetFileCheckL ),
   183         ENTRY( "SetUseCopiedMedias", CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL ),
   188         ENTRY( "SetAutoResume", CVCXMyVideosCollectionPluginTest::SetAutoResumeL ),
   184 
   189 
   185         ENTRY( "OpenCollection", CVCXMyVideosCollectionPluginTest::OpenCollectionL ),
   190         ENTRY( "OpenCollection", CVCXMyVideosCollectionPluginTest::OpenCollectionL ),
   186         ENTRY( "OpenLevel", CVCXMyVideosCollectionPluginTest::OpenLevelL ),
   191         ENTRY( "OpenLevel", CVCXMyVideosCollectionPluginTest::OpenLevelL ),
   187         ENTRY( "OpenLevelByIndex", CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL ),
       
   188         ENTRY( "RefreshContents", CVCXMyVideosCollectionPluginTest::RefreshContentsL ),
   192         ENTRY( "RefreshContents", CVCXMyVideosCollectionPluginTest::RefreshContentsL ),
   189         ENTRY( "GetMediasByMpxId", CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL ),
   193         ENTRY( "GetMediasByMpxId", CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL ),
   190         ENTRY( "CloseLevel", CVCXMyVideosCollectionPluginTest::CloseLevelL ),
   194         ENTRY( "CloseLevel", CVCXMyVideosCollectionPluginTest::CloseLevelL ),
   191         
   195         
   192         ENTRY( "GetMediaFullDetails", CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL ),
   196         ENTRY( "GetMediaFullDetails", CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL ),
   193         ENTRY( "GetMediaFullDetailsByMpxId", CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL ),
   197         ENTRY( "GetMediaFullDetailsByMpxId", CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL ),
   194         ENTRY( "GetAllMediaFullDetails", CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL ),
   198         ENTRY( "GetAllMediaFullDetails", CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL ),
   195         ENTRY( "SetMediaDetail", CVCXMyVideosCollectionPluginTest::SetMediaDetailL ),
   199         ENTRY( "SetMediaDetail", CVCXMyVideosCollectionPluginTest::SetMediaDetailL ),
   196         ENTRY( "CheckMediaDetail", CVCXMyVideosCollectionPluginTest::CheckMediaDetailL ),
   200         ENTRY( "CheckMediaDetail", CVCXMyVideosCollectionPluginTest::CheckMediaDetailL ),
   197         ENTRY( "CheckAlbumCount", CVCXMyVideosCollectionPluginTest::CheckAlbumCountL ),
       
   198         ENTRY( "CheckMediaCount", CVCXMyVideosCollectionPluginTest::CheckMediaCountL ),
   201         ENTRY( "CheckMediaCount", CVCXMyVideosCollectionPluginTest::CheckMediaCountL ),
   199         ENTRY( "CheckMinimumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL ),
   202         ENTRY( "CheckMinimumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL ),
   200         ENTRY( "CheckMaximumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL ),
   203         ENTRY( "CheckMaximumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL ),
       
   204         ENTRY( "CheckDownloadCount", CVCXMyVideosCollectionPluginTest::CheckDownloadCountL ),
   201         
   205         
   202         ENTRY( "CreateCopyOfMedia", CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL ),
   206         ENTRY( "CreateCopyOfMedia", CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL ),
   203         ENTRY( "CreateEmptyMedia", CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL ),
   207         ENTRY( "CreateEmptyMedia", CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL ),
   204         ENTRY( "AddMedia", CVCXMyVideosCollectionPluginTest::AddMediaL ),
   208         ENTRY( "AddMedia", CVCXMyVideosCollectionPluginTest::AddMediaL ),
   205         ENTRY( "SetMedia", CVCXMyVideosCollectionPluginTest::SetMediaL ),
   209         ENTRY( "SetMedia", CVCXMyVideosCollectionPluginTest::SetMediaL ),
   206         ENTRY( "OutsideMediaUpdate", CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL ),
   210         ENTRY( "OutsideMediaUpdate", CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL ),
   207         ENTRY( "CancelNextOperation", CVCXMyVideosCollectionPluginTest::CancelNextOperationL ),
   211         ENTRY( "CancelNextOperation", CVCXMyVideosCollectionPluginTest::CancelNextOperationL ),
   208         
   212         
   209         ENTRY( "DeleteFileOfMedia", CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL ),
   213         ENTRY( "DeleteFileOfMedia", CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL ),
   210         ENTRY( "DeleteFilesOfAllMedias", CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL ),
   214         ENTRY( "DeleteFilesOfAllMedias", CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL ),
   211         ENTRY( "CreateAlbum", CVCXMyVideosCollectionPluginTest::CreateAlbumL ),
       
   212         ENTRY( "RemoveMedia", CVCXMyVideosCollectionPluginTest::RemoveMediaL ),
   215         ENTRY( "RemoveMedia", CVCXMyVideosCollectionPluginTest::RemoveMediaL ),
   213         ENTRY( "RemoveAllMedia", CVCXMyVideosCollectionPluginTest::RemoveAllMediaL ),
   216         ENTRY( "RemoveAllMedia", CVCXMyVideosCollectionPluginTest::RemoveAllMediaL ),
   214         ENTRY( "MoveMedia", CVCXMyVideosCollectionPluginTest::MoveMediaL ),
   217         ENTRY( "MoveMedia", CVCXMyVideosCollectionPluginTest::MoveMediaL ),
   215         ENTRY( "MoveMedias", CVCXMyVideosCollectionPluginTest::MoveMediasL ),
   218         ENTRY( "MoveMedias", CVCXMyVideosCollectionPluginTest::MoveMediasL ),
   216         ENTRY( "CancelMove", CVCXMyVideosCollectionPluginTest::CancelMoveL ),
   219         ENTRY( "CancelMove", CVCXMyVideosCollectionPluginTest::CancelMoveL ),
   219         ENTRY( "CancelCopy", CVCXMyVideosCollectionPluginTest::CancelCopyL ),
   222         ENTRY( "CancelCopy", CVCXMyVideosCollectionPluginTest::CancelCopyL ),
   220         ENTRY( "DeleteMedia", CVCXMyVideosCollectionPluginTest::DeleteMediaL ),
   223         ENTRY( "DeleteMedia", CVCXMyVideosCollectionPluginTest::DeleteMediaL ),
   221         ENTRY( "DeleteMedias", CVCXMyVideosCollectionPluginTest::DeleteMediasL ),
   224         ENTRY( "DeleteMedias", CVCXMyVideosCollectionPluginTest::DeleteMediasL ),
   222         ENTRY( "CancelDelete", CVCXMyVideosCollectionPluginTest::CancelDeleteL ),
   225         ENTRY( "CancelDelete", CVCXMyVideosCollectionPluginTest::CancelDeleteL ),
   223         
   226         
   224         ENTRY( "CreateAlbum", CVCXMyVideosCollectionPluginTest::CreateAlbumL ),
       
   225         ENTRY( "DeleteAlbums", CVCXMyVideosCollectionPluginTest::DeleteAlbumsL ),
       
   226         ENTRY( "DeleteAllAlbums", CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL ),
       
   227         ENTRY( "AddMediasToAlbum", CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL ),
       
   228         ENTRY( "RemoveMediasFromAlbum", CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL ),
       
   229         ENTRY( "RenameAlbum", CVCXMyVideosCollectionPluginTest::RenameAlbumL ),
       
   230         ENTRY( "CheckAlbumExists", CVCXMyVideosCollectionPluginTest::CheckAlbumExistsL ),
       
   231         
       
   232         ENTRY( "CreateVideoFile", CVCXMyVideosCollectionPluginTest::CreateVideoFileL ),
   227         ENTRY( "CreateVideoFile", CVCXMyVideosCollectionPluginTest::CreateVideoFileL ),
   233         ENTRY( "CreateVideoFileNoWait", CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ),
   228         ENTRY( "CreateVideoFileNoWait", CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ),
   234         ENTRY( "EnsureDriveForVideos", CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL ),
   229         ENTRY( "EnsureDriveForVideos", CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL ),
   235         ENTRY( "EmptySideloadFolders", CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL ),
   230         ENTRY( "EmptySideloadFolders", CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL ),
   236         ENTRY( "SetDeleteSideloadedVideos", CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos ),
   231         ENTRY( "SetDeleteSideloadedVideos", CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos ),
   237         
   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 ),
   238         ENTRY( "WaitForMessage", CVCXMyVideosCollectionPluginTest::WaitForMessageL ),
   246         ENTRY( "WaitForMessage", CVCXMyVideosCollectionPluginTest::WaitForMessageL ),
   239         ENTRY( "WaitForAnyMessage", CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL ),
   247         ENTRY( "WaitForAnyMessage", CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL ),
   240         ENTRY( "WaitForMessages", CVCXMyVideosCollectionPluginTest::WaitForMessagesL ),
   248         ENTRY( "WaitForMessages", CVCXMyVideosCollectionPluginTest::WaitForMessagesL ),
   241 
   249 
   242         };
   250         };
   247     return RunInternalL( KFunctions, count, aItem );
   255     return RunInternalL( KFunctions, count, aItem );
   248 
   256 
   249     }
   257     }
   250 
   258 
   251 // -----------------------------------------------------------------------------
   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 // -----------------------------------------------------------------------------
   252 // CVCXMyVideosCollectionPluginTest::CreateL
   288 // CVCXMyVideosCollectionPluginTest::CreateL
   253 // -----------------------------------------------------------------------------
   289 // -----------------------------------------------------------------------------
   254 //
   290 //
   255 TInt CVCXMyVideosCollectionPluginTest::CreateL( CStifItemParser& aItem )
   291 TInt CVCXMyVideosCollectionPluginTest::CreateL( CStifItemParser& aItem )
   256     {
   292     {
   265     User::LeaveIfError( iFs.Connect() );
   301     User::LeaveIfError( iFs.Connect() );
   266     iFileMan = CFileMan::NewL( iFs );
   302     iFileMan = CFileMan::NewL( iFs );
   267 
   303 
   268     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
   304     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
   269 
   305 
   270     iTestUtils = CVCXMyVideosTestUtils::NewL();
   306     iTestCommon = CVCXTestCommon::NewL();
   271     iTester = CVCXMyVideosCollectionPluginTester::NewL( this, iTestUtils );
   307     iStats = CVCXTestStatsKeeper::NewL();
   272     iActiveWait = CVcxTestActiveWait::NewL();
   308     iTester = CVCXMyVideosCollectionPluginTester::NewL( this, iTestCommon, iStats );
   273     iActiveWaitBlocking = CVcxTestActiveWait::NewL();
   309     iActiveWait = CIptvTestActiveWait::NewL();
   274     iTimeoutTimer = CVcxTestTimer::NewL(*this, 0);
   310     iActiveWaitBlocking = CIptvTestActiveWait::NewL();
   275     iCoolDownTimer = CVcxTestTimer::NewL(*this, 1);   
   311     iTimeoutTimer = CIptvTestTimer::NewL(*this, 0);
       
   312     iCoolDownTimer = CIptvTestTimer::NewL(*this, 1);   
   276     
   313     
   277 #ifdef __WINSCW__
   314 #ifdef __WINSCW__
   278     TInt err = iClient.Connect();
   315     TInt err = iClient.Connect();
   279     if( KErrNone != err )
   316     if( KErrNone != err )
   280         {
   317         {
   281         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Could not start MDS server session! Err: %d", err);
   318         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Could not start MDS server session! Err: %d", err);
   282         }
   319         }
   283 #endif // __WINSCW__
   320 #endif // __WINSCW__
   284 
   321 
       
   322     iAutoResume = ETrue;
       
   323 
       
   324     iTester->SetAutoResume( iAutoResume );
       
   325 
       
   326     iServiceEmu = CVCXMyVideosTestServiceEmu::NewL();
       
   327 
   285     iMdsDbModifier = CVCXTestMdsDbModifier::NewL();
   328     iMdsDbModifier = CVCXTestMdsDbModifier::NewL();
   286 
   329 
   287     iCurrentSortOrder = EVcxMyVideosSortingNone;
   330     iCurrentSortOrder = EVcxMyVideosSortingNone;
   288 
   331 
   289     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateL <----------");
   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 <----------");
   290     return KErrNone;
   367     return KErrNone;
   291     }
   368     }
   292 
   369 
   293 // -----------------------------------------------------------------------------
   370 // -----------------------------------------------------------------------------
   294 // CVCXMyVideosCollectionPluginTest::SetSortingOrderL
   371 // CVCXMyVideosCollectionPluginTest::SetSortingOrderL
   318     TRAP( err, DoTotalRefreshL() );
   395     TRAP( err, DoTotalRefreshL() );
   319 
   396 
   320     iCurrentSortOrder = value;
   397     iCurrentSortOrder = value;
   321 
   398 
   322     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetSortingOrderL <----------");
   399     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetSortingOrderL <----------");
   323     return err;
   400     return VCXMVTEST_ERR( err );
   324     }
   401     }
   325 
   402 
   326 // -----------------------------------------------------------------------------
   403 // -----------------------------------------------------------------------------
   327 // CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh
   404 // CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh
   328 // -----------------------------------------------------------------------------
   405 // -----------------------------------------------------------------------------
   344         {
   421         {
   345         iTester->SetAutomaticRefresh( static_cast<TBool>(value) );
   422         iTester->SetAutomaticRefresh( static_cast<TBool>(value) );
   346         }
   423         }
   347 
   424 
   348     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh <----------");
   425     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh <----------");
   349     return err;
   426     return VCXMVTEST_ERR( err );
   350     }
   427     }
   351 
   428 
   352 // -----------------------------------------------------------------------------
   429 // -----------------------------------------------------------------------------
   353 // CVCXMyVideosCollectionPluginTest::SetQuietMode
   430 // CVCXMyVideosCollectionPluginTest::SetQuietMode
   354 // -----------------------------------------------------------------------------
   431 // -----------------------------------------------------------------------------
   370         {
   447         {
   371         iTester->SetQuietMode( static_cast<TBool>(value) );
   448         iTester->SetQuietMode( static_cast<TBool>(value) );
   372         }
   449         }
   373 
   450 
   374     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetQuietMode <----------");
   451     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetQuietMode <----------");
   375     return err;
   452     return VCXMVTEST_ERR( err );
   376     }
   453     }
   377 
   454 
   378 // -----------------------------------------------------------------------------
   455 // -----------------------------------------------------------------------------
   379 // CVcxMyVideosApiTest::CoolDownL
   456 // CIptvMyVideosApiTest::CoolDownL
   380 // -----------------------------------------------------------------------------
   457 // -----------------------------------------------------------------------------
   381 //
   458 //
   382 TInt CVCXMyVideosCollectionPluginTest::CoolDownL( CStifItemParser& /* aItem */ )
   459 TInt CVCXMyVideosCollectionPluginTest::CoolDownL( CStifItemParser& /* aItem */ )
   383     {
   460     {
   384     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CoolDownL ---------->");
   461     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CoolDownL ---------->");
   403     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CoolDownL <----------");
   480     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CoolDownL <----------");
   404     return KErrNone;
   481     return KErrNone;
   405     }
   482     }
   406 
   483 
   407 // -----------------------------------------------------------------------------
   484 // -----------------------------------------------------------------------------
   408 // CVcxMyVideosApiTest::SetFileCheckL
   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
   409 // -----------------------------------------------------------------------------
   501 // -----------------------------------------------------------------------------
   410 //
   502 //
   411 TInt CVCXMyVideosCollectionPluginTest::SetFileCheckL( CStifItemParser& aItem )
   503 TInt CVCXMyVideosCollectionPluginTest::SetFileCheckL( CStifItemParser& aItem )
   412     {
   504     {
   413     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetFileCheckL");
   505     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetFileCheckL");
   419     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetFileCheckL");
   511     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetFileCheckL");
   420     return KErrNone;
   512     return KErrNone;
   421     }
   513     }
   422 
   514 
   423 // -----------------------------------------------------------------------------
   515 // -----------------------------------------------------------------------------
   424 // CVcxMyVideosApiTest::SetUseCopiedMediasL
   516 // CIptvMyVideosApiTest::SetAutoResumeL
   425 // -----------------------------------------------------------------------------
   517 // -----------------------------------------------------------------------------
   426 //
   518 //
   427 TInt CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL( CStifItemParser& aItem )
   519 TInt CVCXMyVideosCollectionPluginTest::SetAutoResumeL( CStifItemParser& aItem )
   428     {
   520     {
   429     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL");
   521     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetAutoResumeL ---------->");
   430 
   522     // Print to UI
   431     TInt value(0);
   523     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
   432     User::LeaveIfError( aItem.GetNextInt( value ) );
   524     _LIT( KWhere, "In SetAutoResumeL" );
   433     TBool set = static_cast<TBool>(value);
   525     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
   434     iTester->SetUseCopiedMediasL( set );
   526     // Print to log file
   435 
   527     iLog->Log( KWhere );
   436     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL");
   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 <----------");
   437     return KErrNone;
   538     return KErrNone;
   438     }
   539     }
   439 
   540 
   440 // -----------------------------------------------------------------------------
   541 // -----------------------------------------------------------------------------
   441 // CVCXMyVideosCollectionPluginTest::OpenCollectionL
   542 // CVCXMyVideosCollectionPluginTest::OpenCollectionL
   476 
   577 
   477     if( err != KErrNone )
   578     if( err != KErrNone )
   478         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   579         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   479 
   580 
   480     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenCollectionL <----------");
   581     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenCollectionL <----------");
   481     return err;
   582     return VCXMVTEST_ERR( err );
   482     }
   583     }
   483 
   584 
   484 // -----------------------------------------------------------------------------
   585 // -----------------------------------------------------------------------------
   485 // CVCXMyVideosCollectionPluginTest::OpenLevelL
   586 // CVCXMyVideosCollectionPluginTest::OpenLevelL
   486 // -----------------------------------------------------------------------------
   587 // -----------------------------------------------------------------------------
   487 //
   588 //
   488 TInt CVCXMyVideosCollectionPluginTest::OpenLevelL( CStifItemParser& aItem )
   589 TInt CVCXMyVideosCollectionPluginTest::OpenLevelL( CStifItemParser& aItem )
   489     {
   590     {
   490     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::OpenLevelL ---------->");
   591     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::OpenLevelL ---------->");
   491     // Print to UI
       
   492     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
   493     _LIT( KWhere, "In OpenLevelL" );
       
   494     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
   495     // Print to log file
       
   496     iLog->Log( KWhere );
       
   497 
       
   498     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
   499     
       
   500     TPtrC name;
       
   501     User::LeaveIfError( aItem.GetNextString( name ) );
       
   502     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: levelName: %S", &name);
       
   503 
       
   504     iLastReceivedMessage = -1;
       
   505 
       
   506     TInt err( KErrNotReady );
       
   507     if( iTester )
       
   508         {
       
   509         TRAP( err, iTester->OpenLevelL( name ) );
       
   510         }
       
   511 
       
   512     if( err != KErrNone )
       
   513         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
       
   514 
       
   515     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelL <----------");
       
   516     return err;
       
   517     }
       
   518 
       
   519 // -----------------------------------------------------------------------------
       
   520 // CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL
       
   521 // -----------------------------------------------------------------------------
       
   522 //
       
   523 TInt CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL( CStifItemParser& aItem )
       
   524     {
       
   525     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL ---------->");
       
   526     // Print to UI
   592     // Print to UI
   527     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
   593     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
   528     _LIT( KWhere, "In OpenLevelL" );
   594     _LIT( KWhere, "In OpenLevelL" );
   529     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
   595     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
   530     // Print to log file
   596     // Print to log file
   544         }
   610         }
   545 
   611 
   546     if( err != KErrNone )
   612     if( err != KErrNone )
   547         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   613         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   548 
   614 
   549     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL <----------");
   615     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelL <----------");
   550     return err;
   616     return VCXMVTEST_ERR( err );
   551     }
   617     }
   552 
   618 
   553 // -----------------------------------------------------------------------------
   619 // -----------------------------------------------------------------------------
   554 // CVCXMyVideosCollectionPluginTest::CloseLevelL
   620 // CVCXMyVideosCollectionPluginTest::CloseLevelL
   555 // -----------------------------------------------------------------------------
   621 // -----------------------------------------------------------------------------
   574 
   640 
   575     if( err != KErrNone )
   641     if( err != KErrNone )
   576         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   642         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   577 
   643 
   578     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CloseLevelL <----------");
   644     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CloseLevelL <----------");
   579     return err;
   645     return VCXMVTEST_ERR( err );
   580     }
   646     }
   581 
   647 
   582 // -----------------------------------------------------------------------------
   648 // -----------------------------------------------------------------------------
   583 // CVCXMyVideosCollectionPluginTest::RefreshContentsL
   649 // CVCXMyVideosCollectionPluginTest::RefreshContentsL
   584 // -----------------------------------------------------------------------------
   650 // -----------------------------------------------------------------------------
   605 
   671 
   606     if( err != KErrNone )
   672     if( err != KErrNone )
   607         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   673         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   608 
   674 
   609     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RefreshContentsL <----------");
   675     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RefreshContentsL <----------");
   610     return err;
   676     return VCXMVTEST_ERR( err );
   611     }
   677     }
   612 
   678 
   613 // -----------------------------------------------------------------------------
   679 // -----------------------------------------------------------------------------
   614 // CVCXMyVideosCollectionPluginTest::RefreshContentsL
   680 // CVCXMyVideosCollectionPluginTest::RefreshContentsL
   615 // -----------------------------------------------------------------------------
   681 // -----------------------------------------------------------------------------
   652 
   718 
   653     if( err != KErrNone )
   719     if( err != KErrNone )
   654         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   720         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   655 
   721 
   656     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL <----------");
   722     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL <----------");
   657     return err;
   723     return VCXMVTEST_ERR( err );
   658     }
   724     }
   659 
   725 
   660 // -----------------------------------------------------------------------------
   726 // -----------------------------------------------------------------------------
   661 // CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL
   727 // CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL
   662 // -----------------------------------------------------------------------------
   728 // -----------------------------------------------------------------------------
   708         }
   774         }
   709     
   775     
   710     messages.Reset();
   776     messages.Reset();
   711 
   777 
   712     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL <----------");
   778     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL <----------");
   713     return err;
   779     return VCXMVTEST_ERR( err );
   714     }
   780     }
   715 
   781 
   716 // -----------------------------------------------------------------------------
   782 // -----------------------------------------------------------------------------
   717 // CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL
   783 // CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL
   718 // -----------------------------------------------------------------------------
   784 // -----------------------------------------------------------------------------
   775         }
   841         }
   776     
   842     
   777     messages.Reset();
   843     messages.Reset();
   778 
   844 
   779     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL <----------");
   845     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL <----------");
   780     return err;
   846     return VCXMVTEST_ERR( err );
   781     }
   847     }
   782 
   848 
   783 // -----------------------------------------------------------------------------
   849 // -----------------------------------------------------------------------------
   784 // CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL
   850 // CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL
   785 // -----------------------------------------------------------------------------
   851 // -----------------------------------------------------------------------------
   808         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   874         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
   809 
   875 
   810     iLastReceivedMessage = -1;
   876     iLastReceivedMessage = -1;
   811 
   877 
   812     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL <----------");
   878     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL <----------");
   813     return err;
   879     return VCXMVTEST_ERR( err );
   814     }
   880     }
   815 
   881 
   816 // -----------------------------------------------------------------------------
   882 // -----------------------------------------------------------------------------
   817 // CVCXMyVideosCollectionPluginTest::CheckMediaDetailL
   883 // CVCXMyVideosCollectionPluginTest::CheckMediaDetailL
   818 // -----------------------------------------------------------------------------
   884 // -----------------------------------------------------------------------------
   835 
   901 
   836     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
   902     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
   837 
   903 
   838     TInt drive(0);
   904     TInt drive(0);
   839     User::LeaveIfError( GetDriveParam( aItem, drive ) );
   905     User::LeaveIfError( GetDriveParam( aItem, drive ) );
   840     
   906 
   841     // Get the media object to be checked.
   907     TInt itemIndex(0);
   842     
   908     User::LeaveIfError( aItem.GetNextInt( itemIndex ) );
   843     TPtrC itemIndexOrName;
   909     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: item index: %d", itemIndex);
   844     User::LeaveIfError( aItem.GetNextString( itemIndexOrName ) );
   910 
   845     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: item index or name: %S", &itemIndexOrName);
   911     if( itemIndex < 0 || itemIndex >= iTester->GetMediaCount() )
   846 
   912         {
   847     TLex lex( itemIndexOrName );
   913         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", itemIndex);
   848     TInt itemIndex( -1 );
       
   849     if( lex.Val( itemIndex ) == KErrNone )
       
   850         {
       
   851         if( itemIndex < 0 || itemIndex >= iTester->GetMediaCount() )
       
   852             {
       
   853             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", itemIndex);
       
   854             User::Leave( KErrArgument );
       
   855             }
       
   856         }
       
   857     else
       
   858         {
       
   859         itemIndex = iTester->GetIndexOfMediaWithNameL( itemIndexOrName );
       
   860         }
       
   861     
       
   862     if( itemIndex == KErrNotFound )
       
   863         {
       
   864         User::Leave( KErrArgument );
   914         User::Leave( KErrArgument );
   865         }
   915         }
   866 
   916 
   867     // Attribute to be checked
       
   868     
       
   869     TInt mpxAttributeMappingId(0);
   917     TInt mpxAttributeMappingId(0);
   870     User::LeaveIfError( aItem.GetNextInt( mpxAttributeMappingId ) );
   918     User::LeaveIfError( aItem.GetNextInt( mpxAttributeMappingId ) );
   871 
   919 
   872     // It's type.
       
   873     
       
   874     TVcxTestMediaAttributeType type;
   920     TVcxTestMediaAttributeType type;
   875     TMPXAttributeData mpxMediaAttribute;
   921     TMPXAttributeData mpxMediaAttribute;
   876     User::LeaveIfError( MapMpxMediaAttribute(
   922     User::LeaveIfError( MapMpxMediaAttribute(
   877             static_cast<TVcxTestMediaAttributeIdMapping>(mpxAttributeMappingId),
   923             static_cast<TVcxTestMediaAttributeIdMapping>(mpxAttributeMappingId),
   878             mpxMediaAttribute, type ) );
   924             mpxMediaAttribute, type ) );
   879     
   925     
   880     // Get the media to be checked.
   926     
   881     
   927     CMPXMedia* media( NULL );        
   882     CMPXMedia* media( NULL );
       
   883     TRAP( err, media = iTester->GetMediaL( drive, itemIndex ) );    
   928     TRAP( err, media = iTester->GetMediaL( drive, itemIndex ) );    
   884     
   929     
   885     // If attribute is not supported, fetch full media details.
   930     // If attribute is not supported, fetch full media details.
   886     if( media && !media->IsSupported( mpxMediaAttribute ) )
   931     if( media && !media->IsSupported( mpxMediaAttribute ) )
   887         {
   932         {
   898         }
   943         }
   899 
   944 
   900     if( err != KErrNone )
   945     if( err != KErrNone )
   901         {
   946         {
   902         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------");
   947         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------");
   903         return err;
   948         return VCXMVTEST_ERR( err );
   904         }
   949         }
   905 
   950 
   906     if( !media->IsSupported( mpxMediaAttribute ) )
   951     if( !media->IsSupported( mpxMediaAttribute ) )
   907         {
   952         {
   908         VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error: iAttributeId: %d, iContentId: %d is not supported.",
   953         VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: error: iAttributeId: %d, iContentId: %d is not supported.",
   909                 mpxMediaAttribute.iAttributeId == 0, mpxMediaAttribute.iContentId);
   954                 mpxMediaAttribute.iAttributeId == 0, mpxMediaAttribute.iContentId);
   910 
   955 
   911         iTester->PrintMPXMediaL( *media, ETrue );
   956         iTester->PrintMPXMediaL( *media, ETrue );
   912         
   957         
   913         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <---------");
   958         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <---------");
   914         return KErrNotSupported;
   959         return VCXMVTEST_ERR( KErrNotSupported );
   915         }
   960         }
   916 
   961 
   917     if( type == EVcxTestMediaAttributeTypeString )
   962     if( type == EVcxTestMediaAttributeTypeString )
   918         {
   963         {
   919         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type text");
   964         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Getting attribute of type text");
  1199         {
  1244         {
  1200         TRAP_IGNORE( iTester->PrintMediasL( NULL, EFalse, _L("Videos") ) );
  1245         TRAP_IGNORE( iTester->PrintMediasL( NULL, EFalse, _L("Videos") ) );
  1201         }
  1246         }
  1202 
  1247 
  1203     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------");
  1248     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------");
  1204     return err;
  1249     return VCXMVTEST_ERR( err );
  1205     }
  1250     }
  1206 
  1251 
  1207 // -----------------------------------------------------------------------------
  1252 // -----------------------------------------------------------------------------
  1208 // CVCXMyVideosCollectionPluginTest::SetItemDetailsL
  1253 // CVCXMyVideosCollectionPluginTest::SetItemDetailsL
  1209 // -----------------------------------------------------------------------------
  1254 // -----------------------------------------------------------------------------
  1399         iMpxMedia->SetTObjectValueL<TUint32>( mpxMediaAttribute, value );
  1444         iMpxMedia->SetTObjectValueL<TUint32>( mpxMediaAttribute, value );
  1400         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value);
  1445         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Set to %d", value);
  1401         }
  1446         }
  1402 
  1447 
  1403     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaDetailL <----------");
  1448     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaDetailL <----------");
  1404     return err;
  1449     return VCXMVTEST_ERR( err );
  1405     }
  1450     }
  1406 
  1451 
  1407 // -----------------------------------------------------------------------------
  1452 // -----------------------------------------------------------------------------
  1408 // CVcxMyVideosApiTest::CheckAlbumCountL
  1453 // CIptvMyVideosApiTest::CheckMediaCountL
  1409 // -----------------------------------------------------------------------------
  1454 // -----------------------------------------------------------------------------
  1410 //
  1455 //
  1411 TInt CVCXMyVideosCollectionPluginTest::CheckAlbumCountL( CStifItemParser& aItem )
  1456 TInt CVCXMyVideosCollectionPluginTest::CheckMediaCountL( CStifItemParser& aItem )
  1412     {
  1457     {
  1413     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckAlbumCountL ---------->");
  1458     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediaCountL ---------->");
  1414     // Print to UI
  1459     // Print to UI
  1415     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
  1460     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
  1416     _LIT( KWhere, "In CheckAlbumCountL" );
  1461     _LIT( KWhere, "In CheckMediaCountL" );
  1417     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
  1462     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
  1418     // Print to log file
  1463     // Print to log file
  1419     iLog->Log( KWhere );
  1464     iLog->Log( KWhere );
  1420 
  1465 
  1421     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
  1466     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
  1422     
  1467     
  1423     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  1468     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  1469 
       
  1470     TInt drive(0);
       
  1471     User::LeaveIfError( GetDriveParam( aItem, drive ) );
  1424 
  1472 
  1425     TInt expectedCount(0);
  1473     TInt expectedCount(0);
  1426     User::LeaveIfError(aItem.GetNextInt(expectedCount));
  1474     User::LeaveIfError(aItem.GetNextInt(expectedCount));
  1427 
  1475 
  1428     // File check
  1476     TRAPD( err, CheckMediasL( expectedCount, drive, 0 ) );
  1429     TInt videoCount = iTester->GetMediaCount();
  1477     
  1430 
  1478     if( err != KErrNone ) 
  1431     // attribute check that they are in allowed values
  1479         {
  1432 
  1480         iTester->PrintMediasL( NULL, EFalse, _L("Videos") );
  1433     int err(KErrNone);
  1481         }
  1434     int actualCount(0);
  1482 
  1435     
  1483     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaCountL <----------");
  1436     for( TInt i = videoCount-1; i >= 0; i-- )
  1484     return VCXMVTEST_ERR( err );
  1437         {
  1485     }
  1438         CMPXMedia* media = iTester->GetMediaL( -1, i );
  1486 
  1439 
  1487 // -----------------------------------------------------------------------------
  1440         // Skip categories with empty names, they are for photos.
  1488 // CIptvMyVideosApiTest::CheckMinimumMediaCountL
  1441         if( !media->IsSupported( KMPXMediaGeneralTitle ) )
  1489 // -----------------------------------------------------------------------------
  1442             {
  1490 //
  1443             continue;
  1491 TInt CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL( CStifItemParser& aItem )
  1444             }
  1492     {
  1445         
  1493     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL ---------->");
  1446         TMPXItemId itemId  = *( media->Value<TMPXItemId>( KMPXMediaGeneralId ) );
  1494     // Print to UI
  1447         
  1495     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
  1448         if(itemId.iId2 == KVcxMvcMediaTypeAlbum)
  1496     _LIT( KWhere, "In CheckMinimumMediaCountL" );
  1449             {
  1497     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
  1450             actualCount++;
  1498     // Print to log file
  1451             }
  1499     iLog->Log( KWhere );
  1452         }
  1500     
  1453     
       
  1454     if ( actualCount != expectedCount )
       
  1455         {
       
  1456         VCXLOGLO2("CVCXMyVideosCollectionPluginTest: Error! Count of albums is wrong: %d", actualCount );
       
  1457         err = KErrCorrupt;
       
  1458         }
       
  1459   
       
  1460     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckAlbumCountL <----------");
       
  1461     return err;
       
  1462     }
       
  1463 
       
  1464 // -----------------------------------------------------------------------------
       
  1465 // CVcxMyVideosApiTest::CheckMediaCountL
       
  1466 // -----------------------------------------------------------------------------
       
  1467 //
       
  1468 TInt CVCXMyVideosCollectionPluginTest::CheckMediaCountL( CStifItemParser& aItem )
       
  1469     {
       
  1470     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediaCountL ---------->");
       
  1471     // Print to UI
       
  1472     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  1473     _LIT( KWhere, "In CheckMediaCountL" );
       
  1474     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  1475     // Print to log file
       
  1476     iLog->Log( KWhere );
       
  1477 
       
  1478     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
  1501     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
  1479     
  1502 
  1480     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  1503     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  1481 
  1504 
  1482     TInt drive(0);
  1505     TInt drive(0);
  1483     User::LeaveIfError( GetDriveParam( aItem, drive ) );
  1506     User::LeaveIfError( GetDriveParam( aItem, drive ) );
  1484 
  1507 
  1485     TInt expectedCount(0);
  1508     TInt expectedCount(0);
  1486     User::LeaveIfError(aItem.GetNextInt(expectedCount));
  1509     User::LeaveIfError(aItem.GetNextInt(expectedCount));
  1487 
  1510 
  1488     TRAPD( err, CheckMediasL( expectedCount, drive, 0 ) );
  1511     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: drive: %d", drive);
  1489     
  1512 
  1490     if( err != KErrNone ) 
  1513     TRAPD( err, CheckMediasL( expectedCount, drive, -1 ) );
  1491         {
  1514 
  1492         iTester->PrintMediasL( NULL, EFalse, _L("Videos") );
  1515     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL <----------");
  1493         }
  1516     return VCXMVTEST_ERR( err );
  1494 
  1517     }
  1495     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaCountL <----------");
  1518 
  1496     return err;
  1519 // -----------------------------------------------------------------------------
  1497     }
  1520 // CIptvMyVideosApiTest::CheckMaximumMediaCountL
  1498 
  1521 // -----------------------------------------------------------------------------
  1499 // -----------------------------------------------------------------------------
  1522 //
  1500 // CVcxMyVideosApiTest::CheckMinimumMediaCountL
  1523 TInt CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL( CStifItemParser& aItem )
  1501 // -----------------------------------------------------------------------------
  1524     {
  1502 //
  1525     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL ---------->");
  1503 TInt CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL( CStifItemParser& aItem )
  1526     // Print to UI
  1504     {
  1527     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
  1505     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL ---------->");
  1528     _LIT( KWhere, "In CheckMaximumMediaCountL" );
  1506     // Print to UI
       
  1507     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  1508     _LIT( KWhere, "In CheckMinimumMediaCountL" );
       
  1509     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
  1529     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
  1510     // Print to log file
  1530     // Print to log file
  1511     iLog->Log( KWhere );
  1531     iLog->Log( KWhere );
  1512     
  1532     
  1513     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
  1533     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
  1516 
  1536 
  1517     TInt drive(0);
  1537     TInt drive(0);
  1518     User::LeaveIfError( GetDriveParam( aItem, drive ) );
  1538     User::LeaveIfError( GetDriveParam( aItem, drive ) );
  1519 
  1539 
  1520     TInt expectedCount(0);
  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);
  1521     User::LeaveIfError(aItem.GetNextInt(expectedCount));
  1570     User::LeaveIfError(aItem.GetNextInt(expectedCount));
  1522 
  1571 
  1523     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: drive: %d", drive);
  1572     TInt err( KErrNotReady );
  1524 
  1573     if( iTester )
  1525     TRAPD( err, CheckMediasL( expectedCount, drive, -1 ) );
  1574         {
  1526 
  1575         err = KErrNone;
  1527     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL <----------");
  1576         if( iTester->GetDownloadWatcher()->GetDownloadCount() != expectedCount )
  1528     return err;
  1577             {
  1529     }
  1578             err = KErrCorrupt;
  1530 
  1579             VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: Not expected count of downloads!");
  1531 // -----------------------------------------------------------------------------
  1580             }
  1532 // CVcxMyVideosApiTest::CheckMaximumMediaCountL
  1581         }
  1533 // -----------------------------------------------------------------------------
  1582 
  1534 //
  1583     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckDownloadCountL <----------");
  1535 TInt CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL( CStifItemParser& aItem )
  1584     return VCXMVTEST_ERR( err );
  1536     {
  1585     }
  1537     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL ---------->");
  1586 
  1538     // Print to UI
  1587 // -----------------------------------------------------------------------------
  1539     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
  1588 // CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL
  1540     _LIT( KWhere, "In CheckMaximumMediaCountL" );
  1589 // -----------------------------------------------------------------------------
  1541     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
  1590 //
  1542     // Print to log file
  1591 TInt CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL( CStifItemParser& aItem )
  1543     iLog->Log( KWhere );
  1592     {
  1544     
  1593     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL ---------->");
  1545     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
  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 );
  1546 
  1600 
  1547     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  1601     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  1548 
  1602 
  1549     TInt drive(0);
  1603     TInt drive(0);
  1550     User::LeaveIfError( GetDriveParam( aItem, drive ) );
  1604     User::LeaveIfError( GetDriveParam( aItem, drive ) );
  1551 
  1605 
  1552     TInt expectedCount(0);
       
  1553     User::LeaveIfError( aItem.GetNextInt(expectedCount) );
       
  1554 
       
  1555     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: drive: %d", drive);
       
  1556 
       
  1557     TRAPD( err, CheckMediasL( expectedCount, drive, 1 ) );
       
  1558 
       
  1559     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL <----------");
       
  1560     return err;
       
  1561     }
       
  1562 
       
  1563 // -----------------------------------------------------------------------------
       
  1564 // CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL
       
  1565 // -----------------------------------------------------------------------------
       
  1566 //
       
  1567 TInt CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL( CStifItemParser& aItem )
       
  1568     {
       
  1569     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL ---------->");
       
  1570     // Print to UI
       
  1571     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  1572     _LIT( KWhere, "In CreateCopyOfMediaL" );
       
  1573     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  1574     // Print to log file
       
  1575     iLog->Log( KWhere );
       
  1576 
       
  1577     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  1578 
       
  1579     TInt drive(0);
       
  1580     User::LeaveIfError( GetDriveParam( aItem, drive ) );
       
  1581 
       
  1582     TInt index(0);
  1606     TInt index(0);
  1583     User::LeaveIfError( aItem.GetNextInt( index ) );
  1607     User::LeaveIfError( aItem.GetNextInt( index ) );
  1584 
  1608 
  1585     if( index < 0 || index >= iTester->GetMediaCount() )
  1609     if( index < 0 || index >= iTester->GetMediaCount() )
  1586         {
  1610         {
  1596 
  1620 
  1597     if( iTester->GetMediaCount() <= 0 )
  1621     if( iTester->GetMediaCount() <= 0 )
  1598         {
  1622         {
  1599         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: There's zero medias!");
  1623         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: There's zero medias!");
  1600         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------");
  1624         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------");
  1601         return KErrArgument;
  1625         return VCXMVTEST_ERR( KErrArgument );
  1602         }
  1626         }
  1603 
  1627 
  1604     if( iMpxMedia )
  1628     if( iMpxMedia )
  1605         {
  1629         {
  1606         delete iMpxMedia;
  1630         delete iMpxMedia;
  1653         {
  1677         {
  1654         VCXLOGLO2("<<<CVCXMyVideosCollectionPluginTest:: err: %d", err);
  1678         VCXLOGLO2("<<<CVCXMyVideosCollectionPluginTest:: err: %d", err);
  1655         }
  1679         }
  1656 
  1680 
  1657     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------");
  1681     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------");
  1658     return err;
  1682     return VCXMVTEST_ERR( err );
  1659     }
  1683     }
  1660 
  1684 
  1661 // -----------------------------------------------------------------------------
  1685 // -----------------------------------------------------------------------------
  1662 // CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL
  1686 // CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL
  1663 // -----------------------------------------------------------------------------
  1687 // -----------------------------------------------------------------------------
  1759             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Open plugin binary failed: %d", err2);
  1783             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Open plugin binary failed: %d", err2);
  1760             }
  1784             }
  1761         }
  1785         }
  1762 #endif // __WINSCW__
  1786 #endif // __WINSCW__
  1763 
  1787 
       
  1788 
  1764     if( err != KErrNone )
  1789     if( err != KErrNone )
  1765         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  1790         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  1766 
  1791 
  1767     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::AddMediaL <----------");
  1792     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::AddMediaL <----------");
  1768     return err;
  1793     return VCXMVTEST_ERR( err );
  1769     }
  1794     }
  1770 
  1795 
  1771 // -----------------------------------------------------------------------------
  1796 // -----------------------------------------------------------------------------
  1772 // CVCXMyVideosCollectionPluginTest::SetMediaL
  1797 // CVCXMyVideosCollectionPluginTest::SetMediaL
  1773 // -----------------------------------------------------------------------------
  1798 // -----------------------------------------------------------------------------
  1805 
  1830 
  1806     if( err != KErrNone )
  1831     if( err != KErrNone )
  1807         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  1832         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  1808 
  1833 
  1809     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaL <----------");
  1834     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaL <----------");
  1810     return err;
  1835     return VCXMVTEST_ERR( err );
  1811     }
  1836     }
  1812 
  1837 
  1813 // -----------------------------------------------------------------------------
  1838 // -----------------------------------------------------------------------------
  1814 // CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL
  1839 // CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL
  1815 // -----------------------------------------------------------------------------
  1840 // -----------------------------------------------------------------------------
  1838 
  1863 
  1839     if( err != KErrNone )
  1864     if( err != KErrNone )
  1840         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  1865         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  1841 
  1866 
  1842     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL <----------");
  1867     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL <----------");
  1843     return err;
  1868     return VCXMVTEST_ERR( err );
  1844     }
  1869     }
  1845 
  1870 
  1846 // -----------------------------------------------------------------------------
  1871 // -----------------------------------------------------------------------------
  1847 // CVcxMyVideosApiTest::RemoveMediaL
  1872 // CIptvMyVideosApiTest::RemoveMediaL
  1848 // -----------------------------------------------------------------------------
  1873 // -----------------------------------------------------------------------------
  1849 //
  1874 //
  1850 TInt CVCXMyVideosCollectionPluginTest::RemoveMediaL( CStifItemParser& aItem )
  1875 TInt CVCXMyVideosCollectionPluginTest::RemoveMediaL( CStifItemParser& aItem )
  1851     {
  1876     {
  1852     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveMediaL ---------->");
  1877     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveMediaL ---------->");
  1880         {
  1905         {
  1881         TRAP( err, iTester->RemoveMediaL( drive, index, syncCall ) );
  1906         TRAP( err, iTester->RemoveMediaL( drive, index, syncCall ) );
  1882         }
  1907         }
  1883 
  1908 
  1884     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveMediaL <----------");
  1909     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveMediaL <----------");
  1885     return err;
  1910     return VCXMVTEST_ERR( err );
  1886     }
  1911     }
  1887 
  1912 
  1888 // -----------------------------------------------------------------------------
  1913 // -----------------------------------------------------------------------------
  1889 // CVcxMyVideosApiTest::RemoveAllMediaL
  1914 // CIptvMyVideosApiTest::RemoveAllMediaL
  1890 // -----------------------------------------------------------------------------
  1915 // -----------------------------------------------------------------------------
  1891 //
  1916 //
  1892 TInt CVCXMyVideosCollectionPluginTest::RemoveAllMediaL( CStifItemParser& aItem )
  1917 TInt CVCXMyVideosCollectionPluginTest::RemoveAllMediaL( CStifItemParser& aItem )
  1893     {
  1918     {
  1894     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveAllMediaL ---------->");
  1919     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveAllMediaL ---------->");
  1904     iLastReceivedMessage = -1;
  1929     iLastReceivedMessage = -1;
  1905 
  1930 
  1906     TRAP_IGNORE( iTester->EnsureMediaFilesAreNotInUseL() );
  1931     TRAP_IGNORE( iTester->EnsureMediaFilesAreNotInUseL() );
  1907     
  1932     
  1908     TInt error( KErrNone );
  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         }
  1909     
  2030     
  1910     // Get current list of medias.
  2031     // Get current list of medias.
  1911     
  2032     
  1912     CMPXMediaArray* medias( NULL );
  2033     CMPXMediaArray* medias( NULL );
  1913     medias = iTester->SelectMediasL( -1, 0, iTester->GetMediaCount() );
  2034     medias = iTester->SelectMediasL( -1, 0, iTester->GetMediaCount() );
  1959 
  2080 
  1960     CleanupStack::PopAndDestroy( medias );
  2081     CleanupStack::PopAndDestroy( medias );
  1961 
  2082 
  1962     iLastReceivedMessage = -1;
  2083     iLastReceivedMessage = -1;
  1963 
  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 
  1964     if( iTester->GetMediaCount() > 0 )
  2095     if( iTester->GetMediaCount() > 0 )
  1965         {
  2096         {
  1966         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: All medias could not be removed."); 
  2097         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: All medias could not be removed."); 
  1967         error = KErrCorrupt;
  2098         error = KErrCorrupt;
  1968         }
  2099         }
  1969     
  2100     
  1970     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveAllMediaL <----------");
  2101     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveAllMediaL <----------");
  1971     return error; 
  2102     return VCXMVTEST_ERR( error ); 
  1972     }
  2103     }
  1973 
  2104 
  1974 // -----------------------------------------------------------------------------
  2105 // -----------------------------------------------------------------------------
  1975 // CVcxMyVideosApiTest::MoveMediaL
  2106 // CIptvMyVideosApiTest::MoveMediaL
  1976 // -----------------------------------------------------------------------------
  2107 // -----------------------------------------------------------------------------
  1977 //
  2108 //
  1978 TInt CVCXMyVideosCollectionPluginTest::MoveMediaL( CStifItemParser& aItem )
  2109 TInt CVCXMyVideosCollectionPluginTest::MoveMediaL( CStifItemParser& aItem )
  1979     {
  2110     {
  1980     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::MoveMediaL ---------->");
  2111     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::MoveMediaL ---------->");
  2008 
  2139 
  2009     TInt err( KErrNotReady );
  2140     TInt err( KErrNotReady );
  2010     if( iTester )
  2141     if( iTester )
  2011         {
  2142         {
  2012         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2143         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2013         err = err;
  2144         err = VCXMVTEST_ERR( err );
  2014         if( err == KErrNone )
  2145         if( err == KErrNone )
  2015             {
  2146             {
  2016             TRAP( err, iTester->MoveMediasL( sourceDrive, index, index+1, destDrive, syncCall ) );
  2147             TRAP( err, iTester->MoveMediasL( sourceDrive, index, index+1, destDrive, syncCall ) );
  2017             }
  2148             }
  2018         }
  2149         }
  2019 
  2150 
  2020     if( err != KErrNone )
  2151     if( err != KErrNone )
  2021         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2152         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2022 
  2153 
  2023     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediaL <----------");
  2154     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediaL <----------");
  2024     return err;
  2155     return VCXMVTEST_ERR( err );
  2025     }
  2156     }
  2026 
  2157 
  2027 // -----------------------------------------------------------------------------
  2158 // -----------------------------------------------------------------------------
  2028 // CVcxMyVideosApiTest::MoveMediasL
  2159 // CIptvMyVideosApiTest::MoveMediasL
  2029 // -----------------------------------------------------------------------------
  2160 // -----------------------------------------------------------------------------
  2030 //
  2161 //
  2031 TInt CVCXMyVideosCollectionPluginTest::MoveMediasL( CStifItemParser& aItem )
  2162 TInt CVCXMyVideosCollectionPluginTest::MoveMediasL( CStifItemParser& aItem )
  2032     {
  2163     {
  2033     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::MoveMediasL ---------->");
  2164     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::MoveMediasL ---------->");
  2064 
  2195 
  2065     TInt err( KErrNotReady );
  2196     TInt err( KErrNotReady );
  2066     if( iTester )
  2197     if( iTester )
  2067         {
  2198         {
  2068         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2199         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2069         err = err;
  2200         err = VCXMVTEST_ERR( err );
  2070         if( err == KErrNone )
  2201         if( err == KErrNone )
  2071             {
  2202             {
  2072             TRAP( err, iTester->MoveMediasL( sourceDrive, index, endIndex, destDrive, syncCall ) );
  2203             TRAP( err, iTester->MoveMediasL( sourceDrive, index, endIndex, destDrive, syncCall ) );
  2073             }
  2204             }
  2074         }
  2205         }
  2075 
  2206 
  2076     if( err != KErrNone )
  2207     if( err != KErrNone )
  2077         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2208         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2078 
  2209 
  2079     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediasL <----------");
  2210     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediasL <----------");
  2080     return err;
  2211     return VCXMVTEST_ERR( err );
  2081     }
  2212     }
  2082 
  2213 
  2083 // -----------------------------------------------------------------------------
  2214 // -----------------------------------------------------------------------------
  2084 // CVcxMyVideosApiTest::CancelMoveL
  2215 // CIptvMyVideosApiTest::CancelMoveL
  2085 // -----------------------------------------------------------------------------
  2216 // -----------------------------------------------------------------------------
  2086 //
  2217 //
  2087 TInt CVCXMyVideosCollectionPluginTest::CancelMoveL( CStifItemParser& aItem )
  2218 TInt CVCXMyVideosCollectionPluginTest::CancelMoveL( CStifItemParser& aItem )
  2088     {
  2219     {
  2089     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelMoveL ---------->");
  2220     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelMoveL ---------->");
  2114 
  2245 
  2115     if( err != KErrNone )
  2246     if( err != KErrNone )
  2116         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2247         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2117 
  2248 
  2118     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelMoveL <----------");
  2249     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelMoveL <----------");
  2119     return err;
  2250     return VCXMVTEST_ERR( err );
  2120     }
  2251     }
  2121 
  2252 
  2122 // -----------------------------------------------------------------------------
  2253 // -----------------------------------------------------------------------------
  2123 // CVcxMyVideosApiTest::CopyMediaL
  2254 // CIptvMyVideosApiTest::CopyMediaL
  2124 // -----------------------------------------------------------------------------
  2255 // -----------------------------------------------------------------------------
  2125 //
  2256 //
  2126 TInt CVCXMyVideosCollectionPluginTest::CopyMediaL( CStifItemParser& aItem )
  2257 TInt CVCXMyVideosCollectionPluginTest::CopyMediaL( CStifItemParser& aItem )
  2127     {
  2258     {
  2128     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CopyMediaL ---------->");
  2259     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CopyMediaL ---------->");
  2162 
  2293 
  2163     if( err != KErrNone )
  2294     if( err != KErrNone )
  2164         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2295         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2165 
  2296 
  2166     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediaL <----------");
  2297     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediaL <----------");
  2167     return err;
  2298     return VCXMVTEST_ERR( err );
  2168     }
  2299     }
  2169 
  2300 
  2170 // -----------------------------------------------------------------------------
  2301 // -----------------------------------------------------------------------------
  2171 // CVcxMyVideosApiTest::CopyMediasL
  2302 // CIptvMyVideosApiTest::CopyMediasL
  2172 // -----------------------------------------------------------------------------
  2303 // -----------------------------------------------------------------------------
  2173 //
  2304 //
  2174 TInt CVCXMyVideosCollectionPluginTest::CopyMediasL( CStifItemParser& aItem )
  2305 TInt CVCXMyVideosCollectionPluginTest::CopyMediasL( CStifItemParser& aItem )
  2175     {
  2306     {
  2176     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CopyMediasL ---------->");
  2307     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CopyMediasL ---------->");
  2213 
  2344 
  2214     if( err != KErrNone )
  2345     if( err != KErrNone )
  2215         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2346         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2216 
  2347 
  2217     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediasL <----------");
  2348     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediasL <----------");
  2218     return err;
  2349     return VCXMVTEST_ERR( err );
  2219     }
  2350     }
  2220 
  2351 
  2221 // -----------------------------------------------------------------------------
  2352 // -----------------------------------------------------------------------------
  2222 // CVcxMyVideosApiTest::CancelCopyL
  2353 // CIptvMyVideosApiTest::CancelCopyL
  2223 // -----------------------------------------------------------------------------
  2354 // -----------------------------------------------------------------------------
  2224 //
  2355 //
  2225 TInt CVCXMyVideosCollectionPluginTest::CancelCopyL( CStifItemParser& aItem )
  2356 TInt CVCXMyVideosCollectionPluginTest::CancelCopyL( CStifItemParser& aItem )
  2226     {
  2357     {
  2227     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelCopyL ---------->");
  2358     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelCopyL ---------->");
  2252 
  2383 
  2253     if( err != KErrNone )
  2384     if( err != KErrNone )
  2254         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2385         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2255 
  2386 
  2256     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelCopyL <----------");
  2387     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelCopyL <----------");
  2257     return err;
  2388     return VCXMVTEST_ERR( err );
  2258     }
  2389     }
  2259 
  2390 
  2260 // -----------------------------------------------------------------------------
  2391 // -----------------------------------------------------------------------------
  2261 // CVcxMyVideosApiTest::DeleteMediaL
  2392 // CIptvMyVideosApiTest::DeleteMediaL
  2262 // -----------------------------------------------------------------------------
  2393 // -----------------------------------------------------------------------------
  2263 //
  2394 //
  2264 TInt CVCXMyVideosCollectionPluginTest::DeleteMediaL( CStifItemParser& aItem )
  2395 TInt CVCXMyVideosCollectionPluginTest::DeleteMediaL( CStifItemParser& aItem )
  2265     {
  2396     {
  2266     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteMediaL ---------->");
  2397     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteMediaL ---------->");
  2291 
  2422 
  2292     TInt err( KErrNotReady );
  2423     TInt err( KErrNotReady );
  2293     if( iTester )
  2424     if( iTester )
  2294         {
  2425         {
  2295         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2426         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2296         err = err;
  2427         err = VCXMVTEST_ERR( err );
  2297         if( err == KErrNone )
  2428         if( err == KErrNone )
  2298             {
  2429             {
  2299             TRAP( err, iTester->DeleteMediasL( sourceDrive, index, index+1, syncCall ) );
  2430             TRAP( err, iTester->DeleteMediasL( sourceDrive, index, index+1, syncCall ) );
  2300             }
  2431             }
  2301         }
  2432         }
  2302 
  2433 
  2303     if( err != KErrNone )
  2434     if( err != KErrNone )
  2304         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2435         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2305 
  2436 
  2306     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediaL <----------");
  2437     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediaL <----------");
  2307     return err;
  2438     return VCXMVTEST_ERR( err );
  2308     }
  2439     }
  2309 
  2440 
  2310 // -----------------------------------------------------------------------------
  2441 // -----------------------------------------------------------------------------
  2311 // CVcxMyVideosApiTest::DeleteMediasL
  2442 // CIptvMyVideosApiTest::DeleteMediasL
  2312 // -----------------------------------------------------------------------------
  2443 // -----------------------------------------------------------------------------
  2313 //
  2444 //
  2314 TInt CVCXMyVideosCollectionPluginTest::DeleteMediasL( CStifItemParser& aItem )
  2445 TInt CVCXMyVideosCollectionPluginTest::DeleteMediasL( CStifItemParser& aItem )
  2315     {
  2446     {
  2316     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteMediasL ---------->");
  2447     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteMediasL ---------->");
  2344 
  2475 
  2345     TInt err( KErrNotReady );
  2476     TInt err( KErrNotReady );
  2346     if( iTester )
  2477     if( iTester )
  2347         {
  2478         {
  2348         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2479         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2349         err = err;
  2480         err = VCXMVTEST_ERR( err );
  2350         if( err == KErrNone )
  2481         if( err == KErrNone )
  2351             {
  2482             {
  2352             TRAP( err, iTester->DeleteMediasL( sourceDrive, index, endIndex, syncCall ) );
  2483             TRAP( err, iTester->DeleteMediasL( sourceDrive, index, endIndex, syncCall ) );
  2353             }
  2484             }
  2354         }
  2485         }
  2357         {
  2488         {
  2358         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2489         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2359         }
  2490         }
  2360 
  2491 
  2361     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediasL <----------");
  2492     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediasL <----------");
  2362     return err;
  2493     return VCXMVTEST_ERR( err );
  2363     }
  2494     }
  2364 
  2495 
  2365 // -----------------------------------------------------------------------------
  2496 // -----------------------------------------------------------------------------
  2366 // CVcxMyVideosApiTest::CancelDeleteL
  2497 // CIptvMyVideosApiTest::CancelDeleteL
  2367 // -----------------------------------------------------------------------------
  2498 // -----------------------------------------------------------------------------
  2368 //
  2499 //
  2369 TInt CVCXMyVideosCollectionPluginTest::CancelDeleteL( CStifItemParser& aItem )
  2500 TInt CVCXMyVideosCollectionPluginTest::CancelDeleteL( CStifItemParser& aItem )
  2370     {
  2501     {
  2371     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDeleteL ---------->");
  2502     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDeleteL ---------->");
  2396 
  2527 
  2397     if( err != KErrNone )
  2528     if( err != KErrNone )
  2398         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2529         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2399 
  2530 
  2400     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDeleteL <----------");
  2531     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDeleteL <----------");
  2401     return err;
  2532     return VCXMVTEST_ERR( err );
  2402     }
  2533     }
  2403 
  2534 
  2404 //----------------------------------------------------------------------------
  2535 //----------------------------------------------------------------------------
  2405 // CVcxMyVideosApiTest::CancelNextOperationL
  2536 // CIptvMyVideosApiTest::CancelNextOperationL
  2406 // -----------------------------------------------------------------------------
  2537 // -----------------------------------------------------------------------------
  2407 //
  2538 //
  2408 TInt CVCXMyVideosCollectionPluginTest::CancelNextOperationL( CStifItemParser& /* aItem */ )
  2539 TInt CVCXMyVideosCollectionPluginTest::CancelNextOperationL( CStifItemParser& /* aItem */ )
  2409     {
  2540     {
  2410     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelNextOperationL ---------->");
  2541     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelNextOperationL ---------->");
  2420     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelNextOperationL <----------");
  2551     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelNextOperationL <----------");
  2421     return KErrNone;
  2552     return KErrNone;
  2422     }
  2553     }
  2423 
  2554 
  2424 // -----------------------------------------------------------------------------
  2555 // -----------------------------------------------------------------------------
  2425 // CVcxMyVideosApiTest::DeleteFileOfMediaL
  2556 // CIptvMyVideosApiTest::DeleteFileOfMediaL
  2426 // -----------------------------------------------------------------------------
  2557 // -----------------------------------------------------------------------------
  2427 //
  2558 //
  2428 TInt CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL( CStifItemParser& aItem )
  2559 TInt CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL( CStifItemParser& aItem )
  2429     {
  2560     {
  2430     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL ---------->");
  2561     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL ---------->");
  2457         {
  2588         {
  2458         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2589         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
  2459         }
  2590         }
  2460 
  2591 
  2461     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL <----------");
  2592     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL <----------");
  2462     return err;
  2593     return VCXMVTEST_ERR( err );
  2463     }
  2594     }
  2464 
  2595 
  2465 // -----------------------------------------------------------------------------
  2596 // -----------------------------------------------------------------------------
  2466 // CVcxMyVideosApiTest::DeleteFilesOfAllMediasL
  2597 // CIptvMyVideosApiTest::DeleteFilesOfAllMediasL
  2467 // -----------------------------------------------------------------------------
  2598 // -----------------------------------------------------------------------------
  2468 //
  2599 //
  2469 TInt CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL( CStifItemParser& /* aItem */ )
  2600 TInt CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL( CStifItemParser& /* aItem */ )
  2470     {
  2601     {
  2471     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL ---------->");
  2602     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL ---------->");
  2480 
  2611 
  2481     TInt err( KErrNotReady );
  2612     TInt err( KErrNotReady );
  2482     if( iTester )
  2613     if( iTester )
  2483         {
  2614         {
  2484         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2615         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
  2485         err = err;
  2616         err = VCXMVTEST_ERR( err );
  2486         if( err == KErrNone )
  2617         if( err == KErrNone )
  2487             {        
  2618             {        
  2488             TRAP( err, iTester->DeleteAllMediaFilesL() );
  2619             TRAP( err, iTester->DeleteAllMediaFilesL() );
  2489             }
  2620             }
  2490         }
  2621         }
  2491 
  2622 
  2492     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL <----------");
  2623     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL <----------");
  2493     return err;
  2624     return VCXMVTEST_ERR( err );
  2494     }
  2625     }
  2495 
  2626 
  2496 // -----------------------------------------------------------------------------
  2627 // -----------------------------------------------------------------------------
  2497 // CVcxMyVideosApiTest::CreateAlbumL
  2628 // CIptvMyVideosApiTest::CreateVideoFileL
  2498 // -----------------------------------------------------------------------------
  2629 // -----------------------------------------------------------------------------
  2499 //
  2630 //
  2500 TInt CVCXMyVideosCollectionPluginTest::CreateAlbumL( CStifItemParser& aItem )
  2631 TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CStifItemParser& aItem )
  2501     {
  2632     {
  2502     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateAlbumL ---------->");
  2633     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateVideoFileL ---------->");
  2503     // Print to UI
  2634     // Print to UI
  2504     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
  2635     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
  2505     _LIT( KWhere, "In CreateAlbumL" );
  2636     _LIT( KWhere, "In CreateVideoFileL" );
  2506     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
  2637     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
  2507     // Print to log file
  2638     // Print to log file
  2508     iLog->Log( KWhere );
  2639     iLog->Log( KWhere );
  2509     
  2640 
  2510     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  2641     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  2511 
  2642 
  2512     iLastReceivedMessage = -1;
       
  2513 
       
  2514     TInt err( KErrNotReady );
       
  2515     if( iTester )
       
  2516         {
       
  2517         TPtrC albumName;
       
  2518         User::LeaveIfError( aItem.GetNextString( albumName ) );
       
  2519         
       
  2520         TInt sync;
       
  2521         if( aItem.GetNextInt( sync ) != KErrNone )
       
  2522             {
       
  2523             sync = EFalse;
       
  2524             }
       
  2525 
       
  2526         if( albumName.Compare( KStifScript2KString ) == KErrNone )
       
  2527             {
       
  2528             TRAP( err, iTester->CreateAlbumL( KAbout2050CharsString, sync ) );
       
  2529             }
       
  2530         else if( albumName.Compare( KStifScriptEmptyString ) == KErrNone )
       
  2531             {
       
  2532             TRAP( err, iTester->CreateAlbumL( KVcxTestEmptyString, sync ) );
       
  2533             }
       
  2534         else if( albumName.Compare( KStifScriptInvalidRequest ) == KErrNone )
       
  2535             {
       
  2536             TRAP( err, iTester->CreateAlbumL( KVcxTestEmptyString, sync, ETrue ) );
       
  2537             }
       
  2538         else
       
  2539             {
       
  2540             TRAP( err, iTester->CreateAlbumL( albumName, sync ) );
       
  2541             }
       
  2542         }
       
  2543 
       
  2544     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateAlbumL <----------");
       
  2545     return err;
       
  2546     }
       
  2547 
       
  2548 // -----------------------------------------------------------------------------
       
  2549 // CVcxMyVideosApiTest::DeleteAlbumsL
       
  2550 // -----------------------------------------------------------------------------
       
  2551 //
       
  2552 TInt CVCXMyVideosCollectionPluginTest::DeleteAlbumsL( CStifItemParser& aItem )
       
  2553     {
       
  2554     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteAlbumsL ---------->");
       
  2555     // Print to UI
       
  2556     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  2557     _LIT( KWhere, "In DeleteAlbumsL" );
       
  2558     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  2559     // Print to log file
       
  2560     iLog->Log( KWhere );
       
  2561     
       
  2562     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  2563 
       
  2564     iLastReceivedMessage = -1;
       
  2565     
       
  2566     TInt err( KErrNotReady );
       
  2567 
       
  2568     if( iTester )
       
  2569         {
       
  2570         TPtrC albumName;
       
  2571         RArray<TPtrC> albumNames;
       
  2572         
       
  2573         while( aItem.GetNextString( albumName ) == KErrNone )
       
  2574             {
       
  2575             albumNames.Append( albumName );
       
  2576             }
       
  2577         
       
  2578         if( albumNames.Count() < 1 )
       
  2579             {
       
  2580             VCXLOGLO1("CVCXMyVideosCollectionPluginTest::DeleteAlbumsL: No albums specified!");
       
  2581             err = KErrArgument;
       
  2582             }
       
  2583         else
       
  2584             {
       
  2585             TRAP( err, iTester->DeleteAlbumsL( albumNames ) );
       
  2586             }
       
  2587         }
       
  2588 
       
  2589     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteAlbumsL <----------");
       
  2590     return err;
       
  2591     }
       
  2592 
       
  2593 // -----------------------------------------------------------------------------
       
  2594 // CVcxMyVideosApiTest::DeleteAllAlbumsL
       
  2595 // -----------------------------------------------------------------------------
       
  2596 //
       
  2597 TInt CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL( CStifItemParser& aItem )
       
  2598     {
       
  2599     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL ---------->");
       
  2600     // Print to UI
       
  2601     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  2602     _LIT( KWhere, "In DeleteAllAlbumsL" );
       
  2603     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  2604     // Print to log file
       
  2605     iLog->Log( KWhere );
       
  2606     
       
  2607     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  2608 
       
  2609     iLastReceivedMessage = -1;
       
  2610     
       
  2611     TInt err( KErrNotReady );
       
  2612 
       
  2613     if( iTester )
       
  2614         {
       
  2615         TRAP( err, iTester->DeleteAllAlbumsL() );
       
  2616         }
       
  2617 
       
  2618     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL <----------");
       
  2619     return err;
       
  2620     }
       
  2621 
       
  2622 // -----------------------------------------------------------------------------
       
  2623 // CVcxMyVideosApiTest::AddMediasToAlbumL
       
  2624 // -----------------------------------------------------------------------------
       
  2625 //
       
  2626 TInt CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL( CStifItemParser& aItem )
       
  2627     {
       
  2628     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL ---------->");
       
  2629     // Print to UI
       
  2630     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  2631     _LIT( KWhere, "In AddMediasToAlbumL" );
       
  2632     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  2633     // Print to log file
       
  2634     iLog->Log( KWhere );
       
  2635     
       
  2636     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  2637 
       
  2638     iLastReceivedMessage = -1;
       
  2639     
       
  2640     TInt err( KErrNotReady );
       
  2641     
       
  2642     if( iTester )
       
  2643         {
       
  2644         TPtrC albumName;
       
  2645         User::LeaveIfError( aItem.GetNextString( albumName ) );
       
  2646     
       
  2647         TInt sourceDrive(0);
       
  2648         User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) );
       
  2649     
       
  2650         TInt index(0);
       
  2651         User::LeaveIfError( aItem.GetNextInt( index ) );
       
  2652     
       
  2653         TInt endIndex(0);
       
  2654         User::LeaveIfError( aItem.GetNextInt( endIndex ) );
       
  2655 
       
  2656         TRAP( err, iTester->AddMediasToAlbumL( albumName, sourceDrive, index, endIndex ) );
       
  2657         }
       
  2658 
       
  2659     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL <----------");
       
  2660     return err;
       
  2661     }
       
  2662 
       
  2663 // -----------------------------------------------------------------------------
       
  2664 // CVcxMyVideosApiTest::RemoveMediasFromAlbumL
       
  2665 // -----------------------------------------------------------------------------
       
  2666 //
       
  2667 TInt CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL( CStifItemParser& aItem )
       
  2668     {
       
  2669     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL ---------->");
       
  2670     // Print to UI
       
  2671     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  2672     _LIT( KWhere, "In RemoveMediasFromAlbumL" );
       
  2673     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  2674     // Print to log file
       
  2675     iLog->Log( KWhere );
       
  2676     
       
  2677     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  2678 
       
  2679     iLastReceivedMessage = -1;
       
  2680     
       
  2681     TInt err( KErrNotReady );
       
  2682 
       
  2683     if( iTester )
       
  2684         {    
       
  2685         TPtrC albumName;
       
  2686         User::LeaveIfError( aItem.GetNextString( albumName ) );
       
  2687     
       
  2688         TInt sourceDrive(0);
       
  2689         User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) );
       
  2690     
       
  2691         TInt index(0);
       
  2692         User::LeaveIfError( aItem.GetNextInt( index ) );
       
  2693     
       
  2694         TInt endIndex(0);
       
  2695         User::LeaveIfError( aItem.GetNextInt( endIndex ) );
       
  2696 
       
  2697         TRAP( err, iTester->RemoveMediasFromAlbumL( albumName, sourceDrive, index, endIndex ) );
       
  2698         }
       
  2699 
       
  2700     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL <----------");
       
  2701     return err;
       
  2702     }
       
  2703 
       
  2704 // -----------------------------------------------------------------------------
       
  2705 // CVcxMyVideosApiTest::RenameAlbumL
       
  2706 // -----------------------------------------------------------------------------
       
  2707 //
       
  2708 TInt CVCXMyVideosCollectionPluginTest::RenameAlbumL( CStifItemParser& aItem )
       
  2709     {
       
  2710     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RenameAlbumL ---------->");
       
  2711     // Print to UI
       
  2712     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  2713     _LIT( KWhere, "In RenameAlbumL" );
       
  2714     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  2715     // Print to log file
       
  2716     iLog->Log( KWhere );
       
  2717 
       
  2718     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
       
  2719     
       
  2720     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  2721 
       
  2722     int err( KErrNotReady );
       
  2723     
       
  2724     if( iTester )
       
  2725         {
       
  2726         TPtrC albumName;
       
  2727         User::LeaveIfError( aItem.GetNextString( albumName ) );
       
  2728         
       
  2729         TPtrC newAlbumName;
       
  2730         User::LeaveIfError( aItem.GetNextString( newAlbumName ) );
       
  2731 
       
  2732         if( newAlbumName.Compare( KStifScript2KString ) == KErrNone )
       
  2733             {
       
  2734             TRAP( err, iTester->RenameAlbumL( albumName, KAbout2050CharsString ) );
       
  2735             }
       
  2736         else if( newAlbumName.Compare( KStifScriptEmptyString ) == KErrNone )
       
  2737             {
       
  2738             TRAP( err, iTester->RenameAlbumL( albumName, KVcxTestEmptyString ) );
       
  2739             }
       
  2740         else
       
  2741             {
       
  2742             TRAP( err, iTester->RenameAlbumL( albumName, newAlbumName ) );    
       
  2743             }
       
  2744         }
       
  2745   
       
  2746     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RenameAlbumL <----------");
       
  2747     return err;
       
  2748     }
       
  2749 
       
  2750 // -----------------------------------------------------------------------------
       
  2751 // CVcxMyVideosApiTest::CheckAlbumExistsL
       
  2752 // -----------------------------------------------------------------------------
       
  2753 //
       
  2754 TInt CVCXMyVideosCollectionPluginTest::CheckAlbumExistsL( CStifItemParser& aItem )
       
  2755     {
       
  2756     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckAlbumExistsL ---------->");
       
  2757     // Print to UI
       
  2758     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  2759     _LIT( KWhere, "In CheckAlbumExistsL" );
       
  2760     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  2761     // Print to log file
       
  2762     iLog->Log( KWhere );
       
  2763 
       
  2764     WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
       
  2765     
       
  2766     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  2767 
       
  2768     int err( KErrNotReady );
       
  2769     
       
  2770     if( iTester )
       
  2771         {
       
  2772         TPtrC albumName;
       
  2773         User::LeaveIfError( aItem.GetNextString( albumName ) );
       
  2774         
       
  2775         TRAP( err, iTester->GetAlbumIdL(albumName) );
       
  2776         }
       
  2777   
       
  2778     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckAlbumExistsL <----------");
       
  2779     return err;
       
  2780     }
       
  2781 
       
  2782 // -----------------------------------------------------------------------------
       
  2783 // CVcxMyVideosApiTest::CreateVideoFileL
       
  2784 // -----------------------------------------------------------------------------
       
  2785 //
       
  2786 TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CStifItemParser& aItem )
       
  2787     {
       
  2788     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateVideoFileL ---------->");
       
  2789     // Print to UI
       
  2790     _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
       
  2791     _LIT( KWhere, "In CreateVideoFileL" );
       
  2792     TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
       
  2793     // Print to log file
       
  2794     iLog->Log( KWhere );
       
  2795 
       
  2796     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
       
  2797 
       
  2798     TInt temp(0);
  2643     TInt temp(0);
  2799 
  2644 
  2800     // Parameter video type
  2645     // Parameter video type
  2801     CVCXMyVideosTestUtils::TVcxTestVideoType videoType;
  2646     CIptvTestVideoCreator::TIptvTestVideoType videoType;
  2802     User::LeaveIfError( aItem.GetNextInt(temp) );
  2647     User::LeaveIfError( aItem.GetNextInt(temp) );
  2803     videoType = static_cast<CVCXMyVideosTestUtils::TVcxTestVideoType>(temp);
  2648     videoType = static_cast<CIptvTestVideoCreator::TIptvTestVideoType>(temp);
  2804     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType);
  2649     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType);
  2805 
  2650 
  2806     // Parameter drive letter
  2651     // Parameter drive letter
  2807     TPtrC driveLetter;
  2652     TPtrC driveLetter;
  2808     User::LeaveIfError(aItem.GetNextString(driveLetter));
  2653     User::LeaveIfError(aItem.GetNextString(driveLetter));
       
  2654 #ifdef __WINSCW__
       
  2655     driveLetter.Set(_L("C"));
       
  2656 #endif
  2809 
  2657 
  2810     // Parameter path and filename
  2658     // Parameter path and filename
  2811     TPtrC filename;
  2659     TPtrC filename;
  2812     User::LeaveIfError(aItem.GetNextString(filename));
  2660     User::LeaveIfError(aItem.GetNextString(filename));
  2813     if(filename.Length() < 64)
  2661     if(filename.Length() < 64)
  2830         }
  2678         }
  2831 
  2679 
  2832     TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, ETrue ) );
  2680     TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, ETrue ) );
  2833 
  2681 
  2834     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileL <----------");
  2682     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileL <----------");
  2835     return err;
  2683     return VCXMVTEST_ERR( err );
  2836     }
  2684     }
  2837 
  2685 
  2838 // -----------------------------------------------------------------------------
  2686 // -----------------------------------------------------------------------------
  2839 // CVcxMyVideosApiTest::CreateVideoFileNoWaitL
  2687 // CIptvMyVideosApiTest::CreateVideoFileNoWaitL
  2840 // -----------------------------------------------------------------------------
  2688 // -----------------------------------------------------------------------------
  2841 //
  2689 //
  2842 TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL( CStifItemParser& aItem )
  2690 TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL( CStifItemParser& aItem )
  2843     {
  2691     {
  2844     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ---------->");
  2692     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ---------->");
  2852     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  2700     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  2853 
  2701 
  2854     TInt temp(0);
  2702     TInt temp(0);
  2855 
  2703 
  2856     // Parameter video type
  2704     // Parameter video type
  2857     CVCXMyVideosTestUtils::TVcxTestVideoType videoType;
  2705     CIptvTestVideoCreator::TIptvTestVideoType videoType;
  2858     User::LeaveIfError( aItem.GetNextInt(temp) );
  2706     User::LeaveIfError( aItem.GetNextInt(temp) );
  2859     videoType = static_cast<CVCXMyVideosTestUtils::TVcxTestVideoType>(temp);
  2707     videoType = static_cast<CIptvTestVideoCreator::TIptvTestVideoType>(temp);
  2860     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType);
  2708     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType);
  2861 
  2709 
  2862     // Parameter drive letter
  2710     // Parameter drive letter
  2863     TPtrC driveLetter;
  2711     TPtrC driveLetter;
  2864     User::LeaveIfError(aItem.GetNextString(driveLetter));
  2712     User::LeaveIfError(aItem.GetNextString(driveLetter));
       
  2713 #ifdef __WINSCW__
       
  2714     driveLetter.Set(_L("C"));
       
  2715 #endif
  2865     
  2716     
  2866     // Parameter path and filename
  2717     // Parameter path and filename
  2867     TPtrC filename;
  2718     TPtrC filename;
  2868     User::LeaveIfError(aItem.GetNextString(filename));
  2719     User::LeaveIfError(aItem.GetNextString(filename));
  2869     if(filename.Length() < 64)
  2720     if(filename.Length() < 64)
  2888         }
  2739         }
  2889 
  2740 
  2890     TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, EFalse ) );
  2741     TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, EFalse ) );
  2891 
  2742 
  2892     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ---------->");
  2743     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ---------->");
  2893     return err;
  2744     return VCXMVTEST_ERR( err );
  2894     }
  2745     }
  2895 
  2746 
  2896 // -----------------------------------------------------------------------------
  2747 // -----------------------------------------------------------------------------
  2897 // CVcxMyVideosApiTest::CreateVideoFileL
  2748 // CIptvMyVideosApiTest::CreateVideoFileL
  2898 // -----------------------------------------------------------------------------
  2749 // -----------------------------------------------------------------------------
  2899 //
  2750 //
  2900 void CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CVCXMyVideosTestUtils::TVcxTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync )
  2751 void CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CIptvTestVideoCreator::TIptvTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync )
  2901     {
  2752     {
  2902     HBufC* path = HBufC::NewL( 2048 );
  2753     HBufC* path = HBufC::NewL( 2048 );
  2903     CleanupStack::PushL(path);
  2754     CleanupStack::PushL(path);
  2904 
  2755 
  2905     // Make sure path exists and resolve path + filename
  2756     // Make sure path exists and resolve path + filename
  2968 
  2819 
  2969     // Create file(s)
  2820     // Create file(s)
  2970     TInt err( KErrNone );
  2821     TInt err( KErrNone );
  2971 
  2822 
  2972     iLastReceivedMessage = -1;
  2823     iLastReceivedMessage = -1;
  2973     
  2824 
  2974     if(aDoSync)
       
  2975     {
       
  2976         // Disable automatic refresh.
       
  2977         iTester->SetAutomaticRefresh( EFalse );
       
  2978     }
       
  2979     
       
  2980     RArray<TInt> messages;
       
  2981     
       
  2982     for(int i =  0; i < aVideoCount; i++)
       
  2983     {
       
  2984         // Create the video.
       
  2985         TRAP( err, iTestUtils->CreateVideoFileL( aType, *path, aSize, ETrue ) );
       
  2986         if(err != KErrNone)
       
  2987             {
       
  2988             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFileL returned error: %d:", err);
       
  2989             }
       
  2990 
       
  2991         if( aDoSync && iTester->GetCurrentLevel() == 3 )
       
  2992             {
       
  2993             // Wait for insertion event.
       
  2994             messages.Append( KVCXMYVideosTestMessageMpxVideoInserted );
       
  2995             WaitForMessagesL( ETrue, messages, 60, ETrue );
       
  2996             messages.Reset();
       
  2997             }
       
  2998     }
       
  2999 
       
  3000     if( aDoSync )
       
  3001     {
       
  3002         // Refresh.
       
  3003         messages.Reset();
       
  3004         iTester->RefreshContentsL();
       
  3005         messages.Append( KVCXMYVideosTestMessageCollectionOpened );
       
  3006         CleanupClosePushL( messages );
       
  3007         WaitForMessagesL( ETrue, messages, 30, ETrue );
       
  3008         CleanupStack::PopAndDestroy( &messages );
       
  3009         iTester->SetAutomaticRefresh( ETrue );
       
  3010     }
       
  3011 
       
  3012     CleanupStack::PopAndDestroy( path );
       
  3013     
       
  3014 #if 0
       
  3015     if( aVideoCount == 1 )
  2825     if( aVideoCount == 1 )
  3016         {
  2826         {
  3017         // Save the path for later use.
  2827         // Save the path for later use.
  3018         CleanupStack::Pop( path );
  2828         CleanupStack::Pop( path );
  3019         iSideloadedFiles.Append( path );
  2829         iSideloadedFiles.Append( path );
  3020 
  2830 
  3021         // Create the video.
  2831         // Create the video.
  3022         TRAP( err, iTestUtils->CreateVideoFileL( aType, *path, aSize ) );
  2832         TRAP( err, iTestCommon->CreateVideoFileL( aType, *path, aSize ) );
  3023         if(err != KErrNone)
  2833         if(err != KErrNone)
  3024             {
  2834             {
  3025             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFileL returned error: %d:", err);
  2835             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFileL returned error: %d:", err);
  3026             }
  2836             }
       
  2837         TRAP_IGNORE( iStats->ActionStartL( KSideloadVideoActionId, _L("Sideload video") ) );
  3027         }
  2838         }
  3028     else
  2839     else
  3029         {
  2840         {
  3030         TRAP( err, iTestUtils->CreateVideoFilesL( aType, *path, aVideoCount, iSideloadedFiles ) );
  2841         TRAP( err, iTestCommon->CreateVideoFilesL( aType, *path, aVideoCount, iSideloadedFiles ) );
  3031         if(err != KErrNone)
  2842         if(err != KErrNone)
  3032             {
  2843             {
  3033             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFilesL returned error: %d:", err);
  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") ) );
  3034             }
  2849             }
  3035         CleanupStack::PopAndDestroy( path );
  2850         CleanupStack::PopAndDestroy( path );
  3036         }
  2851         }
  3037 
  2852 
  3038     if( iTester )
  2853     if( iTester )
  3049 
  2864 
  3050             // Wait for insertion events.
  2865             // Wait for insertion events.
  3051             RArray<TInt> messages;
  2866             RArray<TInt> messages;
  3052             for( TInt i=0; i<aVideoCount; i++ )
  2867             for( TInt i=0; i<aVideoCount; i++ )
  3053                 {
  2868                 {
  3054                 messages.Append( KVCXMYVideosTestMessageMpxVideoInserted );
  2869                 messages.Append( KVCXMYVideosTestMessageMpxItemInserted );
  3055                 }
  2870                 }
  3056             // Only one video added, refresh is automatic.
  2871             // Only one video added, refresh is automatic.
  3057             if( aVideoCount <= 1 )
  2872             if( aVideoCount <= 1 )
  3058                 {
  2873                 {
  3059                 messages.Append( KVCXMYVideosTestMessageCollectionOpened );
  2874                 messages.Append( KVCXMYVideosTestMessageCollectionOpened );
  3074                 CleanupStack::PopAndDestroy( &messages );
  2889                 CleanupStack::PopAndDestroy( &messages );
  3075                 iTester->SetAutomaticRefresh( ETrue );
  2890                 iTester->SetAutomaticRefresh( ETrue );
  3076                 }
  2891                 }
  3077             }
  2892             }
  3078         }
  2893         }
  3079 #endif
       
  3080     }
  2894     }
  3081 
  2895 
  3082 // -----------------------------------------------------------------------------
  2896 // -----------------------------------------------------------------------------
  3083 // CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL
  2897 // CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL
  3084 // Delete everything from sideloading folders.
  2898 // Delete everything from sideloading folders.
  3131             }
  2945             }
  3132         
  2946         
  3133         TInt createCount = amount - videoCount;
  2947         TInt createCount = amount - videoCount;
  3134         
  2948         
  3135         TRAP( err, CreateVideoFileL( 
  2949         TRAP( err, CreateVideoFileL( 
  3136                 CVCXMyVideosTestUtils::VcxTestVideoMpeg4, driveLetter, filename, -1, createCount, ETrue ) );    
  2950                 CIptvTestVideoCreator::IptvTestVideoMpeg4, driveLetter, filename, -1, createCount, ETrue ) );    
  3137         }
  2951         }
  3138     else
  2952     else
  3139     if( videoCount > amount )
  2953     if( videoCount > amount )
  3140         {
  2954         {
  3141         VCXLOGLO2("CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL: drive has more than %d videos.", amount);
  2955         VCXLOGLO2("CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL: drive has more than %d videos.", amount);
  3164         {
  2978         {
  3165         VCXLOGLO2("CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL: drive already has %d videos.", amount);
  2979         VCXLOGLO2("CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL: drive already has %d videos.", amount);
  3166         }
  2980         }
  3167         
  2981         
  3168     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL <----------");
  2982     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL <----------");
  3169     return err;
  2983     return VCXMVTEST_ERR( err );
  3170     }
  2984     }
  3171 
  2985 
  3172 // -----------------------------------------------------------------------------
  2986 // -----------------------------------------------------------------------------
  3173 // CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL
  2987 // CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL
  3174 // Delete everything from sideloading folders.
  2988 // Delete everything from sideloading folders.
  3227         HBufC16* path = filesInUse[i];
  3041         HBufC16* path = filesInUse[i];
  3228         CleanupStack::PushL( path );
  3042         CleanupStack::PushL( path );
  3229         filesInUse.Remove( i );
  3043         filesInUse.Remove( i );
  3230 
  3044 
  3231         // Delete file
  3045         // Delete file
  3232         iTestUtils->EnsureFileIsNotInUse( *path );
  3046         iTestCommon->EnsureFileIsNotInUse( *path );
  3233         TInt err = iFs.Delete( path->Des() );
  3047         TInt err = iFs.Delete( path->Des() );
  3234         if( err != KErrNone )
  3048         if( err != KErrNone )
  3235             {
  3049             {
  3236             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: delete 2nd error: %d", err);
  3050             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: delete 2nd error: %d", err);
  3237             }
  3051             }
  3244     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL <----------");
  3058     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL <----------");
  3245     return KErrNone;
  3059     return KErrNone;
  3246     }
  3060     }
  3247 
  3061 
  3248 // -----------------------------------------------------------------------------
  3062 // -----------------------------------------------------------------------------
  3249 // CVcxMyVideosApiTest::SetDeleteSideloadedVideos
  3063 // CIptvMyVideosApiTest::SetDeleteSideloadedVideos
  3250 // -----------------------------------------------------------------------------
  3064 // -----------------------------------------------------------------------------
  3251 //
  3065 //
  3252 TInt CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos( CStifItemParser& /* aItem */ )
  3066 TInt CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos( CStifItemParser& /* aItem */ )
  3253     {
  3067     {
  3254     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos ---------->");
  3068     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos ---------->");
  3256     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos <----------");
  3070     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos <----------");
  3257     return KErrNone;
  3071     return KErrNone;
  3258     }
  3072     }
  3259 
  3073 
  3260 // -----------------------------------------------------------------------------
  3074 // -----------------------------------------------------------------------------
  3261 // CVcxMyVideosApiTest::WaitForMessageL
  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
  3262 // -----------------------------------------------------------------------------
  3670 // -----------------------------------------------------------------------------
  3263 //
  3671 //
  3264 TInt CVCXMyVideosCollectionPluginTest::WaitForMessageL( CStifItemParser& aItem )
  3672 TInt CVCXMyVideosCollectionPluginTest::WaitForMessageL( CStifItemParser& aItem )
  3265     {
  3673     {
  3266     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForMessageL ---------->");
  3674     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForMessageL ---------->");
  3297     TRAPD( err, WaitForMessagesL( EFalse, messages, timeout, ETrue ) );
  3705     TRAPD( err, WaitForMessagesL( EFalse, messages, timeout, ETrue ) );
  3298     
  3706     
  3299     messages.Reset();
  3707     messages.Reset();
  3300 
  3708 
  3301     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessageL <----------");
  3709     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessageL <----------");
  3302     return err;
  3710     return VCXMVTEST_ERR( err );
  3303     }
  3711     }
  3304 
  3712 
  3305 // -----------------------------------------------------------------------------
  3713 // -----------------------------------------------------------------------------
  3306 // CVcxMyVideosApiTest::WaitForAnyMessageL
  3714 // CIptvMyVideosApiTest::WaitForAnyMessageL
  3307 // -----------------------------------------------------------------------------
  3715 // -----------------------------------------------------------------------------
  3308 //
  3716 //
  3309 TInt CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL( CStifItemParser& aItem )
  3717 TInt CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL( CStifItemParser& aItem )
  3310     {
  3718     {
  3311     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL ---------->");
  3719     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL ---------->");
  3344         }
  3752         }
  3345 
  3753 
  3346     messages.Reset();
  3754     messages.Reset();
  3347 
  3755 
  3348     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL <----------");
  3756     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL <----------");
  3349     return error;
  3757     return VCXMVTEST_ERR( error );
  3350     }
  3758     }
  3351 
  3759 
  3352 // -----------------------------------------------------------------------------
  3760 // -----------------------------------------------------------------------------
  3353 // CVcxMyVideosApiTest::WaitForMessagesL
  3761 // CIptvMyVideosApiTest::WaitForMessagesL
  3354 // -----------------------------------------------------------------------------
  3762 // -----------------------------------------------------------------------------
  3355 //
  3763 //
  3356 TInt CVCXMyVideosCollectionPluginTest::WaitForMessagesL( CStifItemParser& aItem )
  3764 TInt CVCXMyVideosCollectionPluginTest::WaitForMessagesL( CStifItemParser& aItem )
  3357     {
  3765     {
  3358     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForMessagesL ---------->");
  3766     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitForMessagesL ---------->");
  3391         }
  3799         }
  3392 
  3800 
  3393     messages.Reset();
  3801     messages.Reset();
  3394 
  3802 
  3395     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessagesL <----------");
  3803     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessagesL <----------");
  3396     return error;
  3804     return VCXMVTEST_ERR( error );
  3397     }
  3805     }
  3398 
  3806 
  3399 // -----------------------------------------------------------------------------
  3807 // -----------------------------------------------------------------------------
  3400 // CVcxMyVideosApiTest::WaitForMessagesL
  3808 // CIptvMyVideosApiTest::WaitForMessagesL
  3401 // -----------------------------------------------------------------------------
  3809 // -----------------------------------------------------------------------------
  3402 //
  3810 //
  3403 void CVCXMyVideosCollectionPluginTest::WaitForMessagesL( TBool aBlock, RArray<TInt>& aMessages, TInt aTimeout,
  3811 void CVCXMyVideosCollectionPluginTest::WaitForMessagesL( TBool aBlock, RArray<TInt>& aMessages, TInt aTimeout,
  3404         TBool aWaitAll )
  3812         TBool aWaitAll )
  3405     {
  3813     {
  3478     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteDirectoryIfEmpty");
  3886     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteDirectoryIfEmpty");
  3479     return KErrNone;
  3887     return KErrNone;
  3480     }
  3888     }
  3481 
  3889 
  3482 // -----------------------------------------------------------------------------
  3890 // -----------------------------------------------------------------------------
  3483 // CVcxMyVideosApiTest::MapMpxMediaAttribute
  3891 // CIptvMyVideosApiTest::MapMpxMediaAttribute
  3484 // -----------------------------------------------------------------------------
  3892 // -----------------------------------------------------------------------------
  3485 //
  3893 //
  3486 TInt CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute(
  3894 TInt CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute(
  3487         TVcxTestMediaAttributeIdMapping aMapping, TMPXAttributeData& aAttribute, TVcxTestMediaAttributeType& aType )
  3895         TVcxTestMediaAttributeIdMapping aMapping, TMPXAttributeData& aAttribute, TVcxTestMediaAttributeType& aType )
  3488     {
  3896     {
  3743         {
  4151         {
  3744         err = KErrNotFound;
  4152         err = KErrNotFound;
  3745         }
  4153         }
  3746 
  4154 
  3747     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute");
  4155     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute");
  3748     return err;
  4156     return VCXMVTEST_ERR( err );
  3749     }
  4157     }
  3750 
  4158 
  3751 // -----------------------------------------------------------------------------
  4159 // -----------------------------------------------------------------------------
  3752 // CVcxMyVideosApiTest::GetMessageDesc
  4160 // CIptvMyVideosApiTest::GetMessageDesc
  3753 // -----------------------------------------------------------------------------
  4161 // -----------------------------------------------------------------------------
  3754 //
  4162 //
  3755 void CVCXMyVideosCollectionPluginTest::GetMessageDesc( TInt aMessage, TDes& aMsgBuff )
  4163 void CVCXMyVideosCollectionPluginTest::GetMessageDesc( TInt aMessage, TDes& aMsgBuff )
  3756     {
  4164     {
  3757     switch( aMessage )
  4165     switch( aMessage )
  3860         case KVCXMYVideosTestMessageCollectionGeneral:
  4268         case KVCXMYVideosTestMessageCollectionGeneral:
  3861             {
  4269             {
  3862             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionGeneral") );
  4270             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionGeneral") );
  3863             }
  4271             }
  3864             break;
  4272             break;
  3865         case KVCXMYVideosTestMessageMpxVideoInserted:
  4273         case KVCXMYVideosTestMessageCollectionItemChanged:
  3866             {
  4274             {
  3867             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoInserted") );
  4275             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionItemChanged") );
  3868             }
  4276             }
  3869             break;
  4277             break;
  3870         case KVCXMYVideosTestMessageMpxCategoryInserted:
  4278         case KVCXMYVideosTestMessageCollectionCategoryChanged:
  3871             {
  4279             {
  3872             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryInserted") );
  4280             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionCategoryChanged") );
  3873             }
  4281             }
  3874             break;
  4282             break;
  3875         case KVCXMYVideosTestMessageMpxAlbumInserted:
  4283         case KVCXMYVideosTestMessageMpxItemInserted:
  3876             {
  4284             {
  3877             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumInserted") );
  4285             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemInserted") );
  3878             }
  4286             }
  3879             break;
  4287             break;
  3880         case KVCXMYVideosTestMessageMpxVideoDeleted:
  4288         case KVCXMYVideosTestMessageMpxItemDeleted:
  3881             {
  4289             {
  3882             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoDeleted") );
  4290             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemDeleted") );
  3883             }
  4291             }
  3884             break;
  4292             break;
  3885         case KVCXMYVideosTestMessageMpxCategoryDeleted:
  4293         case KVCXMYVideosTestMessageMpxItemModified:
  3886             {
  4294             {
  3887             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryDeleted") );
  4295             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemModified") );
  3888             }
       
  3889             break;
       
  3890         case KVCXMYVideosTestMessageMpxAlbumDeleted:
       
  3891             {
       
  3892             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumDeleted") );
       
  3893             }
       
  3894             break;
       
  3895         case KVCXMYVideosTestMessageMpxVideoModified:
       
  3896             {
       
  3897             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoModified") );
       
  3898             }
       
  3899             break;
       
  3900         case KVCXMYVideosTestMessageMpxCategoryModified:
       
  3901             {
       
  3902             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryModified") );
       
  3903             }
       
  3904             break;
       
  3905         case KVCXMYVideosTestMessageMpxAlbumModified:
       
  3906             {
       
  3907             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumModified") );
       
  3908             }
  4296             }
  3909             break;
  4297             break;
  3910         case KVCXMyVideosTestMessageVideoListOrderChanged:
  4298         case KVCXMyVideosTestMessageVideoListOrderChanged:
  3911             {
  4299             {
  3912             aMsgBuff.Copy( _L("KVCXMyVideosTestMessageVideoListOrderChanged") );
  4300             aMsgBuff.Copy( _L("KVCXMyVideosTestMessageVideoListOrderChanged") );
  3931 
  4319 
  3932         }
  4320         }
  3933     }
  4321     }
  3934 
  4322 
  3935 // -----------------------------------------------------------------------------
  4323 // -----------------------------------------------------------------------------
  3936 // CVcxMyVideosApiTest::CheckMediasL
  4324 // CIptvMyVideosApiTest::CheckMediasL
  3937 // -----------------------------------------------------------------------------
  4325 // -----------------------------------------------------------------------------
  3938 //
  4326 //
  3939 void CVCXMyVideosCollectionPluginTest::CheckMediasL( TInt aExpectedVideoCount, TInt aDrive, TInt aCheckType )
  4327 void CVCXMyVideosCollectionPluginTest::CheckMediasL( TInt aExpectedVideoCount, TInt aDrive, TInt aCheckType )
  3940     {
  4328     {
  3941     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediasL");
  4329     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediasL");
  3942 
  4330 
  3943     WaitForRefreshL( false );
       
  3944     
       
  3945     TInt actualVideoCount(0);
  4331     TInt actualVideoCount(0);
  3946 
  4332 
  3947     // File check
  4333     // File check
  3948     TInt videoCount = iTester->GetMediaCount();
  4334     TInt videoCount = iTester->GetMediaCount();
  3949 
  4335 
  3971                     }
  4357                     }
  3972                 }
  4358                 }
  3973 
  4359 
  3974             actualVideoCount++;
  4360             actualVideoCount++;
  3975 
  4361 
  3976             if( !iFileCheckDisabled )
  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 ) )
  3977                 {
  4376                 {
  3978                 if( !iFs.IsValidName( localFilePath ) )
  4377                 if( !iFs.IsValidName( localFilePath ) )
  3979                     {
  4378                     {
  3980                     VCXLOGLO1("CVCXMyVideosCollectionPluginTest: ERROR. File path is not valid.");
  4379                     VCXLOGLO1("CVCXMyVideosCollectionPluginTest: ERROR. File path is not valid.");
  3981                     VCXLOGLO2("Local file path: %S", &localFilePath);
  4380                     VCXLOGLO2("Local file path: %S", &localFilePath);
  4048 
  4447 
  4049     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediasL");
  4448     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediasL");
  4050     }
  4449     }
  4051 
  4450 
  4052 // -----------------------------------------------------------------------------
  4451 // -----------------------------------------------------------------------------
  4053 // CVcxMyVideosApiTest::GetDriveParam
  4452 // CIptvMyVideosApiTest::GetDriveParam
  4054 // -----------------------------------------------------------------------------
  4453 // -----------------------------------------------------------------------------
  4055 //
  4454 //
  4056 TInt CVCXMyVideosCollectionPluginTest::GetDriveParam( CStifItemParser& aItem, TInt& aDrive )
  4455 TInt CVCXMyVideosCollectionPluginTest::GetDriveParam( CStifItemParser& aItem, TInt& aDrive )
  4057     {
  4456     {
  4058     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  4457     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
  4070             err = iFs.CharToDrive( driveLetter[0], aDrive );
  4469             err = iFs.CharToDrive( driveLetter[0], aDrive );
  4071             VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: drive: %S = %d", &driveLetter, aDrive );
  4470             VCXLOGLO3("CVCXMyVideosCollectionPluginTest:: drive: %S = %d", &driveLetter, aDrive );
  4072             }
  4471             }
  4073         }
  4472         }
  4074 
  4473 
  4075     return err;
  4474     return VCXMVTEST_ERR( err );
  4076     }
  4475     }
  4077 
  4476 
  4078 // -----------------------------------------------------------------------------
  4477 // -----------------------------------------------------------------------------
  4079 // CVcxMyVideosApiTest::DoTotalRefreshL
  4478 // CIptvMyVideosApiTest::DoTotalRefreshL
  4080 // -----------------------------------------------------------------------------
  4479 // -----------------------------------------------------------------------------
  4081 //
  4480 //
  4082 void CVCXMyVideosCollectionPluginTest::DoTotalRefreshL()
  4481 void CVCXMyVideosCollectionPluginTest::DoTotalRefreshL()
  4083     {
  4482     {
  4084     if( iTester && iTester->GetCurrentLevel() == 3 )
  4483     if( iTester && iTester->GetCurrentLevel() == 3 )
  4110         	}
  4509         	}
  4111         }
  4510         }
  4112     }
  4511     }
  4113 
  4512 
  4114 // -----------------------------------------------------------------------------
  4513 // -----------------------------------------------------------------------------
  4115 // CVcxMyVideosApiTest::WaitForRefreshL
  4514 // CIptvMyVideosApiTest::WaitForRefreshL
  4116 // -----------------------------------------------------------------------------
  4515 // -----------------------------------------------------------------------------
  4117 //
  4516 //
  4118 void CVCXMyVideosCollectionPluginTest::WaitForRefreshL( TBool aForcedWait )
  4517 void CVCXMyVideosCollectionPluginTest::WaitForRefreshL( TBool aForcedWait )
  4119     {
  4518     {
  4120     if( iTester && ( iTester->IsRefreshing() || aForcedWait ) )
  4519     if( iTester && ( iTester->IsRefreshing() || aForcedWait ) )
  4126         CleanupStack::PopAndDestroy( &messages );
  4525         CleanupStack::PopAndDestroy( &messages );
  4127         }
  4526         }
  4128     }
  4527     }
  4129 
  4528 
  4130 // -----------------------------------------------------------------------------
  4529 // -----------------------------------------------------------------------------
  4131 // CVcxMyVideosApiTest::GetMediasForLevelL
  4530 // CIptvMyVideosApiTest::GetMediasForLevelL
  4132 // -----------------------------------------------------------------------------
  4531 // -----------------------------------------------------------------------------
  4133 //
  4532 //
  4134 CMPXMediaArray* CVCXMyVideosCollectionPluginTest::GetMediasForLevelL( TInt aLevel, TUint aFlagsFilter )
  4533 CMPXMediaArray* CVCXMyVideosCollectionPluginTest::GetMediasForLevelL( TInt aLevel, TUint aFlagsFilter )
  4135     {
  4534     {
  4136     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::GetMediasForLevelL ---------->");
  4535     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::GetMediasForLevelL ---------->");
  4233     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediasForLevelL <----------");
  4632     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediasForLevelL <----------");
  4234     return medias;
  4633     return medias;
  4235     }
  4634     }
  4236 
  4635 
  4237 // -----------------------------------------------------------------------------
  4636 // -----------------------------------------------------------------------------
  4238 // CVcxMyVideosApiTest::HandleVcxMvTesterMessageL
  4637 // CIptvMyVideosApiTest::HandleVcxMvTesterMessageL
  4239 // -----------------------------------------------------------------------------
  4638 // -----------------------------------------------------------------------------
  4240 //
  4639 //
  4241 void CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL( TInt aMessage, TInt aError )
  4640 void CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL( TInt aMessage, TInt aError )
  4242     {
  4641     {
  4243     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL");
  4642     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL");
  4262     if( aMessage == KVCXMYVideosTestMessageCollectionOpened ||
  4661     if( aMessage == KVCXMYVideosTestMessageCollectionOpened ||
  4263         aMessage == KVCXMYVideosTestMessageListComplete ||
  4662         aMessage == KVCXMYVideosTestMessageListComplete ||
  4264         aMessage == KVCXMYVideosTestMessageCollectionOpened ||
  4663         aMessage == KVCXMYVideosTestMessageCollectionOpened ||
  4265         aMessage == KVCXMYVideosTestMessageGotMediasByKMpxId )
  4664         aMessage == KVCXMYVideosTestMessageGotMediasByKMpxId )
  4266         {
  4665         {
       
  4666         _LIT(KWhat, "VidCount");
       
  4667         _LIT(KDesc, "%d");
  4267         TInt videoCount = iTester->GetMediaCount();
  4668         TInt videoCount = iTester->GetMediaCount();
  4268         if( iTester->GetCurrentOpenLevelIndex() == -1 )
  4669         TestModuleIf().Printf( 0, KWhat, KDesc, videoCount );
  4269             {
  4670         }
  4270             TestModuleIf().Printf( 0, _L("Mv"), _L("CatCount %d"), videoCount );
  4671 
  4271             }
       
  4272         else
       
  4273             {
       
  4274             TestModuleIf().Printf( 0, _L("Mv"), _L("VidCount %d"), videoCount );
       
  4275             }
       
  4276         }
       
  4277 
  4672 
  4278     // Waiting for messages from mpx plugin to stop.
  4673     // Waiting for messages from mpx plugin to stop.
  4279     if( iCoolDownWait )
  4674     if( iCoolDownWait )
  4280         {
  4675         {
  4281         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: MsgQueue: Cooling down.");
  4676         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: MsgQueue: Cooling down.");
  4282         iCoolDownTimer->After( KTimeoutSecond * 5 );
  4677         iCoolDownTimer->After( KTimeoutSecond * 5 );
  4283         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL");
  4678         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL");
  4284         return;
  4679         return;
  4285         }    
  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         }
  4286 
  4753 
  4287     // See if there's cancel needed for move, copy or delete.
  4754     // See if there's cancel needed for move, copy or delete.
  4288     if( aError == KErrNone && iCancelNextOperation )
  4755     if( aError == KErrNone && iCancelNextOperation )
  4289         {
  4756         {
  4290         if( aMessage == KVCXMYVideosTestMessageCopyOrMoveStarted )
  4757         if( aMessage == KVCXMYVideosTestMessageCopyOrMoveStarted )
  4298             iCancelNextOperation = EFalse;
  4765             iCancelNextOperation = EFalse;
  4299             }
  4766             }
  4300         }
  4767         }
  4301 
  4768 
  4302     // Check for errors. 
  4769     // Check for errors. 
  4303     if( aError != KErrNone )
  4770     if( aError != KErrNone && !iWaitingForAllDownloads )
  4304         {
  4771         {
  4305         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
  4772         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
  4306         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Error: %d <----------", aError);
  4773         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Error: %d <----------", aError);
  4307         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
  4774         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
  4308 
  4775 
  4309         iLastReceivedMessage = 0;
  4776         iLastReceivedMessage = 0;
  4310         if( !iMessageWaitIsBlocking )
  4777         if( !iMessageWaitIsBlocking )
  4311             {
  4778             {
  4312             VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------");
  4779             VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------");
  4313             Signal( aError );
  4780             Signal( VCXMVTEST_ERR( aError ) );
  4314             TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), aError );
  4781             TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), aError );
  4315             iEventError = KErrNone;
  4782             iEventError = KErrNone;
  4316             }
  4783             }
  4317         else
  4784         else
  4318             {
  4785             {
  4377                     }
  4844                     }
  4378 
  4845 
  4379                 if( !iMessageWaitIsBlocking )
  4846                 if( !iMessageWaitIsBlocking )
  4380                     {
  4847                     {
  4381                     VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------");
  4848                     VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------");
  4382                     Signal( iEventError );
  4849                     Signal( VCXMVTEST_ERR( iEventError ) );
  4383                     TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), iEventError );
  4850                     TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), iEventError );
  4384                     iEventError = KErrNone;
  4851                     iEventError = KErrNone;
  4385                     }
  4852                     }
  4386                 else
  4853                 else
  4387                     {
  4854                     {
  4398 
  4865 
  4399     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL");
  4866     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL");
  4400     }
  4867     }
  4401 
  4868 
  4402 // -----------------------------------------------------------------------------
  4869 // -----------------------------------------------------------------------------
  4403 // CVcxEpgEngineTest::TimerComplete
  4870 // CIptvEpgEngineTest::TimerComplete
  4404 // -----------------------------------------------------------------------------
  4871 // -----------------------------------------------------------------------------
  4405 //
  4872 //
  4406 void CVCXMyVideosCollectionPluginTest::TimerComplete(TInt aTimerId, TInt aError)
  4873 void CVCXMyVideosCollectionPluginTest::TimerComplete(TInt aTimerId, TInt aError)
  4407     {
  4874     {
  4408     if( aTimerId == 0 )
  4875     if( aTimerId == 0 )
  4419             
  4886             
  4420             // Script is waiting for signal.
  4887             // Script is waiting for signal.
  4421             if( !iMessageWaitIsBlocking )
  4888             if( !iMessageWaitIsBlocking )
  4422                 {
  4889                 {
  4423                 VCXLOGLO2( "CVCXMyVideosCollectionPluginTest:: Signaling: %d", iEventError);
  4890                 VCXLOGLO2( "CVCXMyVideosCollectionPluginTest:: Signaling: %d", iEventError);
  4424                 Signal( iEventError );
  4891                 Signal( VCXMVTEST_ERR( iEventError ) );
  4425                 }
  4892                 }
       
  4893             
       
  4894             TRAP_IGNORE( iStats->ActionEndL( 0, iEventError ) );
       
  4895 
  4426             TestModuleIf().Printf( 0, _L("Timedout"), _L("%d"), iEventError );
  4896             TestModuleIf().Printf( 0, _L("Timedout"), _L("%d"), iEventError );
  4427             }
  4897             }
  4428         }
  4898         }
  4429 
  4899 
  4430     if( aTimerId == 1 )
  4900     if( aTimerId == 1 )
  4431         {
  4901         {
  4432         VCXLOGLO1("CVCXMyVideosCollectionPluginTest::TimerComplete: Cooldown done. ------->");
  4902         VCXLOGLO1("CVCXMyVideosCollectionPluginTest::TimerComplete: Cooldown done. ------->");
  4433         iActiveWait->Stop();
  4903         iActiveWait->Stop();
  4434         iCoolDownWait = EFalse;
  4904         iCoolDownWait = EFalse;
  4435 
  4905 
       
  4906         iWaitingForAllDownloads = EFalse;
  4436         iWaitedTestMessages.Reset();
  4907         iWaitedTestMessages.Reset();
  4437         iLastReceivedMessage = 0;
  4908         iLastReceivedMessage = 0;
  4438         }
  4909         }
  4439     }
  4910     }
  4440 
  4911