homescreensrv_plat/menu_content_service_api/tsrc/src/testutils.cpp
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <f32file.h>
       
    19 #include "testutils.h"
       
    20 
       
    21 _LIT(KMcsFolderC, "C:\\private\\200113dd\\content\\");
       
    22 _LIT(KMcsFolderImportC, "C:\\private\\200113dd\\import\\content\\");
       
    23 _LIT(KTestdataMCSFolder, "C:\\testing\\data\\MCSAPI\\");
       
    24 _LIT(KTestdataMCSFolderImport, "C:\\testing\\data\\MCSAPI\\import\\");
       
    25 
       
    26 _LIT(KMcsFolderAllFilesC, "C:\\private\\200113dd\\content\\*.*");
       
    27 
       
    28 //-----------------------------------------------------------------------
       
    29 // CONSTRUCTION
       
    30 // ---------------------------------------------------------------------------
       
    31 // 
       
    32 CTestUtils* CTestUtils::NewL()
       
    33     {
       
    34     CTestUtils* self = CTestUtils::NewLC();
       
    35     CleanupStack::Pop();
       
    36 
       
    37     return self;
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // 
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 CTestUtils* CTestUtils::NewLC()
       
    45     {
       
    46     CTestUtils* self = new( ELeave ) CTestUtils();
       
    47     CleanupStack::PushL( self );
       
    48 
       
    49     self->ConstructL();
       
    50 
       
    51     return self;
       
    52     }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // Destructor (virtual by CBase)
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 CTestUtils::~CTestUtils()
       
    59     {
       
    60     delete iFileManager;
       
    61     iFs.Close();
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // Default constructor
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CTestUtils::CTestUtils()
       
    69     {    
       
    70     
       
    71     }
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // Second phase construct
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CTestUtils::ConstructL()
       
    78     {
       
    79     User::LeaveIfError( iFs.Connect() );
       
    80     iFileManager = CFileMan::NewL( iFs );
       
    81     iFs.MkDirAll(KMcsFolderC);
       
    82     iFs.MkDirAll(KMcsFolderImportC);
       
    83     }
       
    84 
       
    85 
       
    86 //-----------------------------------------------------------------------
       
    87 //
       
    88 //-----------------------------------------------------------------------
       
    89 TInt CTestUtils::Copy( const TDesC& aFileName, TInt aSuffix )
       
    90     {
       
    91     _LIT(KXml, ".xml");
       
    92     TBuf<150> source(KTestdataMCSFolder);
       
    93     TBuf<150> dest(KMcsFolderC);
       
    94     source.Append( aFileName );
       
    95     source.Append( KXml );
       
    96     
       
    97     dest.Append( aFileName );
       
    98     dest.AppendNum( aSuffix );
       
    99     dest.Append( KXml );
       
   100     
       
   101     
       
   102     return iFileManager->Copy(source, dest);  
       
   103     }
       
   104 
       
   105 //-----------------------------------------------------------------------
       
   106 //
       
   107 //-----------------------------------------------------------------------
       
   108 TInt CTestUtils::CopyImport( const TDesC& aFileName, TInt aSuffix )
       
   109     {
       
   110     _LIT(KXml, ".xml");
       
   111     TBuf<150> source(KTestdataMCSFolderImport);
       
   112     TBuf<150> dest(KMcsFolderImportC);
       
   113     source.Append( aFileName );
       
   114     source.Append( KXml );
       
   115     
       
   116     dest.Append( aFileName );
       
   117     dest.AppendNum( aSuffix );
       
   118     dest.Append( KXml );
       
   119     
       
   120     
       
   121     return iFileManager->Copy(source, dest);  
       
   122     }
       
   123 
       
   124 
       
   125 //-----------------------------------------------------------------------
       
   126 //
       
   127 //-----------------------------------------------------------------------
       
   128 TInt CTestUtils::Copy( const TDesC& aSource, const TDesC& aDest )
       
   129     {
       
   130     return iFileManager->Copy(aSource, aDest);  
       
   131     }    
       
   132     
       
   133 //-----------------------------------------------------------------------
       
   134 //
       
   135 //-----------------------------------------------------------------------
       
   136 TInt CTestUtils::Delete( /*const TDesC& aFilePath*/ )
       
   137     {
       
   138     return iFileManager->Delete( KMcsFolderAllFilesC );  
       
   139     }
       
   140 
       
   141 
       
   142 //-----------------------------------------------------------------------
       
   143 //
       
   144 //-----------------------------------------------------------------------
       
   145 void CTestUtils::InstallSisL( const TDesC& aName )
       
   146     {
       
   147     
       
   148     }
       
   149     
       
   150     
       
   151 //-----------------------------------------------------------------------
       
   152 //
       
   153 //-----------------------------------------------------------------------
       
   154 void CTestUtils::UninstallSisL( const TDesC& aName )
       
   155     {
       
   156     
       
   157     }