videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTestBlocks.cpp
branchRCL_3
changeset 57 befca0ec475f
parent 56 839377eedc2b
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTestBlocks.cpp	Tue Aug 31 15:15:55 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTestBlocks.cpp	Wed Sep 01 12:30:28 2010 +0100
@@ -11,9 +11,10 @@
 *
 * Contributors:
 *
-* Description:
+* Description:   ?Description*
 */
 
+
 // INCLUDE FILES
 #include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroyPushL
 #include <e32svr.h>
@@ -23,35 +24,30 @@
 #include <collate.h>
 
 #include "VCXTestLog.h"
-#include "VCXMyVideosTestUtils.h"
-#include "CVcxTestActiveWait.h"
-#include "CVcxTestTimer.h"
+#include "VCXTestCommon.h"
+#include "CIptvTestActiveWait.h"
+#include "CIptvTestTimer.h"
+#include "VCXTestStatsKeeper.h"
 
 #include "VCXMyVideosCollectionPluginTest.h"
 #include "VCXMyVideosCollectionPluginTester.h"
-#include "VCXMyVideosTestUtils.h"
+#include "VCXMyVideosTestCommon.h"
+#include "VCXMyVideosTestDlWatcher.h"
+#include "VCXMyVideosTestServiceEmu.h"
 #include "VCXTestMdsDbModifier.h"
-#include "VCXMyVideosTestCommon.h"
 
 #include <mpxmedia.h>
 #include <mpxmediageneraldefs.h>
 #include <mpxmediageneralextdefs.h>
 
-#include "vcxmyvideosdefs.h"
 #include "vcxmyvideosuids.h"
 
 // CONSTANTS
 
 const TInt KVcxTestFileSize3GB = -999;
 
-_LIT(KAbout2050CharsString, "asdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjai");
-_LIT(KVcxTestEmptyString, "");
-
-_LIT(KStifScriptInvalidRequest, "InvalidRequest");
-_LIT(KStifScriptEmptyString, "EmptyString");
-_LIT(KStifScript2KString, "2KString");
-
 // MACROS
+#define VCXMVTEST_ERR(err) ( iStatsEnabled ) ? KErrNone : err 
 
 // MODULE DATA STRUCTURES
 
@@ -110,8 +106,8 @@
 
     iSideloadFolders.ResetAndDestroy();
 
-    delete iTestUtils;
-    iTestUtils = NULL;
+    delete iTestCommon;
+    iTestCommon = NULL;
 
 #ifdef __WINSCW__
     iClient.Close();
@@ -148,6 +144,9 @@
     delete iMpxMedia;
     iMpxMedia = NULL;
     
+    delete iServiceEmu;
+    iServiceEmu = NULL;
+    
     delete iMdsDbModifier;
     iMdsDbModifier = NULL;
 
@@ -155,6 +154,9 @@
     iFileMan = NULL;
 
     iFs.Close();
+    
+    delete iStats;
+    iStats = NULL;    
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::Delete <----------");
     }
@@ -175,16 +177,18 @@
         // Second is the actual implementation member function.
         ENTRY( "Create", CVCXMyVideosCollectionPluginTest::CreateL ),
         
+        ENTRY( "EnableStats", CVCXMyVideosCollectionPluginTest::EnableStatsL ),
+        ENTRY( "SetPreferredMemory", CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL ),
         ENTRY( "SetSortingOrder", CVCXMyVideosCollectionPluginTest::SetSortingOrderL ),
         ENTRY( "SetAutomaticRefresh", CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh ),
         ENTRY( "SetQuietMode", CVCXMyVideosCollectionPluginTest::SetQuietMode ),
         ENTRY( "CoolDown", CVCXMyVideosCollectionPluginTest::CoolDownL ),
+        ENTRY( "DisableDownloadCheck", CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL ),
         ENTRY( "SetFileCheck", CVCXMyVideosCollectionPluginTest::SetFileCheckL ),
-        ENTRY( "SetUseCopiedMedias", CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL ),
+        ENTRY( "SetAutoResume", CVCXMyVideosCollectionPluginTest::SetAutoResumeL ),
 
         ENTRY( "OpenCollection", CVCXMyVideosCollectionPluginTest::OpenCollectionL ),
         ENTRY( "OpenLevel", CVCXMyVideosCollectionPluginTest::OpenLevelL ),
-        ENTRY( "OpenLevelByIndex", CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL ),
         ENTRY( "RefreshContents", CVCXMyVideosCollectionPluginTest::RefreshContentsL ),
         ENTRY( "GetMediasByMpxId", CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL ),
         ENTRY( "CloseLevel", CVCXMyVideosCollectionPluginTest::CloseLevelL ),
@@ -194,10 +198,10 @@
         ENTRY( "GetAllMediaFullDetails", CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL ),
         ENTRY( "SetMediaDetail", CVCXMyVideosCollectionPluginTest::SetMediaDetailL ),
         ENTRY( "CheckMediaDetail", CVCXMyVideosCollectionPluginTest::CheckMediaDetailL ),
-        ENTRY( "CheckAlbumCount", CVCXMyVideosCollectionPluginTest::CheckAlbumCountL ),
         ENTRY( "CheckMediaCount", CVCXMyVideosCollectionPluginTest::CheckMediaCountL ),
         ENTRY( "CheckMinimumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL ),
         ENTRY( "CheckMaximumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL ),
+        ENTRY( "CheckDownloadCount", CVCXMyVideosCollectionPluginTest::CheckDownloadCountL ),
         
         ENTRY( "CreateCopyOfMedia", CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL ),
         ENTRY( "CreateEmptyMedia", CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL ),
@@ -208,7 +212,6 @@
         
         ENTRY( "DeleteFileOfMedia", CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL ),
         ENTRY( "DeleteFilesOfAllMedias", CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL ),
-        ENTRY( "CreateAlbum", CVCXMyVideosCollectionPluginTest::CreateAlbumL ),
         ENTRY( "RemoveMedia", CVCXMyVideosCollectionPluginTest::RemoveMediaL ),
         ENTRY( "RemoveAllMedia", CVCXMyVideosCollectionPluginTest::RemoveAllMediaL ),
         ENTRY( "MoveMedia", CVCXMyVideosCollectionPluginTest::MoveMediaL ),
@@ -221,20 +224,25 @@
         ENTRY( "DeleteMedias", CVCXMyVideosCollectionPluginTest::DeleteMediasL ),
         ENTRY( "CancelDelete", CVCXMyVideosCollectionPluginTest::CancelDeleteL ),
         
-        ENTRY( "CreateAlbum", CVCXMyVideosCollectionPluginTest::CreateAlbumL ),
-        ENTRY( "DeleteAlbums", CVCXMyVideosCollectionPluginTest::DeleteAlbumsL ),
-        ENTRY( "DeleteAllAlbums", CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL ),
-        ENTRY( "AddMediasToAlbum", CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL ),
-        ENTRY( "RemoveMediasFromAlbum", CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL ),
-        ENTRY( "RenameAlbum", CVCXMyVideosCollectionPluginTest::RenameAlbumL ),
-        ENTRY( "CheckAlbumExists", CVCXMyVideosCollectionPluginTest::CheckAlbumExistsL ),
-        
         ENTRY( "CreateVideoFile", CVCXMyVideosCollectionPluginTest::CreateVideoFileL ),
         ENTRY( "CreateVideoFileNoWait", CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ),
         ENTRY( "EnsureDriveForVideos", CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL ),
         ENTRY( "EmptySideloadFolders", CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL ),
         ENTRY( "SetDeleteSideloadedVideos", CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos ),
         
+        ENTRY( "Download", CVCXMyVideosCollectionPluginTest::DownloadL ),
+        ENTRY( "ResumeDownload", CVCXMyVideosCollectionPluginTest::ResumeDownloadL ),
+        ENTRY( "ResumeAllDownloads", CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL ),
+        ENTRY( "DownloadUsingMedia", CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL ),
+        ENTRY( "ResumeDownloadUsingMedia", CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL ),
+        ENTRY( "DownloadUrl", CVCXMyVideosCollectionPluginTest::DownloadUrlL ),
+        ENTRY( "CancelDownload", CVCXMyVideosCollectionPluginTest::CancelDownloadL ),
+        ENTRY( "CancelDownloadById", CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL ),
+        ENTRY( "PauseDownload", CVCXMyVideosCollectionPluginTest::PauseDownloadL ),
+        ENTRY( "PauseDownloadByUrl", CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL ),
+        ENTRY( "CheckDownloadProgress", CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL ),
+        
+        ENTRY( "WaitAllDownloads", CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL ),
         ENTRY( "WaitForMessage", CVCXMyVideosCollectionPluginTest::WaitForMessageL ),
         ENTRY( "WaitForAnyMessage", CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL ),
         ENTRY( "WaitForMessages", CVCXMyVideosCollectionPluginTest::WaitForMessagesL ),
@@ -249,6 +257,34 @@
     }
 
 // -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTest::EnableStatsL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::EnableStatsL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::EnableStatsL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In EnableStatsL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    TPtrC statsName;
+    TPtrC fileName;
+    User::LeaveIfError( aItem.GetNextString( statsName) );
+    User::LeaveIfError( aItem.GetNextString( fileName) );
+
+    TRAP_IGNORE( iStats->StartStatsKeepingL( statsName, fileName ) );
+    iStatsEnabled = ETrue;
+    
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EnableStatsL <----------");
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
 // CVCXMyVideosCollectionPluginTest::CreateL
 // -----------------------------------------------------------------------------
 //
@@ -267,12 +303,13 @@
 
     aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
 
-    iTestUtils = CVCXMyVideosTestUtils::NewL();
-    iTester = CVCXMyVideosCollectionPluginTester::NewL( this, iTestUtils );
-    iActiveWait = CVcxTestActiveWait::NewL();
-    iActiveWaitBlocking = CVcxTestActiveWait::NewL();
-    iTimeoutTimer = CVcxTestTimer::NewL(*this, 0);
-    iCoolDownTimer = CVcxTestTimer::NewL(*this, 1);   
+    iTestCommon = CVCXTestCommon::NewL();
+    iStats = CVCXTestStatsKeeper::NewL();
+    iTester = CVCXMyVideosCollectionPluginTester::NewL( this, iTestCommon, iStats );
+    iActiveWait = CIptvTestActiveWait::NewL();
+    iActiveWaitBlocking = CIptvTestActiveWait::NewL();
+    iTimeoutTimer = CIptvTestTimer::NewL(*this, 0);
+    iCoolDownTimer = CIptvTestTimer::NewL(*this, 1);   
     
 #ifdef __WINSCW__
     TInt err = iClient.Connect();
@@ -282,6 +319,12 @@
         }
 #endif // __WINSCW__
 
+    iAutoResume = ETrue;
+
+    iTester->SetAutoResume( iAutoResume );
+
+    iServiceEmu = CVCXMyVideosTestServiceEmu::NewL();
+
     iMdsDbModifier = CVCXTestMdsDbModifier::NewL();
 
     iCurrentSortOrder = EVcxMyVideosSortingNone;
@@ -291,6 +334,40 @@
     }
 
 // -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In SetPreferredMemoryL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    TInt drive(0);
+    User::LeaveIfError( GetDriveParam( aItem, drive ) );
+
+    // These were defined in CVcxMyVideosDownloadUtil::PreferredMemoryDesL()
+    const TInt KVcxCenRepUid = 0x102750E2; // same as KIptvCenRepUid in CIptvUtil.h
+    const TInt KVcxCenRepPreferredMemoryKey = 0x01; // same as KIptvCenRepPreferredMemoryKey in CIptvUtil.h
+
+    TUid uid;
+    uid.iUid = KVcxCenRepUid;
+
+    CRepository* cenRep = CRepository::NewLC( uid );
+    User::LeaveIfError( cenRep->Set( KVcxCenRepPreferredMemoryKey, drive ) );
+    CleanupStack::PopAndDestroy( cenRep );
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL <----------");
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
 // CVCXMyVideosCollectionPluginTest::SetSortingOrderL
 // -----------------------------------------------------------------------------
 //
@@ -320,7 +397,7 @@
     iCurrentSortOrder = value;
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetSortingOrderL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -346,7 +423,7 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -372,11 +449,11 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetQuietMode <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CoolDownL
+// CIptvMyVideosApiTest::CoolDownL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CoolDownL( CStifItemParser& /* aItem */ )
@@ -405,7 +482,22 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::SetFileCheckL
+// CIptvMyVideosApiTest::DisableDownloadCheckL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL( CStifItemParser& /* aItem */ )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL");
+    if( iTester )
+        {
+        iTester->GetDownloadWatcher()->DisableDownloadCheck();
+        }
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL");
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::SetFileCheckL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::SetFileCheckL( CStifItemParser& aItem )
@@ -421,19 +513,28 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::SetUseCopiedMediasL
+// CIptvMyVideosApiTest::SetAutoResumeL
 // -----------------------------------------------------------------------------
 //
-TInt CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL( CStifItemParser& aItem )
+TInt CVCXMyVideosCollectionPluginTest::SetAutoResumeL( CStifItemParser& aItem )
     {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL");
-
-    TInt value(0);
-    User::LeaveIfError( aItem.GetNextInt( value ) );
-    TBool set = static_cast<TBool>(value);
-    iTester->SetUseCopiedMediasL( set );
-
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL");
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetAutoResumeL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In SetAutoResumeL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    TInt autoResume(0);
+    User::LeaveIfError( aItem.GetNextInt( autoResume ) );
+    iAutoResume = autoResume;
+    if( iTester )
+        {
+        iTester->SetAutoResume( iAutoResume );
+        }
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetAutoResumeL <----------");
     return KErrNone;
     }
 
@@ -478,7 +579,7 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenCollectionL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -496,41 +597,6 @@
     iLog->Log( KWhere );
 
     aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-    
-    TPtrC name;
-    User::LeaveIfError( aItem.GetNextString( name ) );
-    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: levelName: %S", &name);
-
-    iLastReceivedMessage = -1;
-
-    TInt err( KErrNotReady );
-    if( iTester )
-        {
-        TRAP( err, iTester->OpenLevelL( name ) );
-        }
-
-    if( err != KErrNone )
-        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
-
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In OpenLevelL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
     TInt index;
     User::LeaveIfError( aItem.GetNextInt( index ) );
     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: index: %d", index);
@@ -546,8 +612,8 @@
     if( err != KErrNone )
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL <----------");
-    return err;
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelL <----------");
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -576,7 +642,7 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CloseLevelL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -607,7 +673,7 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RefreshContentsL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -654,7 +720,7 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -710,7 +776,7 @@
     messages.Reset();
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -777,7 +843,7 @@
     messages.Reset();
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -810,7 +876,7 @@
     iLastReceivedMessage = -1;
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -837,49 +903,28 @@
 
     TInt drive(0);
     User::LeaveIfError( GetDriveParam( aItem, drive ) );
-    
-    // Get the media object to be checked.
-    
-    TPtrC itemIndexOrName;
-    User::LeaveIfError( aItem.GetNextString( itemIndexOrName ) );
-    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: item index or name: %S", &itemIndexOrName);
-
-    TLex lex( itemIndexOrName );
-    TInt itemIndex( -1 );
-    if( lex.Val( itemIndex ) == KErrNone )
+
+    TInt itemIndex(0);
+    User::LeaveIfError( aItem.GetNextInt( itemIndex ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: item index: %d", itemIndex);
+
+    if( itemIndex < 0 || itemIndex >= iTester->GetMediaCount() )
         {
-        if( itemIndex < 0 || itemIndex >= iTester->GetMediaCount() )
-            {
-            VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", itemIndex);
-            User::Leave( KErrArgument );
-            }
-        }
-    else
-        {
-        itemIndex = iTester->GetIndexOfMediaWithNameL( itemIndexOrName );
-        }
-    
-    if( itemIndex == KErrNotFound )
-        {
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", itemIndex);
         User::Leave( KErrArgument );
         }
 
-    // Attribute to be checked
-    
     TInt mpxAttributeMappingId(0);
     User::LeaveIfError( aItem.GetNextInt( mpxAttributeMappingId ) );
 
-    // It's type.
-    
     TVcxTestMediaAttributeType type;
     TMPXAttributeData mpxMediaAttribute;
     User::LeaveIfError( MapMpxMediaAttribute(
             static_cast<TVcxTestMediaAttributeIdMapping>(mpxAttributeMappingId),
             mpxMediaAttribute, type ) );
     
-    // Get the media to be checked.
     
-    CMPXMedia* media( NULL );
+    CMPXMedia* media( NULL );        
     TRAP( err, media = iTester->GetMediaL( drive, itemIndex ) );    
     
     // If attribute is not supported, fetch full media details.
@@ -900,7 +945,7 @@
     if( err != KErrNone )
         {
         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------");
-        return err;
+        return VCXMVTEST_ERR( err );
         }
 
     if( !media->IsSupported( mpxMediaAttribute ) )
@@ -911,7 +956,7 @@
         iTester->PrintMPXMediaL( *media, ETrue );
         
         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <---------");
-        return KErrNotSupported;
+        return VCXMVTEST_ERR( KErrNotSupported );
         }
 
     if( type == EVcxTestMediaAttributeTypeString )
@@ -1201,7 +1246,7 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -1401,68 +1446,11 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaDetailL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CheckAlbumCountL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::CheckAlbumCountL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckAlbumCountL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In CheckAlbumCountL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-
-    WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
-    
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
-    TInt expectedCount(0);
-    User::LeaveIfError(aItem.GetNextInt(expectedCount));
-
-    // File check
-    TInt videoCount = iTester->GetMediaCount();
-
-    // attribute check that they are in allowed values
-
-    int err(KErrNone);
-    int actualCount(0);
-    
-    for( TInt i = videoCount-1; i >= 0; i-- )
-        {
-        CMPXMedia* media = iTester->GetMediaL( -1, i );
-
-        // Skip categories with empty names, they are for photos.
-        if( !media->IsSupported( KMPXMediaGeneralTitle ) )
-            {
-            continue;
-            }
-        
-        TMPXItemId itemId  = *( media->Value<TMPXItemId>( KMPXMediaGeneralId ) );
-        
-        if(itemId.iId2 == KVcxMvcMediaTypeAlbum)
-            {
-            actualCount++;
-            }
-        }
-    
-    if ( actualCount != expectedCount )
-        {
-        VCXLOGLO2("CVCXMyVideosCollectionPluginTest: Error! Count of albums is wrong: %d", actualCount );
-        err = KErrCorrupt;
-        }
-  
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckAlbumCountL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CheckMediaCountL
+// CIptvMyVideosApiTest::CheckMediaCountL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CheckMediaCountL( CStifItemParser& aItem )
@@ -1493,11 +1481,11 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaCountL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CheckMinimumMediaCountL
+// CIptvMyVideosApiTest::CheckMinimumMediaCountL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL( CStifItemParser& aItem )
@@ -1525,11 +1513,11 @@
     TRAPD( err, CheckMediasL( expectedCount, drive, -1 ) );
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CheckMaximumMediaCountL
+// CIptvMyVideosApiTest::CheckMaximumMediaCountL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL( CStifItemParser& aItem )
@@ -1557,7 +1545,43 @@
     TRAPD( err, CheckMediasL( expectedCount, drive, 1 ) );
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::CheckDownloadCountL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::CheckDownloadCountL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckDownloadCountL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In CheckMediaCountL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+    
+    WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
+
+    TInt expectedCount(0);
+    User::LeaveIfError(aItem.GetNextInt(expectedCount));
+
+    TInt err( KErrNotReady );
+    if( iTester )
+        {
+        err = KErrNone;
+        if( iTester->GetDownloadWatcher()->GetDownloadCount() != expectedCount )
+            {
+            err = KErrCorrupt;
+            VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: Not expected count of downloads!");
+            }
+        }
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckDownloadCountL <----------");
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -1598,7 +1622,7 @@
         {
         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: There's zero medias!");
         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------");
-        return KErrArgument;
+        return VCXMVTEST_ERR( KErrArgument );
         }
 
     if( iMpxMedia )
@@ -1655,7 +1679,7 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -1761,11 +1785,12 @@
         }
 #endif // __WINSCW__
 
+
     if( err != KErrNone )
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::AddMediaL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -1807,7 +1832,7 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -1840,11 +1865,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::RemoveMediaL
+// CIptvMyVideosApiTest::RemoveMediaL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::RemoveMediaL( CStifItemParser& aItem )
@@ -1882,11 +1907,11 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveMediaL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::RemoveAllMediaL
+// CIptvMyVideosApiTest::RemoveAllMediaL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::RemoveAllMediaL( CStifItemParser& aItem )
@@ -1907,6 +1932,102 @@
     
     TInt error( KErrNone );
     
+    TInt mediaCount = iTester->GetMediaCount();
+    
+    // Store info about the mpx items. 
+    RArray<TUint> mpxIds;
+    CleanupClosePushL( mpxIds ); 
+            
+    RArray<TUint> downloadIds;
+    CleanupClosePushL( downloadIds );
+    
+    RArray<TInt> downloadStates;
+    CleanupClosePushL( downloadStates );
+
+    RPointerArray<HBufC> filePaths;
+    CleanupResetAndDestroyPushL( filePaths );
+    
+    // Get ids and other needed details. 
+    
+    for( TInt i=0; i<mediaCount; i++ )
+        {
+        CMPXMedia* media( NULL );
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest::RemoveAllMediaL: GetMedia %d", i);
+        TRAP( error, media = iTester->GetMediaL( -1, i ) );
+
+        if( error != KErrNone )
+            {
+            CleanupStack::PopAndDestroy( &filePaths );
+            CleanupStack::PopAndDestroy( &downloadStates );
+            CleanupStack::PopAndDestroy( &downloadIds );
+            CleanupStack::PopAndDestroy( &mpxIds );
+            
+            VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveAllMediaL <----------");
+            return VCXMVTEST_ERR( error );
+            }
+        
+        if( media && media->IsSupported( KMPXMediaGeneralUri ) )
+            {
+            TUint32 downloadId = 0;
+            if( media->IsSupported( KVcxMediaMyVideosDownloadId ) )
+                {
+                downloadId = media->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
+                }
+
+            TInt state = -1;
+            if( media->IsSupported( KVcxMediaMyVideosDownloadState ) )
+                {
+                state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState );
+                }                
+                
+            HBufC* path( NULL );
+            if( media->IsSupported( KMPXMediaGeneralUri ) )
+                {
+                path = media->ValueText( KMPXMediaGeneralUri ).AllocL();
+                }
+            else
+                {
+                path = HBufC::NewL( 32 );
+                }
+            
+            TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId ));
+            
+            filePaths.Append( path );
+            downloadIds.Append( downloadId );
+            downloadStates.Append( state );
+            mpxIds.Append( itemId.iId1 );
+            }
+        }
+    
+    // Cancel downloads.
+    
+    for( TInt i = mpxIds.Count()-1; i >= 0; i-- )
+        {
+        if( downloadIds[i] != 0 || downloadStates[i] != -1 )
+            {
+            // Cancel the download.
+            RArray<TInt> messages;
+            if( BaflUtils::FileExists( iFs, filePaths[i]->Des() ) )
+                {
+                messages.Append( KVCXMYVideosTestMessageMpxItemDeleted );
+                }
+            messages.Append( KVCXMYVideosTestMessageCommandComplete );
+            messages.Append( KVCXMYVideosTestMessageCollectionOpened );
+            TRAP( error, iTester->CancelDownloadL( mpxIds[i], downloadIds[i], filePaths[i]->Des(), EFalse ) );
+            if( error == KErrNone )
+                {
+                TRAP( error, WaitForMessagesL( ETrue, messages, 30, ETrue ) );
+                }
+            messages.Reset();
+            // Error occured, lets hope deleting works.
+            if( error != KErrNone )
+                {
+                downloadIds[i] = 0;
+                downloadStates[i] = -1;
+                }
+            }    
+        }
+    
     // Get current list of medias.
     
     CMPXMediaArray* medias( NULL );
@@ -1961,6 +2082,16 @@
 
     iLastReceivedMessage = -1;
 
+    CleanupStack::PopAndDestroy( &filePaths );
+    CleanupStack::PopAndDestroy( &downloadStates );
+    CleanupStack::PopAndDestroy( &downloadIds );
+    CleanupStack::PopAndDestroy( &mpxIds );
+
+    if( iTester && iTester->GetDownloadWatcher() )
+        {
+        iTester->GetDownloadWatcher()->Reset();
+        }
+
     if( iTester->GetMediaCount() > 0 )
         {
         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: All medias could not be removed."); 
@@ -1968,11 +2099,11 @@
         }
     
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveAllMediaL <----------");
-    return error; 
+    return VCXMVTEST_ERR( error ); 
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::MoveMediaL
+// CIptvMyVideosApiTest::MoveMediaL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::MoveMediaL( CStifItemParser& aItem )
@@ -2010,7 +2141,7 @@
     if( iTester )
         {
         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
-        err = err;
+        err = VCXMVTEST_ERR( err );
         if( err == KErrNone )
             {
             TRAP( err, iTester->MoveMediasL( sourceDrive, index, index+1, destDrive, syncCall ) );
@@ -2021,11 +2152,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediaL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::MoveMediasL
+// CIptvMyVideosApiTest::MoveMediasL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::MoveMediasL( CStifItemParser& aItem )
@@ -2066,7 +2197,7 @@
     if( iTester )
         {
         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
-        err = err;
+        err = VCXMVTEST_ERR( err );
         if( err == KErrNone )
             {
             TRAP( err, iTester->MoveMediasL( sourceDrive, index, endIndex, destDrive, syncCall ) );
@@ -2077,11 +2208,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediasL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CancelMoveL
+// CIptvMyVideosApiTest::CancelMoveL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CancelMoveL( CStifItemParser& aItem )
@@ -2116,11 +2247,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelMoveL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CopyMediaL
+// CIptvMyVideosApiTest::CopyMediaL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CopyMediaL( CStifItemParser& aItem )
@@ -2164,11 +2295,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediaL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CopyMediasL
+// CIptvMyVideosApiTest::CopyMediasL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CopyMediasL( CStifItemParser& aItem )
@@ -2215,11 +2346,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediasL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CancelCopyL
+// CIptvMyVideosApiTest::CancelCopyL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CancelCopyL( CStifItemParser& aItem )
@@ -2254,11 +2385,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelCopyL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::DeleteMediaL
+// CIptvMyVideosApiTest::DeleteMediaL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::DeleteMediaL( CStifItemParser& aItem )
@@ -2293,7 +2424,7 @@
     if( iTester )
         {
         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
-        err = err;
+        err = VCXMVTEST_ERR( err );
         if( err == KErrNone )
             {
             TRAP( err, iTester->DeleteMediasL( sourceDrive, index, index+1, syncCall ) );
@@ -2304,11 +2435,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediaL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::DeleteMediasL
+// CIptvMyVideosApiTest::DeleteMediasL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::DeleteMediasL( CStifItemParser& aItem )
@@ -2346,7 +2477,7 @@
     if( iTester )
         {
         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
-        err = err;
+        err = VCXMVTEST_ERR( err );
         if( err == KErrNone )
             {
             TRAP( err, iTester->DeleteMediasL( sourceDrive, index, endIndex, syncCall ) );
@@ -2359,11 +2490,11 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediasL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CancelDeleteL
+// CIptvMyVideosApiTest::CancelDeleteL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CancelDeleteL( CStifItemParser& aItem )
@@ -2398,11 +2529,11 @@
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDeleteL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 //----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CancelNextOperationL
+// CIptvMyVideosApiTest::CancelNextOperationL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CancelNextOperationL( CStifItemParser& /* aItem */ )
@@ -2422,7 +2553,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::DeleteFileOfMediaL
+// CIptvMyVideosApiTest::DeleteFileOfMediaL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL( CStifItemParser& aItem )
@@ -2459,11 +2590,11 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::DeleteFilesOfAllMediasL
+// CIptvMyVideosApiTest::DeleteFilesOfAllMediasL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL( CStifItemParser& /* aItem */ )
@@ -2482,7 +2613,7 @@
     if( iTester )
         {
         TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
-        err = err;
+        err = VCXMVTEST_ERR( err );
         if( err == KErrNone )
             {        
             TRAP( err, iTester->DeleteAllMediaFilesL() );
@@ -2490,297 +2621,11 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CreateAlbumL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::CreateAlbumL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateAlbumL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In CreateAlbumL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-    
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
-    iLastReceivedMessage = -1;
-
-    TInt err( KErrNotReady );
-    if( iTester )
-        {
-        TPtrC albumName;
-        User::LeaveIfError( aItem.GetNextString( albumName ) );
-        
-        TInt sync;
-        if( aItem.GetNextInt( sync ) != KErrNone )
-            {
-            sync = EFalse;
-            }
-
-        if( albumName.Compare( KStifScript2KString ) == KErrNone )
-            {
-            TRAP( err, iTester->CreateAlbumL( KAbout2050CharsString, sync ) );
-            }
-        else if( albumName.Compare( KStifScriptEmptyString ) == KErrNone )
-            {
-            TRAP( err, iTester->CreateAlbumL( KVcxTestEmptyString, sync ) );
-            }
-        else if( albumName.Compare( KStifScriptInvalidRequest ) == KErrNone )
-            {
-            TRAP( err, iTester->CreateAlbumL( KVcxTestEmptyString, sync, ETrue ) );
-            }
-        else
-            {
-            TRAP( err, iTester->CreateAlbumL( albumName, sync ) );
-            }
-        }
-
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateAlbumL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::DeleteAlbumsL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::DeleteAlbumsL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteAlbumsL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In DeleteAlbumsL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-    
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
-    iLastReceivedMessage = -1;
-    
-    TInt err( KErrNotReady );
-
-    if( iTester )
-        {
-        TPtrC albumName;
-        RArray<TPtrC> albumNames;
-        
-        while( aItem.GetNextString( albumName ) == KErrNone )
-            {
-            albumNames.Append( albumName );
-            }
-        
-        if( albumNames.Count() < 1 )
-            {
-            VCXLOGLO1("CVCXMyVideosCollectionPluginTest::DeleteAlbumsL: No albums specified!");
-            err = KErrArgument;
-            }
-        else
-            {
-            TRAP( err, iTester->DeleteAlbumsL( albumNames ) );
-            }
-        }
-
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteAlbumsL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::DeleteAllAlbumsL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In DeleteAllAlbumsL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-    
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
-    iLastReceivedMessage = -1;
-    
-    TInt err( KErrNotReady );
-
-    if( iTester )
-        {
-        TRAP( err, iTester->DeleteAllAlbumsL() );
-        }
-
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::AddMediasToAlbumL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In AddMediasToAlbumL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-    
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
-    iLastReceivedMessage = -1;
-    
-    TInt err( KErrNotReady );
-    
-    if( iTester )
-        {
-        TPtrC albumName;
-        User::LeaveIfError( aItem.GetNextString( albumName ) );
-    
-        TInt sourceDrive(0);
-        User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) );
-    
-        TInt index(0);
-        User::LeaveIfError( aItem.GetNextInt( index ) );
-    
-        TInt endIndex(0);
-        User::LeaveIfError( aItem.GetNextInt( endIndex ) );
-
-        TRAP( err, iTester->AddMediasToAlbumL( albumName, sourceDrive, index, endIndex ) );
-        }
-
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::RemoveMediasFromAlbumL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In RemoveMediasFromAlbumL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-    
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
-    iLastReceivedMessage = -1;
-    
-    TInt err( KErrNotReady );
-
-    if( iTester )
-        {    
-        TPtrC albumName;
-        User::LeaveIfError( aItem.GetNextString( albumName ) );
-    
-        TInt sourceDrive(0);
-        User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) );
-    
-        TInt index(0);
-        User::LeaveIfError( aItem.GetNextInt( index ) );
-    
-        TInt endIndex(0);
-        User::LeaveIfError( aItem.GetNextInt( endIndex ) );
-
-        TRAP( err, iTester->RemoveMediasFromAlbumL( albumName, sourceDrive, index, endIndex ) );
-        }
-
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::RenameAlbumL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::RenameAlbumL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RenameAlbumL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In RenameAlbumL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-
-    WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
-    
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
-    int err( KErrNotReady );
-    
-    if( iTester )
-        {
-        TPtrC albumName;
-        User::LeaveIfError( aItem.GetNextString( albumName ) );
-        
-        TPtrC newAlbumName;
-        User::LeaveIfError( aItem.GetNextString( newAlbumName ) );
-
-        if( newAlbumName.Compare( KStifScript2KString ) == KErrNone )
-            {
-            TRAP( err, iTester->RenameAlbumL( albumName, KAbout2050CharsString ) );
-            }
-        else if( newAlbumName.Compare( KStifScriptEmptyString ) == KErrNone )
-            {
-            TRAP( err, iTester->RenameAlbumL( albumName, KVcxTestEmptyString ) );
-            }
-        else
-            {
-            TRAP( err, iTester->RenameAlbumL( albumName, newAlbumName ) );    
-            }
-        }
-  
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RenameAlbumL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CheckAlbumExistsL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::CheckAlbumExistsL( CStifItemParser& aItem )
-    {
-    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckAlbumExistsL ---------->");
-    // Print to UI
-    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
-    _LIT( KWhere, "In CheckAlbumExistsL" );
-    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
-    // Print to log file
-    iLog->Log( KWhere );
-
-    WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
-    
-    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
-    int err( KErrNotReady );
-    
-    if( iTester )
-        {
-        TPtrC albumName;
-        User::LeaveIfError( aItem.GetNextString( albumName ) );
-        
-        TRAP( err, iTester->GetAlbumIdL(albumName) );
-        }
-  
-    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckAlbumExistsL <----------");
-    return err;
-    }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CreateVideoFileL
+// CIptvMyVideosApiTest::CreateVideoFileL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CStifItemParser& aItem )
@@ -2798,14 +2643,17 @@
     TInt temp(0);
 
     // Parameter video type
-    CVCXMyVideosTestUtils::TVcxTestVideoType videoType;
+    CIptvTestVideoCreator::TIptvTestVideoType videoType;
     User::LeaveIfError( aItem.GetNextInt(temp) );
-    videoType = static_cast<CVCXMyVideosTestUtils::TVcxTestVideoType>(temp);
+    videoType = static_cast<CIptvTestVideoCreator::TIptvTestVideoType>(temp);
     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType);
 
     // Parameter drive letter
     TPtrC driveLetter;
     User::LeaveIfError(aItem.GetNextString(driveLetter));
+#ifdef __WINSCW__
+    driveLetter.Set(_L("C"));
+#endif
 
     // Parameter path and filename
     TPtrC filename;
@@ -2832,11 +2680,11 @@
     TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, ETrue ) );
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CreateVideoFileNoWaitL
+// CIptvMyVideosApiTest::CreateVideoFileNoWaitL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL( CStifItemParser& aItem )
@@ -2854,14 +2702,17 @@
     TInt temp(0);
 
     // Parameter video type
-    CVCXMyVideosTestUtils::TVcxTestVideoType videoType;
+    CIptvTestVideoCreator::TIptvTestVideoType videoType;
     User::LeaveIfError( aItem.GetNextInt(temp) );
-    videoType = static_cast<CVCXMyVideosTestUtils::TVcxTestVideoType>(temp);
+    videoType = static_cast<CIptvTestVideoCreator::TIptvTestVideoType>(temp);
     VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType);
 
     // Parameter drive letter
     TPtrC driveLetter;
     User::LeaveIfError(aItem.GetNextString(driveLetter));
+#ifdef __WINSCW__
+    driveLetter.Set(_L("C"));
+#endif
     
     // Parameter path and filename
     TPtrC filename;
@@ -2890,14 +2741,14 @@
     TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, EFalse ) );
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ---------->");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CreateVideoFileL
+// CIptvMyVideosApiTest::CreateVideoFileL
 // -----------------------------------------------------------------------------
 //
-void CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CVCXMyVideosTestUtils::TVcxTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync )
+void CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CIptvTestVideoCreator::TIptvTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync )
     {
     HBufC* path = HBufC::NewL( 2048 );
     CleanupStack::PushL(path);
@@ -2970,48 +2821,7 @@
     TInt err( KErrNone );
 
     iLastReceivedMessage = -1;
-    
-    if(aDoSync)
-    {
-        // Disable automatic refresh.
-        iTester->SetAutomaticRefresh( EFalse );
-    }
-    
-    RArray<TInt> messages;
-    
-    for(int i =  0; i < aVideoCount; i++)
-    {
-        // Create the video.
-        TRAP( err, iTestUtils->CreateVideoFileL( aType, *path, aSize, ETrue ) );
-        if(err != KErrNone)
-            {
-            VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFileL returned error: %d:", err);
-            }
-
-        if( aDoSync && iTester->GetCurrentLevel() == 3 )
-            {
-            // Wait for insertion event.
-            messages.Append( KVCXMYVideosTestMessageMpxVideoInserted );
-            WaitForMessagesL( ETrue, messages, 60, ETrue );
-            messages.Reset();
-            }
-    }
-
-    if( aDoSync )
-    {
-        // Refresh.
-        messages.Reset();
-        iTester->RefreshContentsL();
-        messages.Append( KVCXMYVideosTestMessageCollectionOpened );
-        CleanupClosePushL( messages );
-        WaitForMessagesL( ETrue, messages, 30, ETrue );
-        CleanupStack::PopAndDestroy( &messages );
-        iTester->SetAutomaticRefresh( ETrue );
-    }
-
-    CleanupStack::PopAndDestroy( path );
-    
-#if 0
+
     if( aVideoCount == 1 )
         {
         // Save the path for later use.
@@ -3019,19 +2829,24 @@
         iSideloadedFiles.Append( path );
 
         // Create the video.
-        TRAP( err, iTestUtils->CreateVideoFileL( aType, *path, aSize ) );
+        TRAP( err, iTestCommon->CreateVideoFileL( aType, *path, aSize ) );
         if(err != KErrNone)
             {
             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFileL returned error: %d:", err);
             }
+        TRAP_IGNORE( iStats->ActionStartL( KSideloadVideoActionId, _L("Sideload video") ) );
         }
     else
         {
-        TRAP( err, iTestUtils->CreateVideoFilesL( aType, *path, aVideoCount, iSideloadedFiles ) );
+        TRAP( err, iTestCommon->CreateVideoFilesL( aType, *path, aVideoCount, iSideloadedFiles ) );
         if(err != KErrNone)
             {
             VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFilesL returned error: %d:", err);
             }
+        for( TInt i = 0; i < aVideoCount; i++ )
+            {
+            TRAP_IGNORE( iStats->ActionStartL( KSideloadVideoActionId, _L("Sideload video") ) );
+            }
         CleanupStack::PopAndDestroy( path );
         }
 
@@ -3051,7 +2866,7 @@
             RArray<TInt> messages;
             for( TInt i=0; i<aVideoCount; i++ )
                 {
-                messages.Append( KVCXMYVideosTestMessageMpxVideoInserted );
+                messages.Append( KVCXMYVideosTestMessageMpxItemInserted );
                 }
             // Only one video added, refresh is automatic.
             if( aVideoCount <= 1 )
@@ -3076,7 +2891,6 @@
                 }
             }
         }
-#endif
     }
 
 // -----------------------------------------------------------------------------
@@ -3133,7 +2947,7 @@
         TInt createCount = amount - videoCount;
         
         TRAP( err, CreateVideoFileL( 
-                CVCXMyVideosTestUtils::VcxTestVideoMpeg4, driveLetter, filename, -1, createCount, ETrue ) );    
+                CIptvTestVideoCreator::IptvTestVideoMpeg4, driveLetter, filename, -1, createCount, ETrue ) );    
         }
     else
     if( videoCount > amount )
@@ -3166,7 +2980,7 @@
         }
         
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
@@ -3229,7 +3043,7 @@
         filesInUse.Remove( i );
 
         // Delete file
-        iTestUtils->EnsureFileIsNotInUse( *path );
+        iTestCommon->EnsureFileIsNotInUse( *path );
         TInt err = iFs.Delete( path->Des() );
         if( err != KErrNone )
             {
@@ -3246,7 +3060,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::SetDeleteSideloadedVideos
+// CIptvMyVideosApiTest::SetDeleteSideloadedVideos
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos( CStifItemParser& /* aItem */ )
@@ -3258,7 +3072,601 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::WaitForMessageL
+// CIptvMyVideosApiTest::DownloadL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::DownloadL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadL ---------->");
+    iLastReceivedMessage = -1;
+    TRAPD( err, DownloadOrResumeL( aItem, EFalse, EFalse ) );
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::ResumeDownloadL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::ResumeDownloadL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeDownloadL ---------->");
+    iLastReceivedMessage = -1;
+    TRAPD( err, DownloadOrResumeL( aItem, EFalse, ETrue ) );
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeDownloadL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::ResumeAllDownloadsL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL( CStifItemParser& /* aItem */ )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In ResumeAllDownloadsL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    TRAPD( err, iTester->ResumeAllDownloadsL() );
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::DownloadUsingMediaL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL ---------->");
+
+    if( !iMpxMedia )
+        {
+        VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!");
+        User::Leave( KErrArgument );
+        }
+
+    iLastReceivedMessage = -1;
+
+    TRAPD( err, DownloadOrResumeL( aItem, ETrue, EFalse ) );
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::ResumeDownloadUsingMediaL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL ---------->");
+
+    if( !iMpxMedia )
+        {
+        VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!");
+        User::Leave( KErrArgument );
+        }
+
+    iLastReceivedMessage = -1;
+
+    TRAPD( err, DownloadOrResumeL( aItem, ETrue, ETrue ) );
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::DownloadOrResumeL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTest::DownloadOrResumeL( CStifItemParser& aItem, TBool aUseCurrentMedia, TBool aResume )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadOrResumeL");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In DownloadOrResumeL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    iLastReceivedMessage = -1;
+
+    TUint32 iapId(0);
+    TPtrC iapName;
+    User::LeaveIfError( aItem.GetNextString( iapName ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapName: %S", &iapName);
+
+    if( iapName == KVCXTestZeroIap )
+        {
+        iapId = 0;
+        }
+    else
+    if( iapName == KVCXTestInvalidIap )
+        {
+        iapId = 10001;
+        }
+    else
+        {
+        User::LeaveIfError( iTestCommon->GetIapIdL(iapName, iapId) );
+        }
+
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapId: %d", iapId);
+
+    TPtrC serviceName;
+    User::LeaveIfError( aItem.GetNextString( serviceName ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName);
+
+    TInt serviceId(0);
+    User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId);
+
+    TInt contentId(0);
+    User::LeaveIfError( aItem.GetNextInt( contentId ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId);
+
+    TInt syncCallInt(0);
+    User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
+    TBool syncCall = static_cast<TBool>(syncCallInt);
+
+    TPtrC userName;
+    if( KErrNone == aItem.GetNextString( userName ) )
+        {
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: userName: %S", &userName);
+        }
+    else
+        {
+        userName.Set( _L("") );
+        }
+
+    TPtrC password;
+    if( KErrNone == aItem.GetNextString( password ) )
+        {
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: password: %S", &password);
+        }
+    else
+        {
+        password.Set( _L("") );
+        }
+
+    const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId );
+    const TPtrC title = iServiceEmu->GetContentTitleL( serviceId, contentId );
+
+    TInt err(0);
+    if( !aUseCurrentMedia )
+        {
+        if( !aResume )
+            {
+            TRAP( err, iTester->StartDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, NULL ) );
+            }
+        else
+            {
+            TRAP( err, iTester->ResumeDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, NULL ) );
+            }
+        }
+    else
+        {
+        VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: passing current media to MPX plugin.");
+        if( !aResume )
+            {
+            TRAP( err, iTester->StartDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, iMpxMedia ) );
+            }
+        else
+            {
+            TRAP( err, iTester->ResumeDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, iMpxMedia ) );
+            }
+        }
+
+    // Set autoresume on if there's only one paused download.
+    CVCXMyVideosTestDlWatcher* dlWatcher = iTester->GetDownloadWatcher();
+    if( aResume && dlWatcher && !iAutoResume )
+        {
+        TInt pausedDlCount = 0;
+        for( TInt i=0; i<dlWatcher->GetDownloadCount(); i++ ) 
+            {
+            CVCXMyVideosTestDownload* dl = dlWatcher->GetDownloadByIndex( i );
+            if( dl->iState == EVcxMyVideosDlStatePaused )
+                {
+                pausedDlCount++;
+                }
+            }
+            if( pausedDlCount == 1 ) 
+                {
+                iAutoResume = ETrue;
+                iTester->SetAutoResume( ETrue );
+                }
+        }
+    
+    if( err != KErrNone )
+        {
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
+        User::Leave( err );
+        }
+    
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadOrResumeL");
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::DownloadUrlL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::DownloadUrlL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadUrlL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In DownloadUrlL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    iLastReceivedMessage = -1;
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    TUint32 iapId(0);
+    TPtrC iapName;
+    User::LeaveIfError( aItem.GetNextString( iapName ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapName: %S", &iapName);
+    User::LeaveIfError( iTestCommon->GetIapIdL(iapName, iapId) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapId: %d", iapId);
+
+    TPtrC url;
+    User::LeaveIfError( aItem.GetNextString( url ) );
+    
+    TInt syncCallInt(0);
+    User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
+    TBool syncCall = static_cast<TBool>(syncCallInt);
+
+    TPtrC userName;
+    if( KErrNone == aItem.GetNextString( userName ) )
+        {
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: userName: %S", &userName);
+        }
+    else
+        {
+        userName.Set( _L("") );
+        }
+
+    TPtrC password;
+    if( KErrNone == aItem.GetNextString( password ) )
+        {
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: password: %S", &password);
+        }
+    else
+        {
+        password.Set( _L("") );
+        }
+
+    if( url == KVCXTestZeroUrl)
+        {
+        url.Set( _L("" ) );
+        }
+
+    TInt err( KErrNone );
+    
+    if( iTester )
+        {
+        if( url == KVCXMYVideosTest2kURLTag )
+            {
+            TRAP( err, iTester->StartDownloadL( _L("2kcharsurl"), iapId, 0, 0, KVCXMYVideosTest2kURL, syncCall, userName, password, NULL ) );
+            }
+        else
+        if( url == KVCXMYVideosTest1kURLTag )
+            {
+            TRAP( err, iTester->StartDownloadL( _L("1kcharsurl"), iapId, 0, 0, KVCXMYVideosTest1kURL, syncCall, userName, password, NULL ) );
+            }
+        else
+            {
+            TRAP( err, iTester->StartDownloadL( _L("urldl"), iapId, 0, 0, url, syncCall, userName, password, NULL ) );
+            }
+        }
+
+    if( err != KErrNone )
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadUrlL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::CancelDownloadL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::CancelDownloadL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDownloadL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In CancelDownloadL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    iLastReceivedMessage = -1;
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    TPtrC serviceName;
+    User::LeaveIfError( aItem.GetNextString( serviceName ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName);
+
+    TInt serviceId(0);
+    User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId);
+
+    TInt contentId(0);
+    User::LeaveIfError( aItem.GetNextInt( contentId ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId);
+
+    TInt syncCallInt(0);
+    User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
+    TBool syncCall = static_cast<TBool>(syncCallInt);
+
+    const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId );
+
+    CVCXMyVideosTestDownload* dl = iTester->GetDownloadWatcher()->GetDownload( serviceId, contentId, url );
+
+    TInt err( KErrNotReady );
+    if( !dl )
+        {
+        VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Could not find download with specified params!");
+        }
+    else
+    if( iTester )
+        {
+        TRAP( err, iTester->CancelDownloadL( dl, syncCall ) );
+        }
+
+    if( err != KErrNone )
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDownloadL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::CancelDownloadByIdL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In CancelDownloadByIdL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    iLastReceivedMessage = -1;
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    TInt mpxId(0);
+    User::LeaveIfError( aItem.GetNextInt( mpxId ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: mpxId: %d", mpxId);
+
+    TInt downloadId(0);
+    User::LeaveIfError( aItem.GetNextInt( downloadId ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: downloadId: %d", downloadId);
+
+    TInt syncCallInt(0);
+    User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
+    TBool syncCall = static_cast<TBool>(syncCallInt);
+
+    _LIT(KVCxTestEmptyString, "NULL");
+    TPtrC downloadPath;
+    if( aItem.GetNextString( downloadPath ) != KErrNone )
+        {
+        downloadPath.Set( KVCxTestEmptyString );
+        }
+
+    TInt err( KErrNotReady );
+    if( iTester )
+        {
+        TRAP( err, iTester->CancelDownloadL( mpxId, downloadId, downloadPath, syncCall ) );
+        }
+
+    if( err != KErrNone )
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::PauseDownloadL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::PauseDownloadL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::PauseDownloadL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In PauseDownloadL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    iLastReceivedMessage = -1;
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    TPtrC serviceName;
+    User::LeaveIfError( aItem.GetNextString( serviceName ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName);
+
+    TInt serviceId(0);
+    User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId);
+
+    TInt contentId(0);
+    User::LeaveIfError( aItem.GetNextInt( contentId ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId);
+
+    TInt syncCallInt(0);
+    User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
+    TBool syncCall = static_cast<TBool>(syncCallInt);
+
+    const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId );
+
+    TInt err( KErrNotReady );
+    if( iTester )
+        {
+        // Disable autoresume
+        iAutoResume = EFalse;
+        iTester->SetAutoResume( iAutoResume );
+
+        TRAP( err, iTester->PauseDownloadL( serviceId, contentId, url, syncCall ) );
+        }
+
+    if( err != KErrNone )
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::PauseDownloadL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::PauseDownloadByUrlL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In PauseDownloadByUrlL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    iLastReceivedMessage = -1;
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    TPtrC url;
+    User::LeaveIfError( aItem.GetNextString( url ) );
+
+    TInt err( KErrNotReady );
+    if( iTester )
+        {
+        // Disable autoresume
+        iAutoResume = EFalse;
+        iTester->SetAutoResume( iAutoResume );
+
+        TRAP( err, iTester->PauseDownloadL( url, EFalse ) );
+        }
+
+    if( err != KErrNone )
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::PauseDownloadL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::CheckDownloadProgressL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In CheckDownloadProgressL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    iLastReceivedMessage = -1;
+
+    aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+    TPtrC serviceName;
+    User::LeaveIfError( aItem.GetNextString( serviceName ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName);
+
+    TInt serviceId(0);
+    User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId);
+
+    TInt contentId(0);
+    User::LeaveIfError( aItem.GetNextInt( contentId ) );
+    VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId);
+
+    TInt minimumProgress( 0 );
+    User::LeaveIfError( aItem.GetNextInt( minimumProgress ) );
+
+    const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId );
+
+    CVCXMyVideosTestDlWatcher* dlWatcher = iTester->GetDownloadWatcher();
+
+    TInt err( KErrNotReady );
+
+    if( dlWatcher )
+        {
+        CVCXMyVideosTestDownload* dl = dlWatcher->GetDownload( serviceId, contentId, url );
+
+        if( dl )
+            {
+            if( dl->iProgress < minimumProgress )
+                {
+                err = KErrCorrupt;
+                }
+            else
+                {
+                err = KErrNone;
+                }
+            }
+        }
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::WaitAllDownloadsL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL( CStifItemParser& aItem )
+    {
+    VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL ---------->");
+    // Print to UI
+    _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+    _LIT( KWhere, "In WaitAllDownloadsL" );
+    TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+    // Print to log file
+    iLog->Log( KWhere );
+
+    TInt err( KErrNone );
+
+    TInt minutes(0);
+    if( aItem.GetNextInt( minutes ) != KErrNone )
+        {
+        minutes = 10;
+        }
+    iTimeoutTimer->After( KTimeoutMinute * minutes );
+
+    iWaitingForAllDownloads = ETrue;
+
+    VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL <----------");
+    return VCXMVTEST_ERR( err );
+    }
+
+// -----------------------------------------------------------------------------
+// CIptvMyVideosApiTest::WaitForMessageL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::WaitForMessageL( CStifItemParser& aItem )
@@ -3299,11 +3707,11 @@
     messages.Reset();
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessageL <----------");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::WaitForAnyMessageL
+// CIptvMyVideosApiTest::WaitForAnyMessageL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL( CStifItemParser& aItem )
@@ -3346,11 +3754,11 @@
     messages.Reset();
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL <----------");
-    return error;
+    return VCXMVTEST_ERR( error );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::WaitForMessagesL
+// CIptvMyVideosApiTest::WaitForMessagesL
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::WaitForMessagesL( CStifItemParser& aItem )
@@ -3393,11 +3801,11 @@
     messages.Reset();
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessagesL <----------");
-    return error;
+    return VCXMVTEST_ERR( error );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::WaitForMessagesL
+// CIptvMyVideosApiTest::WaitForMessagesL
 // -----------------------------------------------------------------------------
 //
 void CVCXMyVideosCollectionPluginTest::WaitForMessagesL( TBool aBlock, RArray<TInt>& aMessages, TInt aTimeout,
@@ -3480,7 +3888,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::MapMpxMediaAttribute
+// CIptvMyVideosApiTest::MapMpxMediaAttribute
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute(
@@ -3745,11 +4153,11 @@
         }
 
     VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute");
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::GetMessageDesc
+// CIptvMyVideosApiTest::GetMessageDesc
 // -----------------------------------------------------------------------------
 //
 void CVCXMyVideosCollectionPluginTest::GetMessageDesc( TInt aMessage, TDes& aMsgBuff )
@@ -3862,49 +4270,29 @@
             aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionGeneral") );
             }
             break;
-        case KVCXMYVideosTestMessageMpxVideoInserted:
+        case KVCXMYVideosTestMessageCollectionItemChanged:
             {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoInserted") );
+            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionItemChanged") );
             }
             break;
-        case KVCXMYVideosTestMessageMpxCategoryInserted:
-            {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryInserted") );
-            }
-            break;
-        case KVCXMYVideosTestMessageMpxAlbumInserted:
+        case KVCXMYVideosTestMessageCollectionCategoryChanged:
             {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumInserted") );
-            }
-            break;
-        case KVCXMYVideosTestMessageMpxVideoDeleted:
-            {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoDeleted") );
+            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionCategoryChanged") );
             }
             break;
-        case KVCXMYVideosTestMessageMpxCategoryDeleted:
+        case KVCXMYVideosTestMessageMpxItemInserted:
             {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryDeleted") );
-            }
-            break;
-        case KVCXMYVideosTestMessageMpxAlbumDeleted:
-            {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumDeleted") );
+            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemInserted") );
             }
             break;
-        case KVCXMYVideosTestMessageMpxVideoModified:
+        case KVCXMYVideosTestMessageMpxItemDeleted:
             {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoModified") );
+            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemDeleted") );
             }
             break;
-        case KVCXMYVideosTestMessageMpxCategoryModified:
+        case KVCXMYVideosTestMessageMpxItemModified:
             {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryModified") );
-            }
-            break;
-        case KVCXMYVideosTestMessageMpxAlbumModified:
-            {
-            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumModified") );
+            aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemModified") );
             }
             break;
         case KVCXMyVideosTestMessageVideoListOrderChanged:
@@ -3933,15 +4321,13 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::CheckMediasL
+// CIptvMyVideosApiTest::CheckMediasL
 // -----------------------------------------------------------------------------
 //
 void CVCXMyVideosCollectionPluginTest::CheckMediasL( TInt aExpectedVideoCount, TInt aDrive, TInt aCheckType )
     {
     VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediasL");
 
-    WaitForRefreshL( false );
-    
     TInt actualVideoCount(0);
 
     // File check
@@ -3973,7 +4359,20 @@
 
             actualVideoCount++;
 
-            if( !iFileCheckDisabled )
+            TInt state = -1;
+            if( media->IsSupported( KVcxMediaMyVideosDownloadState ) )
+                {
+                state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState );
+                }
+
+            TUint32 downloadId = 0;
+            if( media->IsSupported( KVcxMediaMyVideosDownloadId ) )
+                {
+                downloadId = media->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
+                }
+
+            // No file check for ongoing downloads
+            if( !iFileCheckDisabled && ( downloadId == 0 || state == EVcxMyVideosDlStateDownloaded ) )
                 {
                 if( !iFs.IsValidName( localFilePath ) )
                     {
@@ -4050,7 +4449,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::GetDriveParam
+// CIptvMyVideosApiTest::GetDriveParam
 // -----------------------------------------------------------------------------
 //
 TInt CVCXMyVideosCollectionPluginTest::GetDriveParam( CStifItemParser& aItem, TInt& aDrive )
@@ -4072,11 +4471,11 @@
             }
         }
 
-    return err;
+    return VCXMVTEST_ERR( err );
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::DoTotalRefreshL
+// CIptvMyVideosApiTest::DoTotalRefreshL
 // -----------------------------------------------------------------------------
 //
 void CVCXMyVideosCollectionPluginTest::DoTotalRefreshL()
@@ -4112,7 +4511,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::WaitForRefreshL
+// CIptvMyVideosApiTest::WaitForRefreshL
 // -----------------------------------------------------------------------------
 //
 void CVCXMyVideosCollectionPluginTest::WaitForRefreshL( TBool aForcedWait )
@@ -4128,7 +4527,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::GetMediasForLevelL
+// CIptvMyVideosApiTest::GetMediasForLevelL
 // -----------------------------------------------------------------------------
 //
 CMPXMediaArray* CVCXMyVideosCollectionPluginTest::GetMediasForLevelL( TInt aLevel, TUint aFlagsFilter )
@@ -4235,7 +4634,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxMyVideosApiTest::HandleVcxMvTesterMessageL
+// CIptvMyVideosApiTest::HandleVcxMvTesterMessageL
 // -----------------------------------------------------------------------------
 //
 void CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL( TInt aMessage, TInt aError )
@@ -4264,17 +4663,13 @@
         aMessage == KVCXMYVideosTestMessageCollectionOpened ||
         aMessage == KVCXMYVideosTestMessageGotMediasByKMpxId )
         {
+        _LIT(KWhat, "VidCount");
+        _LIT(KDesc, "%d");
         TInt videoCount = iTester->GetMediaCount();
-        if( iTester->GetCurrentOpenLevelIndex() == -1 )
-            {
-            TestModuleIf().Printf( 0, _L("Mv"), _L("CatCount %d"), videoCount );
-            }
-        else
-            {
-            TestModuleIf().Printf( 0, _L("Mv"), _L("VidCount %d"), videoCount );
-            }
+        TestModuleIf().Printf( 0, KWhat, KDesc, videoCount );
         }
 
+
     // Waiting for messages from mpx plugin to stop.
     if( iCoolDownWait )
         {
@@ -4283,6 +4678,78 @@
         VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL");
         return;
         }    
+    
+    if( aMessage == KVCXMYVideosTestMessageDlSucceeded ||
+        aMessage == KVCXMYVideosTestMessageDlFailed ||
+        aMessage == KVCXMYVideosTestMessageDlPaused ||
+        aMessage == KVCXMYVideosTestMessageDlGeneral ||
+        aMessage == KVCXMYVideosTestErrorDownloadNotFound )
+        {
+        TInt activeDownloads = iTester->GetActiveDownloadCountL();
+        TInt downloads = iTester->GetDownloadWatcher()->GetDownloadCount();
+        _LIT(KWhat, "Downloads");
+        _LIT(KDesc, "%d/%d");
+        TestModuleIf().Printf( 0, KWhat, KDesc, activeDownloads, downloads );
+
+        if( aError != KErrNone )
+            {
+            iLastDownloadError = aError;
+            }        
+        }
+    
+    // Inform script of paused download when auto resume is off.
+    if( !iWaitingForAllDownloads && aMessage == KVCXMYVideosTestMessageDlPaused && !iAutoResume )
+        {
+        // Add message to waited list and continue processing, check for signaling is done later.
+        iWaitedTestMessages.Reset();
+        iWaitedTestMessages.AppendL( aMessage );
+        }
+    
+    // Waiting for all downloads to complete. Check downloads and signal if needed.
+    if( iWaitingForAllDownloads )
+        {
+        TInt activeDownloads = iTester->GetActiveDownloadCountL();
+        VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Ongoing download count: %d", activeDownloads);
+        
+        if( activeDownloads <= 0 )
+            {
+            iTimeoutTimer->CancelTimer();
+            iWaitingForAllDownloads = EFalse;
+
+            TInt downloadCount = iTester->GetDownloadWatcher()->GetDownloadCount();
+            TInt maxFailsToSucceed = downloadCount / 3;
+            TInt fails = iTester->GetDownloadWatcher()->GetFailedDownloadCount();
+
+            if( maxFailsToSucceed <= 0 )
+                {
+                maxFailsToSucceed = 0;
+                }
+
+            VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: download count: %d", downloadCount);
+            VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: failed download count: %d", fails);
+            VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: max allowed fails: %d", maxFailsToSucceed);
+
+            if( fails > maxFailsToSucceed )
+                {
+                if( iLastDownloadError != KErrNone )
+                    {
+                    iEventError = iLastDownloadError;
+                    }
+                else
+                    {
+                    iEventError = KVCXMYVideosTestMessageDlFailed;
+                    }
+                }
+            else
+                {
+                iEventError = KErrNone;
+                }
+
+            // Add message to waited list and continue processing, check for signaling is done later.
+            iWaitedTestMessages.Reset();
+            iWaitedTestMessages.AppendL( aMessage );
+            }
+        }
 
     // See if there's cancel needed for move, copy or delete.
     if( aError == KErrNone && iCancelNextOperation )
@@ -4300,7 +4767,7 @@
         }
 
     // Check for errors. 
-    if( aError != KErrNone )
+    if( aError != KErrNone && !iWaitingForAllDownloads )
         {
         VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
         VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Error: %d <----------", aError);
@@ -4310,7 +4777,7 @@
         if( !iMessageWaitIsBlocking )
             {
             VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------");
-            Signal( aError );
+            Signal( VCXMVTEST_ERR( aError ) );
             TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), aError );
             iEventError = KErrNone;
             }
@@ -4379,7 +4846,7 @@
                 if( !iMessageWaitIsBlocking )
                     {
                     VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------");
-                    Signal( iEventError );
+                    Signal( VCXMVTEST_ERR( iEventError ) );
                     TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), iEventError );
                     iEventError = KErrNone;
                     }
@@ -4400,7 +4867,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CVcxEpgEngineTest::TimerComplete
+// CIptvEpgEngineTest::TimerComplete
 // -----------------------------------------------------------------------------
 //
 void CVCXMyVideosCollectionPluginTest::TimerComplete(TInt aTimerId, TInt aError)
@@ -4421,8 +4888,11 @@
             if( !iMessageWaitIsBlocking )
                 {
                 VCXLOGLO2( "CVCXMyVideosCollectionPluginTest:: Signaling: %d", iEventError);
-                Signal( iEventError );
+                Signal( VCXMVTEST_ERR( iEventError ) );
                 }
+            
+            TRAP_IGNORE( iStats->ActionEndL( 0, iEventError ) );
+
             TestModuleIf().Printf( 0, _L("Timedout"), _L("%d"), iEventError );
             }
         }
@@ -4433,6 +4903,7 @@
         iActiveWait->Stop();
         iCoolDownWait = EFalse;
 
+        iWaitingForAllDownloads = EFalse;
         iWaitedTestMessages.Reset();
         iLastReceivedMessage = 0;
         }